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

TimeVaryingMappedFixedValue field creation

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 4, 2008, 11:50
Default Hi, I still got problems re
  #21
Senior Member
 
John Deas
Join Date: Mar 2009
Posts: 160
Rep Power: 17
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, 13:07
Default
  #22
Senior Member
 
Jiang
Join Date: Oct 2009
Location: Japan
Posts: 186
Rep Power: 17
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, 13:10
Default
  #23
Senior Member
 
Jiang
Join Date: Oct 2009
Location: Japan
Posts: 186
Rep Power: 17
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

Old   October 13, 2015, 07:33
Default
  #24
Senior Member
 
Ehsan Asgari
Join Date: Apr 2010
Posts: 473
Rep Power: 18
syavash is on a distinguished road
Quote:
Originally Posted by johndeas View Post
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:Traits<double>:Traits(const double&)'
/home/flurec/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/Scalar.H:68: note: candidates are: Foam:Traits<double>:Traits(Foam::Istream&)
/home/flurec/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/Scalar.H:41: note: Foam:Traits<double>:Traits(const Foam:Traits<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>:Traits(const primitive& p)
{
p_ = p;
}
Hi,

I have encountered a very similar problem. I have included the following code within pimpleFoam to write U field at inlet, at each time step to be used later through TimeVaryingMappedFixedValue bc.
Code:
AverageIOField<vector> U2
(
    IOobject
    (
        "U",
        mesh.time().timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::NO_WRITE
    ),
    U.boundaryField()[ patchID ]
);

U2.write();
But when compiling, OpenFOAM gives me the following error:

Code:
MypimpleFoam.C: In function ‘int main(int, char**)’:
MypimpleFoam.C:97:4: error: ‘AverageIOField’ was not declared in this scope
    AverageIOField<vector> U2
    ^
MypimpleFoam.C:97:25: error: expected primary-expression before ‘>’ token
    AverageIOField<vector> U2
                         ^
MypimpleFoam.C:108:1: error: ‘U2’ was not declared in this scope
 );
 ^
make: *** [Make/linux64GccDPOpt/MypimpleFoam.o] Error 1
I need to implement AverageIOField because TimeVaryingMappedFixedValue accepts data with this type. How can I resolve this problem??

Thanks,
Syavash
syavash is offline   Reply With Quote

Old   June 14, 2021, 15:56
Default Problem with TimeVaryingMappedFixedValue
  #25
New Member
 
Pilar
Join Date: Jan 2021
Posts: 4
Rep Power: 5
Pilardc91 is on a distinguished road
I am using a boundary condition for the displacement U called TimeVaryingMappedFixedValue. The definition of this BC is:

"This is a derived traction boundary which reads the time and spatial varying force data (from pressure p and/or stresses  S) and computes the traction load and compatible displacement gradient boundary. This boundary condition is derived from tractionDisplacement + timeVary-ingMappedFixedValue in OpenFOAM. (Li et al. 2020)"

When I get the results for each time, this boundary condition does not do like other boundary conditions that store the list of data in the defined patch. In fact, when I look at one of the files and search for the patch where I have imposed that B.C there is no data (it is at the top). The thing is that in Paraview if it represents them to me and it represents them just in that patch.

My doubts are:

1) why does this happen and why Paraview allows to draw it?

2) When I make the sampleDict (and execute sample) none of the interpolation options let me get the data of U, since it looks for the patch and does not find it. Any idea what I can extract those data from

Thank you very much in advance for your help.
Pilardc91 is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 17:53.