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

Saving pressure field in simpleFoam

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 10, 2008, 17:40
Default Hi, In simpleFoam.C, runTim
  #1
New Member
 
J. T.
Join Date: Mar 2009
Posts: 12
Rep Power: 17
cpplabs is on a distinguished road
Hi,
In simpleFoam.C, runTime.Write() is used to write results, and simpleFoam p.storePrevIter() is called to store the pressure field of the previous iteration. Because the WOpt_ member in the copy constructor of GeometricField is always set to be NO_Write, and it seems that the write function always export the pressure field for the previous iteration (not p itself), pressue is always missing from the export.
Can someone tell me how to fix the problem or what part of my understanding is wrong?

Thanks.

============================================
// construct as copy
template<class> class PatchField, class GeoMesh>
Foam::GeometricField<type,>::GeometricField
(
const GeometricField<type,>& gf
)
:
DimensionedField<type,>(gf),
timeIndex_(gf.timeIndex()),
field0Ptr_(NULL),
fieldPrevIterPtr_(NULL),
boundaryField_(*this, gf.boundaryField_)
{
if (debug)
{
Info<<>::GeometricField : "
"constructing as copy"
<<>info() << endl;
}

if (gf.field0Ptr_)
{
field0Ptr_ = new GeometricField<type,>
(
*gf.field0Ptr_
);
}

this->writeOpt() = IOobject::NO_WRITE;
}
cpplabs is offline   Reply With Quote

Old   February 10, 2008, 19:47
Default Nice one. Go to OpenFOAM-1
  #2
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,905
Rep Power: 33
hjasak will become famous soon enough
Nice one. Go to

OpenFOAM-1.4.1-dev/src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricF ield.C

look for the function void Foam::GeometricField<type,>::storePrevIter() const

and in the second part do the following:

fieldPrevIterPtr_ =
new GeometricField<type,>
(
IOobject
(
this->name() + "_prev",
this->time().timeName(),
this->db()
),
*this
);


Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   February 10, 2008, 20:50
Default Hi, Thanks for the workaro
  #3
New Member
 
J. T.
Join Date: Mar 2009
Posts: 12
Rep Power: 17
cpplabs is on a distinguished road
Hi,
Thanks for the workaround. I did further study into the code and found that "ConstructFromTmp" makes the difference because the following contructor. If ConstructFromTmp is turned on (defined), regIOobject(df) will be used instead of regIOobject(df, true), and the objectRegistry registration will not be transfered to the copy.
My further question is what is the purpose of ConstructFromTmp? It is used at several locations in the code, what different does this switch make?

Regards,

JT
================================================
template<class>
DimensionedField<type,>::DimensionedField
(
const DimensionedField<type,>& df
)
:
# ifdef ConstructFromTmp
regIOobject(df),
# else
regIOobject(df, true),
# endif
Field<type>(df),
mesh_(df.mesh_),
dimensions_(df.dimensions_)
{}
cpplabs 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
SimpleFoam pressure driven flow gzink OpenFOAM Running, Solving & CFD 1 July 2, 2013 14:23
Pressure driven laminar flow simpleFoam pressure higher at the outlet than inlet gabriel OpenFOAM Running, Solving & CFD 16 September 30, 2009 18:20
How to get Pressure field from velocity field qunwuhe@hotmail.com Main CFD Forum 4 October 14, 2007 07:38
Pressure Far Field BC Zhen FLUENT 4 January 24, 2005 07:53
about pressure far field fan Qunbo FLUENT 4 June 18, 2002 23:24


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