ENH: function objects - use Info on construction/read, and Log for all other messages

This commit is contained in:
Andrew Heather
2016-11-03 12:11:20 +00:00
parent 40252e99aa
commit c4c57690c6
20 changed files with 75 additions and 110 deletions

View File

@ -114,6 +114,7 @@ Foam::functionObjects::blendingFactor::~blendingFactor()
bool Foam::functionObjects::blendingFactor::read(const dictionary& dict) bool Foam::functionObjects::blendingFactor::read(const dictionary& dict)
{ {
fieldExpression::read(dict); fieldExpression::read(dict);
writeFile::read(dict);
phiName_ = dict.lookupOrDefault<word>("phi", "phi"); phiName_ = dict.lookupOrDefault<word>("phi", "phi");
dict.readIfPresent("tolerance", tolerance_); dict.readIfPresent("tolerance", tolerance_);

View File

@ -936,37 +936,33 @@ bool Foam::functionObjects::externalCoupled::read(const dictionary& dict)
} }
// Print a bit Info<< type() << ": Communicating with regions:" << endl;
if (log) forAll(regionGroupNames_, rgi)
{ {
Info<< type() << ": Communicating with regions:" << endl; //const wordList& regionNames = regionGroupRegions_[rgi];
forAll(regionGroupNames_, rgi) const word& compName = regionGroupNames_[rgi];
Info<< "Region: " << compName << endl << incrIndent;
const labelList& groups = regionToGroups_[compName];
forAll(groups, i)
{ {
//const wordList& regionNames = regionGroupRegions_[rgi]; label groupi = groups[i];
const word& compName = regionGroupNames_[rgi]; const wordRe& groupName = groupNames_[groupi];
Info<< "Region: " << compName << endl << incrIndent; Info<< indent << "patchGroup: " << groupName << "\t"
const labelList& groups = regionToGroups_[compName]; << endl
forAll(groups, i) << incrIndent
{ << indent << "Reading fields: "
label groupi = groups[i]; << groupReadFields_[groupi]
const wordRe& groupName = groupNames_[groupi]; << endl
<< indent << "Writing fields: "
Info<< indent << "patchGroup: " << groupName << "\t" << groupWriteFields_[groupi]
<< endl << endl
<< incrIndent << decrIndent;
<< indent << "Reading fields: "
<< groupReadFields_[groupi]
<< endl
<< indent << "Writing fields: "
<< groupWriteFields_[groupi]
<< endl
<< decrIndent;
}
Info<< decrIndent;
} }
Info<< endl; Info<< decrIndent;
} }
Info<< endl;
// Note: we should not have to make directories since the geometry // Note: we should not have to make directories since the geometry

View File

