where is the function "addField" defined?
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 Code:
//- Add the field to a phase-indexed list, with the given name, 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"? |
Searching for it on github (https://github.com/OpenFOAM/OpenFOAM...ped_q=addField) finds this:
https://github.com/OpenFOAM/OpenFOAM...temTemplates.C |
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? |
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.
|
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 :-) |
All times are GMT -4. The time now is 10:55. |