How the boundary conditions are called in the OpenFOAM solvers?
Dear All,
I was wondering how the boundary conditions subroutines are called ? Let us take an example: Code:
OpenFOAM/OpenFOAM-2.1.1/tutorials/compressible/rhoPimpleFoam/les/pitzDaily Code:
U/0 Code:
inlet Thank you in advance! |
Easy:
- on correctBoundaryConditions() for a field - on updateCoeffs() at matrix creation correctBoundaryConditions is also called after the linear solver call automatically. Enjoy, Hrv |
Thank you so much, Hrvoje!
About the first one, I get it in the Code:
src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.C Code:
// Correct the boundary conditions Code:
src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricField.H Code:
//- Evaluate boundary conditions |
About the updateCoeffs in the turbulentInlet boundary conditions
Code:
OpenFOAM/OpenFOAM-2.1.1/src/finiteVolume/fields/fvPatchFields/derived/turbulentInlet Code:
template<class Type> Code:
fixedValueFvPatchField<Type>::updateCoeffs(); ++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++ As a record how I understand this, I put the answer here: evaluate() is defined in Code:
src/OpenFOAM/fields/GeometricFields/GeometricField/GeometricBoundaryField.C Code:
template<class Type, template<class> class PatchField, class GeoMesh> |
No Body also interested in this issue?
|
As a newbie I asked a similar question in my latest post:
http://www.cfd-online.com/Forums/ope...tempratur.html Quote:
Code:
correctBoundaryConditions() { Am I right? |
Yes, I agree with you. I also did some digging into the source files. But do you know the role of the following lines:
Code:
fixedValueFvPatchField<Type>::updateCoeffs(); |
I did not find this function in the source:
fixedValueFvPatchField.H Sorry for my limit C++ skills. Does anybody know where I can find this function, Code:
fixedValueFvPatchField<Type>::updateCoeffs(); Quote:
|
Please read up on virtual functions - this is basic C++
Hrv |
For my record, actually, the following lines:
Code:
fixedValueFvPatchField<Type>::updateCoeffs(); The function updateCoeffs is defined in: Code:
fvPatchField.H Quote:
|
Dear Dr Jasak,
The second item you mentioned: Code:
updateCoeffs() OFFO Quote:
|
my understanding so far is:
Those BC types that need updating and evaluation at each time step, they either have updateCoeffs() or evaluate() in the class definition, virtual of course. When a fvMatrix<type> Eqn is created, the updateCoeffs() is called in its constructor. Then in Eqn().solve() the function correctBoundaryConditions() is called, which contains evaluate(). Now the two functions are implemented differently in every BC, and the solver would also execute different things out according to each BC type defined. Thanks for corrections and improvement. peter |
My understanding is that functions like updateCoeffs() and evaluate() are defined first in the upper code level virtually like in GeometricBoundaryField.C and overloaded(redefined) later in specific derived classes where actual math manipulation is done. For example lets look at fixedGradientFvPatchField.C in /src/finiteVolume/fields/fvPatchFields/basic/fixedGradient :
template<class Type> void fixedGradientFvPatchField<Type>::evaluate(const Pstream::commsTypes) { if (!this->updated()) { this->updateCoeffs(); } Field<Type>::operator= ( this->patchInternalField() + gradient_/this->patch().deltaCoeffs() ); fvPatchField<Type>::evaluate(); } Here , the value is updated based on specified gradient in BC file. Can somebody please verify since I'm I also new to C++? |
I think what you said is correct. :D
Quote:
|
How to call updateCoeff on UEqn. I tried UEqn.updateCoeff() but openfoam returned a compiler error
|
Quote:
Hi I am trying to see a value of a variable inside BC. I tried standard Info statement: Code:
Info<< "variable = " << variable << endl; I tried also Code:
if (debug) |
All times are GMT -4. The time now is 07:02. |