ENH: function obejct updates

This commit is contained in:
andy
2013-10-04 16:44:58 +01:00
parent 184a4c7c67
commit 837ca32397
35 changed files with 261 additions and 195 deletions

View File

@ -121,7 +121,7 @@ void Foam::writeDictionary::read(const dictionary& dict)
digests_.setSize(dictNames_.size(), SHA1Digest());
Info<< type() << ": monitoring dictionaries:" << nl;
Info<< type() << " " << name_ << ": monitoring dictionaries:" << nl;
if (dictNames_.size())
{
forAll(dictNames_, i)
@ -151,7 +151,7 @@ void Foam::writeDictionary::execute()
{
if (firstDict)
{
Info<< type() << " output:" << nl << endl;
Info<< type() << " " << name_ << " output:" << nl << endl;
IOobject::writeDivider(Info);
Info<< endl;

View File

@ -89,6 +89,8 @@ void Foam::writeRegisteredObject::timeSet()
void Foam::writeRegisteredObject::write()
{
Info<< type() << " " << name_ << " output:" << nl;
forAll(objectNames_, i)
{
if (obr_.foundObject<regIOobject>(objectNames_[i]))
@ -105,6 +107,8 @@ void Foam::writeRegisteredObject::write()
obj.writeOpt() = IOobject::NO_WRITE;
}
Info<< " writing object " << obj.name() << nl << endl;
obj.write();
}
else

View File

@ -104,6 +104,7 @@ protected:
//- Takes over the writing from Db
bool exclusiveWriting_;
//- Refererence to Db
const objectRegistry& obr_;
// Read from dictionary

View File

@ -76,7 +76,7 @@ void Foam::cloudInfo::read(const dictionary& dict)
{
functionObjectFile::resetNames(dict.lookup("clouds"));
Info<< type() << ": ";
Info<< type() << " " << name_ << ": ";
if (names().size())
{
Info<< "applying to clouds:" << nl;

View File

@ -65,6 +65,8 @@ void Foam::fieldAverage::initialize()
{
resetFields();
Info<< type() << " " << name_ << ":" << nl;
// Add mean fields to the field lists
forAll(faItems_, fieldI)
@ -96,6 +98,8 @@ void Foam::fieldAverage::initialize()
// ensure first averaging works unconditionally
prevTimeIndex_ = -1;
Info<< endl;
initialised_ = true;
}
@ -107,6 +111,8 @@ void Foam::fieldAverage::calcAverages()
initialize();
}
Info<< type() << " " << name_ << " output:" << nl;
const label currentTimeIndex =
static_cast<const fvMesh&>(obr_).time().timeIndex();
@ -119,7 +125,7 @@ void Foam::fieldAverage::calcAverages()
prevTimeIndex_ = currentTimeIndex;
}
Info<< "Calculating averages" << nl << endl;
Info<< " Calculating averages" << nl;
addMeanSqrToPrime2Mean<scalar, scalar>();
addMeanSqrToPrime2Mean<vector, symmTensor>();
@ -143,6 +149,8 @@ void Foam::fieldAverage::calcAverages()
void Foam::fieldAverage::writeAverages() const
{
Info<< " Writing average fields" << endl;
writeFields<scalar>();
writeFields<vector>();
writeFields<sphericalTensor>();
@ -189,8 +197,8 @@ void Foam::fieldAverage::readAveragingProperties()
if (resetOnRestart_)
{
Info<< "fieldAverage: starting averaging at time "
<< obr_.time().timeName() << nl << endl;
Info<< " Starting averaging at time " << obr_.time().timeName()
<< nl;
}
else
{
@ -207,14 +215,14 @@ void Foam::fieldAverage::readAveragingProperties()
if (!propsDictHeader.headerOk())
{
Info<< "fieldAverage: starting averaging at time "
<< obr_.time().timeName() << nl << endl;
Info<< " Starting averaging at time " << obr_.time().timeName()
<< nl;
return;
}
IOdictionary propsDict(propsDictHeader);
Info<< "fieldAverage: restarting averaging for fields:" << endl;
Info<< " Restarting averaging for fields:" << nl;
forAll(faItems_, fieldI)
{
const word& fieldName = faItems_[fieldI].fieldName();
@ -226,11 +234,9 @@ void Foam::fieldAverage::readAveragingProperties()
totalTime_[fieldI] = readScalar(fieldDict.lookup("totalTime"));
Info<< " " << fieldName
<< " iters = " << totalIter_[fieldI]
<< " time = " << totalTime_[fieldI] << endl;
<< " time = " << totalTime_[fieldI] << nl;
}
}
Info<< endl;
}
}
@ -266,15 +272,15 @@ Foam::fieldAverage::fieldAverage
active_ = false;
WarningIn
(
"fieldAverage::fieldAverage\n"
"(\n"
"const word&,\n"
"const objectRegistry&,\n"
"const dictionary&,\n"
"const bool\n"
"fieldAverage::fieldAverage"
"("
"const word&, "
"const objectRegistry&, "
"const dictionary&, "
"const bool "
")"
) << "No fvMesh available, deactivating."
<< nl << endl;
) << "No fvMesh available, deactivating " << name_ << nl
<< endl;
}
}
@ -293,11 +299,15 @@ void Foam::fieldAverage::read(const dictionary& dict)
{
initialised_ = false;
Info<< type() << " " << name_ << ":" << nl;
dict.readIfPresent("resetOnRestart", resetOnRestart_);
dict.readIfPresent("resetOnOutput", resetOnOutput_);
dict.lookup("fields") >> faItems_;
readAveragingProperties();
Info<< endl;
}
}
@ -307,6 +317,8 @@ void Foam::fieldAverage::execute()
if (active_)
{
calcAverages();
Info<< endl;
}
}
@ -329,14 +341,16 @@ void Foam::fieldAverage::write()
if (resetOnOutput_)
{
Info<< "fieldAverage: restarting averaging at time "
<< obr_.time().timeName() << nl << endl;
Info<< " Restarting averaging at time " << obr_.time().timeName()
<< nl << endl;
initialize();
// ensure first averaging works unconditionally
prevTimeIndex_ = -1;
}
Info<< endl;
}
}

