Faces heat transfer regimes, alphatWallBoilingWallFunctionFvPatchScalarField.C
Summary
Wrong counting of heat transfer regime faces in alphatWallBoilingWallFunctionFvPatchScalarField.C. The calculation is wrong only when more than one CPU is used.
Steps to reproduce
1 CPU
Using $FOAM_TUTORIALS/heatTransfer/chtMultiRegionTwoPhaseEulerFoam/solidQuenching2D case.
Change the debug switch for the boiling boundary condition in system/controlDict
compressible::alphatWallBoilingWallFunction 2;
Execute ./Allrun
4 CPUs
Using $FOAM_TUTORIALS/heatTransfer/chtMultiRegionTwoPhaseEulerFoam/solidQuenching2D case.
Change the debug switch for the boiling boundary condition in system/controlDict
compressible::alphatWallBoilingWallFunction 2;
Add a line for decomopsition in Allrun.pre
runApplication decomposePar -allRegions
.
Change Allrun file the line
runApplication $application
into
runParallel $application
Execute the ./Allrun
Comparing the output log files log.chtMultiRegionTwoPhaseEulerFoam (1CPU and 4CPUs) we can see that numbers in section Faces regime are different. Also, the number of faces in total should be 70 as it is seen in constant/water/polyMesh/boundary. When 4CPUs (or another number of CPUs) are used then the total number of faces is different (if not all boundary faces are on 1 CPU which prints the information).
Example case
In the section Steps to reproduce
What is the current bug behaviour?
The wrong number of faces counted for various heat transfer regimes when debug 2 is used. The part of the code is only for debugging, hence, it does not have any impact on the simulation result.
What is the expected correct behavior?
The number of faces should be counted using mpi related methods. Thus, these which get information from all CPUs. E.g. total number of faces should be equal to the number of faces at the particular boundary condition shown in constant/water/polyMesh/boundary for any number of CPUs used (for any mesh decomposition).
Relevant logs and/or images
1CPU
sub Cool faces : 0
transient faces : 0
film faces : 70
non-Boiling faces : 0
total faces : 70
4CPUs
sub Cool faces : 0
transient faces : 0
film faces : 63
non-Boiling faces : 0
total faces : 63
Environment information
- OpenFOAM version : v1906 (will most probably happen also in 1912)
- Operating system : ubuntu 16.04 LTS
- Hardware info : -
- Compiler : gcc 5.4.0
Possible fixes
Adjust the $FOAM_SRC/phaseSystemModels/reactingEulerFoam/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C Starting from the line 1006 (OF-v1912) change
if (debug & 2)
{
scalar nSubCool(0);
scalar nTransient(0);
scalar nFilm(0);
scalar nNonBoiling(0);
scalarField nSubCools(this->size(), 0);
scalarField nTransients(this->size(), 0);
scalarField nFilms(this->size(), 0);
scalarField nNonBoilings(this->size(), 0);
forAll (*this, i)
{
//faceRegimes[i] = regimeTypes[i];
switch (regimeTypes[i])
{
case regimeType::subcool:
nSubCool++;
nSubCools[i] = 1;
break;
case regimeType::transient:
nTransient++;
nTransients[i] = 1;
break;
case regimeType::film:
nFilm++;
nFilms[i] = 1;
break;
case regimeType::nonBoiling:
nNonBoiling++;
nNonBoilings[i] = 1;
break;
}
}
Info<< "Faces regime : " << nl << endl;
Info<< " sub Cool faces : " << nSubCool << endl;
Info<< " transient faces : " << nTransient << endl;
Info<< " film faces : " << nFilm << endl;
Info<< " non-Boiling faces : " << nNonBoiling << endl;
Info<< " total faces : " << this->size() << endl << nl;
into
if (debug & 2)
{
scalarField nSubCools(this->size(), 0);
scalarField nTransients(this->size(), 0);
scalarField nFilms(this->size(), 0);
scalarField nNonBoilings(this->size(), 0);
forAll (*this, i)
{
switch (regimeTypes[i])
{
case regimeType::subcool:
nSubCools[i] = 1;
break;
case regimeType::transient:
nTransients[i] = 1;
break;
case regimeType::film:
nFilms[i] = 1;
break;
case regimeType::nonBoiling:
nNonBoilings[i] = 1;
break;
}
}
scalar nSubCool(gSum(nSubCools));
scalar nTransient(gSum(nTransients));
scalar nFilm(gSum(nFilms));
scalar nNonBoiling(gSum(nNonBoilings));
Info<< "Faces regime : " << nl << endl;
Info<< " sub Cool faces : " << nSubCool << endl;
Info<< " transient faces : " << nTransient << endl;
Info<< " film faces : " << nFilm << endl;
Info<< " non-Boiling faces : " << nNonBoiling << endl;
Info<< " total faces : " << nSubCool + nTransient +
nFilm + nNonBoiling << endl << nl;
/label bug