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

 Register Blogs Members List Search Today's Posts Mark Forums Read

 December 21, 2013, 10:13 multiphaseEulerFoam: method mag(...) withing method solveAlphase() #1 Senior Member   Join Date: Jan 2012 Posts: 166 Rep Power: 13 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 PatchField, class GeoMesh> 323*tmp > mag 324*( 325* const GeometricField& gf //const surfaceScalarField& phi_ 326*) 327*{ 328* tmp > tMag 329* ( 330* new GeometricField 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 > tMag 348*}``` In line 345 is found the second mag(...) method: Code: ```//SNIPPET 3 template class PatchField, class GeoMesh> 312 void mag 313 ( 314 GeometricField& gsf, 315 const GeometricField& 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::internalField() //QUESTION 1 674 { 675 this->setUpToDate(); 676 storeOldTimes(); 677 return *this; 678 }``` and Code: ```//SNIPPET 5 Foam::GeometricField::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& sf, const FieldField& f) //sf: GeometricBoundaryField boundaryField_ of GeometricField of tmp > 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 06:10.