mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: avoid raw dictionary lookup in functionObjects (issue #762)
Style changes:
- use lookupObjectRef instead of using const_cast
- use tmp::New factory
This commit is contained in:
@ -59,10 +59,8 @@ Foam::functionObjects::CourantNo::byRho
|
|||||||
{
|
{
|
||||||
return Co/obr_.lookupObject<volScalarField>(rhoName_);
|
return Co/obr_.lookupObject<volScalarField>(rhoName_);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return Co;
|
||||||
return Co;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -85,35 +83,27 @@ bool Foam::functionObjects::CourantNo::calc()
|
|||||||
|
|
||||||
if (foundObject<volScalarField>(resultName_, false))
|
if (foundObject<volScalarField>(resultName_, false))
|
||||||
{
|
{
|
||||||
volScalarField& Co
|
volScalarField& Co =
|
||||||
(
|
lookupObjectRef<volScalarField>(resultName_);
|
||||||
const_cast<volScalarField&>
|
|
||||||
(
|
|
||||||
lookupObject<volScalarField>(resultName_)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
Co.ref() = Coi();
|
Co.ref() = Coi();
|
||||||
Co.correctBoundaryConditions();
|
Co.correctBoundaryConditions();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tmp<volScalarField> tCo
|
auto tCo = tmp<volScalarField>::New
|
||||||
(
|
(
|
||||||
new volScalarField
|
IOobject
|
||||||
(
|
(
|
||||||
IOobject
|
resultName_,
|
||||||
(
|
mesh_.time().timeName(),
|
||||||
resultName_,
|
|
||||||
mesh_.time().timeName(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
mesh_,
|
mesh_,
|
||||||
dimensionedScalar(dimless, Zero),
|
IOobject::NO_READ,
|
||||||
zeroGradientFvPatchScalarField::typeName
|
IOobject::NO_WRITE
|
||||||
)
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedScalar(dimless, Zero),
|
||||||
|
zeroGradientFvPatchScalarField::typeName
|
||||||
);
|
);
|
||||||
tCo.ref().ref() = Coi();
|
tCo.ref().ref() = Coi();
|
||||||
tCo.ref().correctBoundaryConditions();
|
tCo.ref().correctBoundaryConditions();
|
||||||
@ -122,10 +112,8 @@ bool Foam::functionObjects::CourantNo::calc()
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -75,33 +75,28 @@ bool Foam::functionObjects::Curle::calc()
|
|||||||
|
|
||||||
const volVectorField& C = mesh_.C();
|
const volVectorField& C = mesh_.C();
|
||||||
|
|
||||||
tmp<volScalarField> tpDash
|
auto tpDash = tmp<volScalarField>::New
|
||||||
(
|
(
|
||||||
new volScalarField
|
IOobject
|
||||||
(
|
(
|
||||||
IOobject
|
resultName_,
|
||||||
(
|
mesh_.time().timeName(),
|
||||||
resultName_,
|
|
||||||
mesh_.time().timeName(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
mesh_,
|
mesh_,
|
||||||
dimensionedScalar(p.dimensions(), Zero)
|
IOobject::NO_READ,
|
||||||
)
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedScalar(p.dimensions(), Zero)
|
||||||
);
|
);
|
||||||
|
auto& pDash = tpDash.ref();
|
||||||
|
|
||||||
volScalarField& pDash = tpDash.ref();
|
|
||||||
const volVectorField d(scopedName("d"), C - x0_);
|
const volVectorField d(scopedName("d"), C - x0_);
|
||||||
pDash = (d/magSqr(d) & dfdt)/(4.0*mathematical::pi*c0_);
|
pDash = (d/magSqr(d) & dfdt)/(4.0*mathematical::pi*c0_);
|
||||||
|
|
||||||
return store(resultName_, tpDash);
|
return store(resultName_, tpDash);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
@ -136,8 +131,7 @@ bool Foam::functionObjects::Curle::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
if (fieldExpression::read(dict))
|
if (fieldExpression::read(dict))
|
||||||
{
|
{
|
||||||
patchSet_ =
|
patchSet_ = mesh_.boundaryMesh().patchSet(dict.get<wordRes>("patches"));
|
||||||
mesh_.boundaryMesh().patchSet(wordReList(dict.lookup("patches")));
|
|
||||||
|
|
||||||
if (patchSet_.empty())
|
if (patchSet_.empty())
|
||||||
{
|
{
|
||||||
@ -149,7 +143,7 @@ bool Foam::functionObjects::Curle::read(const dictionary& dict)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Read the reference speed of sound
|
// Read the reference speed of sound
|
||||||
dict.lookup("c0") >> c0_;
|
dict.readEntry("c0", c0_);
|
||||||
|
|
||||||
|
|
||||||
// Set the location of the effective point source to the area-average
|
// Set the location of the effective point source to the area-average
|
||||||
|
|||||||
@ -75,26 +75,21 @@ Foam::functionObjects::DESModelRegions::DESModelRegions
|
|||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
|
|
||||||
tmp<volScalarField> tDESModelRegions
|
auto tmodelRegions = tmp<volScalarField>::New
|
||||||
(
|
(
|
||||||
|
IOobject
|
||||||
(
|
(
|
||||||
new volScalarField
|
resultName_,
|
||||||
(
|
time_.timeName(),
|
||||||
IOobject
|
mesh_,
|
||||||
(
|
IOobject::NO_READ,
|
||||||
resultName_,
|
IOobject::NO_WRITE
|
||||||
time_.timeName(),
|
),
|
||||||
mesh_,
|
mesh_,
|
||||||
IOobject::NO_READ,
|
dimensionedScalar(dimless, Zero)
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
mesh_,
|
|
||||||
dimensionedScalar(dimless, Zero)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
store(resultName_, tDESModelRegions);
|
store(resultName_, tmodelRegions);
|
||||||
|
|
||||||
writeFileHeader(file());
|
writeFileHeader(file());
|
||||||
}
|
}
|
||||||
@ -124,10 +119,7 @@ bool Foam::functionObjects::DESModelRegions::execute()
|
|||||||
Log << type() << " " << name() << " execute:" << nl;
|
Log << type() << " " << name() << " execute:" << nl;
|
||||||
|
|
||||||
volScalarField& DESModelRegions =
|
volScalarField& DESModelRegions =
|
||||||
const_cast<volScalarField&>
|
lookupObjectRef<volScalarField>(resultName_);
|
||||||
(
|
|
||||||
lookupObject<volScalarField>(resultName_)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
if (foundObject<DESModelBase>(turbulenceModel::propertiesName))
|
if (foundObject<DESModelBase>(turbulenceModel::propertiesName))
|
||||||
|
|||||||
@ -57,10 +57,8 @@ Foam::tmp<Foam::surfaceScalarField> Foam::functionObjects::PecletNo::rhoScale
|
|||||||
{
|
{
|
||||||
return phi/fvc::interpolate(lookupObject<volScalarField>(rhoName_));
|
return phi/fvc::interpolate(lookupObject<volScalarField>(rhoName_));
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return phi;
|
||||||
return phi;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -84,23 +82,19 @@ bool Foam::functionObjects::PecletNo::calc()
|
|||||||
const dictionary& model =
|
const dictionary& model =
|
||||||
mesh_.lookupObject<dictionary>("transportProperties");
|
mesh_.lookupObject<dictionary>("transportProperties");
|
||||||
|
|
||||||
nuEff =
|
nuEff = tmp<volScalarField>::New
|
||||||
tmp<volScalarField>
|
(
|
||||||
|
IOobject
|
||||||
(
|
(
|
||||||
new volScalarField
|
"nuEff",
|
||||||
(
|
mesh_.time().timeName(),
|
||||||
IOobject
|
mesh_,
|
||||||
(
|
IOobject::NO_READ,
|
||||||
"nuEff",
|
IOobject::NO_WRITE
|
||||||
mesh_.time().timeName(),
|
),
|
||||||
mesh_,
|
mesh_,
|
||||||
IOobject::NO_READ,
|
dimensionedScalar(model.lookup("nu"))
|
||||||
IOobject::NO_WRITE
|
);
|
||||||
),
|
|
||||||
mesh_,
|
|
||||||
dimensionedScalar(model.lookup("nu"))
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -81,22 +81,19 @@ Foam::functionObjects::blendingFactor::blendingFactor
|
|||||||
writeFileHeader(file());
|
writeFileHeader(file());
|
||||||
setResultName(typeName, "");
|
setResultName(typeName, "");
|
||||||
|
|
||||||
tmp<volScalarField> indicatorPtr
|
auto indicatorPtr = tmp<volScalarField>::New
|
||||||
(
|
(
|
||||||
new volScalarField
|
IOobject
|
||||||
(
|
(
|
||||||
IOobject
|
resultName_,
|
||||||
(
|
time_.timeName(),
|
||||||
resultName_,
|
|
||||||
time_.timeName(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
mesh_,
|
mesh_,
|
||||||
dimensionedScalar(dimless, Zero),
|
IOobject::NO_READ,
|
||||||
zeroGradientFvPatchScalarField::typeName
|
IOobject::NO_WRITE
|
||||||
)
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedScalar(dimless, Zero),
|
||||||
|
zeroGradientFvPatchScalarField::typeName
|
||||||
);
|
);
|
||||||
|
|
||||||
store(resultName_, indicatorPtr);
|
store(resultName_, indicatorPtr);
|
||||||
|
|||||||
@ -72,10 +72,8 @@ void Foam::functionObjects::blendingFactor::calcBlendingFactor
|
|||||||
// - factor applied to 1st scheme, and (1-factor) to 2nd scheme
|
// - factor applied to 1st scheme, and (1-factor) to 2nd scheme
|
||||||
// - not using the store(...) mechanism due to need to correct BCs
|
// - not using the store(...) mechanism due to need to correct BCs
|
||||||
volScalarField& indicator =
|
volScalarField& indicator =
|
||||||
const_cast<volScalarField&>
|
lookupObjectRef<volScalarField>(resultName_);
|
||||||
(
|
|
||||||
lookupObject<volScalarField>(resultName_)
|
|
||||||
);
|
|
||||||
indicator = 1 - fvc::cellReduce(factorf, minEqOp<scalar>(), GREAT);
|
indicator = 1 - fvc::cellReduce(factorf, minEqOp<scalar>(), GREAT);
|
||||||
indicator.correctBoundaryConditions();
|
indicator.correctBoundaryConditions();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -134,7 +134,7 @@ bool Foam::functionObjects::ddt2::read(const dictionary& dict)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
dict.lookup("fields") >> selectFields_;
|
dict.readEntry("fields", selectFields_);
|
||||||
selectFields_.uniq();
|
selectFields_.uniq();
|
||||||
|
|
||||||
Info<< type() << " fields: " << selectFields_ << nl;
|
Info<< type() << " fields: " << selectFields_ << nl;
|
||||||
|
|||||||
@ -56,28 +56,24 @@ int Foam::functionObjects::ddt2::apply(const word& inputName, int& state)
|
|||||||
: magSqr(input.dimensions()/dimTime)
|
: magSqr(input.dimensions()/dimTime)
|
||||||
);
|
);
|
||||||
|
|
||||||
tmp<volScalarField> tddt2
|
auto tddt2 = tmp<volScalarField>::New
|
||||||
(
|
(
|
||||||
new volScalarField
|
IOobject
|
||||||
(
|
(
|
||||||
IOobject
|
outputName,
|
||||||
(
|
time_.timeName(),
|
||||||
outputName,
|
|
||||||
time_.timeName(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
mesh_,
|
mesh_,
|
||||||
dimensionedScalar(dims, Zero)
|
IOobject::NO_READ,
|
||||||
)
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedScalar(dims, Zero)
|
||||||
);
|
);
|
||||||
|
|
||||||
store(outputName, tddt2);
|
store(outputName, tddt2);
|
||||||
}
|
}
|
||||||
|
|
||||||
volScalarField& output =
|
volScalarField& output = lookupObjectRef<volScalarField>(outputName);
|
||||||
const_cast<volScalarField&>(lookupObject<volScalarField>(outputName));
|
|
||||||
|
|
||||||
if (mag_)
|
if (mag_)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -606,8 +606,8 @@ bool Foam::functionObjects::externalCoupled::read(const dictionary& dict)
|
|||||||
const dictionary& groupDict = regionIter().dict();
|
const dictionary& groupDict = regionIter().dict();
|
||||||
|
|
||||||
const label nGroups = groupNames_.size();
|
const label nGroups = groupNames_.size();
|
||||||
const wordList readFields(groupDict.lookup("readFields"));
|
const wordList readFields(groupDict.get<wordList>("readFields"));
|
||||||
const wordList writeFields(groupDict.lookup("writeFields"));
|
const wordList writeFields(groupDict.get<wordList>("writeFields"));
|
||||||
|
|
||||||
auto fnd = regionToGroups_.find(regionGroupNames_.last());
|
auto fnd = regionToGroups_.find(regionGroupNames_.last());
|
||||||
if (fnd.found())
|
if (fnd.found())
|
||||||
|
|||||||
@ -278,8 +278,8 @@ Foam::functionObjects::externalCoupled::gatherAndCombine
|
|||||||
Pstream::gatherList(gatheredValues);
|
Pstream::gatherList(gatheredValues);
|
||||||
|
|
||||||
|
|
||||||
tmp<Field<Type>> tresult(new Field<Type>(0));
|
auto tresult = tmp<Field<Type>>::New();
|
||||||
Field<Type>& result = tresult.ref();
|
auto& result = tresult.ref();
|
||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -584,8 +584,8 @@ bool Foam::functionObjects::extractEulerianParticles::read
|
|||||||
|
|
||||||
if (fvMeshFunctionObject::read(dict) && writeFile::read(dict))
|
if (fvMeshFunctionObject::read(dict) && writeFile::read(dict))
|
||||||
{
|
{
|
||||||
dict.lookup("faceZone") >> faceZoneName_;
|
dict.readEntry("faceZone", faceZoneName_);
|
||||||
dict.lookup("alpha") >> alphaName_;
|
dict.readEntry("alpha", alphaName_);
|
||||||
|
|
||||||
dict.readIfPresent("alphaThreshold", alphaThreshold_);
|
dict.readIfPresent("alphaThreshold", alphaThreshold_);
|
||||||
dict.readIfPresent("U", UName_);
|
dict.readIfPresent("U", UName_);
|
||||||
|
|||||||
@ -305,13 +305,13 @@ bool Foam::functionObjects::fieldAverage::read(const dictionary& dict)
|
|||||||
dict.readIfPresent("restartOnRestart", restartOnRestart_);
|
dict.readIfPresent("restartOnRestart", restartOnRestart_);
|
||||||
dict.readIfPresent("restartOnOutput", restartOnOutput_);
|
dict.readIfPresent("restartOnOutput", restartOnOutput_);
|
||||||
dict.readIfPresent("periodicRestart", periodicRestart_);
|
dict.readIfPresent("periodicRestart", periodicRestart_);
|
||||||
dict.lookup("fields") >> faItems_;
|
dict.readEntry("fields", faItems_);
|
||||||
|
|
||||||
const scalar currentTime = obr().time().value();
|
const scalar currentTime = obr().time().value();
|
||||||
|
|
||||||
if (periodicRestart_)
|
if (periodicRestart_)
|
||||||
{
|
{
|
||||||
scalar userRestartPeriod = readScalar(dict.lookup("restartPeriod"));
|
scalar userRestartPeriod = dict.get<scalar>("restartPeriod");
|
||||||
restartPeriod_ = obr().time().userTimeToTime(userRestartPeriod);
|
restartPeriod_ = obr().time().userTimeToTime(userRestartPeriod);
|
||||||
|
|
||||||
if (restartPeriod_ > 0)
|
if (restartPeriod_ > 0)
|
||||||
|
|||||||
@ -192,13 +192,13 @@ void Foam::functionObjects::fieldAverageItem::clear
|
|||||||
|
|
||||||
bool Foam::functionObjects::fieldAverageItem::readState(const dictionary& dict)
|
bool Foam::functionObjects::fieldAverageItem::readState(const dictionary& dict)
|
||||||
{
|
{
|
||||||
dict.lookup("totalIter") >> totalIter_;
|
dict.readEntry("totalIter", totalIter_);
|
||||||
dict.lookup("totalTime") >> totalTime_;
|
dict.readEntry("totalTime", totalTime_);
|
||||||
|
|
||||||
if (window_ > 0)
|
if (window_ > 0)
|
||||||
{
|
{
|
||||||
dict.lookup("windowTimes") >> windowTimes_;
|
dict.readEntry("windowTimes", windowTimes_);
|
||||||
dict.lookup("windowFieldNames") >> windowFieldNames_;
|
dict.readEntry("windowFieldNames", windowFieldNames_);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -66,8 +66,8 @@ Foam::Istream& Foam::functionObjects::operator>>
|
|||||||
|
|
||||||
faItem.active_ = false;
|
faItem.active_ = false;
|
||||||
faItem.fieldName_ = entry.keyword();
|
faItem.fieldName_ = entry.keyword();
|
||||||
faItem.mean_ = readBool(entry.lookup("mean"));
|
faItem.mean_ = entry.get<bool>("mean");
|
||||||
faItem.prime2Mean_ = readBool(entry.lookup("prime2Mean"));
|
faItem.prime2Mean_ = entry.get<bool>("prime2Mean");
|
||||||
faItem.base_ = faItem.baseTypeNames_.lookup("base", entry);
|
faItem.base_ = faItem.baseTypeNames_.lookup("base", entry);
|
||||||
faItem.window_ = entry.lookupOrDefault<scalar>("window", -1.0);
|
faItem.window_ = entry.lookupOrDefault<scalar>("window", -1.0);
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ Foam::Istream& Foam::functionObjects::operator>>
|
|||||||
|
|
||||||
if (faItem.windowType_ == fieldAverageItem::windowType::EXACT)
|
if (faItem.windowType_ == fieldAverageItem::windowType::EXACT)
|
||||||
{
|
{
|
||||||
faItem.allowRestart_ = readBool(entry.lookup("allowRestart"));
|
faItem.allowRestart_ = entry.get<bool>("allowRestart");
|
||||||
|
|
||||||
if (!faItem.allowRestart_)
|
if (!faItem.allowRestart_)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -97,12 +97,12 @@ bool Foam::functionObjects::fieldExpression::read(const dictionary& dict)
|
|||||||
|
|
||||||
if (fieldName_.empty() || dict.found("field"))
|
if (fieldName_.empty() || dict.found("field"))
|
||||||
{
|
{
|
||||||
dict.lookup("field") >> fieldName_;
|
dict.readEntry("field", fieldName_);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dict.found("result"))
|
if (dict.found("result"))
|
||||||
{
|
{
|
||||||
dict.lookup("result") >> resultName_;
|
dict.readEntry("result", resultName_);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -95,8 +95,8 @@ bool Foam::functionObjects::fieldValue::read(const dictionary& dict)
|
|||||||
fvMeshFunctionObject::read(dict);
|
fvMeshFunctionObject::read(dict);
|
||||||
writeFile::read(dict);
|
writeFile::read(dict);
|
||||||
|
|
||||||
dict.lookup("fields") >> fields_;
|
dict.readEntry("fields", fields_);
|
||||||
dict.lookup("writeFields") >> writeFields_;
|
dict.readEntry("writeFields", writeFields_);
|
||||||
scaleFactor_ = dict.lookupOrDefault<scalar>("scaleFactor", 1.0);
|
scaleFactor_ = dict.lookupOrDefault<scalar>("scaleFactor", 1.0);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -36,7 +36,7 @@ Foam::functionObjects::fieldValue::New
|
|||||||
const bool output
|
const bool output
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const word modelType(dict.lookup("type"));
|
const word modelType(dict.get<word>("type"));
|
||||||
|
|
||||||
if (output)
|
if (output)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -484,7 +484,7 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::initialise
|
|||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
dict.lookup("name") >> regionName_;
|
dict.readEntry("name", regionName_);
|
||||||
|
|
||||||
switch (regionType_)
|
switch (regionType_)
|
||||||
{
|
{
|
||||||
@ -616,7 +616,7 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::initialise
|
|||||||
surfaceWriterPtr_.clear();
|
surfaceWriterPtr_.clear();
|
||||||
if (writeFields_)
|
if (writeFields_)
|
||||||
{
|
{
|
||||||
const word surfaceFormat(dict.lookup("surfaceFormat"));
|
const word surfaceFormat(dict.get<word>("surfaceFormat"));
|
||||||
|
|
||||||
if (surfaceFormat != "none")
|
if (surfaceFormat != "none")
|
||||||
{
|
{
|
||||||
@ -687,12 +687,12 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::processValues
|
|||||||
{
|
{
|
||||||
case opSumDirection:
|
case opSumDirection:
|
||||||
{
|
{
|
||||||
const vector n(dict_.lookup("direction"));
|
const vector n(dict_.get<vector>("direction"));
|
||||||
return gSum(pos0(values*(Sf & n))*mag(values));
|
return gSum(pos0(values*(Sf & n))*mag(values));
|
||||||
}
|
}
|
||||||
case opSumDirectionBalance:
|
case opSumDirectionBalance:
|
||||||
{
|
{
|
||||||
const vector n(dict_.lookup("direction"));
|
const vector n(dict_.get<vector>("direction"));
|
||||||
const scalarField nv(values*(Sf & n));
|
const scalarField nv(values*(Sf & n));
|
||||||
|
|
||||||
return gSum(pos0(nv)*mag(values) - neg(nv)*mag(values));
|
return gSum(pos0(nv)*mag(values) - neg(nv)*mag(values));
|
||||||
@ -758,16 +758,14 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::processValues
|
|||||||
{
|
{
|
||||||
case opSumDirection:
|
case opSumDirection:
|
||||||
{
|
{
|
||||||
vector n(dict_.lookup("direction"));
|
const vector n(dict_.get<vector>("direction").normalise());
|
||||||
n /= mag(n) + ROOTVSMALL;
|
|
||||||
|
|
||||||
const scalarField nv(n & values);
|
const scalarField nv(n & values);
|
||||||
return gSum(pos0(nv)*n*(nv));
|
return gSum(pos0(nv)*n*(nv));
|
||||||
}
|
}
|
||||||
case opSumDirectionBalance:
|
case opSumDirectionBalance:
|
||||||
{
|
{
|
||||||
vector n(dict_.lookup("direction"));
|
const vector n(dict_.get<vector>("direction").normalise());
|
||||||
n /= mag(n) + ROOTVSMALL;
|
|
||||||
|
|
||||||
const scalarField nv(n & values);
|
const scalarField nv(n & values);
|
||||||
return gSum(pos0(nv)*n*(nv));
|
return gSum(pos0(nv)*n*(nv));
|
||||||
|
|||||||
@ -178,7 +178,6 @@ processSameTypeValues
|
|||||||
if (canWeight(weightField))
|
if (canWeight(weightField))
|
||||||
{
|
{
|
||||||
tmp<scalarField> weight(weightingFactor(weightField));
|
tmp<scalarField> weight(weightingFactor(weightField));
|
||||||
|
|
||||||
result = gSum(weight*values);
|
result = gSum(weight*values);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -466,8 +465,8 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::filterField
|
|||||||
const GeometricField<Type, fvPatchField, volMesh>& field
|
const GeometricField<Type, fvPatchField, volMesh>& field
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
tmp<Field<Type>> tvalues(new Field<Type>(faceId_.size()));
|
auto tvalues = tmp<Field<Type>>::New(faceId_.size());
|
||||||
Field<Type>& values = tvalues.ref();
|
auto& values = tvalues.ref();
|
||||||
|
|
||||||
forAll(values, i)
|
forAll(values, i)
|
||||||
{
|
{
|
||||||
@ -501,8 +500,8 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::filterField
|
|||||||
const GeometricField<Type, fvsPatchField, surfaceMesh>& field
|
const GeometricField<Type, fvsPatchField, surfaceMesh>& field
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
tmp<Field<Type>> tvalues(new Field<Type>(faceId_.size()));
|
auto tvalues = tmp<Field<Type>>::New(faceId_.size());
|
||||||
Field<Type>& values = tvalues.ref();
|
auto& values = tvalues.ref();
|
||||||
|
|
||||||
forAll(values, i)
|
forAll(values, i)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -111,12 +111,12 @@ bool Foam::functionObjects::fieldsExpression::read(const dictionary& dict)
|
|||||||
|
|
||||||
if (fieldNames_.empty() || dict.found("fields"))
|
if (fieldNames_.empty() || dict.found("fields"))
|
||||||
{
|
{
|
||||||
dict.lookup("fields") >> fieldNames_;
|
dict.readEntry("fields", fieldNames_);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dict.found("result"))
|
if (dict.found("result"))
|
||||||
{
|
{
|
||||||
dict.lookup("result") >> resultName_;
|
dict.readEntry("result", resultName_);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -448,8 +448,7 @@ void Foam::functionObjects::fluxSummary::initialiseCellZoneAndDirection
|
|||||||
|
|
||||||
if (((own != -1) && (nbr == -1)) || ((own == -1) && (nbr != -1)))
|
if (((own != -1) && (nbr == -1)) || ((own == -1) && (nbr != -1)))
|
||||||
{
|
{
|
||||||
vector n = mesh_.faces()[facei].normal(mesh_.points());
|
vector n = mesh_.faces()[facei].unitNormal(mesh_.points());
|
||||||
n /= mag(n) + ROOTVSMALL;
|
|
||||||
|
|
||||||
if ((n & refDir) > tolerance_)
|
if ((n & refDir) > tolerance_)
|
||||||
{
|
{
|
||||||
@ -481,8 +480,7 @@ void Foam::functionObjects::fluxSummary::initialiseCellZoneAndDirection
|
|||||||
|
|
||||||
if ((own != -1) && (nbr == -1))
|
if ((own != -1) && (nbr == -1))
|
||||||
{
|
{
|
||||||
vector n = mesh_.faces()[facei].normal(mesh_.points());
|
vector n = mesh_.faces()[facei].unitNormal(mesh_.points());
|
||||||
n /= mag(n) + ROOTVSMALL;
|
|
||||||
|
|
||||||
if ((n & refDir) > tolerance_)
|
if ((n & refDir) > tolerance_)
|
||||||
{
|
{
|
||||||
@ -835,7 +833,7 @@ bool Foam::functionObjects::fluxSummary::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
case mdFaceZone:
|
case mdFaceZone:
|
||||||
{
|
{
|
||||||
List<word> zones(dict.lookup("faceZones"));
|
wordList zones(dict.get<wordList>("faceZones"));
|
||||||
|
|
||||||
forAll(zones, i)
|
forAll(zones, i)
|
||||||
{
|
{
|
||||||
@ -853,8 +851,8 @@ bool Foam::functionObjects::fluxSummary::read(const dictionary& dict)
|
|||||||
}
|
}
|
||||||
case mdFaceZoneAndDirection:
|
case mdFaceZoneAndDirection:
|
||||||
{
|
{
|
||||||
List<Tuple2<word, vector>>
|
List<Tuple2<word, vector>> zoneAndDirection;
|
||||||
zoneAndDirection(dict.lookup("faceZoneAndDirection"));
|
dict.readEntry("faceZoneAndDirection", zoneAndDirection);
|
||||||
|
|
||||||
forAll(zoneAndDirection, i)
|
forAll(zoneAndDirection, i)
|
||||||
{
|
{
|
||||||
@ -873,8 +871,8 @@ bool Foam::functionObjects::fluxSummary::read(const dictionary& dict)
|
|||||||
}
|
}
|
||||||
case mdCellZoneAndDirection:
|
case mdCellZoneAndDirection:
|
||||||
{
|
{
|
||||||
List<Tuple2<word, vector>>
|
List<Tuple2<word, vector>> zoneAndDirection;
|
||||||
zoneAndDirection(dict.lookup("cellZoneAndDirection"));
|
dict.readEntry("cellZoneAndDirection", zoneAndDirection);
|
||||||
|
|
||||||
forAll(zoneAndDirection, i)
|
forAll(zoneAndDirection, i)
|
||||||
{
|
{
|
||||||
@ -893,7 +891,7 @@ bool Foam::functionObjects::fluxSummary::read(const dictionary& dict)
|
|||||||
}
|
}
|
||||||
case mdSurface:
|
case mdSurface:
|
||||||
{
|
{
|
||||||
List<word> surfs(dict.lookup("surfaces"));
|
wordList surfs(dict.get<wordList>("surfaces"));
|
||||||
|
|
||||||
forAll(surfs, i)
|
forAll(surfs, i)
|
||||||
{
|
{
|
||||||
@ -909,8 +907,8 @@ bool Foam::functionObjects::fluxSummary::read(const dictionary& dict)
|
|||||||
}
|
}
|
||||||
case mdSurfaceAndDirection:
|
case mdSurfaceAndDirection:
|
||||||
{
|
{
|
||||||
List<Tuple2<word, vector>>
|
List<Tuple2<word, vector>> surfAndDirection;
|
||||||
surfAndDirection(dict.lookup("surfaceAndDirection"));
|
dict.readEntry("surfaceAndDirection", surfAndDirection);
|
||||||
|
|
||||||
forAll(surfAndDirection, i)
|
forAll(surfAndDirection, i)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -164,12 +164,8 @@ Foam::heatTransferCoeffModels::ReynoldsAnalogy::Cf() const
|
|||||||
const volVectorField& U = mesh_.lookupObject<volVectorField>(UName_);
|
const volVectorField& U = mesh_.lookupObject<volVectorField>(UName_);
|
||||||
const volVectorField::Boundary& Ubf = U.boundaryField();
|
const volVectorField::Boundary& Ubf = U.boundaryField();
|
||||||
|
|
||||||
tmp<FieldField<Field, scalar>> tCf
|
auto tCf = tmp<FieldField<Field, scalar>>::New(Ubf.size());
|
||||||
(
|
auto& Cf = tCf.ref();
|
||||||
new FieldField<Field, scalar>(Ubf.size())
|
|
||||||
);
|
|
||||||
|
|
||||||
FieldField<Field, scalar>& Cf = tCf.ref();
|
|
||||||
|
|
||||||
forAll(Cf, patchi)
|
forAll(Cf, patchi)
|
||||||
{
|
{
|
||||||
@ -179,7 +175,7 @@ Foam::heatTransferCoeffModels::ReynoldsAnalogy::Cf() const
|
|||||||
const volSymmTensorField R(devReff());
|
const volSymmTensorField R(devReff());
|
||||||
const volSymmTensorField::Boundary& Rbf = R.boundaryField();
|
const volSymmTensorField::Boundary& Rbf = R.boundaryField();
|
||||||
|
|
||||||
for (label patchi : patchSet_)
|
for (const label patchi : patchSet_)
|
||||||
{
|
{
|
||||||
const fvPatchVectorField& Up = Ubf[patchi];
|
const fvPatchVectorField& Up = Ubf[patchi];
|
||||||
|
|
||||||
@ -226,18 +222,18 @@ bool Foam::heatTransferCoeffModels::ReynoldsAnalogy::read
|
|||||||
{
|
{
|
||||||
if (heatTransferCoeffModel::read(dict))
|
if (heatTransferCoeffModel::read(dict))
|
||||||
{
|
{
|
||||||
dict.lookup("UInf") >> URef_;
|
dict.readEntry("UInf", URef_);
|
||||||
|
|
||||||
dict.readIfPresent("Cp", CpName_);
|
dict.readIfPresent("Cp", CpName_);
|
||||||
if (CpName_ == "CpInf")
|
if (CpName_ == "CpInf")
|
||||||
{
|
{
|
||||||
dict.lookup("CpInf") >> CpRef_;
|
dict.readEntry("CpInf", CpRef_);
|
||||||
}
|
}
|
||||||
|
|
||||||
dict.readIfPresent("rho", rhoName_);
|
dict.readIfPresent("rho", rhoName_);
|
||||||
if (rhoName_ == "rhoInf")
|
if (rhoName_ == "rhoInf")
|
||||||
{
|
{
|
||||||
dict.lookup("rhoInf") >> rhoRef_;
|
dict.readEntry("rhoInf", rhoRef_);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -253,9 +249,9 @@ void Foam::heatTransferCoeffModels::ReynoldsAnalogy::htc(volScalarField& htc)
|
|||||||
const scalar magU = mag(URef_);
|
const scalar magU = mag(URef_);
|
||||||
|
|
||||||
volScalarField::Boundary& htcBf = htc.boundaryFieldRef();
|
volScalarField::Boundary& htcBf = htc.boundaryFieldRef();
|
||||||
forAllConstIters(patchSet_, iter)
|
|
||||||
|
for (const label patchi : patchSet_)
|
||||||
{
|
{
|
||||||
label patchi = iter.key();
|
|
||||||
const scalarField rhop(rho(patchi));
|
const scalarField rhop(rho(patchi));
|
||||||
const scalarField Cpp(Cp(patchi));
|
const scalarField Cpp(Cp(patchi));
|
||||||
|
|
||||||
|
|||||||
@ -68,7 +68,7 @@ bool Foam::heatTransferCoeffModels::fixedReferenceTemperature::read
|
|||||||
{
|
{
|
||||||
if (heatTransferCoeffModel::read(dict))
|
if (heatTransferCoeffModel::read(dict))
|
||||||
{
|
{
|
||||||
dict.lookup("TRef") >> TRef_;
|
dict.readEntry("TRef", TRef_);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,16 +46,12 @@ Foam::heatTransferCoeffModel::q() const
|
|||||||
const volScalarField& T = mesh_.lookupObject<volScalarField>(TName_);
|
const volScalarField& T = mesh_.lookupObject<volScalarField>(TName_);
|
||||||
const volScalarField::Boundary& Tbf = T.boundaryField();
|
const volScalarField::Boundary& Tbf = T.boundaryField();
|
||||||
|
|
||||||
tmp<FieldField<Field, scalar>> tq
|
auto tq = tmp<FieldField<Field, scalar>>::New(Tbf.size());
|
||||||
(
|
auto& q = tq.ref();
|
||||||
new FieldField<Field, scalar>(Tbf.size())
|
|
||||||
);
|
|
||||||
|
|
||||||
FieldField<Field, scalar>& q = tq.ref();
|
|
||||||
|
|
||||||
forAll(q, patchi)
|
forAll(q, patchi)
|
||||||
{
|
{
|
||||||
q.set(patchi, new Field<scalar>(Tbf[patchi].size(), 0));
|
q.set(patchi, new Field<scalar>(Tbf[patchi].size(), Zero));
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef compressible::turbulenceModel cmpTurbModel;
|
typedef compressible::turbulenceModel cmpTurbModel;
|
||||||
@ -71,7 +67,7 @@ Foam::heatTransferCoeffModel::q() const
|
|||||||
const volScalarField alphaEff(turb.alphaEff());
|
const volScalarField alphaEff(turb.alphaEff());
|
||||||
const volScalarField::Boundary& alphaEffbf = alphaEff.boundaryField();
|
const volScalarField::Boundary& alphaEffbf = alphaEff.boundaryField();
|
||||||
|
|
||||||
for (label patchi : patchSet_)
|
for (const label patchi : patchSet_)
|
||||||
{
|
{
|
||||||
q[patchi] = alphaEffbf[patchi]*hebf[patchi].snGrad();
|
q[patchi] = alphaEffbf[patchi]*hebf[patchi].snGrad();
|
||||||
}
|
}
|
||||||
@ -105,7 +101,7 @@ Foam::heatTransferCoeffModel::q() const
|
|||||||
const volScalarField& qr = mesh_.lookupObject<volScalarField>(qrName_);
|
const volScalarField& qr = mesh_.lookupObject<volScalarField>(qrName_);
|
||||||
const volScalarField::Boundary& qrbf = qr.boundaryField();
|
const volScalarField::Boundary& qrbf = qr.boundaryField();
|
||||||
|
|
||||||
for (label patchi : patchSet_)
|
for (const label patchi : patchSet_)
|
||||||
{
|
{
|
||||||
q[patchi] += qrbf[patchi];
|
q[patchi] += qrbf[patchi];
|
||||||
}
|
}
|
||||||
@ -135,8 +131,7 @@ Foam::heatTransferCoeffModel::heatTransferCoeffModel
|
|||||||
|
|
||||||
bool Foam::heatTransferCoeffModel::read(const dictionary& dict)
|
bool Foam::heatTransferCoeffModel::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
patchSet_ =
|
patchSet_ = mesh_.boundaryMesh().patchSet(dict.get<wordRes>("patches"));
|
||||||
mesh_.boundaryMesh().patchSet(wordReList(dict.lookup("patches")));
|
|
||||||
|
|
||||||
dict.readIfPresent("qr", qrName_);
|
dict.readIfPresent("qr", qrName_);
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,7 @@ Foam::autoPtr<Foam::heatTransferCoeffModel> Foam::heatTransferCoeffModel::New
|
|||||||
const word& TName
|
const word& TName
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const word modelType(dict.lookup("htcModel"));
|
const word modelType(dict.get<word>("htcModel"));
|
||||||
|
|
||||||
Info<< "Selecting heat transfer coefficient model " << modelType << endl;
|
Info<< "Selecting heat transfer coefficient model " << modelType << endl;
|
||||||
|
|
||||||
|
|||||||
@ -105,13 +105,13 @@ bool Foam::functionObjects::histogram::read(const dictionary& dict)
|
|||||||
fvMeshFunctionObject::read(dict);
|
fvMeshFunctionObject::read(dict);
|
||||||
writeFile::read(dict);
|
writeFile::read(dict);
|
||||||
|
|
||||||
dict.lookup("field") >> fieldName_;
|
dict.readEntry("field", fieldName_);
|
||||||
|
|
||||||
max_ = dict.lookupOrDefault<scalar>("max", -GREAT);
|
max_ = dict.lookupOrDefault<scalar>("max", -GREAT);
|
||||||
min_ = dict.lookupOrDefault<scalar>("min", GREAT);
|
min_ = dict.lookupOrDefault<scalar>("min", GREAT);
|
||||||
dict.lookup("nBins") >> nBins_;
|
dict.readEntry("nBins", nBins_);
|
||||||
|
|
||||||
word format(dict.lookup("setFormat"));
|
const word format(dict.get<word>("setFormat"));
|
||||||
formatterPtr_ = writer<scalar>::New(format);
|
formatterPtr_ = writer<scalar>::New(format);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -53,7 +53,7 @@ void Foam::functionObjects::mapFields::createInterpolation
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
const fvMesh& meshTarget = mesh_;
|
const fvMesh& meshTarget = mesh_;
|
||||||
const word mapRegionName(dict.lookup("mapRegion"));
|
const word mapRegionName(dict.get<word>("mapRegion"));
|
||||||
|
|
||||||
Info<< name() << ':' << nl
|
Info<< name() << ':' << nl
|
||||||
<< " Reading mesh " << mapRegionName << endl;
|
<< " Reading mesh " << mapRegionName << endl;
|
||||||
@ -71,7 +71,7 @@ void Foam::functionObjects::mapFields::createInterpolation
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
const fvMesh& mapRegion = mapRegionPtr_();
|
const fvMesh& mapRegion = mapRegionPtr_();
|
||||||
const word mapMethodName(dict.lookup("mapMethod"));
|
const word mapMethodName(dict.get<word>("mapMethod"));
|
||||||
if (!meshToMesh::interpolationMethodNames_.found(mapMethodName))
|
if (!meshToMesh::interpolationMethodNames_.found(mapMethodName))
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
@ -100,11 +100,9 @@ void Foam::functionObjects::mapFields::createInterpolation
|
|||||||
Info<< " Patch mapping method: " << patchMapMethodName << endl;
|
Info<< " Patch mapping method: " << patchMapMethodName << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool consistent = readBool(dict.lookup("consistent"));
|
|
||||||
|
|
||||||
Info<< " Creating mesh to mesh interpolation" << endl;
|
Info<< " Creating mesh to mesh interpolation" << endl;
|
||||||
|
|
||||||
if (consistent)
|
if (dict.get<bool>("consistent"))
|
||||||
{
|
{
|
||||||
interpPtr_.reset
|
interpPtr_.reset
|
||||||
(
|
(
|
||||||
@ -119,8 +117,11 @@ void Foam::functionObjects::mapFields::createInterpolation
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HashTable<word> patchMap(dict.lookup("patchMap"));
|
HashTable<word> patchMap;
|
||||||
wordList cuttingPatches(dict.lookup("cuttingPatches"));
|
wordList cuttingPatches;
|
||||||
|
|
||||||
|
dict.readEntry("patchMap", patchMap);
|
||||||
|
dict.readEntry("cuttingPatches", cuttingPatches);
|
||||||
|
|
||||||
interpPtr_.reset
|
interpPtr_.reset
|
||||||
(
|
(
|
||||||
@ -162,7 +163,7 @@ bool Foam::functionObjects::mapFields::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
fvMeshFunctionObject::read(dict);
|
fvMeshFunctionObject::read(dict);
|
||||||
|
|
||||||
dict.lookup("fields") >> fieldNames_;
|
dict.readEntry("fields", fieldNames_);
|
||||||
createInterpolation(dict);
|
createInterpolation(dict);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -260,10 +260,9 @@ bool Foam::functionObjects::nearWallFields::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
fvMeshFunctionObject::read(dict);
|
fvMeshFunctionObject::read(dict);
|
||||||
|
|
||||||
dict.lookup("fields") >> fieldSet_;
|
dict.readEntry("fields", fieldSet_);
|
||||||
patchSet_ =
|
patchSet_ = mesh_.boundaryMesh().patchSet(dict.get<wordRes>("patches"));
|
||||||
mesh_.boundaryMesh().patchSet(wordReList(dict.lookup("patches")));
|
distance_ = dict.get<scalar>("distance");
|
||||||
distance_ = readScalar(dict.lookup("distance"));
|
|
||||||
|
|
||||||
|
|
||||||
// Clear out any previously loaded fields
|
// Clear out any previously loaded fields
|
||||||
|
|||||||
@ -37,9 +37,9 @@ void Foam::functionObjects::nearWallFields::createFields
|
|||||||
|
|
||||||
HashTable<const VolFieldType*> flds(obr_.lookupClass<VolFieldType>());
|
HashTable<const VolFieldType*> flds(obr_.lookupClass<VolFieldType>());
|
||||||
|
|
||||||
forAllConstIter(typename HashTable<const VolFieldType*>, flds, iter)
|
forAllConstIters(flds, iter)
|
||||||
{
|
{
|
||||||
const VolFieldType& fld = *iter();
|
const VolFieldType& fld = *(iter.object());
|
||||||
|
|
||||||
if (fieldMap_.found(fld.name()))
|
if (fieldMap_.found(fld.name()))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -80,10 +80,10 @@ bool Foam::functionObjects::particleDistribution::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
if (fvMeshFunctionObject::read(dict) && writeFile::read(dict))
|
if (fvMeshFunctionObject::read(dict) && writeFile::read(dict))
|
||||||
{
|
{
|
||||||
dict.lookup("cloud") >> cloudName_;
|
dict.readEntry("cloud", cloudName_);
|
||||||
dict.lookup("nameVsBinWidth") >> nameVsBinWidth_;
|
dict.readEntry("nameVsBinWidth", nameVsBinWidth_);
|
||||||
dict.readIfPresent("tagField", tagFieldName_);
|
dict.readIfPresent("tagField", tagFieldName_);
|
||||||
word format(dict.lookup("setFormat"));
|
const word format(dict.get<word>("setFormat"));
|
||||||
writerPtr_ = writer<scalar>::New(format);
|
writerPtr_ = writer<scalar>::New(format);
|
||||||
|
|
||||||
Info<< type() << " " << name() << " output:" << nl
|
Info<< type() << " " << name() << " output:" << nl
|
||||||
|
|||||||
@ -70,22 +70,19 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::pressure::rhoScale
|
|||||||
{
|
{
|
||||||
if (p.dimensions() == dimPressure)
|
if (p.dimensions() == dimPressure)
|
||||||
{
|
{
|
||||||
return tmp<volScalarField>
|
return tmp<volScalarField>::New
|
||||||
(
|
(
|
||||||
new volScalarField
|
IOobject
|
||||||
(
|
(
|
||||||
IOobject
|
"rhoScale",
|
||||||
(
|
p.mesh().time().timeName(),
|
||||||
"rhoScale",
|
p.mesh(),
|
||||||
p.mesh().time().timeName(),
|
IOobject::NO_READ,
|
||||||
p.mesh(),
|
IOobject::NO_WRITE,
|
||||||
IOobject::NO_READ,
|
false
|
||||||
IOobject::NO_WRITE,
|
),
|
||||||
false
|
p,
|
||||||
),
|
fvPatchField<scalar>::calculatedType()
|
||||||
p,
|
|
||||||
fvPatchField<scalar>::calculatedType()
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -115,10 +112,8 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::pressure::rhoScale
|
|||||||
{
|
{
|
||||||
return lookupObject<volScalarField>(rhoName_)*tsf;
|
return lookupObject<volScalarField>(rhoName_)*tsf;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return dimensionedScalar("rhoInf", dimDensity, rhoInf_)*tsf;
|
||||||
return dimensionedScalar("rhoInf", dimDensity, rhoInf_)*tsf;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -192,28 +187,23 @@ bool Foam::functionObjects::pressure::calc()
|
|||||||
{
|
{
|
||||||
const volScalarField& p = lookupObject<volScalarField>(fieldName_);
|
const volScalarField& p = lookupObject<volScalarField>(fieldName_);
|
||||||
|
|
||||||
tmp<volScalarField> tp
|
auto tp = tmp<volScalarField>::New
|
||||||
(
|
(
|
||||||
new volScalarField
|
IOobject
|
||||||
(
|
(
|
||||||
IOobject
|
resultName_,
|
||||||
(
|
p.mesh().time().timeName(),
|
||||||
resultName_,
|
p.mesh(),
|
||||||
p.mesh().time().timeName(),
|
IOobject::NO_READ,
|
||||||
p.mesh(),
|
IOobject::NO_WRITE
|
||||||
IOobject::NO_READ,
|
),
|
||||||
IOobject::NO_WRITE
|
coeff(pRef(pDyn(p, rhoScale(p))))
|
||||||
),
|
|
||||||
coeff(pRef(pDyn(p, rhoScale(p))))
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return store(resultName_, tp);
|
return store(resultName_, tp);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -265,22 +255,22 @@ bool Foam::functionObjects::pressure::read(const dictionary& dict)
|
|||||||
|
|
||||||
if (rhoName_ == "rhoInf")
|
if (rhoName_ == "rhoInf")
|
||||||
{
|
{
|
||||||
dict.lookup("rhoInf") >> rhoInf_;
|
dict.readEntry("rhoInf", rhoInf_);
|
||||||
rhoInfInitialised_ = true;
|
rhoInfInitialised_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
dict.lookup("calcTotal") >> calcTotal_;
|
dict.readEntry("calcTotal", calcTotal_);
|
||||||
if (calcTotal_)
|
if (calcTotal_)
|
||||||
{
|
{
|
||||||
pRef_ = dict.lookupOrDefault<scalar>("pRef", 0.0);
|
pRef_ = dict.lookupOrDefault<scalar>("pRef", 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
dict.lookup("calcCoeff") >> calcCoeff_;
|
dict.readEntry("calcCoeff", calcCoeff_);
|
||||||
if (calcCoeff_)
|
if (calcCoeff_)
|
||||||
{
|
{
|
||||||
dict.lookup("pInf") >> pInf_;
|
dict.readEntry("pInf", pInf_);
|
||||||
dict.lookup("UInf") >> UInf_;
|
dict.readEntry("UInf", UInf_);
|
||||||
dict.lookup("rhoInf") >> rhoInf_;
|
dict.readEntry("rhoInf", rhoInf_);
|
||||||
|
|
||||||
scalar zeroCheck = 0.5*rhoInf_*magSqr(UInf_) + pInf_;
|
scalar zeroCheck = 0.5*rhoInf_*magSqr(UInf_) + pInf_;
|
||||||
|
|
||||||
|
|||||||
@ -91,10 +91,10 @@ bool Foam::functionObjects::processorField::read(const dictionary& dict)
|
|||||||
|
|
||||||
bool Foam::functionObjects::processorField::execute()
|
bool Foam::functionObjects::processorField::execute()
|
||||||
{
|
{
|
||||||
const volScalarField& procField =
|
volScalarField& procField =
|
||||||
mesh_.lookupObject<volScalarField>("processorID");
|
mesh_.lookupObjectRef<volScalarField>("processorID");
|
||||||
|
|
||||||
const_cast<volScalarField&>(procField) ==
|
procField ==
|
||||||
dimensionedScalar("proci", dimless, Pstream::myProcNo());
|
dimensionedScalar("proci", dimless, Pstream::myProcNo());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -81,7 +81,7 @@ bool Foam::functionObjects::randomise::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
fieldExpression::read(dict);
|
fieldExpression::read(dict);
|
||||||
|
|
||||||
dict.lookup("magPerturbation") >> magPerturbation_;
|
dict.readEntry("magPerturbation", magPerturbation_);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,26 +39,25 @@ bool Foam::functionObjects::randomise::calcRandomised()
|
|||||||
|
|
||||||
resultName_ = fieldName_ & "Random";
|
resultName_ = fieldName_ & "Random";
|
||||||
|
|
||||||
tmp<VolFieldType> rfieldt(new VolFieldType(field));
|
auto trfield = tmp<VolFieldType>::New(field);
|
||||||
VolFieldType& rfield = rfieldt.ref();
|
auto& rfield = trfield.ref();
|
||||||
|
|
||||||
Random rand(1234567);
|
Random rand(1234567);
|
||||||
|
|
||||||
forAll(field, celli)
|
for (Type& cellval : rfield)
|
||||||
{
|
{
|
||||||
Type rndPert;
|
Type rndPert;
|
||||||
rand.randomise01(rndPert);
|
rand.randomise01(rndPert);
|
||||||
rndPert = 2.0*rndPert - pTraits<Type>::one;
|
rndPert = 2.0*rndPert - pTraits<Type>::one;
|
||||||
rndPert /= mag(rndPert);
|
rndPert /= mag(rndPert);
|
||||||
rfield[celli] += magPerturbation_*rndPert;
|
|
||||||
|
cellval += magPerturbation_*rndPert;
|
||||||
}
|
}
|
||||||
|
|
||||||
return store(resultName_, rfieldt);
|
return store(resultName_, trfield);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -78,24 +78,20 @@ calculateSpeciesRR
|
|||||||
const basicChemistryModel& basicChemistry
|
const basicChemistryModel& basicChemistry
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
tmp<DimensionedField<scalar, volMesh>> RRt
|
auto RRt = tmp<DimensionedField<scalar, volMesh>>::New
|
||||||
(
|
(
|
||||||
new DimensionedField<scalar, volMesh>
|
IOobject
|
||||||
(
|
(
|
||||||
IOobject
|
"RR",
|
||||||
(
|
time_.timeName(),
|
||||||
"RR",
|
|
||||||
time_.timeName(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
mesh_,
|
mesh_,
|
||||||
dimensionedScalar(dimMass/dimVolume/dimTime, Zero)
|
IOobject::NO_READ,
|
||||||
)
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedScalar(dimMass/dimVolume/dimTime, Zero)
|
||||||
);
|
);
|
||||||
|
auto& RR = RRt.ref();
|
||||||
DimensionedField<scalar, volMesh>& RR = RRt.ref();
|
|
||||||
|
|
||||||
scalar dt = time_.deltaT().value();
|
scalar dt = time_.deltaT().value();
|
||||||
|
|
||||||
|
|||||||
@ -74,7 +74,7 @@ bool Foam::functionObjects::readFields::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
fvMeshFunctionObject::read(dict);
|
fvMeshFunctionObject::read(dict);
|
||||||
|
|
||||||
dict.lookup("fields") >> fieldSet_;
|
dict.readEntry("fields", fieldSet_);
|
||||||
dict.readIfPresent("readOnStart", readOnStart_);
|
dict.readIfPresent("readOnStart", readOnStart_);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -209,8 +209,8 @@ Foam::functionObjects::regionSizeDistribution::divide
|
|||||||
const scalarField& denom
|
const scalarField& denom
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
tmp<scalarField> tresult(new scalarField(num.size()));
|
auto tresult = tmp<scalarField>::New(num.size());
|
||||||
scalarField& result = tresult.ref();
|
auto& result = tresult.ref();
|
||||||
|
|
||||||
forAll(denom, i)
|
forAll(denom, i)
|
||||||
{
|
{
|
||||||
@ -317,8 +317,8 @@ Foam::functionObjects::regionSizeDistribution::regionSizeDistribution
|
|||||||
:
|
:
|
||||||
fvMeshFunctionObject(name, runTime, dict),
|
fvMeshFunctionObject(name, runTime, dict),
|
||||||
writeFile(obr_, name),
|
writeFile(obr_, name),
|
||||||
alphaName_(dict.lookup("field")),
|
alphaName_(dict.get<word>("field")),
|
||||||
patchNames_(dict.lookup("patches")),
|
patchNames_(dict.get<wordRes>("patches")),
|
||||||
isoPlanes_(dict.lookupOrDefault("isoPlanes", false))
|
isoPlanes_(dict.lookupOrDefault("isoPlanes", false))
|
||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
@ -338,16 +338,16 @@ bool Foam::functionObjects::regionSizeDistribution::read(const dictionary& dict)
|
|||||||
fvMeshFunctionObject::read(dict);
|
fvMeshFunctionObject::read(dict);
|
||||||
writeFile::read(dict);
|
writeFile::read(dict);
|
||||||
|
|
||||||
dict.lookup("field") >> alphaName_;
|
dict.readEntry("field", alphaName_);
|
||||||
dict.lookup("patches") >> patchNames_;
|
dict.readEntry("patches", patchNames_);
|
||||||
dict.lookup("threshold") >> threshold_;
|
dict.readEntry("threshold", threshold_);
|
||||||
dict.lookup("maxDiameter") >> maxDiam_;
|
dict.readEntry("maxDiameter", maxDiam_);
|
||||||
minDiam_ = 0.0;
|
minDiam_ = 0.0;
|
||||||
dict.readIfPresent("minDiameter", minDiam_);
|
dict.readIfPresent("minDiameter", minDiam_);
|
||||||
dict.lookup("nBins") >> nBins_;
|
dict.readEntry("nBins", nBins_);
|
||||||
dict.lookup("fields") >> fields_;
|
dict.readEntry("fields", fields_);
|
||||||
|
|
||||||
word format(dict.lookup("setFormat"));
|
const word format(dict.get<word>("setFormat"));
|
||||||
formatterPtr_ = writer<scalar>::New(format);
|
formatterPtr_ = writer<scalar>::New(format);
|
||||||
|
|
||||||
if (dict.found("coordinateSystem"))
|
if (dict.found("coordinateSystem"))
|
||||||
@ -360,12 +360,12 @@ bool Foam::functionObjects::regionSizeDistribution::read(const dictionary& dict)
|
|||||||
|
|
||||||
if (isoPlanes_)
|
if (isoPlanes_)
|
||||||
{
|
{
|
||||||
dict.lookup("origin") >> origin_;
|
dict.readEntry("origin", origin_);
|
||||||
dict.lookup("direction") >> direction_;
|
dict.readEntry("direction", direction_);
|
||||||
dict.lookup("maxDiameter") >> maxDiameter_;
|
dict.readEntry("maxDiameter", maxDiameter_);
|
||||||
dict.lookup("nDownstreamBins") >> nDownstreamBins_;
|
dict.readEntry("nDownstreamBins", nDownstreamBins_);
|
||||||
dict.lookup("maxDownstream") >> maxDownstream_;
|
dict.readEntry("maxDownstream", maxDownstream_);
|
||||||
direction_ /= mag(direction_);
|
direction_.normalise();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -458,6 +458,7 @@ bool Foam::functionObjects::regionSizeDistribution::write()
|
|||||||
{
|
{
|
||||||
tmp<scalarField> townFld(fvp.patchInternalField());
|
tmp<scalarField> townFld(fvp.patchInternalField());
|
||||||
const scalarField& ownFld = townFld();
|
const scalarField& ownFld = townFld();
|
||||||
|
|
||||||
tmp<scalarField> tnbrFld(fvp.patchNeighbourField());
|
tmp<scalarField> tnbrFld(fvp.patchNeighbourField());
|
||||||
const scalarField& nbrFld = tnbrFld();
|
const scalarField& nbrFld = tnbrFld();
|
||||||
|
|
||||||
|
|||||||
@ -137,7 +137,7 @@ bool Foam::functionObjects::setFlow::read(const dictionary& dict)
|
|||||||
if (fvMeshFunctionObject::read(dict))
|
if (fvMeshFunctionObject::read(dict))
|
||||||
{
|
{
|
||||||
Info<< name() << ":" << endl;
|
Info<< name() << ":" << endl;
|
||||||
mode_ = modeTypeNames.read(dict.lookup("mode"));
|
mode_ = modeTypeNames.lookup("mode", dict);
|
||||||
|
|
||||||
Info<< " operating mode: " << modeTypeNames[mode_] << endl;
|
Info<< " operating mode: " << modeTypeNames[mode_] << endl;
|
||||||
|
|
||||||
@ -176,22 +176,21 @@ bool Foam::functionObjects::setFlow::read(const dictionary& dict)
|
|||||||
case modeType::ROTATION:
|
case modeType::ROTATION:
|
||||||
{
|
{
|
||||||
omegaPtr_ = Function1<scalar>::New("omega", dict);
|
omegaPtr_ = Function1<scalar>::New("omega", dict);
|
||||||
dict.lookup("origin") >> origin_;
|
|
||||||
vector refDir(dict.lookup("refDir"));
|
dict.readEntry("origin", origin_);
|
||||||
refDir /= mag(refDir) + ROOTVSMALL;
|
const vector refDir(dict.get<vector>("refDir").normalise());
|
||||||
vector axis(dict.lookup("axis"));
|
const vector axis(dict.get<vector>("axis").normalise());
|
||||||
axis /= mag(axis) + ROOTVSMALL;
|
|
||||||
R_ = tensor(refDir, axis, refDir^axis);
|
R_ = tensor(refDir, axis, refDir^axis);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case modeType::VORTEX2D:
|
case modeType::VORTEX2D:
|
||||||
case modeType::VORTEX3D:
|
case modeType::VORTEX3D:
|
||||||
{
|
{
|
||||||
dict.lookup("origin") >> origin_;
|
dict.readEntry("origin", origin_);
|
||||||
vector refDir(dict.lookup("refDir"));
|
const vector refDir(dict.get<vector>("refDir").normalise());
|
||||||
refDir /= mag(refDir) + ROOTVSMALL;
|
const vector axis(dict.get<vector>("axis").normalise());
|
||||||
vector axis(dict.lookup("axis"));
|
|
||||||
axis /= mag(axis) + ROOTVSMALL;
|
|
||||||
R_ = tensor(refDir, axis, refDir^axis);
|
R_ = tensor(refDir, axis, refDir^axis);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -279,23 +279,21 @@ bool Foam::functionObjects::stabilityBlendingFactor::init(bool first)
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp<volScalarField> magGradCCPtr
|
auto tmagGradCC = tmp<volScalarField>::New
|
||||||
(
|
(
|
||||||
new volScalarField
|
IOobject
|
||||||
(
|
(
|
||||||
IOobject
|
"magGradCC",
|
||||||
(
|
time_.timeName(),
|
||||||
"magGradCC",
|
|
||||||
time_.timeName(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
mesh_,
|
mesh_,
|
||||||
dimensionedScalar(dimless, Zero),
|
IOobject::NO_READ,
|
||||||
zeroGradientFvPatchScalarField::typeName
|
IOobject::NO_WRITE
|
||||||
)
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedScalar(dimless, Zero),
|
||||||
|
zeroGradientFvPatchScalarField::typeName
|
||||||
);
|
);
|
||||||
|
auto& magGradCC = tmagGradCC.ref();
|
||||||
|
|
||||||
for (direction i=0; i<vector::nComponents; i++)
|
for (direction i=0; i<vector::nComponents; i++)
|
||||||
{
|
{
|
||||||
@ -316,12 +314,12 @@ bool Foam::functionObjects::stabilityBlendingFactor::init(bool first)
|
|||||||
);
|
);
|
||||||
cci = mesh_.C().component(i);
|
cci = mesh_.C().component(i);
|
||||||
cci.correctBoundaryConditions();
|
cci.correctBoundaryConditions();
|
||||||
magGradCCPtr.ref() += mag(fvc::grad(cci)).ref();
|
magGradCC += mag(fvc::grad(cci)).ref();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (first)
|
if (first)
|
||||||
{
|
{
|
||||||
Log << " Max magGradCc : " << max(magGradCCPtr.ref()).value()
|
Log << " Max magGradCc : " << max(magGradCC.ref()).value()
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,7 +332,7 @@ bool Foam::functionObjects::stabilityBlendingFactor::init(bool first)
|
|||||||
max
|
max
|
||||||
(
|
(
|
||||||
scalar(0),
|
scalar(0),
|
||||||
(magGradCCPtr.ref() - maxGradCc_)
|
(magGradCC - maxGradCc_)
|
||||||
/ (minGradCc_ - maxGradCc_)
|
/ (minGradCc_ - maxGradCc_)
|
||||||
),
|
),
|
||||||
scalar(1)
|
scalar(1)
|
||||||
@ -355,25 +353,22 @@ bool Foam::functionObjects::stabilityBlendingFactor::init(bool first)
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp<volScalarField> CoPtr
|
auto CoPtr = tmp<volScalarField>::New
|
||||||
(
|
(
|
||||||
new volScalarField
|
IOobject
|
||||||
(
|
(
|
||||||
IOobject
|
"Co",
|
||||||
(
|
time_.timeName(),
|
||||||
"Co",
|
|
||||||
time_.timeName(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
mesh_,
|
mesh_,
|
||||||
dimensionedScalar(dimless, Zero),
|
IOobject::NO_READ,
|
||||||
zeroGradientFvPatchScalarField::typeName
|
IOobject::NO_WRITE
|
||||||
)
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedScalar(dimless, Zero),
|
||||||
|
zeroGradientFvPatchScalarField::typeName
|
||||||
);
|
);
|
||||||
|
|
||||||
volScalarField& Co = CoPtr.ref();
|
auto& Co = CoPtr.ref();
|
||||||
|
|
||||||
Co.primitiveFieldRef() =
|
Co.primitiveFieldRef() =
|
||||||
mesh_.time().deltaT()*mag(*UNamePtr)/pow(mesh_.V(), 1.0/3.0);
|
mesh_.time().deltaT()*mag(*UNamePtr)/pow(mesh_.V(), 1.0/3.0);
|
||||||
@ -417,12 +412,10 @@ bool Foam::functionObjects::stabilityBlendingFactor::init(bool first)
|
|||||||
indicator_.max(0.0);
|
indicator_.max(0.0);
|
||||||
|
|
||||||
// Update the blended surface field
|
// Update the blended surface field
|
||||||
surfaceScalarField* surBlendedPtr =
|
surfaceScalarField& surBlended =
|
||||||
(
|
mesh_.lookupObjectRef<surfaceScalarField>(resultName_);
|
||||||
mesh_.lookupObjectRefPtr<surfaceScalarField>(resultName_)
|
|
||||||
);
|
|
||||||
|
|
||||||
*surBlendedPtr = fvc::interpolate(indicator_);
|
surBlended = fvc::interpolate(indicator_);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -511,21 +504,18 @@ Foam::functionObjects::stabilityBlendingFactor::stabilityBlendingFactor
|
|||||||
read(dict);
|
read(dict);
|
||||||
setResultName(typeName, "");
|
setResultName(typeName, "");
|
||||||
|
|
||||||
tmp<surfaceScalarField> faceBlendedPtr
|
auto faceBlendedPtr = tmp<surfaceScalarField>::New
|
||||||
(
|
(
|
||||||
new surfaceScalarField
|
IOobject
|
||||||
(
|
(
|
||||||
IOobject
|
resultName_,
|
||||||
(
|
time_.timeName(),
|
||||||
resultName_,
|
|
||||||
time_.timeName(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
mesh_,
|
mesh_,
|
||||||
dimensionedScalar(dimless, Zero)
|
IOobject::NO_READ,
|
||||||
)
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedScalar(dimless, Zero)
|
||||||
);
|
);
|
||||||
store(resultName_, faceBlendedPtr);
|
store(resultName_, faceBlendedPtr);
|
||||||
|
|
||||||
@ -653,12 +643,12 @@ bool Foam::functionObjects::stabilityBlendingFactor::read
|
|||||||
{
|
{
|
||||||
if (fieldExpression::read(dict) && writeFile::read(dict))
|
if (fieldExpression::read(dict) && writeFile::read(dict))
|
||||||
{
|
{
|
||||||
dict.lookup("switchNonOrtho") >> nonOrthogonality_;
|
dict.readEntry("switchNonOrtho", nonOrthogonality_);
|
||||||
dict.lookup("switchGradCc") >> gradCc_;
|
dict.readEntry("switchGradCc", gradCc_);
|
||||||
dict.lookup("switchResiduals") >> residuals_;
|
dict.readEntry("switchResiduals", residuals_);
|
||||||
dict.lookup("switchFaceWeight") >> faceWeight_;
|
dict.readEntry("switchFaceWeight", faceWeight_);
|
||||||
dict.lookup("switchSkewness") >> skewness_;
|
dict.readEntry("switchSkewness", skewness_);
|
||||||
dict.lookup("switchCo") >> Co_;
|
dict.readEntry("switchCo", Co_);
|
||||||
|
|
||||||
dict.readIfPresent("maxNonOrthogonality", maxNonOrthogonality_);
|
dict.readIfPresent("maxNonOrthogonality", maxNonOrthogonality_);
|
||||||
dict.readIfPresent("maxGradCc", maxGradCc_);
|
dict.readIfPresent("maxGradCc", maxGradCc_);
|
||||||
|
|||||||
@ -71,27 +71,21 @@ Foam::tmp<Foam::pointScalarField> Foam::functionObjects::streamFunction::calc
|
|||||||
|
|
||||||
const pointMesh& pMesh = pointMesh::New(mesh_);
|
const pointMesh& pMesh = pointMesh::New(mesh_);
|
||||||
|
|
||||||
tmp<pointScalarField> tstreamFunction
|
auto tstreamFunction = tmp<pointScalarField>::New
|
||||||
(
|
(
|
||||||
new pointScalarField
|
IOobject
|
||||||
(
|
(
|
||||||
IOobject
|
"streamFunction",
|
||||||
(
|
time_.timeName(),
|
||||||
"streamFunction",
|
mesh_
|
||||||
time_.timeName(),
|
),
|
||||||
mesh_
|
pMesh,
|
||||||
),
|
dimensionedScalar(phi.dimensions(), Zero)
|
||||||
pMesh,
|
|
||||||
dimensionedScalar(phi.dimensions(), Zero)
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
pointScalarField& streamFunction = tstreamFunction.ref();
|
pointScalarField& streamFunction = tstreamFunction.ref();
|
||||||
|
|
||||||
labelList visitedPoint(mesh_.nPoints());
|
labelList visitedPoint(mesh_.nPoints(), Zero);
|
||||||
forAll(visitedPoint, pointi)
|
|
||||||
{
|
|
||||||
visitedPoint[pointi] = 0;
|
|
||||||
}
|
|
||||||
label nVisited = 0;
|
label nVisited = 0;
|
||||||
label nVisitedOld = 0;
|
label nVisitedOld = 0;
|
||||||
|
|
||||||
@ -263,7 +257,7 @@ Foam::tmp<Foam::pointScalarField> Foam::functionObjects::streamFunction::calc
|
|||||||
points[curBPoints[pointi]]
|
points[curBPoints[pointi]]
|
||||||
- currentBStreamPoint;
|
- currentBStreamPoint;
|
||||||
edgeHat.replace(slabDir, 0);
|
edgeHat.replace(slabDir, 0);
|
||||||
edgeHat /= mag(edgeHat);
|
edgeHat.normalise();
|
||||||
|
|
||||||
vector nHat = unitAreas[facei];
|
vector nHat = unitAreas[facei];
|
||||||
|
|
||||||
@ -356,7 +350,7 @@ Foam::tmp<Foam::pointScalarField> Foam::functionObjects::streamFunction::calc
|
|||||||
points[curPoints[pointi]] - currentStreamPoint;
|
points[curPoints[pointi]] - currentStreamPoint;
|
||||||
|
|
||||||
edgeHat.replace(slabDir, 0);
|
edgeHat.replace(slabDir, 0);
|
||||||
edgeHat /= mag(edgeHat);
|
edgeHat.normalise();
|
||||||
|
|
||||||
vector nHat = unitAreas[facei];
|
vector nHat = unitAreas[facei];
|
||||||
|
|
||||||
|
|||||||
@ -865,7 +865,7 @@ bool Foam::functionObjects::streamLineBase::read(const dictionary& dict)
|
|||||||
|
|
||||||
if (fields_.empty())
|
if (fields_.empty())
|
||||||
{
|
{
|
||||||
dict.lookup("fields") >> fields_;
|
dict.readEntry("fields", fields_);
|
||||||
|
|
||||||
if (!fields_.found(UName_))
|
if (!fields_.found(UName_))
|
||||||
{
|
{
|
||||||
@ -878,8 +878,8 @@ bool Foam::functionObjects::streamLineBase::read(const dictionary& dict)
|
|||||||
|
|
||||||
Info<< " Employing velocity field " << UName_ << endl;
|
Info<< " Employing velocity field " << UName_ << endl;
|
||||||
|
|
||||||
dict.lookup("trackForward") >> trackForward_;
|
dict.readEntry("trackForward", trackForward_);
|
||||||
dict.lookup("lifeTime") >> lifeTime_;
|
dict.readEntry("lifeTime", lifeTime_);
|
||||||
if (lifeTime_ < 1)
|
if (lifeTime_ < 1)
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
@ -916,8 +916,8 @@ bool Foam::functionObjects::streamLineBase::read(const dictionary& dict)
|
|||||||
sampledSetPtr_.clear();
|
sampledSetPtr_.clear();
|
||||||
sampledSetAxis_.clear();
|
sampledSetAxis_.clear();
|
||||||
|
|
||||||
scalarFormatterPtr_ = writer<scalar>::New(dict.lookup("setFormat"));
|
scalarFormatterPtr_ = writer<scalar>::New(dict.get<word>("setFormat"));
|
||||||
vectorFormatterPtr_ = writer<vector>::New(dict.lookup("setFormat"));
|
vectorFormatterPtr_ = writer<vector>::New(dict.get<word>("setFormat"));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -76,7 +76,7 @@ bool Foam::functionObjects::surfaceInterpolate::read
|
|||||||
{
|
{
|
||||||
fvMeshFunctionObject::read(dict);
|
fvMeshFunctionObject::read(dict);
|
||||||
|
|
||||||
dict.lookup("fields") >> fieldSet_;
|
dict.readEntry("fields", fieldSet_);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -144,11 +144,11 @@ bool Foam::functionObjects::turbulenceFields::read(const dictionary& dict)
|
|||||||
|
|
||||||
if (dict.found("field"))
|
if (dict.found("field"))
|
||||||
{
|
{
|
||||||
fieldSet_.insert(word(dict.lookup("field")));
|
fieldSet_.insert(dict.get<word>("field"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fieldSet_.insert(wordList(dict.lookup("fields")));
|
fieldSet_.insert(dict.get<wordList>("fields"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< type() << " " << name() << ": ";
|
Info<< type() << " " << name() << ": ";
|
||||||
|
|||||||
@ -40,8 +40,7 @@ void Foam::functionObjects::turbulenceFields::processField
|
|||||||
|
|
||||||
if (obr_.foundObject<FieldType>(scopedName))
|
if (obr_.foundObject<FieldType>(scopedName))
|
||||||
{
|
{
|
||||||
FieldType& fld =
|
FieldType& fld = obr_.lookupObjectRef<FieldType>(scopedName);
|
||||||
const_cast<FieldType&>(obr_.lookupObject<FieldType>(scopedName));
|
|
||||||
fld == tvalue();
|
fld == tvalue();
|
||||||
}
|
}
|
||||||
else if (obr_.found(scopedName))
|
else if (obr_.found(scopedName))
|
||||||
|
|||||||
@ -87,7 +87,7 @@ Foam::functionObjects::valueAverage::valueAverage
|
|||||||
if (dict.found(fieldName))
|
if (dict.found(fieldName))
|
||||||
{
|
{
|
||||||
const dictionary& valueDict = dict.subDict(fieldName);
|
const dictionary& valueDict = dict.subDict(fieldName);
|
||||||
totalTime_[fieldi] = readScalar(valueDict.lookup("totalTime"));
|
totalTime_[fieldi] = valueDict.get<scalar>("totalTime");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -112,8 +112,8 @@ bool Foam::functionObjects::valueAverage::read(const dictionary& dict)
|
|||||||
// Make certain that the values are consistent with the defaults:
|
// Make certain that the values are consistent with the defaults:
|
||||||
resetOnRestart_ = false;
|
resetOnRestart_ = false;
|
||||||
|
|
||||||
dict.lookup("functionObject") >> functionObjectName_;
|
dict.readEntry("functionObject", functionObjectName_);
|
||||||
dict.lookup("fields") >> fieldNames_;
|
dict.readEntry("fields", fieldNames_);
|
||||||
if (dict.readIfPresent("window", window_))
|
if (dict.readIfPresent("window", window_))
|
||||||
{
|
{
|
||||||
window_ = obr().time().userTimeToTime(window_);
|
window_ = obr().time().userTimeToTime(window_);
|
||||||
|
|||||||
@ -316,8 +316,7 @@ Foam::scalar Foam::wallBoundedParticle::trackFaceTri
|
|||||||
|
|
||||||
// Outwards pointing normal
|
// Outwards pointing normal
|
||||||
vector edgeNormal = (pt1 - pt0)^n;
|
vector edgeNormal = (pt1 - pt0)^n;
|
||||||
|
edgeNormal.normalise();
|
||||||
edgeNormal /= mag(edgeNormal) + VSMALL;
|
|
||||||
|
|
||||||
// Determine whether position and end point on either side of edge.
|
// Determine whether position and end point on either side of edge.
|
||||||
scalar sEnd = (endPosition - pt0)&edgeNormal;
|
scalar sEnd = (endPosition - pt0)&edgeNormal;
|
||||||
|
|||||||
@ -166,8 +166,7 @@ Foam::scalar Foam::wallBoundedParticle::trackToEdge
|
|||||||
}
|
}
|
||||||
|
|
||||||
const triFace tri(currentTetIndices().faceTriIs(mesh(), false));
|
const triFace tri(currentTetIndices().faceTriIs(mesh(), false));
|
||||||
vector n = tri.normal(mesh().points());
|
const vector n = tri.unitNormal(mesh().points());
|
||||||
n /= mag(n);
|
|
||||||
|
|
||||||
point projectedEndPosition = endPosition;
|
point projectedEndPosition = endPosition;
|
||||||
|
|
||||||
|
|||||||
@ -120,10 +120,7 @@ bool Foam::functionObjects::yPlus::read(const dictionary& dict)
|
|||||||
bool Foam::functionObjects::yPlus::execute()
|
bool Foam::functionObjects::yPlus::execute()
|
||||||
{
|
{
|
||||||
volScalarField& yPlus =
|
volScalarField& yPlus =
|
||||||
const_cast<volScalarField&>
|
lookupObjectRef<volScalarField>(typeName);
|
||||||
(
|
|
||||||
lookupObject<volScalarField>(typeName)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (foundObject<turbulenceModel>(turbulenceModel::propertiesName))
|
if (foundObject<turbulenceModel>(turbulenceModel::propertiesName))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -112,7 +112,7 @@ bool Foam::functionObjects::zeroGradient::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
fvMeshFunctionObject::read(dict);
|
fvMeshFunctionObject::read(dict);
|
||||||
|
|
||||||
dict.lookup("fields") >> selectFields_;
|
dict.readEntry("fields", selectFields_);
|
||||||
selectFields_.uniq();
|
selectFields_.uniq();
|
||||||
|
|
||||||
Info<< type() << " fields: " << selectFields_ << nl;
|
Info<< type() << " fields: " << selectFields_ << nl;
|
||||||
|
|||||||
@ -83,29 +83,25 @@ int Foam::functionObjects::zeroGradient::apply
|
|||||||
|
|
||||||
if (!foundObject<VolFieldType>(outputName))
|
if (!foundObject<VolFieldType>(outputName))
|
||||||
{
|
{
|
||||||
tmp<VolFieldType> tzg
|
auto tzeroGrad = tmp<VolFieldType>::New
|
||||||
(
|
(
|
||||||
new VolFieldType
|
IOobject
|
||||||
(
|
(
|
||||||
IOobject
|
outputName,
|
||||||
(
|
time_.timeName(),
|
||||||
outputName,
|
|
||||||
time_.timeName(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
mesh_,
|
mesh_,
|
||||||
dimensioned<Type>(input.dimensions(), Zero),
|
IOobject::NO_READ,
|
||||||
zeroGradientFvPatchField<Type>::typeName
|
IOobject::NO_WRITE
|
||||||
)
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensioned<Type>(input.dimensions(), Zero),
|
||||||
|
zeroGradientFvPatchField<Type>::typeName
|
||||||
);
|
);
|
||||||
|
|
||||||
store(outputName, tzg);
|
store(outputName, tzeroGrad);
|
||||||
}
|
}
|
||||||
|
|
||||||
VolFieldType& output =
|
VolFieldType& output = lookupObjectRef<VolFieldType>(outputName);
|
||||||
const_cast<VolFieldType&>(lookupObject<VolFieldType>(outputName));
|
|
||||||
|
|
||||||
output = input;
|
output = input;
|
||||||
output.correctBoundaryConditions();
|
output.correctBoundaryConditions();
|
||||||
|
|||||||
@ -243,24 +243,24 @@ bool Foam::functionObjects::forceCoeffs::read(const dictionary& dict)
|
|||||||
forces::read(dict);
|
forces::read(dict);
|
||||||
|
|
||||||
// Directions for lift and drag forces, and pitch moment
|
// Directions for lift and drag forces, and pitch moment
|
||||||
dict.lookup("liftDir") >> liftDir_;
|
dict.readEntry("liftDir", liftDir_);
|
||||||
dict.lookup("dragDir") >> dragDir_;
|
dict.readEntry("dragDir", dragDir_);
|
||||||
dict.lookup("pitchAxis") >> pitchAxis_;
|
dict.readEntry("pitchAxis", pitchAxis_);
|
||||||
|
|
||||||
// Free stream velocity magnitude
|
// Free stream velocity magnitude
|
||||||
dict.lookup("magUInf") >> magUInf_;
|
dict.readEntry("magUInf", magUInf_);
|
||||||
|
|
||||||
// If case is compressible we must read rhoInf (store in rhoRef_) to
|
// If case is compressible we must read rhoInf (store in rhoRef_) to
|
||||||
// calculate the reference dynamic pressure
|
// calculate the reference dynamic pressure
|
||||||
// - note: for incompressible, rhoRef_ is already initialised
|
// - note: for incompressible, rhoRef_ is already initialised
|
||||||
if (rhoName_ != "rhoInf")
|
if (rhoName_ != "rhoInf")
|
||||||
{
|
{
|
||||||
dict.lookup("rhoInf") >> rhoRef_;
|
dict.readEntry("rhoInf", rhoRef_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reference length and area scales
|
// Reference length and area scales
|
||||||
dict.lookup("lRef") >> lRef_;
|
dict.readEntry("lRef", lRef_);
|
||||||
dict.lookup("Aref") >> Aref_;
|
dict.readEntry("Aref", Aref_);
|
||||||
|
|
||||||
if (writeFields_)
|
if (writeFields_)
|
||||||
{
|
{
|
||||||
@ -402,16 +402,10 @@ bool Foam::functionObjects::forceCoeffs::execute()
|
|||||||
lookupObject<volVectorField>(fieldName("moment"));
|
lookupObject<volVectorField>(fieldName("moment"));
|
||||||
|
|
||||||
volVectorField& forceCoeff =
|
volVectorField& forceCoeff =
|
||||||
const_cast<volVectorField&>
|
lookupObjectRef<volVectorField>(fieldName("forceCoeff"));
|
||||||
(
|
|
||||||
lookupObject<volVectorField>(fieldName("forceCoeff"))
|
|
||||||
);
|
|
||||||
|
|
||||||
volVectorField& momentCoeff =
|
volVectorField& momentCoeff =
|
||||||
const_cast<volVectorField&>
|
lookupObjectRef<volVectorField>(fieldName("momentCoeff"));
|
||||||
(
|
|
||||||
lookupObject<volVectorField>(fieldName("momentCoeff"))
|
|
||||||
);
|
|
||||||
|
|
||||||
dimensionedScalar f0("f0", dimForce, Aref_*pDyn);
|
dimensionedScalar f0("f0", dimForce, Aref_*pDyn);
|
||||||
dimensionedScalar m0("m0", dimForce*dimLength, Aref_*lRef_*pDyn);
|
dimensionedScalar m0("m0", dimForce*dimLength, Aref_*lRef_*pDyn);
|
||||||
|
|||||||
@ -292,18 +292,12 @@ void Foam::functionObjects::forces::resetFields()
|
|||||||
if (writeFields_)
|
if (writeFields_)
|
||||||
{
|
{
|
||||||
volVectorField& force =
|
volVectorField& force =
|
||||||
const_cast<volVectorField&>
|
lookupObjectRef<volVectorField>(fieldName("force"));
|
||||||
(
|
|
||||||
lookupObject<volVectorField>(fieldName("force"))
|
|
||||||
);
|
|
||||||
|
|
||||||
force == dimensionedVector(force.dimensions(), Zero);
|
force == dimensionedVector(force.dimensions(), Zero);
|
||||||
|
|
||||||
volVectorField& moment =
|
volVectorField& moment =
|
||||||
const_cast<volVectorField&>
|
lookupObjectRef<volVectorField>(fieldName("moment"));
|
||||||
(
|
|
||||||
lookupObject<volVectorField>(fieldName("moment"))
|
|
||||||
);
|
|
||||||
|
|
||||||
moment == dimensionedVector(moment.dimensions(), Zero);
|
moment == dimensionedVector(moment.dimensions(), Zero);
|
||||||
}
|
}
|
||||||
@ -415,25 +409,20 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::forces::rho() const
|
|||||||
{
|
{
|
||||||
if (rhoName_ == "rhoInf")
|
if (rhoName_ == "rhoInf")
|
||||||
{
|
{
|
||||||
return tmp<volScalarField>
|
return tmp<volScalarField>::New
|
||||||
(
|
(
|
||||||
new volScalarField
|
IOobject
|
||||||
(
|
(
|
||||||
IOobject
|
"rho",
|
||||||
(
|
mesh_.time().timeName(),
|
||||||
"rho",
|
mesh_
|
||||||
mesh_.time().timeName(),
|
),
|
||||||
mesh_
|
mesh_,
|
||||||
),
|
dimensionedScalar("rho", dimDensity, rhoRef_)
|
||||||
mesh_,
|
|
||||||
dimensionedScalar("rho", dimDensity, rhoRef_)
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return(lookupObject<volScalarField>(rhoName_));
|
||||||
return(lookupObject<volScalarField>(rhoName_));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -443,17 +432,15 @@ Foam::scalar Foam::functionObjects::forces::rho(const volScalarField& p) const
|
|||||||
{
|
{
|
||||||
return 1.0;
|
return 1.0;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (rhoName_ != "rhoInf")
|
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "Dynamic pressure is expected but kinematic is provided."
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
return rhoRef_;
|
if (rhoName_ != "rhoInf")
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Dynamic pressure is expected but kinematic is provided."
|
||||||
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return rhoRef_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -509,19 +496,13 @@ void Foam::functionObjects::forces::addToFields
|
|||||||
}
|
}
|
||||||
|
|
||||||
volVectorField& force =
|
volVectorField& force =
|
||||||
const_cast<volVectorField&>
|
lookupObjectRef<volVectorField>(fieldName("force"));
|
||||||
(
|
|
||||||
lookupObject<volVectorField>(fieldName("force"))
|
|
||||||
);
|
|
||||||
|
|
||||||
vectorField& pf = force.boundaryFieldRef()[patchi];
|
vectorField& pf = force.boundaryFieldRef()[patchi];
|
||||||
pf += fN + fT + fP;
|
pf += fN + fT + fP;
|
||||||
|
|
||||||
volVectorField& moment =
|
volVectorField& moment =
|
||||||
const_cast<volVectorField&>
|
lookupObjectRef<volVectorField>(fieldName("moment"));
|
||||||
(
|
|
||||||
lookupObject<volVectorField>(fieldName("moment"))
|
|
||||||
);
|
|
||||||
|
|
||||||
vectorField& pm = moment.boundaryFieldRef()[patchi];
|
vectorField& pm = moment.boundaryFieldRef()[patchi];
|
||||||
pm += Md;
|
pm += Md;
|
||||||
@ -543,16 +524,10 @@ void Foam::functionObjects::forces::addToFields
|
|||||||
}
|
}
|
||||||
|
|
||||||
volVectorField& force =
|
volVectorField& force =
|
||||||
const_cast<volVectorField&>
|
lookupObjectRef<volVectorField>(fieldName("force"));
|
||||||
(
|
|
||||||
lookupObject<volVectorField>(fieldName("force"))
|
|
||||||
);
|
|
||||||
|
|
||||||
volVectorField& moment =
|
volVectorField& moment =
|
||||||
const_cast<volVectorField&>
|
lookupObjectRef<volVectorField>(fieldName("moment"));
|
||||||
(
|
|
||||||
lookupObject<volVectorField>(fieldName("moment"))
|
|
||||||
);
|
|
||||||
|
|
||||||
forAll(cellIDs, i)
|
forAll(cellIDs, i)
|
||||||
{
|
{
|
||||||
@ -851,7 +826,7 @@ bool Foam::functionObjects::forces::read(const dictionary& dict)
|
|||||||
|
|
||||||
const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
|
const polyBoundaryMesh& pbm = mesh_.boundaryMesh();
|
||||||
|
|
||||||
patchSet_ = pbm.patchSet(wordReList(dict.lookup("patches")));
|
patchSet_ = pbm.patchSet(dict.get<wordRes>("patches"));
|
||||||
|
|
||||||
if (directForceDensity_)
|
if (directForceDensity_)
|
||||||
{
|
{
|
||||||
@ -868,7 +843,7 @@ bool Foam::functionObjects::forces::read(const dictionary& dict)
|
|||||||
// Reference density needed for incompressible calculations
|
// Reference density needed for incompressible calculations
|
||||||
if (rhoName_ == "rhoInf")
|
if (rhoName_ == "rhoInf")
|
||||||
{
|
{
|
||||||
dict.lookup("rhoInf") >> rhoRef_;
|
dict.readEntry("rhoInf", rhoRef_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reference pressure, 0 by default
|
// Reference pressure, 0 by default
|
||||||
@ -899,7 +874,7 @@ bool Foam::functionObjects::forces::read(const dictionary& dict)
|
|||||||
if (dict.found("binData"))
|
if (dict.found("binData"))
|
||||||
{
|
{
|
||||||
const dictionary& binDict(dict.subDict("binData"));
|
const dictionary& binDict(dict.subDict("binData"));
|
||||||
binDict.lookup("nBin") >> nBin_;
|
binDict.readEntry("nBin", nBin_);
|
||||||
|
|
||||||
if (nBin_ < 0)
|
if (nBin_ < 0)
|
||||||
{
|
{
|
||||||
@ -914,9 +889,9 @@ bool Foam::functionObjects::forces::read(const dictionary& dict)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
binDict.lookup("cumulative") >> binCumulative_;
|
binDict.readEntry("cumulative", binCumulative_);
|
||||||
binDict.lookup("direction") >> binDir_;
|
binDict.readEntry("direction", binDir_);
|
||||||
binDir_ /= mag(binDir_);
|
binDir_.normalise();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1062,7 +1037,7 @@ void Foam::functionObjects::forces::calcForcesMoment()
|
|||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
forAllConstIter(HashTable<const porosityModel*>, models, iter)
|
forAllConstIters(models, iter)
|
||||||
{
|
{
|
||||||
// Non-const access required if mesh is changing
|
// Non-const access required if mesh is changing
|
||||||
porosityModel& pm = const_cast<porosityModel&>(*iter());
|
porosityModel& pm = const_cast<porosityModel&>(*iter());
|
||||||
|
|||||||
@ -484,7 +484,7 @@ Foam::functionObjects::fieldVisualisationBase::fieldVisualisationBase
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
colours_(colours),
|
colours_(colours),
|
||||||
fieldName_(dict.lookup("field")),
|
fieldName_(dict.get<word>("field")),
|
||||||
colourBy_(cbColour),
|
colourBy_(cbColour),
|
||||||
colourMap_(cmRainbow),
|
colourMap_(cmRainbow),
|
||||||
range_()
|
range_()
|
||||||
@ -500,7 +500,7 @@ Foam::functionObjects::fieldVisualisationBase::fieldVisualisationBase
|
|||||||
}
|
}
|
||||||
case cbField:
|
case cbField:
|
||||||
{
|
{
|
||||||
dict.lookup("range") >> range_;
|
dict.readEntry("range", range_);
|
||||||
|
|
||||||
if (dict.found("colourMap"))
|
if (dict.found("colourMap"))
|
||||||
{
|
{
|
||||||
@ -508,15 +508,15 @@ Foam::functionObjects::fieldVisualisationBase::fieldVisualisationBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
const dictionary& sbarDict = dict.subDict("scalarBar");
|
const dictionary& sbarDict = dict.subDict("scalarBar");
|
||||||
sbarDict.lookup("visible") >> scalarBar_.visible_;
|
sbarDict.readEntry("visible", scalarBar_.visible_);
|
||||||
if (scalarBar_.visible_)
|
if (scalarBar_.visible_)
|
||||||
{
|
{
|
||||||
sbarDict.lookup("vertical") >> scalarBar_.vertical_;
|
sbarDict.readEntry("vertical", scalarBar_.vertical_);
|
||||||
sbarDict.lookup("position") >> scalarBar_.position_;
|
sbarDict.readEntry("position", scalarBar_.position_);
|
||||||
sbarDict.lookup("title") >> scalarBar_.title_;
|
sbarDict.readEntry("title", scalarBar_.title_);
|
||||||
sbarDict.lookup("fontSize") >> scalarBar_.fontSize_;
|
sbarDict.readEntry("fontSize", scalarBar_.fontSize_);
|
||||||
sbarDict.lookup("labelFormat") >> scalarBar_.labelFormat_;
|
sbarDict.readEntry("labelFormat", scalarBar_.labelFormat_);
|
||||||
sbarDict.lookup("numberOfLabels") >> scalarBar_.numberOfLabels_;
|
sbarDict.readEntry("numberOfLabels", scalarBar_.numberOfLabels_);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -86,7 +86,7 @@ Foam::functionObjects::runTimePostPro::functionObjectBase::functionObjectBase
|
|||||||
:
|
:
|
||||||
fieldVisualisationBase(dict, colours),
|
fieldVisualisationBase(dict, colours),
|
||||||
state_(state),
|
state_(state),
|
||||||
functionObjectName_(dict.lookup("functionObject")),
|
functionObjectName_(dict.get<word>("functionObject")),
|
||||||
clearObjects_(dict.lookupOrDefault("clearObjects", false))
|
clearObjects_(dict.lookupOrDefault("clearObjects", false))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|||||||
@ -65,9 +65,9 @@ Foam::functionObjects::runTimePostPro::functionObjectCloud::functionObjectCloud
|
|||||||
:
|
:
|
||||||
pointData(parent, dict, colours),
|
pointData(parent, dict, colours),
|
||||||
functionObjectBase(parent, dict, colours),
|
functionObjectBase(parent, dict, colours),
|
||||||
cloudName_(dict.lookup("cloud")),
|
cloudName_(dict.get<word>("cloud")),
|
||||||
inputFileName_(),
|
inputFileName_(),
|
||||||
colourFieldName_(dict.lookup("colourField")),
|
colourFieldName_(dict.get<word>("colourField")),
|
||||||
actor_()
|
actor_()
|
||||||
{
|
{
|
||||||
actor_ = vtkSmartPointer<vtkActor>::New();
|
actor_ = vtkSmartPointer<vtkActor>::New();
|
||||||
|
|||||||
@ -86,7 +86,7 @@ Foam::functionObjects::runTimePostPro::geometryBase::geometryBase
|
|||||||
:
|
:
|
||||||
parent_(parent),
|
parent_(parent),
|
||||||
name_(dict.dictName()),
|
name_(dict.dictName()),
|
||||||
visible_(readBool(dict.lookup("visible"))),
|
visible_(dict.get<bool>("visible")),
|
||||||
renderMode_(rmGouraud),
|
renderMode_(rmGouraud),
|
||||||
opacity_(nullptr),
|
opacity_(nullptr),
|
||||||
colours_(colours)
|
colours_(colours)
|
||||||
|
|||||||
@ -140,8 +140,10 @@ Foam::functionObjects::runTimePostPro::geometrySurface::geometrySurface
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
surface(parent, dict, colours),
|
surface(parent, dict, colours),
|
||||||
fileNames_(dict.lookup("files"))
|
fileNames_()
|
||||||
{}
|
{
|
||||||
|
dict.readEntry("files", fileNames_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::functionObjects::runTimePostPro::geometrySurface::geometrySurface
|
Foam::functionObjects::runTimePostPro::geometrySurface::geometrySurface
|
||||||
|
|||||||
@ -155,7 +155,7 @@ Foam::functionObjects::runTimePostPro::pathline::pathline
|
|||||||
}
|
}
|
||||||
case rtTube:
|
case rtTube:
|
||||||
{
|
{
|
||||||
dict.lookup("tubeRadius") >> tubeRadius_;
|
dict.readEntry("tubeRadius", tubeRadius_);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case rtVector:
|
case rtVector:
|
||||||
|
|||||||
@ -101,7 +101,7 @@ Foam::functionObjects::runTimePostPro::pointData::pointData
|
|||||||
(
|
(
|
||||||
representationTypeNames.lookup("representation", dict)
|
representationTypeNames.lookup("representation", dict)
|
||||||
),
|
),
|
||||||
maxGlyphLength_(readScalar(dict.lookup("maxGlyphLength"))),
|
maxGlyphLength_(dict.get<scalar>("maxGlyphLength")),
|
||||||
pointColour_(nullptr)
|
pointColour_(nullptr)
|
||||||
{
|
{
|
||||||
if (dict.found("pointColour"))
|
if (dict.found("pointColour"))
|
||||||
|
|||||||
@ -97,9 +97,9 @@ bool Foam::functionObjects::runTimePostProcessing::read(const dictionary& dict)
|
|||||||
scene_.read(dict);
|
scene_.read(dict);
|
||||||
|
|
||||||
const dictionary& outputDict = dict.subDict("output");
|
const dictionary& outputDict = dict.subDict("output");
|
||||||
outputDict.lookup("name") >> output_.name_;
|
outputDict.readEntry("name", output_.name_);
|
||||||
outputDict.lookup("width") >> output_.width_;
|
outputDict.readEntry("width", output_.width_);
|
||||||
outputDict.lookup("height") >> output_.height_;
|
outputDict.readEntry("height", output_.height_);
|
||||||
|
|
||||||
|
|
||||||
readObjects(dict.subOrEmptyDict("points"), points_);
|
readObjects(dict.subOrEmptyDict("points"), points_);
|
||||||
@ -117,11 +117,14 @@ bool Foam::functionObjects::runTimePostProcessing::read(const dictionary& dict)
|
|||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
text_.append(new runTimePostPro::text
|
text_.append
|
||||||
(
|
(
|
||||||
*this,
|
new runTimePostPro::text
|
||||||
iter().dict(),
|
(
|
||||||
scene_.colours())
|
*this,
|
||||||
|
iter().dict(),
|
||||||
|
scene_.colours()
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -44,7 +44,7 @@ void Foam::functionObjects::runTimePostProcessing::readObjects
|
|||||||
}
|
}
|
||||||
|
|
||||||
const dictionary& objectDict(iter().dict());
|
const dictionary& objectDict(iter().dict());
|
||||||
word objectType = objectDict.lookup("type");
|
const word objectType = objectDict.get<word>("type");
|
||||||
|
|
||||||
objects.append
|
objects.append
|
||||||
(
|
(
|
||||||
|
|||||||
@ -87,7 +87,7 @@ void Foam::functionObjects::runTimePostPro::scene::readCamera
|
|||||||
cameraUp_ = Function1<vector>::New("up", dict);
|
cameraUp_ = Function1<vector>::New("up", dict);
|
||||||
|
|
||||||
dict.readIfPresent("clipBox", clipBox_);
|
dict.readIfPresent("clipBox", clipBox_);
|
||||||
dict.lookup("parallelProjection") >> parallelProjection_;
|
dict.readEntry("parallelProjection", parallelProjection_);
|
||||||
if (!parallelProjection_)
|
if (!parallelProjection_)
|
||||||
{
|
{
|
||||||
if (dict.found("viewAngle"))
|
if (dict.found("viewAngle"))
|
||||||
|
|||||||
@ -184,11 +184,11 @@ Foam::functionObjects::runTimePostPro::surface::surface
|
|||||||
|
|
||||||
if (representation_ == rtGlyph)
|
if (representation_ == rtGlyph)
|
||||||
{
|
{
|
||||||
dict.lookup("maxGlyphLength") >> maxGlyphLength_;
|
dict.readEntry("maxGlyphLength", maxGlyphLength_);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dict.lookup("featureEdges") >> featureEdges_;
|
dict.readEntry("featureEdges", featureEdges_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -44,13 +44,15 @@ Foam::functionObjects::runTimePostPro::text::text
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
geometryBase(parent, dict, colours),
|
geometryBase(parent, dict, colours),
|
||||||
string_(dict.lookup("string")),
|
string_(dict.get<string>("string")),
|
||||||
position_(dict.lookup("position")),
|
position_(),
|
||||||
size_(readScalar(dict.lookup("size"))),
|
size_(dict.get<scalar>("size")),
|
||||||
colour_(nullptr),
|
colour_(nullptr),
|
||||||
bold_(readBool(dict.lookup("bold"))),
|
bold_(dict.get<bool>("bold")),
|
||||||
timeStamp_(dict.lookupOrDefault("timeStamp", false))
|
timeStamp_(dict.lookupOrDefault("timeStamp", false))
|
||||||
{
|
{
|
||||||
|
dict.readEntry("position", position_);
|
||||||
|
|
||||||
if (dict.found("colour"))
|
if (dict.found("colour"))
|
||||||
{
|
{
|
||||||
colour_.reset(Function1<vector>::New("colour", dict).ptr());
|
colour_.reset(Function1<vector>::New("colour", dict).ptr());
|
||||||
|
|||||||
@ -90,7 +90,7 @@ bool Foam::functionObjects::cloudInfo::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
if (regionFunctionObject::read(dict) && logFiles::read(dict))
|
if (regionFunctionObject::read(dict) && logFiles::read(dict))
|
||||||
{
|
{
|
||||||
logFiles::resetNames(dict.lookup("clouds"));
|
logFiles::resetNames(dict.get<wordList>("clouds"));
|
||||||
|
|
||||||
Info<< type() << " " << name() << ": ";
|
Info<< type() << " " << name() << ": ";
|
||||||
if (writeToFile() && names().size())
|
if (writeToFile() && names().size())
|
||||||
|
|||||||
@ -364,7 +364,7 @@ bool Foam::functionObjects::vtkCloud::read(const dictionary& dict)
|
|||||||
writeOpts_.ascii
|
writeOpts_.ascii
|
||||||
(
|
(
|
||||||
dict.found("format")
|
dict.found("format")
|
||||||
&& (IOstream::formatEnum(dict.lookup("format")) == IOstream::ASCII)
|
&& (IOstream::formatEnum(dict.get<word>("format")) == IOstream::ASCII)
|
||||||
);
|
);
|
||||||
|
|
||||||
writeOpts_.append(false); // No append supported
|
writeOpts_.append(false); // No append supported
|
||||||
|
|||||||
@ -57,20 +57,17 @@ Foam::volScalarField& Foam::functionObjects::energyTransport::transportedField()
|
|||||||
{
|
{
|
||||||
if (!foundObject<volScalarField>(fieldName_))
|
if (!foundObject<volScalarField>(fieldName_))
|
||||||
{
|
{
|
||||||
tmp<volScalarField> tfldPtr
|
auto tfldPtr = tmp<volScalarField>::New
|
||||||
(
|
(
|
||||||
new volScalarField
|
IOobject
|
||||||
(
|
(
|
||||||
IOobject
|
fieldName_,
|
||||||
(
|
mesh_.time().timeName(),
|
||||||
fieldName_,
|
mesh_,
|
||||||
mesh_.time().timeName(),
|
IOobject::MUST_READ,
|
||||||
mesh_,
|
IOobject::AUTO_WRITE
|
||||||
IOobject::MUST_READ,
|
),
|
||||||
IOobject::AUTO_WRITE
|
mesh_
|
||||||
),
|
|
||||||
mesh_
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
store(fieldName_, tfldPtr);
|
store(fieldName_, tfldPtr);
|
||||||
}
|
}
|
||||||
@ -113,21 +110,18 @@ Foam::functionObjects::energyTransport::kappaEff() const
|
|||||||
Foam::tmp<Foam::volScalarField>
|
Foam::tmp<Foam::volScalarField>
|
||||||
Foam::functionObjects::energyTransport::rho() const
|
Foam::functionObjects::energyTransport::rho() const
|
||||||
{
|
{
|
||||||
tmp<volScalarField> trho
|
auto trho = tmp<volScalarField>::New
|
||||||
(
|
(
|
||||||
new volScalarField
|
IOobject
|
||||||
(
|
(
|
||||||
IOobject
|
"trho",
|
||||||
(
|
mesh_.time().timeName(),
|
||||||
"trho",
|
|
||||||
mesh_.time().timeName(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
mesh_,
|
mesh_,
|
||||||
rho_
|
IOobject::NO_READ,
|
||||||
)
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
rho_
|
||||||
);
|
);
|
||||||
|
|
||||||
if (phases_.size())
|
if (phases_.size())
|
||||||
@ -152,24 +146,19 @@ Foam::functionObjects::energyTransport::Cp() const
|
|||||||
return tCp;
|
return tCp;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp<volScalarField> tCp
|
return tmp<volScalarField>::New
|
||||||
(
|
(
|
||||||
new volScalarField
|
IOobject
|
||||||
(
|
(
|
||||||
IOobject
|
"tCp",
|
||||||
(
|
mesh_.time().timeName(),
|
||||||
"tCp",
|
|
||||||
mesh_.time().timeName(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
mesh_,
|
mesh_,
|
||||||
Cp_
|
IOobject::NO_READ,
|
||||||
)
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
Cp_
|
||||||
);
|
);
|
||||||
|
|
||||||
return tCp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -187,24 +176,19 @@ Foam::functionObjects::energyTransport::kappa() const
|
|||||||
return tkappa;
|
return tkappa;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp<volScalarField> tkappa
|
return tmp<volScalarField>::New
|
||||||
(
|
(
|
||||||
new volScalarField
|
IOobject
|
||||||
(
|
(
|
||||||
IOobject
|
"tkappa",
|
||||||
(
|
mesh_.time().timeName(),
|
||||||
"tkappa",
|
|
||||||
mesh_.time().timeName(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
mesh_,
|
mesh_,
|
||||||
kappa_
|
IOobject::NO_READ,
|
||||||
)
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
kappa_
|
||||||
);
|
);
|
||||||
|
|
||||||
return tkappa;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
@ -430,21 +414,18 @@ bool Foam::functionObjects::energyTransport::execute()
|
|||||||
|
|
||||||
const surfaceScalarField CpPhi(rhoCp*phi);
|
const surfaceScalarField CpPhi(rhoCp*phi);
|
||||||
|
|
||||||
tmp<volScalarField> trhoCp
|
auto trhoCp = tmp<volScalarField>::New
|
||||||
(
|
(
|
||||||
new volScalarField
|
IOobject
|
||||||
(
|
(
|
||||||
IOobject
|
"trhoCp",
|
||||||
(
|
mesh_.time().timeName(),
|
||||||
"trhoCp",
|
|
||||||
mesh_.time().timeName(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
mesh_,
|
mesh_,
|
||||||
rhoCp
|
IOobject::NO_READ,
|
||||||
)
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
rhoCp
|
||||||
);
|
);
|
||||||
|
|
||||||
for (label i = 0; i <= nCorr_; i++)
|
for (label i = 0; i <= nCorr_; i++)
|
||||||
|
|||||||
@ -58,20 +58,17 @@ Foam::volScalarField& Foam::functionObjects::scalarTransport::transportedField()
|
|||||||
{
|
{
|
||||||
if (!foundObject<volScalarField>(fieldName_))
|
if (!foundObject<volScalarField>(fieldName_))
|
||||||
{
|
{
|
||||||
tmp<volScalarField> tfldPtr
|
auto tfldPtr = tmp<volScalarField>::New
|
||||||
(
|
(
|
||||||
new volScalarField
|
IOobject
|
||||||
(
|
(
|
||||||
IOobject
|
fieldName_,
|
||||||
(
|
mesh_.time().timeName(),
|
||||||
fieldName_,
|
mesh_,
|
||||||
mesh_.time().timeName(),
|
IOobject::MUST_READ,
|
||||||
mesh_,
|
IOobject::AUTO_WRITE
|
||||||
IOobject::MUST_READ,
|
),
|
||||||
IOobject::AUTO_WRITE
|
mesh_
|
||||||
),
|
|
||||||
mesh_
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
store(fieldName_, tfldPtr);
|
store(fieldName_, tfldPtr);
|
||||||
|
|
||||||
@ -81,10 +78,7 @@ Foam::volScalarField& Foam::functionObjects::scalarTransport::transportedField()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return const_cast<volScalarField&>
|
return lookupObjectRef<volScalarField>(fieldName_);
|
||||||
(
|
|
||||||
lookupObject<volScalarField>(fieldName_)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -109,19 +109,16 @@ bool Foam::functionObjects::ensightWrite::read(const dictionary& dict)
|
|||||||
//
|
//
|
||||||
writeOpts_.noPatches(dict.lookupOrDefault("noPatches", false));
|
writeOpts_.noPatches(dict.lookupOrDefault("noPatches", false));
|
||||||
|
|
||||||
if (dict.found("patches"))
|
wordRes list;
|
||||||
|
if (dict.readIfPresent("patches", list))
|
||||||
{
|
{
|
||||||
wordRes list(dict.lookup("patches"));
|
|
||||||
list.uniq();
|
list.uniq();
|
||||||
|
|
||||||
writeOpts_.patchSelection(list);
|
writeOpts_.patchSelection(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dict.found("faceZones"))
|
if (dict.readIfPresent("faceZones", list))
|
||||||
{
|
{
|
||||||
wordRes list(dict.lookup("faceZones"));
|
|
||||||
list.uniq();
|
list.uniq();
|
||||||
|
|
||||||
writeOpts_.faceZoneSelection(list);
|
writeOpts_.faceZoneSelection(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,7 +144,7 @@ bool Foam::functionObjects::ensightWrite::read(const dictionary& dict)
|
|||||||
//
|
//
|
||||||
// output fields
|
// output fields
|
||||||
//
|
//
|
||||||
dict.lookup("fields") >> selectFields_;
|
dict.readEntry("fields", selectFields_);
|
||||||
selectFields_.uniq();
|
selectFields_.uniq();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -74,7 +74,7 @@ bool Foam::functionObjects::removeRegisteredObject::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
regionFunctionObject::read(dict);
|
regionFunctionObject::read(dict);
|
||||||
|
|
||||||
dict.lookup("objects") >> objectNames_;
|
dict.readEntry("objects", objectNames_);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,9 +53,9 @@ Foam::functionObjects::runTimeControls::averageCondition::averageCondition
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
runTimeCondition(name, obr, dict, state),
|
runTimeCondition(name, obr, dict, state),
|
||||||
functionObjectName_(dict.lookup("functionObject")),
|
functionObjectName_(dict.get<word>("functionObject")),
|
||||||
fieldNames_(dict.lookup("fields")),
|
fieldNames_(dict.get<wordList>("fields")),
|
||||||
tolerance_(readScalar(dict.lookup("tolerance"))),
|
tolerance_(dict.get<scalar>("tolerance")),
|
||||||
window_(dict.lookupOrDefault<scalar>("window", -1)),
|
window_(dict.lookupOrDefault<scalar>("window", -1)),
|
||||||
totalTime_(fieldNames_.size(), obr_.time().deltaTValue()),
|
totalTime_(fieldNames_.size(), obr_.time().deltaTValue()),
|
||||||
resetOnRestart_(false)
|
resetOnRestart_(false)
|
||||||
@ -71,7 +71,7 @@ Foam::functionObjects::runTimeControls::averageCondition::averageCondition
|
|||||||
if (dict.found(fieldName))
|
if (dict.found(fieldName))
|
||||||
{
|
{
|
||||||
const dictionary& valueDict = dict.subDict(fieldName);
|
const dictionary& valueDict = dict.subDict(fieldName);
|
||||||
totalTime_[fieldi] = readScalar(valueDict.lookup("totalTime"));
|
valueDict.readEntry("totalTime", totalTime_[fieldi]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -76,8 +76,8 @@ equationInitialResidualCondition
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
runTimeCondition(name, obr, dict, state),
|
runTimeCondition(name, obr, dict, state),
|
||||||
fieldNames_(dict.lookup("fields")),
|
fieldNames_(dict.get<wordList>("fields")),
|
||||||
value_(readScalar(dict.lookup("value"))),
|
value_(dict.get<scalar>("value")),
|
||||||
timeStart_(dict.lookupOrDefault("timeStart", -GREAT)),
|
timeStart_(dict.lookupOrDefault("timeStart", -GREAT)),
|
||||||
mode_(operatingModeNames.lookup("mode", dict))
|
mode_(operatingModeNames.lookup("mode", dict))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -60,8 +60,8 @@ equationMaxIterCondition
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
runTimeCondition(name, obr, dict, state),
|
runTimeCondition(name, obr, dict, state),
|
||||||
fieldNames_(dict.lookup("fields")),
|
fieldNames_(dict.get<wordList>("fields")),
|
||||||
threshold_(readLabel(dict.lookup("threshold"))),
|
threshold_(dict.get<label>("threshold")),
|
||||||
startIter_(dict.lookupOrDefault("startIter", 2))
|
startIter_(dict.lookupOrDefault("startIter", 2))
|
||||||
{
|
{
|
||||||
if (!fieldNames_.size())
|
if (!fieldNames_.size())
|
||||||
|
|||||||
@ -83,10 +83,10 @@ Foam::functionObjects::runTimeControls::minMaxCondition::minMaxCondition
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
runTimeCondition(name, obr, dict, state),
|
runTimeCondition(name, obr, dict, state),
|
||||||
functionObjectName_(dict.lookup("functionObject")),
|
functionObjectName_(dict.get<word>("functionObject")),
|
||||||
mode_(modeTypeNames_.lookup("mode", dict)),
|
mode_(modeTypeNames_.lookup("mode", dict)),
|
||||||
fieldNames_(dict.lookup("fields")),
|
fieldNames_(dict.get<wordList>("fields")),
|
||||||
value_(readScalar(dict.lookup("value")))
|
value_(dict.get<scalar>("value"))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -59,7 +59,7 @@ minTimeStepCondition
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
runTimeCondition(name, obr, dict, state),
|
runTimeCondition(name, obr, dict, state),
|
||||||
minValue_(readScalar(dict.lookup("minValue")))
|
minValue_(dict.get<scalar>("minValue"))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,7 @@ Foam::functionObjects::runTimeControls::runTimeCondition::New
|
|||||||
stateFunctionObject& state
|
stateFunctionObject& state
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const word conditionType(dict.lookup("type"));
|
const word conditionType(dict.get<word>("type"));
|
||||||
|
|
||||||
Info<< "Selecting runTimeCondition " << conditionType << endl;
|
Info<< "Selecting runTimeCondition " << conditionType << endl;
|
||||||
|
|
||||||
@ -52,7 +52,8 @@ Foam::functionObjects::runTimeControls::runTimeCondition::New
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
return autoPtr<runTimeCondition>
|
return
|
||||||
|
autoPtr<runTimeCondition>
|
||||||
(
|
(
|
||||||
cstrIter()(conditionName, obr, dict, state)
|
cstrIter()(conditionName, obr, dict, state)
|
||||||
);
|
);
|
||||||
|
|||||||
@ -56,7 +56,7 @@ Foam::functionObjects::thermoCoupleProbes::thermoCoupleProbes
|
|||||||
probes(name, runTime, dict, loadFromFiles, false),
|
probes(name, runTime, dict, loadFromFiles, false),
|
||||||
ODESystem(),
|
ODESystem(),
|
||||||
UName_(dict.lookupOrDefault<word>("U", "U")),
|
UName_(dict.lookupOrDefault<word>("U", "U")),
|
||||||
radiationFieldName_(dict.lookup("radiationField")),
|
radiationFieldName_(dict.get<word>("radiationField")),
|
||||||
thermo_(mesh_.lookupObject<fluidThermo>(basicThermo::dictName)),
|
thermo_(mesh_.lookupObject<fluidThermo>(basicThermo::dictName)),
|
||||||
odeSolver_(nullptr),
|
odeSolver_(nullptr),
|
||||||
Ttc_()
|
Ttc_()
|
||||||
@ -71,7 +71,7 @@ Foam::functionObjects::thermoCoupleProbes::thermoCoupleProbes
|
|||||||
dictionary probeDict;
|
dictionary probeDict;
|
||||||
if (getDict(typeName, probeDict))
|
if (getDict(typeName, probeDict))
|
||||||
{
|
{
|
||||||
probeDict.lookup("Tc") >> Ttc_;
|
probeDict.readEntry("Tc", Ttc_);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -198,10 +198,10 @@ bool Foam::functionObjects::thermoCoupleProbes::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
if (probes::read(dict))
|
if (probes::read(dict))
|
||||||
{
|
{
|
||||||
rho_ = readScalar(dict.lookup("rho"));
|
dict.readEntry("rho", rho_);
|
||||||
Cp_ = readScalar(dict.lookup("Cp"));
|
dict.readEntry("Cp", Cp_);
|
||||||
d_ = readScalar(dict.lookup("d"));
|
dict.readEntry("d", d_);
|
||||||
epsilon_ = readScalar(dict.lookup("epsilon"));
|
dict.readEntry("epsilon", epsilon_);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -115,8 +115,8 @@ bool Foam::functionObjects::timeActivatedFileUpdate::read
|
|||||||
{
|
{
|
||||||
functionObject::read(dict);
|
functionObject::read(dict);
|
||||||
|
|
||||||
dict.lookup("fileToUpdate") >> fileToUpdate_;
|
dict.readEntry("fileToUpdate", fileToUpdate_);
|
||||||
dict.lookup("timeVsFile") >> timeVsFile_;
|
dict.readEntry("timeVsFile", timeVsFile_);
|
||||||
|
|
||||||
lastIndex_ = -1;
|
lastIndex_ = -1;
|
||||||
fileToUpdate_.expand();
|
fileToUpdate_.expand();
|
||||||
|
|||||||
@ -87,7 +87,7 @@ bool Foam::functionObjects::vtkWrite::read(const dictionary& dict)
|
|||||||
writeOpts_.ascii
|
writeOpts_.ascii
|
||||||
(
|
(
|
||||||
dict.found("format")
|
dict.found("format")
|
||||||
&& (IOstream::formatEnum(dict.lookup("format")) == IOstream::ASCII)
|
&& (IOstream::formatEnum(dict.get<word>("format")) == IOstream::ASCII)
|
||||||
);
|
);
|
||||||
|
|
||||||
// FUTURE?
|
// FUTURE?
|
||||||
@ -115,7 +115,7 @@ bool Foam::functionObjects::vtkWrite::read(const dictionary& dict)
|
|||||||
//
|
//
|
||||||
// output fields
|
// output fields
|
||||||
//
|
//
|
||||||
dict.lookup("fields") >> selectFields_;
|
dict.readEntry("fields", selectFields_);
|
||||||
selectFields_.uniq();
|
selectFields_.uniq();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -125,7 +125,7 @@ bool Foam::functionObjects::writeDictionary::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
regionFunctionObject::read(dict);
|
regionFunctionObject::read(dict);
|
||||||
|
|
||||||
wordList dictNames(dict.lookup("dictNames"));
|
wordList dictNames(dict.get<wordList>("dictNames"));
|
||||||
wordHashSet uniqueNames(dictNames);
|
wordHashSet uniqueNames(dictNames);
|
||||||
dictNames_ = uniqueNames.toc();
|
dictNames_ = uniqueNames.toc();
|
||||||
|
|
||||||
@ -134,9 +134,9 @@ bool Foam::functionObjects::writeDictionary::read(const dictionary& dict)
|
|||||||
Info<< type() << " " << name() << ": monitoring dictionaries:" << nl;
|
Info<< type() << " " << name() << ": monitoring dictionaries:" << nl;
|
||||||
if (dictNames_.size())
|
if (dictNames_.size())
|
||||||
{
|
{
|
||||||
forAll(dictNames_, i)
|
for (const word & dictName : dictNames_)
|
||||||
{
|
{
|
||||||
Info<< " " << dictNames_[i] << endl;
|
Info<< " " << dictName << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -90,15 +90,15 @@ bool Foam::functionObjects::writeObjects::read(const dictionary& dict)
|
|||||||
if (dict.found("field"))
|
if (dict.found("field"))
|
||||||
{
|
{
|
||||||
objectNames_.setSize(1);
|
objectNames_.setSize(1);
|
||||||
dict.lookup("field") >> objectNames_[0];
|
dict.readEntry("field", objectNames_[0]);
|
||||||
}
|
}
|
||||||
else if (dict.found("fields"))
|
else if (dict.found("fields"))
|
||||||
{
|
{
|
||||||
dict.lookup("fields") >> objectNames_;
|
dict.readEntry("fields", objectNames_);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dict.lookup("objects") >> objectNames_;
|
dict.readEntry("objects", objectNames_);
|
||||||
}
|
}
|
||||||
|
|
||||||
writeOption_ = writeOptionNames_.lookupOrDefault
|
writeOption_ = writeOptionNames_.lookupOrDefault
|
||||||
|
|||||||
Reference in New Issue
Block a user