@ -108,8 +108,7 @@ void Foam::functionObjects::fieldAverage::initialize()
void Foam::functionObjects::fieldAverage::restart() void Foam::functionObjects::fieldAverage::restart()
{ {
Log Log << " Restarting averaging at time " << obr_.time().timeName()
<< " Restarting averaging at time " << obr_.time().timeName()
<< nl << endl; << nl << endl;
totalIter_.clear(); totalIter_.clear();
@ -159,8 +158,7 @@ void Foam::functionObjects::fieldAverage::calcAverages()
restart(); restart();
} }
Log Log << type() << " " << name() << " write:" << nl
<< type() << " " << name() << " write:" << nl
<< " Calculating averages" << nl; << " Calculating averages" << nl;
addMeanSqrToPrime2Mean<scalar, scalar>(); addMeanSqrToPrime2Mean<scalar, scalar>();
@ -221,14 +219,14 @@ void Foam::functionObjects::fieldAverage::readAveragingProperties()
totalTime_.clear(); totalTime_.clear();
totalTime_.setSize(faItems_.size(), obr_.time().deltaTValue()); totalTime_.setSize(faItems_.size(), obr_.time().deltaTValue());
if ((restartOnRestart_ || restartOnOutput_) && log) if (restartOnRestart_ || restartOnOutput_)
{ {
Info<< " Starting averaging at time " << obr_.time().timeName() Info<< " Starting averaging at time " << obr_.time().timeName()
<< nl; << nl;
} }
else else
{ {
Log << " Restarting averaging for fields:" << nl; Info<< " Restarting averaging for fields:" << nl;
forAll(faItems_, fieldi) forAll(faItems_, fieldi)
@ -242,15 +240,13 @@ void Foam::functionObjects::fieldAverage::readAveragingProperties()
totalIter_[fieldi] = readLabel(fieldDict.lookup("totalIter")); totalIter_[fieldi] = readLabel(fieldDict.lookup("totalIter"));
totalTime_[fieldi] = readScalar(fieldDict.lookup("totalTime")); totalTime_[fieldi] = readScalar(fieldDict.lookup("totalTime"));
Log Info<< " " << fieldName
<< " " << fieldName
<< " iters = " << totalIter_[fieldi] << " iters = " << totalIter_[fieldi]
<< " time = " << totalTime_[fieldi] << nl; << " time = " << totalTime_[fieldi] << nl;
} }
else else
{ {
Log Info<< " " << fieldName
<< " " << fieldName
<< ": starting averaging at time " << ": starting averaging at time "
<< obr_.time().timeName() << endl; << obr_.time().timeName() << endl;
} }
@ -299,7 +295,7 @@ bool Foam::functionObjects::fieldAverage::read(const dictionary& dict)
initialised_ = false; initialised_ = false;
Log << type() << " " << name() << ":" << nl; Info<< type() << " " << name() << ":" << nl;
dict.readIfPresent("restartOnRestart", restartOnRestart_); dict.readIfPresent("restartOnRestart", restartOnRestart_);
dict.readIfPresent("restartOnOutput", restartOnOutput_); dict.readIfPresent("restartOnOutput", restartOnOutput_);
@ -309,8 +305,7 @@ bool Foam::functionObjects::fieldAverage::read(const dictionary& dict)
if (periodicRestart_) if (periodicRestart_)
{ {
dict.lookup("restartPeriod") >> restartPeriod_; dict.lookup("restartPeriod") >> restartPeriod_;
Log Info<< " Restart period " << restartPeriod_
<< " Restart period " << restartPeriod_
<< nl << endl; << nl << endl;
} }
@ -324,15 +319,14 @@ bool Foam::functionObjects::fieldAverage::read(const dictionary& dict)
} }
else else
{ {
Log Info<< " Restart scheduled at time " << restartTime_
<< " Restart scheduled at time " << restartTime_
<< nl << endl; << nl << endl;
} }
} }
readAveragingProperties(); readAveragingProperties();
Log << endl; Info<< endl;
return true; return true;
} }

View File

@ -60,7 +60,7 @@ fieldCoordinateSystemTransform
{ {
read(dict); read(dict);
Log << type() << " " << name << ":" << nl Info<< type() << " " << name << ":" << nl
<< " Applying transformation from global Cartesian to local " << " Applying transformation from global Cartesian to local "
<< coordSys_ << nl << endl; << coordSys_ << nl << endl;
} }

View File

