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 Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By jherb

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 26, 2019, 04:15
Question where is the function "addField" defined?
  #1
New Member
 
SAIKRISHNA N
Join Date: Jun 2014
Posts: 7
Rep Power: 8
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, 10:25
Default
  #2
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 601
Rep Power: 18
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, 11:12
Default
  #3
New Member
 
SAIKRISHNA N
Join Date: Jun 2014
Posts: 7
Rep Power: 8
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, 08:44
Default
  #4
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 601
Rep Power: 18
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, 13:07
Default
  #5
New Member
 
SAIKRISHNA N
Join Date: Jun 2014
Posts: 7
Rep Power: 8
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

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 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


All times are GMT -4. The time now is 10:56.