mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Further enhancements to stabilizationSchemes
This commit is contained in:
@ -48,6 +48,37 @@ namespace functionObjects
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::stabilityBlendingFactor::calcStats
|
||||
(
|
||||
label& nCellsScheme1,
|
||||
label& nCellsScheme2,
|
||||
label& nCellsBlended
|
||||
) const
|
||||
{
|
||||
forAll(indicator_, celli)
|
||||
{
|
||||
scalar i = indicator_[celli];
|
||||
|
||||
if (i < tolerance_)
|
||||
{
|
||||
nCellsScheme2++;
|
||||
}
|
||||
else if (i > (1 - tolerance_))
|
||||
{
|
||||
nCellsScheme1++;
|
||||
}
|
||||
else
|
||||
{
|
||||
nCellsBlended++;
|
||||
}
|
||||
}
|
||||
|
||||
reduce(nCellsScheme1, sumOp<label>());
|
||||
reduce(nCellsScheme2, sumOp<label>());
|
||||
reduce(nCellsBlended, sumOp<label>());
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::stabilityBlendingFactor::writeFileHeader
|
||||
(
|
||||
Ostream& os
|
||||
@ -370,6 +401,21 @@ bool Foam::functionObjects::stabilityBlendingFactor::init(bool first)
|
||||
Log << nl;
|
||||
}
|
||||
|
||||
if (log)
|
||||
{
|
||||
label nCellsScheme1 = 0;
|
||||
label nCellsScheme2 = 0;
|
||||
label nCellsBlended = 0;
|
||||
|
||||
calcStats(nCellsScheme1, nCellsScheme2, nCellsBlended);
|
||||
|
||||
Log << nl << type() << " execute :" << nl
|
||||
<< " scheme 1 cells : " << nCellsScheme1 << nl
|
||||
<< " scheme 2 cells : " << nCellsScheme2 << nl
|
||||
<< " blended cells : " << nCellsBlended << nl
|
||||
<< endl;
|
||||
}
|
||||
|
||||
indicator_.correctBoundaryConditions();
|
||||
indicator_.min(1.0);
|
||||
indicator_.max(0.0);
|
||||
@ -689,41 +735,15 @@ bool Foam::functionObjects::stabilityBlendingFactor::read
|
||||
|
||||
bool Foam::functionObjects::stabilityBlendingFactor::write()
|
||||
{
|
||||
// Generate scheme statistics
|
||||
if (writeToFile_)
|
||||
{
|
||||
|
||||
label nCellsScheme1 = 0;
|
||||
label nCellsScheme2 = 0;
|
||||
label nCellsBlended = 0;
|
||||
forAll(indicator_, celli)
|
||||
{
|
||||
scalar i = indicator_[celli];
|
||||
|
||||
if (i < tolerance_)
|
||||
{
|
||||
nCellsScheme2++;
|
||||
}
|
||||
else if (i > (1 - tolerance_))
|
||||
{
|
||||
nCellsScheme1++;
|
||||
}
|
||||
else
|
||||
{
|
||||
nCellsBlended++;
|
||||
}
|
||||
}
|
||||
calcStats(nCellsScheme1, nCellsScheme2, nCellsBlended);
|
||||
|
||||
reduce(nCellsScheme1, sumOp<label>());
|
||||
reduce(nCellsScheme2, sumOp<label>());
|
||||
reduce(nCellsBlended, sumOp<label>());
|
||||
|
||||
Log << nl << type() << " execute :" << nl
|
||||
<< " scheme 1 cells : " << nCellsScheme1 << nl
|
||||
<< " scheme 2 cells : " << nCellsScheme2 << nl
|
||||
<< " blended cells : " << nCellsBlended << nl
|
||||
<< endl;
|
||||
|
||||
|
||||
if (writeToFile_)
|
||||
{
|
||||
writeTime(file());
|
||||
|
||||
file()
|
||||
@ -736,5 +756,4 @@ bool Foam::functionObjects::stabilityBlendingFactor::write()
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -424,6 +424,9 @@ class stabilityBlendingFactor
|
||||
//- Init fields
|
||||
bool init(bool first);
|
||||
|
||||
//- Calculate statistics
|
||||
void calcStats(label&, label&, label&) const ;
|
||||
|
||||
//- Calculate the blending factor field and return true if successful
|
||||
virtual bool calc();
|
||||
|
||||
|
||||
@ -22,7 +22,6 @@ blendingFactor
|
||||
log true;
|
||||
writeToFile false;
|
||||
|
||||
|
||||
switchNonOrtho yes;
|
||||
switchGradCc no;
|
||||
switchResiduals yes;
|
||||
|
||||
Reference in New Issue
Block a user