ENH: Improvements to the log format and fix write function

This commit is contained in:
sergio 2018-06-20 16:43:00 -07:00
parent 7bf7aaea91
commit 649149f9de

View File

@ -105,11 +105,6 @@ bool Foam::functionObjects::stabilityBlendingFactor::init(bool first)
const IOField<scalar>* residualPtr = const IOField<scalar>* residualPtr =
mesh_.lookupObjectPtr<IOField<scalar>>(residualName_); mesh_.lookupObjectPtr<IOField<scalar>>(residualName_);
if (log)
{
Log << nl << type() << " : " << nl;
}
if (residuals_) if (residuals_)
{ {
if (!residualPtr) if (!residualPtr)
@ -131,6 +126,7 @@ bool Foam::functionObjects::stabilityBlendingFactor::init(bool first)
if (log) if (log)
{ {
Log << nl << name() << " : " << nl;
Log << " Average(mag(residuals)) : " << meanRes << endl; Log << " Average(mag(residuals)) : " << meanRes << endl;
} }
@ -409,7 +405,7 @@ bool Foam::functionObjects::stabilityBlendingFactor::init(bool first)
calcStats(nCellsScheme1, nCellsScheme2, nCellsBlended); calcStats(nCellsScheme1, nCellsScheme2, nCellsBlended);
Log << nl << type() << " execute :" << nl Log << nl << name() << " execute :" << nl
<< " scheme 1 cells : " << nCellsScheme1 << nl << " scheme 1 cells : " << nCellsScheme1 << nl
<< " scheme 2 cells : " << nCellsScheme2 << nl << " scheme 2 cells : " << nCellsScheme2 << nl
<< " blended cells : " << nCellsBlended << nl << " blended cells : " << nCellsBlended << nl
@ -447,7 +443,7 @@ Foam::functionObjects::stabilityBlendingFactor::stabilityBlendingFactor
( (
IOobject IOobject
( (
"blendedIndicator", "blendedIndicator" + fieldName_,
time_.timeName(), time_.timeName(),
mesh_, mesh_,
IOobject::NO_READ, IOobject::NO_READ,
@ -630,6 +626,7 @@ Foam::functionObjects::stabilityBlendingFactor::stabilityBlendingFactor
if (log) if (log)
{ {
indicator_.writeOpt() = IOobject::AUTO_WRITE; indicator_.writeOpt() = IOobject::AUTO_WRITE;
} }
if (writeToFile_) if (writeToFile_)
@ -735,22 +732,25 @@ bool Foam::functionObjects::stabilityBlendingFactor::read
bool Foam::functionObjects::stabilityBlendingFactor::write() bool Foam::functionObjects::stabilityBlendingFactor::write()
{ {
label nCellsScheme1 = 0;
label nCellsScheme2 = 0;
label nCellsBlended = 0;
calcStats(nCellsScheme1, nCellsScheme2, nCellsBlended);
if (writeToFile_) if (writeToFile_)
{ {
label nCellsScheme1 = 0;
label nCellsScheme2 = 0;
label nCellsBlended = 0;
calcStats(nCellsScheme1, nCellsScheme2, nCellsBlended);
writeTime(file()); writeTime(file());
DebugVar("here");
file() file()
<< tab << nCellsScheme1 << tab << nCellsScheme1
<< tab << nCellsScheme2 << tab << nCellsScheme2
<< tab << nCellsBlended << tab << nCellsBlended
<< endl; << endl;
DebugVar("here1");
} }
return true; return true;