@ -122,6 +122,7 @@ Foam::functionObjects::fieldMinMax::~fieldMinMax()
bool Foam::functionObjects::fieldMinMax::read(const dictionary& dict) bool Foam::functionObjects::fieldMinMax::read(const dictionary& dict)
{ {
fvMeshFunctionObject::read(dict); fvMeshFunctionObject::read(dict);
writeFile::read(dict);
location_ = dict.lookupOrDefault<Switch>("location", true); location_ = dict.lookupOrDefault<Switch>("location", true);

View File

@ -128,7 +128,6 @@ bool Foam::functionObjects::fieldValues::fieldValueDelta::read
) )
{ {
fvMeshFunctionObject::read(dict); fvMeshFunctionObject::read(dict);
writeFile::read(dict); writeFile::read(dict);
region1Ptr_.reset region1Ptr_.reset
@ -210,9 +209,9 @@ bool Foam::functionObjects::fieldValues::fieldValueDelta::write()
applyOperation<symmTensor>(type1, name1, name2, entry1, entry2, found); applyOperation<symmTensor>(type1, name1, name2, entry1, entry2, found);
applyOperation<tensor>(type1, name1, name2, entry1, entry2, found); applyOperation<tensor>(type1, name1, name2, entry1, entry2, found);
if (log && !found) if (!found)
{ {
Info<< "Operation between " Log << "Operation between "
<< name1 << " with result " << entry1 << " and " << name1 << " with result " << entry1 << " and "
<< name2 << " with result " << entry2 << " not applied" << name2 << " with result " << entry2 << " not applied"
<< endl; << endl;

View File

@ -488,7 +488,7 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::initialise
if (weightFieldName_ == "none") if (weightFieldName_ == "none")
{ {
dict.lookup("orientedWeightField") >> weightFieldName_; dict.lookup("orientedWeightField") >> weightFieldName_;
Log << " weight field = " << weightFieldName_ << nl; Info<< " weight field = " << weightFieldName_ << nl;
orientWeightField_ = true; orientWeightField_ = true;
} }
else else

View File

@ -21,28 +21,6 @@ License
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
flowType
Group
grpPostProcessingUtilities
Description
Calculates and writes the flowType of velocity field U.
The -noWrite option has no meaning.
The flow type parameter is obtained according to the following equation:
\verbatim
|D| - |Omega|
lambda = -------------
|D| + |Omega|
-1 = rotational flow
0 = simple shear flow
1 = planar extensional flow
\endverbatim
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "flowType.H" #include "flowType.H"

View File

@ -727,22 +727,18 @@ bool Foam::functionObjects::fluxSummary::read(const dictionary& dict)
} }
} }
// Provide some output Info<< type() << " " << name() << " output:" << nl;
if (log)
forAll(faceZoneName_, zonei)
{ {
Info<< type() << " " << name() << " output:" << nl; const word& zoneName = faceZoneName_[zonei];
scalar zoneArea = faceArea_[zonei];
forAll(faceZoneName_, zonei) Info<< " Zone: " << zoneName << ", area: " << zoneArea << nl;
{
const word& zoneName = faceZoneName_[zonei];
scalar zoneArea = faceArea_[zonei];
Info<< " Zone: " << zoneName << ", area: " << zoneArea << nl;
}
Info<< endl;
} }
Info<< endl;
return true; return true;
} }

View File