View File

@ -38,7 +38,7 @@ void Foam::fieldAverage::addMeanFieldType(const label fieldI)
const word& fieldName = faItems_[fieldI].fieldName();
const word& meanFieldName = faItems_[fieldI].meanFieldName();
Info<< "Reading/calculating field " << meanFieldName << nl << endl;
Info<< " Reading/initialising field " << meanFieldName << endl;
if (obr_.foundObject<Type>(meanFieldName))
{
@ -48,7 +48,7 @@ void Foam::fieldAverage::addMeanFieldType(const label fieldI)
{
Info<< " Cannot allocate average field " << meanFieldName
<< " since an object with that name already exists."
<< " Disabling averaging." << nl << endl;
<< " Disabling averaging for field." << endl;
faItems_[fieldI].mean() = false;
}
@ -105,7 +105,7 @@ void Foam::fieldAverage::addPrime2MeanFieldType(const label fieldI)
const word& meanFieldName = faItems_[fieldI].meanFieldName();
const word& prime2MeanFieldName = faItems_[fieldI].prime2MeanFieldName();
Info<< "Reading/calculating field " << prime2MeanFieldName << nl << endl;
Info<< " Reading/initialising field " << prime2MeanFieldName << nl;
if (obr_.foundObject<Type2>(prime2MeanFieldName))
{
@ -115,7 +115,7 @@ void Foam::fieldAverage::addPrime2MeanFieldType(const label fieldI)
{
Info<< " Cannot allocate average field " << prime2MeanFieldName
<< " since an object with that name already exists."
<< " Disabling averaging." << nl << endl;
<< " Disabling averaging for field." << nl;
faItems_[fieldI].prime2Mean() = false;
}

View File

@ -51,7 +51,15 @@ Foam::fieldCoordinateSystemTransform::fieldCoordinateSystemTransform
coordSys_(obr, dict)
{
// Check if the available mesh is an fvMesh otherise deactivate
if (!isA<fvMesh>(obr_))
if (isA<fvMesh>(obr_))
{
read(dict);
Info<< type() << " " << name_ << ":" << nl
<< " Applying transformation from global Cartesian to local "
<< coordSys_ << nl << endl;
}
else
{
active_ = false;
WarningIn
@ -63,15 +71,9 @@ Foam::fieldCoordinateSystemTransform::fieldCoordinateSystemTransform
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating."
) << "No fvMesh available, deactivating " << name_
<< endl;
}
read(dict);
Info<< type() << ":" << nl
<< " Applying transformation from global Cartesian to local "
<< coordSys_ << nl << endl;
}
@ -112,6 +114,8 @@ void Foam::fieldCoordinateSystemTransform::timeSet()
void Foam::fieldCoordinateSystemTransform::write()
{
Info<< type() << " " << name_ << " output:" << nl;
forAll(fieldSet_, fieldI)
{
// If necessary load field

View File

@ -39,25 +39,9 @@ void Foam::fieldCoordinateSystemTransform::transformField
{
const word& fieldName = field.name() + "Transformed";
dimensionedTensor R("R", field.dimensions(), coordSys_.R().R());
if (obr_.foundObject<Type>(fieldName))
if (!obr_.foundObject<Type>(fieldName))
{
Type& transField =
const_cast<Type&>(obr_.lookupObject<Type>(fieldName));
transField == field;
forAll(field, i)
{
Foam::transform(transField, R, transField);
}
transField.write();
}
else
{
Type& transField = obr_.store
obr_.store
(
new Type
(
@ -72,15 +56,24 @@ void Foam::fieldCoordinateSystemTransform::transformField
field
)
);
}
Type& transField =
const_cast<Type&>(obr_.lookupObject<Type>(fieldName));
transField == field;
dimensionedTensor R("R", field.dimensions(), coordSys_.R().R());
forAll(field, i)
{
Foam::transform(transField, R, transField);
}
Info<< " writing field " << transField.name() << nl << endl;
transField.write();
}
}
template<class Type>

View File

@ -65,7 +65,7 @@ Foam::fieldMinMax::fieldMinMax
name_(name),
obr_(obr),
active_(true),
log_(false),
log_(true),
mode_(mdMag),
fieldSet_()
{
@ -82,7 +82,7 @@ Foam::fieldMinMax::fieldMinMax
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating."
) << "No fvMesh available, deactivating " << name_
<< endl;
}
@ -102,7 +102,7 @@ void Foam::fieldMinMax::read(const dictionary& dict)
{
if (active_)
{
log_ = dict.lookupOrDefault<Switch>("log", false);
log_ = dict.lookupOrDefault<Switch>("log", true);
mode_ = modeTypeNames_[dict.lookupOrDefault<word>("mode", "magnitude")];
dict.lookup("fields") >> fieldSet_;
@ -158,7 +158,7 @@ void Foam::fieldMinMax::write()
if (log_)
{
Info<< type() << " output:" << nl;
Info<< type() << " " << name_ << " output:" << nl;
}
forAll(fieldSet_, fieldI)

View File

@ -45,7 +45,7 @@ void Foam::fieldValue::read(const dictionary& dict)
{
dict_ = dict;
log_ = dict.lookupOrDefault<Switch>("log", false);
log_ = dict.lookupOrDefault<Switch>("log", true);
dict.lookup("fields") >> fields_;
dict.lookup("valueOutput") >> valueOutput_;
}
@ -82,7 +82,7 @@ Foam::fieldValue::fieldValue
obr_(obr),
dict_(dict),
active_(true),
log_(false),
log_(true),
sourceName_(dict.lookupOrDefault<word>("sourceName", "sampledSurface")),
fields_(dict.lookup("fields")),
valueOutput_(dict.lookup("valueOutput")),
@ -104,8 +104,8 @@ Foam::fieldValue::fieldValue
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating."
<< nl << endl;
) << "No fvMesh available, deactivating " << name << nl
<< endl;
active_ = false;
}
}

