Output bugfix in ggiCheckFunctionObject
This commit is contained in:
parent
9a3b72961c
commit
9170cf2d97
1 changed files with 30 additions and 36 deletions
|
@ -86,6 +86,7 @@ bool Foam::ggiCheckFunctionObject::execute(const bool forceWrite)
|
||||||
|
|
||||||
if (mesh.foundObject<surfaceScalarField>(phiName_))
|
if (mesh.foundObject<surfaceScalarField>(phiName_))
|
||||||
{
|
{
|
||||||
|
Info<< "Checking flux " << phiName_ << " GGI balance." << endl;
|
||||||
const surfaceScalarField& phi =
|
const surfaceScalarField& phi =
|
||||||
mesh.lookupObject<surfaceScalarField>(phiName_);
|
mesh.lookupObject<surfaceScalarField>(phiName_);
|
||||||
|
|
||||||
|
@ -110,24 +111,22 @@ bool Foam::ggiCheckFunctionObject::execute(const bool forceWrite)
|
||||||
visited[patchI] = true;
|
visited[patchI] = true;
|
||||||
visited[shadowPatchI] = true;
|
visited[shadowPatchI] = true;
|
||||||
|
|
||||||
// Calculate local and shadow flux
|
// Calculate local flux and area
|
||||||
scalar localArea =
|
const scalar localArea =
|
||||||
gSum(phi.mesh().magSf().boundaryField()[patchI]);
|
gSum(phi.mesh().magSf().boundaryField()[patchI]);
|
||||||
|
|
||||||
scalar localFlux = gSum(phi.boundaryField()[patchI]);
|
const scalar localFlux = gSum(phi.boundaryField()[patchI]);
|
||||||
scalar localFluxMag = gSumMag(phi.boundaryField()[patchI]);
|
const scalar localFluxMag = mag(localFlux);
|
||||||
|
|
||||||
|
// Calculate shadow flux and area
|
||||||
|
const scalar shadowArea =
|
||||||
scalar shadowArea =
|
|
||||||
gSum(phi.mesh().magSf().boundaryField()[shadowPatchI]);
|
gSum(phi.mesh().magSf().boundaryField()[shadowPatchI]);
|
||||||
|
|
||||||
scalar shadowFlux =
|
const scalar shadowFlux =
|
||||||
gSum(phi.boundaryField()[shadowPatchI]);
|
gSum(phi.boundaryField()[shadowPatchI]);
|
||||||
|
const scalar shadowFluxMag = mag(shadowFlux);
|
||||||
|
|
||||||
scalar shadowFluxMag =
|
// Report
|
||||||
gSumMag(phi.boundaryField()[shadowPatchI]);
|
|
||||||
|
|
||||||
Info<< "GGI pair (" << ggiPatch.name() << ", "
|
Info<< "GGI pair (" << ggiPatch.name() << ", "
|
||||||
<< ggiPatch.shadow().name() << ")" << nl
|
<< ggiPatch.shadow().name() << ")" << nl
|
||||||
<< "Area: " << localArea << " " << shadowArea
|
<< "Area: " << localArea << " " << shadowArea
|
||||||
|
@ -138,7 +137,7 @@ bool Foam::ggiCheckFunctionObject::execute(const bool forceWrite)
|
||||||
<< "Flux: " << localFluxMag << " " << shadowFluxMag
|
<< "Flux: " << localFluxMag << " " << shadowFluxMag
|
||||||
<< " Diff = " << localFlux + shadowFlux << " or "
|
<< " Diff = " << localFlux + shadowFlux << " or "
|
||||||
<< mag(localFlux + shadowFlux)/
|
<< mag(localFlux + shadowFlux)/
|
||||||
(localFluxMag + SMALL)*100
|
(Foam::max(localFluxMag, shadowFluxMag) + SMALL)*100
|
||||||
<< " %" << endl;
|
<< " %" << endl;
|
||||||
}
|
}
|
||||||
else if
|
else if
|
||||||
|
@ -157,22 +156,22 @@ bool Foam::ggiCheckFunctionObject::execute(const bool forceWrite)
|
||||||
visited[patchI] = true;
|
visited[patchI] = true;
|
||||||
visited[shadowPatchI] = true;
|
visited[shadowPatchI] = true;
|
||||||
|
|
||||||
// Calculate local and shadow flux
|
// Calculate local flux and area
|
||||||
scalar localArea =
|
const scalar localArea =
|
||||||
gSum(phi.mesh().magSf().boundaryField()[patchI]);
|
gSum(phi.mesh().magSf().boundaryField()[patchI]);
|
||||||
|
|
||||||
scalar localFlux = gSum(phi.boundaryField()[patchI]);
|
const scalar localFlux = gSum(phi.boundaryField()[patchI]);
|
||||||
scalar localFluxMag = gSumMag(phi.boundaryField()[patchI]);
|
const scalar localFluxMag = mag(localFlux);
|
||||||
|
|
||||||
scalar shadowArea =
|
// Calculate shadow flux and area
|
||||||
|
const scalar shadowArea =
|
||||||
gSum(phi.mesh().magSf().boundaryField()[shadowPatchI]);
|
gSum(phi.mesh().magSf().boundaryField()[shadowPatchI]);
|
||||||
|
|
||||||
scalar shadowFlux =
|
const scalar shadowFlux =
|
||||||
gSum(phi.boundaryField()[shadowPatchI]);
|
gSum(phi.boundaryField()[shadowPatchI]);
|
||||||
|
const scalar shadowFluxMag = mag(shadowFlux);
|
||||||
|
|
||||||
scalar shadowFluxMag =
|
// Report
|
||||||
gSumMag(phi.boundaryField()[shadowPatchI]);
|
|
||||||
|
|
||||||
Info<< "Cyclic GGI pair (" << ggiPatch.name() << ", "
|
Info<< "Cyclic GGI pair (" << ggiPatch.name() << ", "
|
||||||
<< ggiPatch.shadow().name() << ")" << nl
|
<< ggiPatch.shadow().name() << ")" << nl
|
||||||
<< "Area: " << localArea << " " << shadowArea
|
<< "Area: " << localArea << " " << shadowArea
|
||||||
|
@ -183,7 +182,7 @@ bool Foam::ggiCheckFunctionObject::execute(const bool forceWrite)
|
||||||
<< "Flux: " << localFluxMag << " " << shadowFluxMag
|
<< "Flux: " << localFluxMag << " " << shadowFluxMag
|
||||||
<< " Diff = " << localFlux + shadowFlux << " or "
|
<< " Diff = " << localFlux + shadowFlux << " or "
|
||||||
<< mag(localFlux + shadowFlux)/
|
<< mag(localFlux + shadowFlux)/
|
||||||
(localFluxMag + SMALL)*100
|
(Foam::max(localFluxMag, shadowFluxMag) + SMALL)*100
|
||||||
<< " %" << endl;
|
<< " %" << endl;
|
||||||
}
|
}
|
||||||
else if
|
else if
|
||||||
|
@ -208,30 +207,25 @@ bool Foam::ggiCheckFunctionObject::execute(const bool forceWrite)
|
||||||
visited[patchI] = true;
|
visited[patchI] = true;
|
||||||
visited[shadowPatchI] = true;
|
visited[shadowPatchI] = true;
|
||||||
|
|
||||||
// Calculate local and shadow flux
|
// Calculate local flux and area
|
||||||
scalar localArea =
|
const scalar localArea =
|
||||||
gSum(phi.mesh().magSf().boundaryField()[patchI])
|
gSum(phi.mesh().magSf().boundaryField()[patchI])
|
||||||
*ggiPatch.nCopies();
|
*ggiPatch.nCopies();
|
||||||
|
|
||||||
scalar localFlux =
|
const scalar localFlux =
|
||||||
gSum(phi.boundaryField()[patchI])
|
gSum(phi.boundaryField()[patchI])
|
||||||
*ggiPatch.nCopies();
|
*ggiPatch.nCopies();
|
||||||
|
const scalar localFluxMag = mag(localFlux);
|
||||||
|
|
||||||
scalar localFluxMag =
|
// Calculate shadow flux and area
|
||||||
gSumMag(phi.boundaryField()[patchI])
|
const scalar shadowArea =
|
||||||
*ggiPatch.nCopies();
|
|
||||||
|
|
||||||
scalar shadowArea =
|
|
||||||
gSum(phi.mesh().magSf().boundaryField()[shadowPatchI])
|
gSum(phi.mesh().magSf().boundaryField()[shadowPatchI])
|
||||||
*ggiShadowPatch.nCopies();
|
*ggiShadowPatch.nCopies();
|
||||||
|
|
||||||
scalar shadowFlux =
|
const scalar shadowFlux =
|
||||||
gSum(phi.boundaryField()[shadowPatchI])
|
gSum(phi.boundaryField()[shadowPatchI])
|
||||||
*ggiShadowPatch.nCopies();
|
*ggiShadowPatch.nCopies();
|
||||||
|
const scalar shadowFluxMag = mag(shadowFlux);
|
||||||
scalar shadowFluxMag =
|
|
||||||
gSumMag(phi.boundaryField()[shadowPatchI])
|
|
||||||
*ggiShadowPatch.nCopies();
|
|
||||||
|
|
||||||
Info<< "Overlap GGI pair (" << ggiPatch.name() << ", "
|
Info<< "Overlap GGI pair (" << ggiPatch.name() << ", "
|
||||||
<< ggiPatch.shadow().name() << ")" << nl
|
<< ggiPatch.shadow().name() << ")" << nl
|
||||||
|
@ -253,7 +247,7 @@ bool Foam::ggiCheckFunctionObject::execute(const bool forceWrite)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
InfoIn("bool ggiCheckFunctionObject::execute(const bool forceWrite)")
|
InfoIn("bool ggiCheckFunctionObject::execute(const bool forceWrite)")
|
||||||
<< "Cannot find flux field phi"
|
<< "Cannot find flux field " << phiName_
|
||||||
<< endl;
|
<< endl;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
Reference in a new issue