@ -93,6 +93,7 @@ Foam::functionObjects::histogram::~histogram()
bool Foam::functionObjects::histogram::read(const dictionary& dict) bool Foam::functionObjects::histogram::read(const dictionary& dict)
{ {
fvMeshFunctionObject::read(dict); fvMeshFunctionObject::read(dict);
writeFile::read(dict);
dict.lookup("field") >> fieldName_; dict.lookup("field") >> fieldName_;
dict.lookup("max") >> max_; dict.lookup("max") >> max_;

View File

@ -55,7 +55,7 @@ void Foam::functionObjects::mapFields::createInterpolation
const fvMesh& meshTarget = mesh_; const fvMesh& meshTarget = mesh_;
const word mapRegionName(dict.lookup("mapRegion")); const word mapRegionName(dict.lookup("mapRegion"));
Log << name() << ':' << nl Info<< name() << ':' << nl
<< " Reading mesh " << mapRegionName << endl; << " Reading mesh " << mapRegionName << endl;
mapRegionPtr_.reset mapRegionPtr_.reset
@ -97,12 +97,12 @@ void Foam::functionObjects::mapFields::createInterpolation
// Optionally override // Optionally override
if (dict.readIfPresent("patchMapMethod", patchMapMethodName)) if (dict.readIfPresent("patchMapMethod", patchMapMethodName))
{ {
Log << " Patch mapping method: " << patchMapMethodName << endl; Info<< " Patch mapping method: " << patchMapMethodName << endl;
} }
bool consistent = readBool(dict.lookup("consistent")); bool consistent = readBool(dict.lookup("consistent"));
Log << " Creating mesh to mesh interpolation" << endl; Info<< " Creating mesh to mesh interpolation" << endl;
if (consistent) if (consistent)
{ {

View File

@ -281,7 +281,7 @@ bool Foam::functionObjects::nearWallFields::read(const dictionary& dict)
reverseFieldMap_.insert(sampleFldName, fldName); reverseFieldMap_.insert(sampleFldName, fldName);
} }
Log << type() << " " << name() Info<< type() << " " << name()
<< ": Sampling " << fieldMap_.size() << " fields" << endl; << ": Sampling " << fieldMap_.size() << " fields" << endl;
// Do analysis // Do analysis

View File

@ -138,10 +138,10 @@ writeSpeciesRR()
prodFilePtr_() << "delta T : "<< mesh_.time().deltaT().value() << nl << nl; prodFilePtr_() << "delta T : "<< mesh_.time().deltaT().value() << nl << nl;
consIntFilePtr_() << "start time : " << startTime_ << tab consIntFilePtr_() << "start time : " << startTime_ << tab
<< "end time :" << endTime_ << nl; << "end time :" << endTime_ << nl;
prodIntFilePtr_() << "start time : " << startTime_ << tab prodIntFilePtr_() << "start time : " << startTime_ << tab
<< "end time :" << endTime_ << nl; << "end time :" << endTime_ << nl;
for (label reactioni = 0; reactioni < nReactions_; ++reactioni) for (label reactioni = 0; reactioni < nReactions_; ++reactioni)
{ {
@ -202,7 +202,7 @@ reactionsSensitivityAnalysis
if (mesh_.nCells() != 1) if (mesh_.nCells() != 1)
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Function object only applicable to single cell cases " << "Function object only applicable to single cell cases"
<< abort(FatalError); << abort(FatalError);
} }
@ -243,9 +243,9 @@ reactionsSensitivityAnalysis
} }
else else
{ {
FatalErrorInFunction FatalErrorInFunction
<< " Not chemistry model found. " << " No chemistry model found. "
<< " Object available are : " << mesh_.names() << " Objects available are : " << mesh_.names()
<< exit(FatalError); << exit(FatalError);
} }
} }

View File

@ -354,6 +354,7 @@ Foam::functionObjects::regionSizeDistribution::~regionSizeDistribution()
bool Foam::functionObjects::regionSizeDistribution::read(const dictionary& dict) bool Foam::functionObjects::regionSizeDistribution::read(const dictionary& dict)
{ {
fvMeshFunctionObject::read(dict); fvMeshFunctionObject::read(dict);
writeFile::read(dict);
dict.lookup("field") >> alphaName_; dict.lookup("field") >> alphaName_;
dict.lookup("patches") >> patchNames_; dict.lookup("patches") >> patchNames_;
@ -371,7 +372,7 @@ bool Foam::functionObjects::regionSizeDistribution::read(const dictionary& dict)
{ {
coordSysPtr_.reset(new coordinateSystem(obr_, dict)); coordSysPtr_.reset(new coordinateSystem(obr_, dict));
Log << "Transforming all vectorFields with coordinate system " Info<< "Transforming all vectorFields with coordinate system "
<< coordSysPtr_().name() << endl; << coordSysPtr_().name() << endl;
} }

View File

@ -162,7 +162,7 @@ bool Foam::functionObjects::streamLine::read(const dictionary& dict)
nSubCycle_ = max(nSubCycle_, 1); nSubCycle_ = max(nSubCycle_, 1);
Log << " automatic track length specified through" Info<< " automatic track length specified through"
<< " number of sub cycles : " << nSubCycle_ << nl << " number of sub cycles : " << nSubCycle_ << nl
<< endl; << endl;
} }

View File

