CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

TimeVaryingMappedFixedValue field creation

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   December 4, 2008, 10:50
Default Hi, I still got problems re
  #21
Senior Member
 
John Deas
Join Date: Mar 2009
Posts: 160
Rep Power: 7
johndeas is on a distinguished road
Hi,

I still got problems related to pTraits :

I tried to modify my code in order to export other variables than U (k and p for instance).

This expression will compile:

AverageIOField<vector> writeSampleU
(
IOobject
(
"U",
mesh.time().constant(),
"boundaryData/entree"/runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
U[0],
combinedVecU
);

But, as soon as I want to insert this one:

AverageIOField<scalar> writeSampleP
(
IOobject
(
"p",
mesh.time().constant(),
"boundaryData/entree"/runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
p[0],
combinedScaP
);

I get a nice:

/home/flurec/OpenFOAM/OpenFOAM-1.5/src/finiteVolume/lnInclude/AverageIOField.C: In constructor 'Foam::AverageIOField<type>::AverageIOField(const Foam::IOobject&, const Type&, const Foam::Field<type>&) [with Type = double]':
writeSampleP.H:39: instantiated from here
/home/flurec/OpenFOAM/OpenFOAM-1.5/src/finiteVolume/lnInclude/AverageIOField.C:7 3: error: no matching function for call to 'Foam::pTraits<double>::pTraits(const double&)'
/home/flurec/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/Scalar.H:68: note: candidates are: Foam::pTraits<double>::pTraits(Foam::Istream&)
/home/flurec/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/Scalar.H:41: note: Foam::pTraits<double>::pTraits(const Foam::pTraits<double>&)
writeSampleP.H:39: instantiated from here
/home/flurec/OpenFOAM/OpenFOAM-1.5/src/finiteVolume/lnInclude/AverageIOField.C:7 7: error: invalid static_cast from type 'Foam::AverageIOField<double>' to type 'double&'

From my understanding of template specialization, in Scalar.H:68, when the template pTraits is specialized for scalars, its only constructor is pTraits(Istream& is)

Therefore, the general constructor from primitive:

pTraits(const primitive& p)
:
primitive(p)
{}

which has been added in this forum thread is not available. Should I modify Scalar.H and Scalar.C to get my code to compile ?

adding to Scalar.H :

pTraits(const primitive& p);

adding to Scalar.C :

pTraits<scalar>::pTraits(const primitive& p)
{
p_ = p;
}
johndeas is offline   Reply With Quote

Old   April 2, 2010, 12:07
Default
  #22
Senior Member
 
Jiang
Join Date: Oct 2009
Location: Japan
Posts: 186
Rep Power: 7
panda60 is on a distinguished road
Dear Mattijs and John Deas,
Do you have some common on how to use TimeVaryingMappedFixedValue boundary condition ?
I have two questions:
1.what's the meaning of Average in its input data ?
FoamFile
{
version 2.0;
format ascii;
class vectorAverageField;
object values;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Average
( 0 0 0 )
//
// Data on points
70
(
//minz
(5.74803 0 0)
(5.74803 0 0)

2. Because the most useful things of this boundary condition is to read a large series of data from file as inlet condition. But its request data is a little strange, how we can generate this kind of data ?
Maybe I can get these data from functionObject surface sampling using pre-simulation. But the sampling data is a little difference from TimeVaryingMappedFixedValue data format, and the sampling result have more folders, so how can do this ?
If we have utility to convert sample data to request data format ?
Thank you very much.
panda60 is offline   Reply With Quote

Old   April 2, 2010, 12:10
Default
  #23
Senior Member
 
Jiang
Join Date: Oct 2009
Location: Japan
Posts: 186
Rep Power: 7
panda60 is on a distinguished road
This is request data format for timeVaryingMappedFixedValue :

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class vectorAverageField;
object values;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Average
( 0 0 0 )
//
// Data on points
70
(
//minz
(5.74803 0 0)
(5.74803 0 0)
(11.3009 0 0)
(13.4518 0 0)
.,.................
)

This is sampling data format :

15408
(
(0.0239436 -6.28249e-05 0.000567144)
(0.0239436 -6.28249e-05 0.000567144)
(0.0712944 -0.00019323 -0.00045317)
(0.0712944 -0.00019323 -0.00045317)
(0.122301 -0.000335644 -0.00117908)
(0.122301 -0.000335644 -0.00117908)
(0.178985 -0.000485735 -0.000847965)
(0.178985 -0.000485735 -0.000847965)
.................................................. ....
)
panda60 is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
TimeVaryingMappedFixedValue irishdave OpenFOAM Running, Solving & CFD 26 July 24, 2014 04:30
TimeVaryingMappedFixedValue best practice to extract subset points and fields podallaire OpenFOAM Running, Solving & CFD 6 May 21, 2014 10:25
TimeVaryingMappedFixedValue sunnysun OpenFOAM Running, Solving & CFD 12 October 30, 2013 16:22
Possible bug with timeVaryingMappedFixedValue jerome OpenFOAM Bugs 2 October 9, 2007 09:38
Putting submesh field values into field on parent mesh helmut OpenFOAM Running, Solving & CFD 2 June 20, 2006 07:31


All times are GMT -4. The time now is 04:31.