|
[Sponsors] |
May 26, 2019, 04:15 |
where is the function "addField" defined?
|
#1 |
New Member
SAIKRISHNA N
Join Date: Jun 2014
Posts: 10
Rep Power: 12 |
Hello Foamers,
I am going through the source code in reactingEulerFoam in OpenFOAM 6. I have found a function addField, for example, in momentumTransferPhaseSystem.C as Code:
this->addField ( pair.phase1(), "phiF", fvc::flux(rAUs[pair.phase1().index()]*F), phiFs ); Code:
//- Add the field to a phase-indexed list, with the given name, // constructing if necessary template<class GeoField> void addField ( const phaseModel& phase, const word& fieldName, tmp<GeoField> field, PtrList<GeoField>& fieldList ) const; I would like to know what exactly this function does and where is it defined. Because, this function is used to add interfacial transfer forces to momentum conservations equations in momentumTransferPhaseSystem.C multiple times and also used many other places in this solver. I want to understand whether this function algebraically adds "field" to the already existing field referenced by "fieldName" which is in "fieldList"? |
|
May 30, 2019, 10:25 |
|
#2 |
Senior Member
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 22 |
Searching for it on github (https://github.com/OpenFOAM/OpenFOAM...ped_q=addField) finds this:
https://github.com/OpenFOAM/OpenFOAM...temTemplates.C |
|
May 30, 2019, 11:12 |
|
#3 |
New Member
SAIKRISHNA N
Join Date: Jun 2014
Posts: 10
Rep Power: 12 |
Dear Joachim herb,
Thank you very much. I don't know how this file got skipped while going through the code. After going through the definition in phaseSystemTemplates.C, I understand that "addField" is algebraically adding the "field" supplied into the existing location (or will create new location) in the "fieldList". let us say, if field "a" as values 5 stored in it. if I use this addField on this with field = 2, then the result would be a=7. Am I right? |
|
May 31, 2019, 08:44 |
|
#4 |
Senior Member
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 22 |
What do you mean with algebraically adding? The fields are referenced by the phase.index(). Otherwise, I think you are correct: If there is no entry for a certain phase.index(), a new one is created and the field argument put insert at this index. Otherwise the field is added to the existing value.
|
|
May 31, 2019, 13:07 |
|
#5 |
New Member
SAIKRISHNA N
Join Date: Jun 2014
Posts: 10
Rep Power: 12 |
Yes. That is exactly what I am saying. It matches with the context of this function as well.
Now it's all clear. Thank you :-) |
|
Tags |
addfield, reactingeulerfoam, wallboiling |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[blockMesh] non-orthogonal faces and incorrect orientation? | nennbs | OpenFOAM Meshing & Mesh Conversion | 7 | April 17, 2013 06:42 |
is internalField(U) equivalent to zeroGradient? | immortality | OpenFOAM Running, Solving & CFD | 7 | March 29, 2013 02:27 |
using METIS functions in fortran | dokeun | Main CFD Forum | 7 | January 29, 2013 05:06 |
channelFoam for a 3D pipe | AlmostSurelyRob | OpenFOAM | 3 | June 24, 2011 14:06 |
Problem with compile the setParabolicInlet | ivanyao | OpenFOAM Running, Solving & CFD | 6 | September 5, 2008 21:50 |