@ -157,19 +157,19 @@ bool Foam::functionObjects::turbulenceFields::read(const dictionary& dict)
fieldSet_.insert(wordList(dict.lookup("fields"))); fieldSet_.insert(wordList(dict.lookup("fields")));
} }
Log << type() << " " << name() << ": "; Info<< type() << " " << name() << ": ";
if (fieldSet_.size()) if (fieldSet_.size())
{ {
Log << "storing fields:" << nl; Info<< "storing fields:" << nl;
forAllConstIter(wordHashSet, fieldSet_, iter) forAllConstIter(wordHashSet, fieldSet_, iter)
{ {
Log << " " << modelName << ':' << iter.key() << nl; Info<< " " << modelName << ':' << iter.key() << nl;
} }
Log << endl; Info<< endl;
} }
else else
{ {
Log << "no fields requested to be stored" << nl << endl; Info<< "no fields requested to be stored" << nl << endl;
} }
return true; return true;

View File

@ -143,7 +143,7 @@ bool Foam::functionObjects::wallShearStress::read(const dictionary& dict)
wordReList(dict.lookupOrDefault("patches", wordReList())) wordReList(dict.lookupOrDefault("patches", wordReList()))
); );
Log << type() << " " << name() << ":" << nl; Info<< type() << " " << name() << ":" << nl;
if (patchSet_.empty()) if (patchSet_.empty())
{ {
@ -155,7 +155,7 @@ bool Foam::functionObjects::wallShearStress::read(const dictionary& dict)
} }
} }
Log << " processing all wall patches" << nl << endl; Info<< " processing all wall patches" << nl << endl;
} }
else else
{ {
@ -177,7 +177,7 @@ bool Foam::functionObjects::wallShearStress::read(const dictionary& dict)
} }
} }
Log << endl; Info<< endl;
patchSet_ = filteredPatchSet; patchSet_ = filteredPatchSet;
} }

View File

@ -846,7 +846,7 @@ bool Foam::functionObjects::forces::read(const dictionary& dict)
initialised_ = false; initialised_ = false;
Info << type() << " " << name() << ":" << nl; Info<< type() << " " << name() << ":" << nl;
directForceDensity_ = dict.lookupOrDefault("directForceDensity", false); directForceDensity_ = dict.lookupOrDefault("directForceDensity", false);
@ -889,11 +889,11 @@ bool Foam::functionObjects::forces::read(const dictionary& dict)
dict.readIfPresent("porosity", porosity_); dict.readIfPresent("porosity", porosity_);
if (porosity_) if (porosity_)
{ {
Info << " Including porosity effects" << endl; Info<< " Including porosity effects" << endl;
} }
else else
{ {
Info << " Not including porosity effects" << endl; Info<< " Not including porosity effects" << endl;
} }
if (dict.found("binData")) if (dict.found("binData"))
@ -924,7 +924,7 @@ bool Foam::functionObjects::forces::read(const dictionary& dict)
if (writeFields_) if (writeFields_)
{ {
Info << " Fields will be written" << endl; Info<< " Fields will be written" << endl;
volVectorField* forcePtr volVectorField* forcePtr
( (

View File

@ -120,9 +120,7 @@ bool Foam::functionObjects::icoUncoupledKinematicCloud::read
const dictionary& dict const dictionary& dict
) )
{ {
fvMeshFunctionObject::read(dict); return fvMeshFunctionObject::read(dict);
return true;
} }

View File

@ -111,7 +111,7 @@ bool Foam::functionObjects::timeActivatedFileUpdate::read
lastIndex_ = -1; lastIndex_ = -1;
fileToUpdate_.expand(); fileToUpdate_.expand();
Log << type() << " " << name() << " output:" << nl Info<< type() << " " << name() << " output:" << nl
<< " time vs file list:" << endl; << " time vs file list:" << endl;
forAll(timeVsFile_, i) forAll(timeVsFile_, i)
@ -124,7 +124,7 @@ bool Foam::functionObjects::timeActivatedFileUpdate::read
<< nl << exit(FatalError); << nl << exit(FatalError);
} }
Log << " " << timeVsFile_[i].first() << tab Info<< " " << timeVsFile_[i].first() << tab
<< timeVsFile_[i].second() << endl; << timeVsFile_[i].second() << endl;
} }