View File

@ -68,7 +68,7 @@ Foam::fieldValues::fieldValueDelta::fieldValueDelta
name_(name),
obr_(obr),
loadFromFiles_(loadFromFiles),
log_(false),
log_(true),
operation_(opSubtract),
source1Ptr_(NULL),
source2Ptr_(NULL)
@ -119,7 +119,7 @@ Foam::fieldValues::fieldValueDelta::~fieldValueDelta()
void Foam::fieldValues::fieldValueDelta::read(const dictionary& dict)
{
log_ = dict.lookupOrDefault<Switch>("log", false);
log_ = dict.lookupOrDefault<Switch>("log", true);
source1Ptr_.reset
(
fieldValue::New

View File

@ -50,7 +50,11 @@ Foam::nearWallFields::nearWallFields
fieldSet_()
{
// Check if the available mesh is an fvMesh otherise deactivate
if (!isA<fvMesh>(obr_))
if (isA<fvMesh>(obr_))
{
read(dict);
}
else
{
active_ = false;
WarningIn
@ -62,11 +66,10 @@ Foam::nearWallFields::nearWallFields
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating."
) << "No fvMesh available, deactivating " << name_
<< endl;
}
read(dict);
}
@ -124,12 +127,16 @@ void Foam::nearWallFields::read(const dictionary& dict)
reverseFieldMap_.insert(sampleFldName, fldName);
}
Info<< "Creating " << fieldMap_.size() << " fields" << endl;
Info<< type() << " " << name_ << ": Creating " << fieldMap_.size()
<< " fields" << endl;
createFields(vsf_);
createFields(vvf_);
createFields(vSpheretf_);
createFields(vSymmtf_);
createFields(vtf_);
Info<< endl;
}
}
@ -165,6 +172,7 @@ void Foam::nearWallFields::end()
void Foam::nearWallFields::timeSet()
{
// Do nothing
}
@ -178,6 +186,8 @@ void Foam::nearWallFields::write()
// Do nothing
if (active_)
{
Info<< type() << " " << name_ << " output:" << nl;
Info<< " Writing sampled fields to " << obr_.time().timeName()
<< endl;
@ -208,6 +218,8 @@ void Foam::nearWallFields::write()
{
vtf_[i].write();
}
Info<< endl;
}
}

