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

multiphaseEulerFoam: method mag(...) withing method solveAlphase()

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 21, 2013, 11:13
Default multiphaseEulerFoam: method mag(...) withing method solveAlphase()
  #1
Senior Member
 
Join Date: Jan 2012
Posts: 166
Rep Power: 14
maybee is on a distinguished road
hi,

within method solveAlphas in file multiphaseSystem.C of the multiphaseEulerFoam solver is found:

Code:
//SNIPPET 1 
(mag(phi_) + mag(phase1.phi() - phase2.phi()))/mesh_.magSf()
where phi_ is "const surfaceScalarField& phi_ in multiphasesystem.H" and therefore the first mag method is:

Code:
//SNIPPET 2
template<class Type, template<class> class PatchField, class GeoMesh>
323*tmp<GeometricField<scalar, PatchField, GeoMesh> > mag
324*(
325* const GeometricField<Type, PatchField, GeoMesh>& gf  //const surfaceScalarField& phi_
326*)
327*{
328* tmp<GeometricField<scalar, PatchField, GeoMesh> > tMag
329* (
330* new GeometricField<scalar, PatchField, GeoMesh>
331* (
332* IOobject
333* (
334* "mag(" + gf.name() + ')', 
335* gf.instance(),
336* gf.db(),
337* IOobject::NO_READ,
338* IOobject::NO_WRITE
339* ),
340* gf.mesh(),
341* gf.dimensions()
342* )
343* );
344*
345* mag(tMag(), gf);     
346*
347* return tMag;     //tmp<GeometricField<scalar, PatchField, GeoMesh> > tMag
348*}
In line 345 is found the second mag(...) method:

Code:
//SNIPPET 3
template<class Type, template<class> class PatchField, class GeoMesh>
  312 void mag
  313 (
  314     GeometricField<scalar, PatchField, GeoMesh>& gsf,
  315     const GeometricField<Type, PatchField, GeoMesh>& gf
  316 )
  317 {
  318     mag(gsf.internalField(), gf.internalField());         //QUESTION 1
  319     mag(gsf.boundaryField(), gf.boundaryField());    //QUESTION 2
  320 }
with the third and the fourth mag(...) methods

Code:
//SNIPPET 4
Foam::GeometricField<Type, PatchField, GeoMesh>::internalField()  //QUESTION 1
  674 {
  675     this->setUpToDate();
  676     storeOldTimes();
  677     return *this;
  678 }
and

Code:
//SNIPPET 5
Foam::GeometricField<Type, PatchField, GeoMesh>::boundaryField()  //QUESTION 2
  686 {
  687     this->setUpToDate();
  688     storeOldTimes();
  689     return boundaryField_; //GeometricBoundaryField boundaryField_
  690 }
My questions are about the three last codesnippets (SNIPPET 3-5):

QUESTION 1:

If "internalfield()" returns the updated object it is called on and afterwards mag(...) is called in line 318 of SNIPPET 3 wouldn't this cause an endless loop since the SAME method mag(...) like at the beginning of SNIPPET 3 would be called again and again?

QUESTION 2:

method mag(...) in line 319 of SNIPPET 3 should be
Code:
void mag(FieldField<Field, scalar>& sf, const FieldField<Field, Type>& f) //sf: GeometricBoundaryField boundaryField_ of GeometricField of tmp<GeometricField<scalar, PatchField, GeoMesh> > tMag
189*{                                                                     //f: GeometricBoundaryField boundaryField_ of const surfaceScalarField& phi_
190* forAll(sf, i)
191* {
192* mag(sf[i], f[i]);
193* }
194*}
Where can I find the mag(...) method that in this case should take two scalars as input parameters (as I suppose)?

Last edited by maybee; December 22, 2013 at 07:10.
maybee is offline   Reply With Quote

Reply


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
multiphaseEulerFoam: method iter() and calculation of phase fractions maybee OpenFOAM Programming & Development 1 July 22, 2020 09:20
On the alpha Eqn of VOF method when using Immersed boundary method in OpenFOAM keepfit OpenFOAM 4 January 31, 2014 15:32
multiphaseEulerFoam: Method forAllIter(...) within solve() maybee OpenFOAM Programming & Development 4 January 7, 2014 05:35
[Gmsh] discretizer - gmshToFoam Andyjoe OpenFOAM Meshing & Mesh Conversion 13 March 14, 2012 05:35
Code for most powerfull FDV Method D.S.Nasan Main CFD Forum 6 September 4, 2008 03:08


All times are GMT -4. The time now is 18:30.