tutorials/modules/incompressibleFluid/pitzDailyScalarTransport: Added coded functionObject

which stops the run when the mixing defined as mean(T)/max(T) > 0.9.
This commit is contained in:
Henry Weller
2023-01-27 16:40:22 +00:00
parent 2da6c4cc62
commit 59409fb463

View File

@ -26,7 +26,7 @@ startTime 0;
stopAt endTime;
endTime 0.1;
endTime 0.2;
deltaT 0.0001;
@ -51,6 +51,31 @@ runTimeModifiable true;
functions
{
#includeFunc scalarTransport(T, diffusivity=constant, D = 0.01)
mixingQualityCheck
{
type coded;
libs ("libutilityFunctionObjects.so");
codeExecute
#{
const volScalarField& T
(
mesh().lookupObject<volScalarField>("T")
);
const scalar maxT = max(T).value();
const scalar meanT = T.weightedAverage(mesh().V()).value();
const scalar mixingQuality = meanT/maxT;
Info << "mixingQuality = " << mixingQuality << endl;
if (mixingQuality > 0.9)
{
const_cast<Time&>(mesh().time()).writeAndEnd();
}
#};
}
}
// ************************************************************************* //