View File

@ -50,7 +50,11 @@ Foam::processorField::processorField
active_(true)
{
// Check if the available mesh is an fvMesh otherise deactivate
if (!isA<fvMesh>(obr_))
if (isA<fvMesh>(obr_))
{
read(dict);
}
else
{
active_ = false;
WarningIn
@ -62,11 +66,9 @@ Foam::processorField::processorField
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating."
) << "No fvMesh available, deactivating " << name_
<< endl;
}
read(dict);
}

View File

@ -50,7 +50,11 @@ Foam::readFields::readFields
fieldSet_()
{
// Check if the available mesh is an fvMesh otherise deactivate
if (!isA<fvMesh>(obr_))
if (isA<fvMesh>(obr_))
{
read(dict);
}
else
{
active_ = false;
WarningIn
@ -62,11 +66,9 @@ Foam::readFields::readFields
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating."
) << "No fvMesh available, deactivating " << name_
<< endl;
}
read(dict);
}

View File

@ -330,18 +330,25 @@ Foam::regionSizeDistribution::regionSizeDistribution
patchNames_(dict.lookup("patches"))
{
// Check if the available mesh is an fvMesh, otherwise deactivate
if (!isA<fvMesh>(obr_))
if (isA<fvMesh>(obr_))
{
read(dict);
}
else
{
active_ = false;
WarningIn
(
"regionSizeDistribution::regionSizeDistribution"
"(const objectRegistry&, const dictionary&)"
) << "No fvMesh available, deactivating." << nl
"("
"const word&, "
"const objectRegistry&, "
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating " << name_ << nl
<< endl;
}
read(dict);
}
@ -394,6 +401,8 @@ void Foam::regionSizeDistribution::write()
{
if (active_)
{
Info<< type() << " " << name_ << " output:" << nl;
const fvMesh& mesh = refCast<const fvMesh>(obr_);
autoPtr<volScalarField> alphaPtr;
@ -498,8 +507,8 @@ void Foam::regionSizeDistribution::write()
regionSplit regions(mesh, blockedFace);
Info<< "Determined " << regions.nRegions() << " disconnected regions"
<< endl;
Info<< " Determined " << regions.nRegions()
<< " disconnected regions" << endl;
if (debug)
@ -549,7 +558,7 @@ void Foam::regionSizeDistribution::write()
if (debug)
{
Info<< token::TAB << "Region"
Info<< " " << token::TAB << "Region"
<< token::TAB << "Volume(mesh)"
<< token::TAB << "Volume(" << alpha.name() << "):"
<< token::TAB << "nCells"
@ -569,7 +578,7 @@ void Foam::regionSizeDistribution::write()
++vIter, ++aIter, ++numIter
)
{
Info<< token::TAB << vIter.key()
Info<< " " << token::TAB << vIter.key()
<< token::TAB << vIter()
<< token::TAB << aIter()
<< token::TAB << numIter()
@ -579,7 +588,7 @@ void Foam::regionSizeDistribution::write()
alphaSumVol += aIter();
nCells += numIter();
}
Info<< token::TAB << "Total:"
Info<< " " << token::TAB << "Total:"
<< token::TAB << meshSumVol
<< token::TAB << alphaSumVol
<< token::TAB << nCells
@ -599,7 +608,7 @@ void Foam::regionSizeDistribution::write()
forAllConstIter(Map<label>, patchRegions, iter)
{
label regionI = iter.key();
Info<< token::TAB << iter.key()
Info<< " " << token::TAB << iter.key()
<< token::TAB << allRegionVolume[regionI]
<< token::TAB << allRegionAlphaVolume[regionI] << endl;
@ -609,7 +618,7 @@ void Foam::regionSizeDistribution::write()
{
Info<< " Background regions:" << endl;
Info<< token::TAB << "Region"
Info<< " " << token::TAB << "Region"
<< token::TAB << "Volume(mesh)"
<< token::TAB << "Volume(" << alpha.name() << "):"
<< endl;
@ -630,7 +639,7 @@ void Foam::regionSizeDistribution::write()
&& vIter() >= maxDropletVol
)
{
Info<< token::TAB << vIter.key()
Info<< " " << token::TAB << vIter.key()
<< token::TAB << vIter()
<< token::TAB << aIter() << endl;
}
@ -731,7 +740,7 @@ void Foam::regionSizeDistribution::write()
// Write to screen
{
Info<< " Bins:" << endl;
Info<< token::TAB << "Bin"
Info<< " " << token::TAB << "Bin"
<< token::TAB << "Min diameter"
<< token::TAB << "Count:"
<< endl;
@ -739,7 +748,7 @@ void Foam::regionSizeDistribution::write()
scalar diam = 0.0;
forAll(binCount, binI)
{
Info<< token::TAB << binI
Info<< " " << token::TAB << binI
<< token::TAB << diam
<< token::TAB << binCount[binI] << endl;
diam += delta;

View File

@ -128,7 +128,7 @@ void Foam::streamLine::track()
label nSeeds = returnReduce(particles.size(), sumOp<label>());
Info<< type() << " : seeded " << nSeeds << " particles." << endl;
Info << " seeded " << nSeeds << " particles." << endl;
// Read or lookup fields
PtrList<volScalarField> vsFlds;
@ -194,10 +194,10 @@ void Foam::streamLine::track()
}
else
{
FatalErrorIn("streamLine::execute()")
<< "Cannot find field " << fields_[i] << endl
FatalErrorIn("streamLine::track()")
<< "Cannot find field " << fields_[i] << nl
<< "Valid scalar fields are:"
<< mesh.names(volScalarField::typeName) << endl
<< mesh.names(volScalarField::typeName) << nl
<< "Valid vector fields are:"
<< mesh.names(volVectorField::typeName)
<< exit(FatalError);
@ -267,12 +267,10 @@ void Foam::streamLine::track()
if (UIndex == -1)
{
FatalErrorIn("streamLine::execute()")
<< "Cannot find field to move particles with : " << UName_
<< endl
<< "This field has to be present in the sampled fields "
<< fields_
<< " and in the objectRegistry." << endl
FatalErrorIn("streamLine::track()")
<< "Cannot find field to move particles with : " << UName_ << nl
<< "This field has to be present in the sampled fields " << fields_
<< " and in the objectRegistry."
<< exit(FatalError);
}
@ -374,6 +372,8 @@ void Foam::streamLine::read(const dictionary& dict)
{
if (active_)
{
Info<< type() << " " << name_ << ":" << nl;
//dict_ = dict;
dict.lookup("fields") >> fields_;
if (dict.found("UName"))
@ -433,14 +433,14 @@ void Foam::streamLine::read(const dictionary& dict)
{
nSubCycle_ = 1;
}
Info<< type() << " : automatic track length specified through"
Info<< " automatic track length specified through"
<< " number of sub cycles : " << nSubCycle_ << nl << endl;
}
else
{
dict.lookup("trackLength") >> trackLength_;
Info<< type() << " : fixed track length specified : "
Info<< " fixed track length specified : "
<< trackLength_ << nl << endl;
}
@ -451,7 +451,7 @@ void Foam::streamLine::read(const dictionary& dict)
interpolationCellPoint<scalar>::typeName
);
//Info<< typeName << " using interpolation " << interpolationScheme_
//Info<< " using interpolation " << interpolationScheme_
// << endl;
cloudName_ = dict.lookupOrDefault<word>("cloudName", "streamLine");
@ -525,6 +525,8 @@ void Foam::streamLine::write()
{
if (active_)
{
Info<< type() << " " << name_ << " output:" << nl;
const Time& runTime = obr_.time();
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
@ -623,8 +625,8 @@ void Foam::streamLine::write()
n += allTracks_[trackI].size();
}
Info<< "Tracks:" << allTracks_.size()
<< " total samples:" << n << endl;
Info<< " Tracks:" << allTracks_.size() << " total samples:" << n
<< endl;
// Massage into form suitable for writers

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -49,7 +49,11 @@ Foam::surfaceInterpolateFields::surfaceInterpolateFields
fieldSet_()
{
// Check if the available mesh is an fvMesh otherise deactivate
if (!isA<fvMesh>(obr_))
if (isA<fvMesh>(obr_))
{
read(dict);
}
else
{
active_ = false;
WarningIn
@ -61,11 +65,9 @@ Foam::surfaceInterpolateFields::surfaceInterpolateFields
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating."
) << "No fvMesh available, deactivating " << name_
<< endl;
}
read(dict);
}
@ -122,6 +124,8 @@ void Foam::surfaceInterpolateFields::write()
{
if (active_)
{
Info<< type() << " " << name_ << " output:" << nl;
Info<< " Writing interpolated surface fields to "
<< obr_.time().timeName() << endl;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -59,7 +59,7 @@ void Foam::surfaceInterpolateFields::interpolateFields
if (obr_.found(sName))
{
Info<< " a surfaceField " << sName << " already exists"
Info<< " surface field " << sName << " already exists"
<< endl;
}
else

View File

@ -101,7 +101,11 @@ Foam::turbulenceFields::turbulenceFields
fieldSet_()
{
// Check if the available mesh is an fvMesh otherise deactivate
if (!isA<fvMesh>(obr_))
if (isA<fvMesh>(obr_))
{
read(dict);
}
else
{
active_ = false;
WarningIn
@ -113,11 +117,9 @@ Foam::turbulenceFields::turbulenceFields
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating."
) << "No fvMesh available, deactivating " << name_
<< endl;
}
read(dict);
}
@ -135,7 +137,7 @@ void Foam::turbulenceFields::read(const dictionary& dict)
{
fieldSet_.insert(wordList(dict.lookup("fields")));
Info<< type() << ": ";
Info<< type() << " " << name_ << ": ";
if (fieldSet_.size())
{
Info<< "storing fields:" << nl;

View File

@ -457,13 +457,13 @@ Foam::wallBoundedStreamLine::wallBoundedStreamLine
WarningIn
(
"wallBoundedStreamLine::wallBoundedStreamLine\n"
"(\n"
"const word&,\n"
"const objectRegistry&,\n"
"const dictionary&,\n"
"const bool\n"
"("
"const word&, "
"const objectRegistry&, "
"const dictionary&, "
"const bool "
")"
) << "No fvMesh available, deactivating."
) << "No fvMesh available, deactivating " << name_
<< nl << endl;
}
}
@ -584,11 +584,11 @@ void Foam::wallBoundedStreamLine::read(const dictionary& dict)
{
label nFaces = returnReduce(faces.size(), sumOp<label>());
WarningIn("wallBoundedStreamLine::track()")
WarningIn("wallBoundedStreamLine::read(const dictionary&)")
<< "Found " << nFaces
<<" faces with low quality or negative volume "
<< "decomposition tets. Writing to faceSet " << faces.name()
<< endl; //exit(FatalError);
<< endl;
}
// 2. all edges on a cell having two faces
@ -625,7 +625,7 @@ void Foam::wallBoundedStreamLine::read(const dictionary& dict)
{
FatalErrorIn
(
"wallBoundedStreamLine::read(..)"
"wallBoundedStreamLine::read(const dictionary&)"
) << "problem cell:" << cellI
<< abort(FatalError);
}

View File

@ -52,6 +52,7 @@ void Foam::forceCoeffs::writeFileHeader(const label i)
<< "# magUInf : " << magUInf_ << nl
<< "# lRef : " << lRef_ << nl
<< "# Aref : " << Aref_ << nl
<< "# CofR : " << coordSys_.origin() << nl
<< "# Time" << tab << "Cm" << tab << "Cd" << tab << "Cl" << tab
<< "Cl(f)" << tab << "Cl(r)";
}
@ -68,7 +69,7 @@ void Foam::forceCoeffs::writeFileHeader(const label i)
for (label j = 0; j < nBin_; j++)
{
const word jn = Foam::name(j);
const word jn('[' + Foam::name(j) + ']');
file(i)
<< tab << "Cm" << jn << tab << "Cd" << jn << tab << "Cl" << jn;
@ -95,7 +96,7 @@ Foam::forceCoeffs::forceCoeffs
const bool loadFromFiles
)
:
forces(name, obr, dict, loadFromFiles),
forces(name, obr, dict, loadFromFiles, false),
liftDir_(vector::zero),
dragDir_(vector::zero),
pitchAxis_(vector::zero),
@ -104,6 +105,8 @@ Foam::forceCoeffs::forceCoeffs
Aref_(0.0)
{
read(dict);
Info<< endl;
}

View File

@ -74,6 +74,7 @@ void Foam::forces::writeFileHeader(const label i)
// force data
file(i)
<< "# CofR : " << coordSys_.origin() << nl
<< "# Time" << tab
<< "forces(pressure,viscous,porous) "
<< "moment(pressure,viscous,porous)";
@ -99,7 +100,7 @@ void Foam::forces::writeFileHeader(const label i)
for (label j = 0; j < nBin_; j++)
{
const word jn = Foam::name(j);
const word jn('[' + Foam::name(j) + ']');
file(i)
<< tab
@ -110,7 +111,7 @@ void Foam::forces::writeFileHeader(const label i)
{
for (label j = 0; j < nBin_; j++)
{
const word jn = Foam::name(j);
const word jn('[' + Foam::name(j) + ']');
file(i)
<< tab
@ -496,14 +497,15 @@ Foam::forces::forces
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
const bool loadFromFiles,
const bool readFields
)
:
functionObjectFile(obr, name, createFileNames(dict)),
name_(name),
obr_(obr),
active_(true),
log_(false),
log_(true),
force_(3),
moment_(3),
patchSet_(),
@ -526,7 +528,15 @@ Foam::forces::forces
initialised_(false)
{
// Check if the available mesh is an fvMesh otherise deactivate
if (!isA<fvMesh>(obr_))
if (isA<fvMesh>(obr_))
{
if (readFields)
{
read(dict);
Info<< endl;
}
}
else
{
active_ = false;
WarningIn
@ -538,11 +548,10 @@ Foam::forces::forces
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating."
) << "No fvMesh available, deactivating " << name_
<< endl;
}
read(dict);
}
@ -563,7 +572,7 @@ Foam::forces::forces
name_(name),
obr_(obr),
active_(true),
log_(false),
log_(true),
force_(3),
moment_(3),
patchSet_(patchSet),
@ -607,7 +616,13 @@ void Foam::forces::read(const dictionary& dict)
{
initialised_ = false;
log_ = dict.lookupOrDefault<Switch>("log", false);
log_ = dict.lookupOrDefault<Switch>("log", true);
if (log_)
{
Info<< type() << " " << name_ << ":" << nl;
}
directForceDensity_ = dict.lookupOrDefault("directForceDensity", false);
const fvMesh& mesh = refCast<const fvMesh>(obr_);
@ -644,7 +659,7 @@ void Foam::forces::read(const dictionary& dict)
localSystem_ = true;
}
if (dict.readIfPresent("porosity", porosity_))
if (dict.readIfPresent("porosity", porosity_) && log_)
{
if (porosity_)
{

View File

@ -278,7 +278,8 @@ public:
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
const bool loadFromFiles = false,
const bool readFields = true
);

View File

@ -181,6 +181,7 @@ void Foam::abortCalculation::end()
void Foam::abortCalculation::timeSet()
{
// Do nothing - only valid on execute
}

View File

@ -113,6 +113,7 @@ void Foam::systemCall::end()
void Foam::systemCall::timeSet()
{
// Do nothing
}

View File

@ -102,7 +102,7 @@ Foam::CourantNo::CourantNo
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating." << nl
) << "No fvMesh available, deactivating " << name_ << nl
<< endl;
}

View File

@ -77,7 +77,7 @@ Foam::DESModelRegions::DESModelRegions
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating." << nl
) << "No fvMesh available, deactivating " << name_ << nl
<< endl;
}
@ -204,7 +204,7 @@ void Foam::DESModelRegions::write()
gSum(DESModelRegions.internalField()*mesh.V())
/gSum(mesh.V())*100.0;
if (Pstream::master())
if (Pstream::master() && log_)
{
file() << obr_.time().timeName() << token::TAB
<< prc << token::TAB << 100.0 - prc << endl;

View File

@ -65,7 +65,7 @@ Foam::Lambda2::Lambda2
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating." << nl
) << "No fvMesh available, deactivating " << name_ << nl
<< endl;
}

View File

@ -68,7 +68,7 @@ Foam::Peclet::Peclet
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating." << nl
) << "No fvMesh available, deactivating " << name_ << nl
<< endl;
}

