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()); digests_.setSize(dictNames_.size(), SHA1Digest());
Info<< type() << ": monitoring dictionaries:" << nl; Info<< type() << " " << name_ << ": monitoring dictionaries:" << nl;
if (dictNames_.size()) if (dictNames_.size())
{ {
forAll(dictNames_, i) forAll(dictNames_, i)
@ -151,7 +151,7 @@ void Foam::writeDictionary::execute()
{ {
if (firstDict) if (firstDict)
{ {
Info<< type() << " output:" << nl << endl; Info<< type() << " " << name_ << " output:" << nl << endl;
IOobject::writeDivider(Info); IOobject::writeDivider(Info);
Info<< endl; Info<< endl;

View File

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

View File

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

View File

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

View File

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

View File

@ -51,7 +51,15 @@ Foam::fieldCoordinateSystemTransform::fieldCoordinateSystemTransform
coordSys_(obr, dict) coordSys_(obr, dict)
{ {
// Check if the available mesh is an fvMesh otherise deactivate // 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; active_ = false;
WarningIn WarningIn
@ -63,15 +71,9 @@ Foam::fieldCoordinateSystemTransform::fieldCoordinateSystemTransform
"const dictionary&, " "const dictionary&, "
"const bool" "const bool"
")" ")"
) << "No fvMesh available, deactivating." ) << "No fvMesh available, deactivating " << name_
<< endl; << 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() void Foam::fieldCoordinateSystemTransform::write()
{ {
Info<< type() << " " << name_ << " output:" << nl;
forAll(fieldSet_, fieldI) forAll(fieldSet_, fieldI)
{ {
// If necessary load field // If necessary load field

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -278,7 +278,8 @@ public:
const word& name, const word& name,
const objectRegistry&, const objectRegistry&,
const dictionary&, 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() void Foam::abortCalculation::timeSet()
{ {
// Do nothing - only valid on execute
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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