mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: function objects - apply scoped name when registering objects
This commit is contained in:
committed by
Mark Olesen
parent
9194cd5203
commit
c233961d45
@ -48,15 +48,25 @@ Foam::word Foam::functionObject::outputPrefix("postProcessing");
|
|||||||
|
|
||||||
Foam::word Foam::functionObject::scopedName(const word& name) const
|
Foam::word Foam::functionObject::scopedName(const word& name) const
|
||||||
{
|
{
|
||||||
return name_ + ":" + name;
|
if (scopedNames_)
|
||||||
|
{
|
||||||
|
return IOobject::scopedName(name_, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::functionObject::functionObject(const word& name)
|
Foam::functionObject::functionObject
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const bool scopedNames
|
||||||
|
)
|
||||||
:
|
:
|
||||||
name_(name),
|
name_(name),
|
||||||
|
scopedNames_(scopedNames),
|
||||||
log(postProcess)
|
log(postProcess)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -128,16 +138,23 @@ Foam::autoPtr<Foam::functionObject> Foam::functionObject::New
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
const Foam::word& Foam::functionObject::name() const
|
const Foam::word& Foam::functionObject::name() const noexcept
|
||||||
{
|
{
|
||||||
return name_;
|
return name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::functionObject::scopedNames() const noexcept
|
||||||
|
{
|
||||||
|
return scopedNames_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::functionObject::read(const dictionary& dict)
|
bool Foam::functionObject::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
if (!postProcess)
|
if (!postProcess)
|
||||||
{
|
{
|
||||||
|
scopedNames_ = dict.getOrDefault("scopedNames", true);
|
||||||
log = dict.getOrDefault("log", true);
|
log = dict.getOrDefault("log", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2017-2020 OpenCFD Ltd.
|
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -221,6 +221,9 @@ class functionObject
|
|||||||
//- Name
|
//- Name
|
||||||
const word name_;
|
const word name_;
|
||||||
|
|
||||||
|
//- Flag to indicate that names should be scoped
|
||||||
|
bool scopedNames_;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@ -266,7 +269,11 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
functionObject(const word& name);
|
explicit functionObject
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const bool scopedNames = true
|
||||||
|
);
|
||||||
|
|
||||||
//- Return clone
|
//- Return clone
|
||||||
autoPtr<functionObject> clone() const
|
autoPtr<functionObject> clone() const
|
||||||
@ -294,7 +301,10 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return the name of this functionObject
|
//- Return the name of this functionObject
|
||||||
const word& name() const;
|
const word& name() const noexcept;
|
||||||
|
|
||||||
|
//- Return the scoped names flag
|
||||||
|
bool scopedNames() const noexcept;
|
||||||
|
|
||||||
//- Read and set the function object if its data have changed
|
//- Read and set the function object if its data have changed
|
||||||
virtual bool read(const dictionary& dict);
|
virtual bool read(const dictionary& dict);
|
||||||
@ -347,7 +357,7 @@ class functionObject::unavailableFunctionObject
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
//- Construct with name
|
//- Construct with name
|
||||||
unavailableFunctionObject(const word& name);
|
explicit unavailableFunctionObject(const word& name);
|
||||||
|
|
||||||
//- Report it is unavailable, emitting a FatalError for try/catch
|
//- Report it is unavailable, emitting a FatalError for try/catch
|
||||||
//- in the caller
|
//- in the caller
|
||||||
|
|||||||
@ -68,7 +68,7 @@ Foam::functionObjects::DESModelRegions::DESModelRegions
|
|||||||
:
|
:
|
||||||
fvMeshFunctionObject(name, runTime, dict),
|
fvMeshFunctionObject(name, runTime, dict),
|
||||||
writeFile(obr_, name, typeName, dict),
|
writeFile(obr_, name, typeName, dict),
|
||||||
resultName_(name)
|
resultName_(scopedName("regions"))
|
||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
|
|
||||||
|
|||||||
@ -74,20 +74,17 @@ bool Foam::functionObjects::XiReactionRate::execute()
|
|||||||
|
|
||||||
bool Foam::functionObjects::XiReactionRate::write()
|
bool Foam::functionObjects::XiReactionRate::write()
|
||||||
{
|
{
|
||||||
const volScalarField& b =
|
const volScalarField& b = mesh_.lookupObject<volScalarField>("b");
|
||||||
mesh_.lookupObject<volScalarField>("b");
|
|
||||||
|
|
||||||
const volScalarField& Su =
|
const volScalarField& Su = mesh_.lookupObject<volScalarField>("Su");
|
||||||
mesh_.lookupObject<volScalarField>("Su");
|
|
||||||
|
|
||||||
const volScalarField& Xi =
|
const volScalarField& Xi = mesh_.lookupObject<volScalarField>("Xi");
|
||||||
mesh_.lookupObject<volScalarField>("Xi");
|
|
||||||
|
|
||||||
const volScalarField St
|
const volScalarField St
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"St",
|
scopedName("St"),
|
||||||
time_.timeName(),
|
time_.timeName(),
|
||||||
mesh_
|
mesh_
|
||||||
),
|
),
|
||||||
@ -103,7 +100,7 @@ bool Foam::functionObjects::XiReactionRate::write()
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
"wdot",
|
scopedName("wdot"),
|
||||||
time_.timeName(),
|
time_.timeName(),
|
||||||
mesh_
|
mesh_
|
||||||
),
|
),
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2018-2020 OpenCFD Ltd.
|
Copyright (C) 2018-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -113,7 +113,7 @@ const Foam::word Foam::functionObjects::columnAverage::averageName
|
|||||||
const word& fieldName
|
const word& fieldName
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return name() + ":columnAverage(" + fieldName + ")";
|
return scopedName("columnAverage(" + fieldName + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -310,6 +310,12 @@ bool Foam::functionObjects::fieldAverage::read(const dictionary& dict)
|
|||||||
dict.readIfPresent("periodicRestart", periodicRestart_);
|
dict.readIfPresent("periodicRestart", periodicRestart_);
|
||||||
dict.readEntry("fields", faItems_);
|
dict.readEntry("fields", faItems_);
|
||||||
|
|
||||||
|
for (auto& item : faItems_)
|
||||||
|
{
|
||||||
|
item.setMeanFieldName(scopedName(item.meanFieldName()));
|
||||||
|
item.setPrime2MeanFieldName(scopedName(item.prime2MeanFieldName()));
|
||||||
|
}
|
||||||
|
|
||||||
const scalar currentTime = obr().time().value();
|
const scalar currentTime = obr().time().value();
|
||||||
|
|
||||||
if (periodicRestart_)
|
if (periodicRestart_)
|
||||||
|
|||||||
@ -236,6 +236,9 @@ public:
|
|||||||
//- Return const access to the mean field name
|
//- Return const access to the mean field name
|
||||||
inline const word& meanFieldName() const;
|
inline const word& meanFieldName() const;
|
||||||
|
|
||||||
|
//- Set the mean field name
|
||||||
|
inline void setMeanFieldName(const word& name);
|
||||||
|
|
||||||
//- Return const access to the prime-squared mean flag
|
//- Return const access to the prime-squared mean flag
|
||||||
inline bool prime2Mean() const;
|
inline bool prime2Mean() const;
|
||||||
|
|
||||||
@ -245,6 +248,9 @@ public:
|
|||||||
//- Return const access to the prime-squared mean field name
|
//- Return const access to the prime-squared mean field name
|
||||||
inline const word& prime2MeanFieldName() const;
|
inline const word& prime2MeanFieldName() const;
|
||||||
|
|
||||||
|
//- Set the prime-squared mean field name
|
||||||
|
inline void setPrime2MeanFieldName(const word& name);
|
||||||
|
|
||||||
//- Return averaging base type name
|
//- Return averaging base type name
|
||||||
inline const word& base() const;
|
inline const word& base() const;
|
||||||
|
|
||||||
|
|||||||
@ -64,6 +64,15 @@ Foam::functionObjects::fieldAverageItem::meanFieldName() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::functionObjects::fieldAverageItem::setMeanFieldName
|
||||||
|
(
|
||||||
|
const word& name
|
||||||
|
)
|
||||||
|
{
|
||||||
|
meanFieldName_ = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::functionObjects::fieldAverageItem::prime2Mean() const
|
bool Foam::functionObjects::fieldAverageItem::prime2Mean() const
|
||||||
{
|
{
|
||||||
return prime2Mean_;
|
return prime2Mean_;
|
||||||
@ -76,12 +85,22 @@ bool& Foam::functionObjects::fieldAverageItem::prime2Mean()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Foam::word& Foam::functionObjects::fieldAverageItem::prime2MeanFieldName() const
|
const Foam::word&
|
||||||
|
Foam::functionObjects::fieldAverageItem::prime2MeanFieldName() const
|
||||||
{
|
{
|
||||||
return prime2MeanFieldName_;
|
return prime2MeanFieldName_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::functionObjects::fieldAverageItem::setPrime2MeanFieldName
|
||||||
|
(
|
||||||
|
const word& name
|
||||||
|
)
|
||||||
|
{
|
||||||
|
prime2MeanFieldName_ = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const Foam::word& Foam::functionObjects::fieldAverageItem::base() const
|
const Foam::word& Foam::functionObjects::fieldAverageItem::base() const
|
||||||
{
|
{
|
||||||
return baseTypeNames_[base_];
|
return baseTypeNames_[base_];
|
||||||
|
|||||||
@ -63,6 +63,8 @@ void Foam::functionObjects::fieldExpression::setResultName
|
|||||||
{
|
{
|
||||||
resultName_ = typeName;
|
resultName_ = typeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resultName_ = scopedName(resultName_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -55,8 +55,7 @@ void Foam::functionObjects::fieldExtents::calcFieldExtents
|
|||||||
{
|
{
|
||||||
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
|
||||||
|
|
||||||
const VolFieldType* fieldPtr =
|
const VolFieldType* fieldPtr = obr_.findObject<VolFieldType>(fieldName);
|
||||||
obr_.findObject<VolFieldType>(fieldName);
|
|
||||||
|
|
||||||
if (!fieldPtr)
|
if (!fieldPtr)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -71,7 +71,7 @@ Foam::functionObjects::heatTransferCoeff::heatTransferCoeff
|
|||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
|
|
||||||
setResultName(typeName, name + ":htc:" + htcModelPtr_->type());
|
setResultName(typeName, "htc:" + htcModelPtr_->type());
|
||||||
|
|
||||||
auto* heatTransferCoeffPtr =
|
auto* heatTransferCoeffPtr =
|
||||||
new volScalarField
|
new volScalarField
|
||||||
|
|||||||
@ -120,7 +120,7 @@ bool Foam::functionObjects::particleDistribution::write()
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
name() & "CloudRegistry",
|
scopedName("CloudRegistry"),
|
||||||
mesh_.time().timeName(),
|
mesh_.time().timeName(),
|
||||||
cloud::prefix,
|
cloud::prefix,
|
||||||
mesh_.time(),
|
mesh_.time(),
|
||||||
|
|||||||
@ -236,7 +236,7 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::pressure::calcPressure
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
name() + ":p",
|
scopedName("p"),
|
||||||
mesh_.time().timeName(),
|
mesh_.time().timeName(),
|
||||||
mesh_,
|
mesh_,
|
||||||
IOobject::NO_READ
|
IOobject::NO_READ
|
||||||
|
|||||||
@ -56,7 +56,7 @@ bool Foam::functionObjects::randomise::calcTemplate()
|
|||||||
{
|
{
|
||||||
const auto& field = *fieldPtr;
|
const auto& field = *fieldPtr;
|
||||||
|
|
||||||
resultName_ = fieldName_ & "Random";
|
resultName_ = scopedName(fieldName_ & "Random");
|
||||||
|
|
||||||
auto trfield = tmp<VolFieldType>::New(field);
|
auto trfield = tmp<VolFieldType>::New(field);
|
||||||
auto& rfield = trfield.ref();
|
auto& rfield = trfield.ref();
|
||||||
|
|||||||
@ -95,7 +95,7 @@ void Foam::functionObjects::regionSizeDistribution::writeAlphaFields
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
alphaName_ + "_liquidCore",
|
scopedName(alphaName_ + "_liquidCore"),
|
||||||
obr_.time().timeName(),
|
obr_.time().timeName(),
|
||||||
obr_,
|
obr_,
|
||||||
IOobject::NO_READ
|
IOobject::NO_READ
|
||||||
@ -108,7 +108,7 @@ void Foam::functionObjects::regionSizeDistribution::writeAlphaFields
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
alphaName_ + "_background",
|
scopedName(alphaName_ + "_background"),
|
||||||
obr_.time().timeName(),
|
obr_.time().timeName(),
|
||||||
obr_,
|
obr_,
|
||||||
IOobject::NO_READ
|
IOobject::NO_READ
|
||||||
|
|||||||
@ -114,7 +114,7 @@ Foam::functionObjects::wallHeatFlux::wallHeatFlux
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
type(),
|
scopedName(typeName),
|
||||||
mesh_.time().timeName(),
|
mesh_.time().timeName(),
|
||||||
mesh_,
|
mesh_,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
@ -194,7 +194,7 @@ bool Foam::functionObjects::wallHeatFlux::read(const dictionary& dict)
|
|||||||
|
|
||||||
bool Foam::functionObjects::wallHeatFlux::execute()
|
bool Foam::functionObjects::wallHeatFlux::execute()
|
||||||
{
|
{
|
||||||
volScalarField& wallHeatFlux = lookupObjectRef<volScalarField>(type());
|
auto& wallHeatFlux = lookupObjectRef<volScalarField>(scopedName(typeName));
|
||||||
|
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
@ -284,7 +284,8 @@ bool Foam::functionObjects::wallHeatFlux::execute()
|
|||||||
|
|
||||||
bool Foam::functionObjects::wallHeatFlux::write()
|
bool Foam::functionObjects::wallHeatFlux::write()
|
||||||
{
|
{
|
||||||
const volScalarField& wallHeatFlux = lookupObject<volScalarField>(type());
|
const auto& wallHeatFlux =
|
||||||
|
lookupObject<volScalarField>(scopedName(typeName));
|
||||||
|
|
||||||
Log << type() << " " << name() << " write:" << nl
|
Log << type() << " " << name() << " write:" << nl
|
||||||
<< " writing field " << wallHeatFlux.name() << endl;
|
<< " writing field " << wallHeatFlux.name() << endl;
|
||||||
|
|||||||
@ -102,7 +102,7 @@ Foam::functionObjects::wallShearStress::wallShearStress
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
typeName,
|
scopedName(typeName),
|
||||||
mesh_.time().timeName(),
|
mesh_.time().timeName(),
|
||||||
mesh_,
|
mesh_,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
@ -176,8 +176,8 @@ bool Foam::functionObjects::wallShearStress::read(const dictionary& dict)
|
|||||||
|
|
||||||
bool Foam::functionObjects::wallShearStress::execute()
|
bool Foam::functionObjects::wallShearStress::execute()
|
||||||
{
|
{
|
||||||
volVectorField& wallShearStress =
|
auto& wallShearStress =
|
||||||
mesh_.lookupObjectRef<volVectorField>(type());
|
mesh_.lookupObjectRef<volVectorField>(scopedName(typeName));
|
||||||
|
|
||||||
// Compressible
|
// Compressible
|
||||||
{
|
{
|
||||||
@ -217,8 +217,8 @@ bool Foam::functionObjects::wallShearStress::execute()
|
|||||||
|
|
||||||
bool Foam::functionObjects::wallShearStress::write()
|
bool Foam::functionObjects::wallShearStress::write()
|
||||||
{
|
{
|
||||||
const volVectorField& wallShearStress =
|
const auto& wallShearStress =
|
||||||
obr_.lookupObject<volVectorField>(type());
|
obr_.lookupObject<volVectorField>(scopedName(typeName));
|
||||||
|
|
||||||
Log << type() << " " << name() << " write:" << nl
|
Log << type() << " " << name() << " write:" << nl
|
||||||
<< " writing field " << wallShearStress.name() << endl;
|
<< " writing field " << wallShearStress.name() << endl;
|
||||||
|
|||||||
@ -83,7 +83,7 @@ Foam::functionObjects::yPlus::yPlus
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
typeName,
|
scopedName(typeName),
|
||||||
mesh_.time().timeName(),
|
mesh_.time().timeName(),
|
||||||
mesh_,
|
mesh_,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
@ -115,8 +115,7 @@ bool Foam::functionObjects::yPlus::read(const dictionary& dict)
|
|||||||
|
|
||||||
bool Foam::functionObjects::yPlus::execute()
|
bool Foam::functionObjects::yPlus::execute()
|
||||||
{
|
{
|
||||||
volScalarField& yPlus =
|
auto& yPlus = lookupObjectRef<volScalarField>(scopedName(typeName));
|
||||||
lookupObjectRef<volScalarField>(typeName);
|
|
||||||
|
|
||||||
if (foundObject<turbulenceModel>(turbulenceModel::propertiesName))
|
if (foundObject<turbulenceModel>(turbulenceModel::propertiesName))
|
||||||
{
|
{
|
||||||
@ -192,8 +191,7 @@ bool Foam::functionObjects::yPlus::execute()
|
|||||||
|
|
||||||
bool Foam::functionObjects::yPlus::write()
|
bool Foam::functionObjects::yPlus::write()
|
||||||
{
|
{
|
||||||
const volScalarField& yPlus =
|
const auto& yPlus = obr_.lookupObject<volScalarField>(scopedName(typeName));
|
||||||
obr_.lookupObject<volScalarField>(type());
|
|
||||||
|
|
||||||
Log << type() << " " << name() << " write:" << nl
|
Log << type() << " " << name() << " write:" << nl
|
||||||
<< " writing field " << yPlus.name() << endl;
|
<< " writing field " << yPlus.name() << endl;
|
||||||
|
|||||||
@ -113,7 +113,8 @@ bool Foam::functionObjects::zeroGradient::read(const dictionary& dict)
|
|||||||
|
|
||||||
Info<< type() << " fields: " << selectFields_ << nl;
|
Info<< type() << " fields: " << selectFields_ << nl;
|
||||||
|
|
||||||
resultName_ = dict.getOrDefault<word>("result", type() + "(@@)");
|
resultName_ =
|
||||||
|
dict.getOrDefault<word>("result", scopedName(type() + "(@@)"));
|
||||||
|
|
||||||
// Require '@@' token for result, unless a single (non-regex) source field
|
// Require '@@' token for result, unless a single (non-regex) source field
|
||||||
return
|
return
|
||||||
|
|||||||
@ -287,7 +287,7 @@ bool Foam::functionObjects::forceCoeffs::read(const dictionary& dict)
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
fieldName("forceCoeff"),
|
scopedName("forceCoeff"),
|
||||||
mesh_.time().timeName(),
|
mesh_.time().timeName(),
|
||||||
mesh_,
|
mesh_,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
@ -306,7 +306,7 @@ bool Foam::functionObjects::forceCoeffs::read(const dictionary& dict)
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
fieldName("momentCoeff"),
|
scopedName("momentCoeff"),
|
||||||
mesh_.time().timeName(),
|
mesh_.time().timeName(),
|
||||||
mesh_,
|
mesh_,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
@ -467,16 +467,16 @@ bool Foam::functionObjects::forceCoeffs::execute()
|
|||||||
if (writeFields_)
|
if (writeFields_)
|
||||||
{
|
{
|
||||||
const volVectorField& force =
|
const volVectorField& force =
|
||||||
lookupObject<volVectorField>(fieldName("force"));
|
lookupObject<volVectorField>(scopedName("force"));
|
||||||
|
|
||||||
const volVectorField& moment =
|
const volVectorField& moment =
|
||||||
lookupObject<volVectorField>(fieldName("moment"));
|
lookupObject<volVectorField>(scopedName("moment"));
|
||||||
|
|
||||||
volVectorField& forceCoeff =
|
volVectorField& forceCoeff =
|
||||||
lookupObjectRef<volVectorField>(fieldName("forceCoeff"));
|
lookupObjectRef<volVectorField>(scopedName("forceCoeff"));
|
||||||
|
|
||||||
volVectorField& momentCoeff =
|
volVectorField& momentCoeff =
|
||||||
lookupObjectRef<volVectorField>(fieldName("momentCoeff"));
|
lookupObjectRef<volVectorField>(scopedName("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);
|
||||||
@ -494,10 +494,10 @@ bool Foam::functionObjects::forceCoeffs::write()
|
|||||||
if (writeFields_)
|
if (writeFields_)
|
||||||
{
|
{
|
||||||
const volVectorField& forceCoeff =
|
const volVectorField& forceCoeff =
|
||||||
lookupObject<volVectorField>(fieldName("forceCoeff"));
|
lookupObject<volVectorField>(scopedName("forceCoeff"));
|
||||||
|
|
||||||
const volVectorField& momentCoeff =
|
const volVectorField& momentCoeff =
|
||||||
lookupObject<volVectorField>(fieldName("momentCoeff"));
|
lookupObject<volVectorField>(scopedName("momentCoeff"));
|
||||||
|
|
||||||
forceCoeff.write();
|
forceCoeff.write();
|
||||||
momentCoeff.write();
|
momentCoeff.write();
|
||||||
|
|||||||
@ -48,12 +48,6 @@ namespace functionObjects
|
|||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::word Foam::functionObjects::forces::fieldName(const word& name) const
|
|
||||||
{
|
|
||||||
return this->name() + ":" + name;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::forces::createFiles()
|
void Foam::functionObjects::forces::createFiles()
|
||||||
{
|
{
|
||||||
// Note: Only possible to create bin files after bins have been initialised
|
// Note: Only possible to create bin files after bins have been initialised
|
||||||
@ -332,12 +326,12 @@ void Foam::functionObjects::forces::resetFields()
|
|||||||
if (writeFields_)
|
if (writeFields_)
|
||||||
{
|
{
|
||||||
volVectorField& force =
|
volVectorField& force =
|
||||||
lookupObjectRef<volVectorField>(fieldName("force"));
|
lookupObjectRef<volVectorField>(scopedName("force"));
|
||||||
|
|
||||||
force == dimensionedVector(force.dimensions(), Zero);
|
force == dimensionedVector(force.dimensions(), Zero);
|
||||||
|
|
||||||
volVectorField& moment =
|
volVectorField& moment =
|
||||||
lookupObjectRef<volVectorField>(fieldName("moment"));
|
lookupObjectRef<volVectorField>(scopedName("moment"));
|
||||||
|
|
||||||
moment == dimensionedVector(moment.dimensions(), Zero);
|
moment == dimensionedVector(moment.dimensions(), Zero);
|
||||||
}
|
}
|
||||||
@ -526,11 +520,11 @@ void Foam::functionObjects::forces::addToFields
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& force = lookupObjectRef<volVectorField>(fieldName("force"));
|
auto& force = lookupObjectRef<volVectorField>(scopedName("force"));
|
||||||
vectorField& pf = force.boundaryFieldRef()[patchi];
|
vectorField& pf = force.boundaryFieldRef()[patchi];
|
||||||
pf += fN + fT + fP;
|
pf += fN + fT + fP;
|
||||||
|
|
||||||
auto& moment = lookupObjectRef<volVectorField>(fieldName("moment"));
|
auto& moment = lookupObjectRef<volVectorField>(scopedName("moment"));
|
||||||
vectorField& pm = moment.boundaryFieldRef()[patchi];
|
vectorField& pm = moment.boundaryFieldRef()[patchi];
|
||||||
pm = Md^pf;
|
pm = Md^pf;
|
||||||
}
|
}
|
||||||
@ -550,8 +544,8 @@ void Foam::functionObjects::forces::addToFields
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& force = lookupObjectRef<volVectorField>(fieldName("force"));
|
auto& force = lookupObjectRef<volVectorField>(scopedName("force"));
|
||||||
auto& moment = lookupObjectRef<volVectorField>(fieldName("moment"));
|
auto& moment = lookupObjectRef<volVectorField>(scopedName("moment"));
|
||||||
|
|
||||||
forAll(cellIDs, i)
|
forAll(cellIDs, i)
|
||||||
{
|
{
|
||||||
@ -913,7 +907,7 @@ bool Foam::functionObjects::forces::read(const dictionary& dict)
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
fieldName("force"),
|
scopedName("force"),
|
||||||
time_.timeName(),
|
time_.timeName(),
|
||||||
mesh_,
|
mesh_,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
@ -932,7 +926,7 @@ bool Foam::functionObjects::forces::read(const dictionary& dict)
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
fieldName("moment"),
|
scopedName("moment"),
|
||||||
time_.timeName(),
|
time_.timeName(),
|
||||||
mesh_,
|
mesh_,
|
||||||
IOobject::NO_READ,
|
IOobject::NO_READ,
|
||||||
@ -1120,8 +1114,8 @@ bool Foam::functionObjects::forces::write()
|
|||||||
{
|
{
|
||||||
if (writeFields_)
|
if (writeFields_)
|
||||||
{
|
{
|
||||||
lookupObject<volVectorField>(fieldName("force")).write();
|
lookupObject<volVectorField>(scopedName("force")).write();
|
||||||
lookupObject<volVectorField>(fieldName("moment")).write();
|
lookupObject<volVectorField>(scopedName("moment")).write();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -256,9 +256,6 @@ protected:
|
|||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
//- Create a field name
|
|
||||||
word fieldName(const word& name) const;
|
|
||||||
|
|
||||||
//- Create the output files
|
//- Create the output files
|
||||||
void createFiles();
|
void createFiles();
|
||||||
|
|
||||||
|
|||||||
@ -137,7 +137,7 @@ Foam::functionObjects::reactingEulerHtcModel::reactingEulerHtcModel
|
|||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
|
|
||||||
setResultName(typeName, name + ":htc:" + htcModelPtr_->type());
|
setResultName(typeName, "htc:" + htcModelPtr_->type());
|
||||||
|
|
||||||
volScalarField* htcPtr =
|
volScalarField* htcPtr =
|
||||||
new volScalarField
|
new volScalarField
|
||||||
|
|||||||
Reference in New Issue
Block a user