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

where is the function "addField" defined?

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By jherb

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 26, 2019, 03:15
Question where is the function "addField" defined?
  #1
New Member
 
SAIKRISHNA N
Join Date: Jun 2014
Posts: 10
Rep Power: 11
SAIKRISHNA N is on a distinguished road
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
          );
The function is declared in phaseSystem.H as

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;
But, I could not find the definition anywhere.
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"?
SAIKRISHNA N is offline   Reply With Quote

Old   May 30, 2019, 09:25
Default
  #2
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21
jherb is on a distinguished road
Searching for it on github (https://github.com/OpenFOAM/OpenFOAM...ped_q=addField) finds this:


https://github.com/OpenFOAM/OpenFOAM...temTemplates.C
jherb is offline   Reply With Quote

Old   May 30, 2019, 10:12
Default
  #3
New Member
 
SAIKRISHNA N
Join Date: Jun 2014
Posts: 10
Rep Power: 11
SAIKRISHNA N is on a distinguished road
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?
SAIKRISHNA N is offline   Reply With Quote

Old   May 31, 2019, 07:44
Default
  #4
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21
jherb is on a distinguished road
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.
SAIKRISHNA N likes this.
jherb is offline   Reply With Quote

Old   May 31, 2019, 12:07
Default
  #5
New Member
 
SAIKRISHNA N
Join Date: Jun 2014
Posts: 10
Rep Power: 11
SAIKRISHNA N is on a distinguished road
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 :-)
SAIKRISHNA N is offline   Reply With Quote

Reply

Tags
addfield, reactingeulerfoam, wallboiling


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
[blockMesh] non-orthogonal faces and incorrect orientation? nennbs OpenFOAM Meshing & Mesh Conversion 7 April 17, 2013 05:42
is internalField(U) equivalent to zeroGradient? immortality OpenFOAM Running, Solving & CFD 7 March 29, 2013 01:27
using METIS functions in fortran dokeun Main CFD Forum 7 January 29, 2013 04:06
channelFoam for a 3D pipe AlmostSurelyRob OpenFOAM 3 June 24, 2011 13:06
Problem with compile the setParabolicInlet ivanyao OpenFOAM Running, Solving & CFD 6 September 5, 2008 20:50


All times are GMT -4. The time now is 13:34.