View File

@ -64,7 +64,7 @@ Foam::Q::Q
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating." << nl
) << "No fvMesh available, deactivating " << name_ << nl
<< endl;
}

View File

@ -67,7 +67,7 @@ Foam::dsmcFields::dsmcFields
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating." << nl
) << "No fvMesh available, deactivating " << name_ << nl
<< endl;
}

View File

@ -213,7 +213,7 @@ Foam::pressureTools::pressureTools
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating." << nl
) << "No fvMesh available, deactivating " << name_ << nl
<< endl;
}

View File

@ -101,7 +101,7 @@ Foam::wallShearStress::wallShearStress
name_(name),
obr_(obr),
active_(true),
log_(false),
log_(true),
patchSet_()
{
// Check if the available mesh is an fvMesh, otherwise deactivate
@ -117,7 +117,7 @@ Foam::wallShearStress::wallShearStress
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating." << nl
) << "No fvMesh available, deactivating " << name_ << nl
<< endl;
}
@ -166,7 +166,7 @@ void Foam::wallShearStress::read(const dictionary& dict)
{
if (active_)
{
log_ = dict.lookupOrDefault<Switch>("log", false);
log_ = dict.lookupOrDefault<Switch>("log", true);
const fvMesh& mesh = refCast<const fvMesh>(obr_);
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
@ -177,7 +177,7 @@ void Foam::wallShearStress::read(const dictionary& dict)
wordReList(dict.lookupOrDefault("patches", wordReList()))
);
Info<< type() << " output:" << nl;
Info<< type() << " " << name_ << ":" << nl;
if (patchSet_.empty())
{

View File

@ -195,7 +195,7 @@ Foam::yPlusLES::yPlusLES
name_(name),
obr_(obr),
active_(true),
log_(false),
log_(true),
phiName_("phi"),
UName_("U")
{
@ -212,7 +212,7 @@ Foam::yPlusLES::yPlusLES
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating." << nl
) << "No fvMesh available, deactivating " << name_ << nl
<< endl;
}
@ -254,7 +254,7 @@ void Foam::yPlusLES::read(const dictionary& dict)
{
if (active_)
{
log_ = dict.lookupOrDefault<Switch>("log", false);
log_ = dict.lookupOrDefault<Switch>("log", true);
phiName_ = dict.lookupOrDefault<word>("phiName", "phi");
}
}
@ -313,9 +313,7 @@ void Foam::yPlusLES::write()
if (log_)
{
Info<< type() << " " << name_ << " output:" << nl
<< " writing field " << yPlusLES.name() << nl
<< endl;
Info<< " writing field " << yPlusLES.name() << nl << endl;
}
yPlusLES.write();

View File

@ -183,7 +183,7 @@ Foam::yPlusRAS::yPlusRAS
name_(name),
obr_(obr),
active_(true),
log_(false),
log_(true),
phiName_("phi")
{
// Check if the available mesh is an fvMesh, otherwise deactivate
@ -199,7 +199,7 @@ Foam::yPlusRAS::yPlusRAS
"const dictionary&, "
"const bool"
")"
) << "No fvMesh available, deactivating." << nl
) << "No fvMesh available, deactivating " << name_ << nl
<< endl;
}
@ -241,7 +241,7 @@ void Foam::yPlusRAS::read(const dictionary& dict)
{
if (active_)
{
log_ = dict.lookupOrDefault<Switch>("log", false);
log_ = dict.lookupOrDefault<Switch>("log", true);
phiName_ = dict.lookupOrDefault<word>("phiName", "phi");
}
}
@ -298,9 +298,7 @@ void Foam::yPlusRAS::write()
if (log_)
{
Info<< type() << " " << name_ << " output:" << nl
<< " writing field " << yPlusRAS.name() << nl
<< endl;
Info<< " writing field " << yPlusRAS.name() << nl << endl;
}
yPlusRAS.write();