mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'feature-functionObject-Function1' into 'develop'
Function1 objectRegistry access See merge request Development/openfoam!499
This commit is contained in:
@ -123,7 +123,7 @@ Foam::fv::VoFSolidificationMeltingSource::VoFSolidificationMeltingSource
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fv::cellSetOption(sourceName, modelType, dict, mesh),
|
fv::cellSetOption(sourceName, modelType, dict, mesh),
|
||||||
alphaSolidT_(Function1<scalar>::New("alphaSolidT", coeffs_)),
|
alphaSolidT_(Function1<scalar>::New("alphaSolidT", coeffs_, &mesh)),
|
||||||
L_("L", dimEnergy/dimMass, coeffs_),
|
L_("L", dimEnergy/dimMass, coeffs_),
|
||||||
relax_(coeffs_.getOrDefault("relax", 0.9)),
|
relax_(coeffs_.getOrDefault("relax", 0.9)),
|
||||||
Cu_(coeffs_.getOrDefault<scalar>("Cu", 100000)),
|
Cu_(coeffs_.getOrDefault<scalar>("Cu", 100000)),
|
||||||
|
|||||||
@ -33,7 +33,7 @@ bool Foam::fv::VoFSolidificationMeltingSource::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
if (fv::cellSetOption::read(dict))
|
if (fv::cellSetOption::read(dict))
|
||||||
{
|
{
|
||||||
alphaSolidT_ = Function1<scalar>::New("alphaSolidT", coeffs_);
|
alphaSolidT_ = Function1<scalar>::New("alphaSolidT", coeffs_, &mesh_);
|
||||||
coeffs_.readEntry("L", L_);
|
coeffs_.readEntry("L", L_);
|
||||||
coeffs_.readIfPresent("relax", relax_);
|
coeffs_.readIfPresent("relax", relax_);
|
||||||
coeffs_.readIfPresent("Cu", Cu_);
|
coeffs_.readIfPresent("Cu", Cu_);
|
||||||
|
|||||||
@ -343,12 +343,12 @@ Foam::radiation::laserDTRM::laserDTRM(const volScalarField& T)
|
|||||||
|
|
||||||
focalLaserPosition_
|
focalLaserPosition_
|
||||||
(
|
(
|
||||||
Function1<point>::New("focalLaserPosition", *this)
|
Function1<point>::New("focalLaserPosition", *this, &mesh_)
|
||||||
),
|
),
|
||||||
|
|
||||||
laserDirection_
|
laserDirection_
|
||||||
(
|
(
|
||||||
Function1<vector>::New("laserDirection", *this)
|
Function1<vector>::New("laserDirection", *this, &mesh_)
|
||||||
),
|
),
|
||||||
|
|
||||||
focalLaserRadius_(get<scalar>("focalLaserRadius")),
|
focalLaserRadius_(get<scalar>("focalLaserRadius")),
|
||||||
@ -359,7 +359,7 @@ Foam::radiation::laserDTRM::laserDTRM(const volScalarField& T)
|
|||||||
|
|
||||||
sigma_(0),
|
sigma_(0),
|
||||||
I0_(0),
|
I0_(0),
|
||||||
laserPower_(Function1<scalar>::New("laserPower", *this)),
|
laserPower_(Function1<scalar>::New("laserPower", *this, &mesh_)),
|
||||||
powerDistribution_(),
|
powerDistribution_(),
|
||||||
|
|
||||||
reflectionSwitch_(false),
|
reflectionSwitch_(false),
|
||||||
@ -441,11 +441,11 @@ Foam::radiation::laserDTRM::laserDTRM
|
|||||||
|
|
||||||
focalLaserPosition_
|
focalLaserPosition_
|
||||||
(
|
(
|
||||||
Function1<point>::New("focalLaserPosition", *this)
|
Function1<point>::New("focalLaserPosition", *this, &mesh_)
|
||||||
),
|
),
|
||||||
laserDirection_
|
laserDirection_
|
||||||
(
|
(
|
||||||
Function1<vector>::New("laserDirection", *this)
|
Function1<vector>::New("laserDirection", *this, &mesh_)
|
||||||
),
|
),
|
||||||
|
|
||||||
focalLaserRadius_(get<scalar>("focalLaserRadius")),
|
focalLaserRadius_(get<scalar>("focalLaserRadius")),
|
||||||
@ -456,7 +456,7 @@ Foam::radiation::laserDTRM::laserDTRM
|
|||||||
|
|
||||||
sigma_(0),
|
sigma_(0),
|
||||||
I0_(0),
|
I0_(0),
|
||||||
laserPower_(Function1<scalar>::New("laserPower", *this)),
|
laserPower_(Function1<scalar>::New("laserPower", *this, &mesh_)),
|
||||||
powerDistribution_(),
|
powerDistribution_(),
|
||||||
|
|
||||||
reflectionSwitch_(false),
|
reflectionSwitch_(false),
|
||||||
|
|||||||
@ -16,7 +16,7 @@ const vector L(dict.get<vector>("L"));
|
|||||||
const Vector<label> N(dict.get<Vector<label>>("N"));
|
const Vector<label> N(dict.get<Vector<label>>("N"));
|
||||||
|
|
||||||
// Wave number vs energy profile
|
// Wave number vs energy profile
|
||||||
autoPtr<Function1<scalar>> Ek(Function1<scalar>::New("Ek", dict));
|
autoPtr<Function1<scalar>> Ek(Function1<scalar>::New("Ek", dict, &runTime));
|
||||||
|
|
||||||
// Number of modes
|
// Number of modes
|
||||||
const label nModes = dict.get<label>("nModes");
|
const label nModes = dict.get<label>("nModes");
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*--------------------------------*- C++ -*----------------------------------*\
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration | Version: v2106
|
\\ / O peration | Version: v2112
|
||||||
\\ / A nd | Website: www.openfoam.com
|
\\ / A nd | Website: www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
@ -15,11 +15,12 @@ Description
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
type dsmcFields;
|
type dsmcFields;
|
||||||
libs ("liblagrangianFunctionObjects.so");
|
libs ("liblagrangianFunctionObjects.so");
|
||||||
|
|
||||||
fields (rhoNMean rhoMMean momentumMean linearKEMean internalEMean
|
// Names for reference purposes only
|
||||||
iDofMean fDMean);
|
fields ( rhoNMean rhoMMean momentumMean linearKEMean internalEMean
|
||||||
|
iDofMean fDMean );
|
||||||
|
|
||||||
executeControl writeTime;
|
executeControl writeTime;
|
||||||
writeControl writeTime;
|
writeControl writeTime;
|
||||||
|
|||||||
@ -78,7 +78,7 @@ CONSTRUCT
|
|||||||
scalarData_(dict.get<scalar>("scalarData")),
|
scalarData_(dict.get<scalar>("scalarData")),
|
||||||
data_(dict.get<TYPE>("data")),
|
data_(dict.get<TYPE>("data")),
|
||||||
fieldData_("fieldData", dict, p.size()),
|
fieldData_("fieldData", dict, p.size()),
|
||||||
timeVsData_(Function1<TYPE>::New("timeVsData", dict)),
|
timeVsData_(Function1<TYPE>::New("timeVsData", dict, &this->db())),
|
||||||
wordData_(dict.getOrDefault<word>("wordName", "wordDefault")),
|
wordData_(dict.getOrDefault<word>("wordName", "wordDefault")),
|
||||||
labelData_(-1),
|
labelData_(-1),
|
||||||
boolData_(false)
|
boolData_(false)
|
||||||
|
|||||||
@ -354,6 +354,7 @@ $(dll)/codedBase/codedBase.C
|
|||||||
funcObjs = db/functionObjects
|
funcObjs = db/functionObjects
|
||||||
|
|
||||||
$(funcObjs)/functionObject/functionObject.C
|
$(funcObjs)/functionObject/functionObject.C
|
||||||
|
$(funcObjs)/functionObjectProperties/functionObjectProperties.C
|
||||||
$(funcObjs)/functionObjectList/functionObjectList.C
|
$(funcObjs)/functionObjectList/functionObjectList.C
|
||||||
$(funcObjs)/stateFunctionObject/stateFunctionObject.C
|
$(funcObjs)/stateFunctionObject/stateFunctionObject.C
|
||||||
$(funcObjs)/timeFunctionObject/timeFunctionObject.C
|
$(funcObjs)/timeFunctionObject/timeFunctionObject.C
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -97,13 +97,13 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::functionObjectList::createStateDict() const
|
void Foam::functionObjectList::createPropertiesDict() const
|
||||||
{
|
{
|
||||||
// Cannot set the state dictionary on construction since Time has not
|
// Cannot set the properties dictionary on construction since Time has not
|
||||||
// been fully initialised
|
// been fully initialised
|
||||||
stateDictPtr_.reset
|
propsDictPtr_.reset
|
||||||
(
|
(
|
||||||
new IOdictionary
|
new functionObjects::properties
|
||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
@ -412,7 +412,7 @@ Foam::functionObjectList::functionObjectList
|
|||||||
warnings_(),
|
warnings_(),
|
||||||
time_(runTime),
|
time_(runTime),
|
||||||
parentDict_(parentDict),
|
parentDict_(parentDict),
|
||||||
stateDictPtr_(nullptr),
|
propsDictPtr_(nullptr),
|
||||||
objectsRegistryPtr_(nullptr),
|
objectsRegistryPtr_(nullptr),
|
||||||
execution_(execution),
|
execution_(execution),
|
||||||
updated_(false)
|
updated_(false)
|
||||||
@ -509,37 +509,38 @@ Foam::autoPtr<Foam::functionObjectList> Foam::functionObjectList::New
|
|||||||
|
|
||||||
Foam::label Foam::functionObjectList::triggerIndex() const
|
Foam::label Foam::functionObjectList::triggerIndex() const
|
||||||
{
|
{
|
||||||
return stateDict().getOrDefault<label>("triggerIndex", labelMin);
|
return propsDict().getTrigger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjectList::resetState()
|
void Foam::functionObjectList::resetPropertiesDict()
|
||||||
{
|
{
|
||||||
// Reset (re-read) the state dictionary
|
// Reset (re-read) the properties dictionary
|
||||||
stateDictPtr_.reset(nullptr);
|
propsDictPtr_.reset(nullptr);
|
||||||
createStateDict();
|
createPropertiesDict();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::IOdictionary& Foam::functionObjectList::stateDict()
|
Foam::functionObjects::properties& Foam::functionObjectList::propsDict()
|
||||||
{
|
{
|
||||||
if (!stateDictPtr_)
|
if (!propsDictPtr_)
|
||||||
{
|
{
|
||||||
createStateDict();
|
createPropertiesDict();
|
||||||
}
|
}
|
||||||
|
|
||||||
return *stateDictPtr_;
|
return *propsDictPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Foam::IOdictionary& Foam::functionObjectList::stateDict() const
|
const Foam::functionObjects::properties&
|
||||||
|
Foam::functionObjectList::propsDict() const
|
||||||
{
|
{
|
||||||
if (!stateDictPtr_)
|
if (!propsDictPtr_)
|
||||||
{
|
{
|
||||||
createStateDict();
|
createPropertiesDict();
|
||||||
}
|
}
|
||||||
|
|
||||||
return *stateDictPtr_;
|
return *propsDictPtr_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -768,13 +769,13 @@ bool Foam::functionObjectList::execute()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force writing of state dictionary after function object execution
|
// Force writing of properties dictionary after function object execution
|
||||||
if (time_.writeTime())
|
if (time_.writeTime())
|
||||||
{
|
{
|
||||||
const auto oldPrecision = IOstream::precision_;
|
const auto oldPrecision = IOstream::precision_;
|
||||||
IOstream::precision_ = 16;
|
IOstream::precision_ = 16;
|
||||||
|
|
||||||
stateDictPtr_->writeObject
|
propsDictPtr_->writeObject
|
||||||
(
|
(
|
||||||
IOstreamOption(IOstream::ASCII, time_.writeCompression()),
|
IOstreamOption(IOstream::ASCII, time_.writeCompression()),
|
||||||
true
|
true
|
||||||
@ -930,9 +931,9 @@ bool Foam::functionObjectList::adjustTimeStep()
|
|||||||
|
|
||||||
bool Foam::functionObjectList::read()
|
bool Foam::functionObjectList::read()
|
||||||
{
|
{
|
||||||
if (!stateDictPtr_)
|
if (!propsDictPtr_)
|
||||||
{
|
{
|
||||||
createStateDict();
|
createPropertiesDict();
|
||||||
}
|
}
|
||||||
|
|
||||||
updated_ = execution_;
|
updated_ = execution_;
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -87,6 +87,7 @@ SourceFiles
|
|||||||
#include "HashTable.H"
|
#include "HashTable.H"
|
||||||
#include "IOdictionary.H"
|
#include "IOdictionary.H"
|
||||||
#include "HashSet.H"
|
#include "HashSet.H"
|
||||||
|
#include "functionObjectProperties.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -145,7 +146,7 @@ class functionObjectList
|
|||||||
const dictionary& parentDict_;
|
const dictionary& parentDict_;
|
||||||
|
|
||||||
//- Function object properties - stores state information
|
//- Function object properties - stores state information
|
||||||
mutable autoPtr<IOdictionary> stateDictPtr_;
|
mutable autoPtr<functionObjects::properties> propsDictPtr_;
|
||||||
|
|
||||||
//- Function objects output registry
|
//- Function objects output registry
|
||||||
mutable autoPtr<objectRegistry> objectsRegistryPtr_;
|
mutable autoPtr<objectRegistry> objectsRegistryPtr_;
|
||||||
@ -165,8 +166,8 @@ class functionObjectList
|
|||||||
//- List of functions
|
//- List of functions
|
||||||
PtrList<functionObject>& functions() { return *this; }
|
PtrList<functionObject>& functions() { return *this; }
|
||||||
|
|
||||||
//- Create state dictionary - attached to Time.
|
//- Create properties dictionary - attached to Time.
|
||||||
void createStateDict() const;
|
void createPropertiesDict() const;
|
||||||
|
|
||||||
//- Create registry for output objects - attached to Time.
|
//- Create registry for output objects - attached to Time.
|
||||||
void createOutputRegistry() const;
|
void createOutputRegistry() const;
|
||||||
@ -262,19 +263,19 @@ public:
|
|||||||
//- Access to the functionObjects
|
//- Access to the functionObjects
|
||||||
using PtrList<functionObject>::operator[];
|
using PtrList<functionObject>::operator[];
|
||||||
|
|
||||||
//- Return the current trigger index (read from the stateDict)
|
//- Return the current trigger index (read from the propsDict)
|
||||||
label triggerIndex() const;
|
label triggerIndex() const;
|
||||||
|
|
||||||
//- Reset/read state dictionary for current time
|
//- Reset/read properties dictionary for current time
|
||||||
void resetState();
|
void resetPropertiesDict();
|
||||||
|
|
||||||
//- Write access to the state dictionary ("functionObjectProperties")
|
//- Write access to the properties dictionary
|
||||||
//- registered on Time
|
//- ("functionObjectProperties") registered on Time
|
||||||
IOdictionary& stateDict();
|
functionObjects::properties& propsDict();
|
||||||
|
|
||||||
//- Const access to the state dictionary ("functionObjectProperties")
|
//- Const access to the properties dictionary
|
||||||
//- registered on Time
|
//- ("functionObjectProperties") registered on Time
|
||||||
const IOdictionary& stateDict() const;
|
const Foam::functionObjects::properties& propsDict() const;
|
||||||
|
|
||||||
//- Write access to the output objects ("functionObjectObjects")
|
//- Write access to the output objects ("functionObjectObjects")
|
||||||
//- registered on Time
|
//- registered on Time
|
||||||
|
|||||||
@ -0,0 +1,320 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "functionObjectProperties.H"
|
||||||
|
#include "SHA1.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
const Foam::word Foam::functionObjects::properties::resultsName_ =
|
||||||
|
SHA1("results").str();
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::functionObjects::properties::properties
|
||||||
|
(
|
||||||
|
const IOobject& io
|
||||||
|
)
|
||||||
|
:
|
||||||
|
IOdictionary(io)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::wordList Foam::functionObjects::properties::objectNames() const
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
// - remove resultsName_ dict from results?
|
||||||
|
// - or put objects into their own subdictionary?
|
||||||
|
return sortedToc();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::functionObjects::properties::hasObjectDict
|
||||||
|
(
|
||||||
|
const word& objectName
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return found(objectName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::dictionary& Foam::functionObjects::properties::getObjectDict
|
||||||
|
(
|
||||||
|
const word& objectName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (!found(objectName))
|
||||||
|
{
|
||||||
|
add(objectName, dictionary());
|
||||||
|
}
|
||||||
|
|
||||||
|
return subDict(objectName);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::functionObjects::properties::clearTrigger()
|
||||||
|
{
|
||||||
|
remove("triggerIndex");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::label Foam::functionObjects::properties::getTrigger() const
|
||||||
|
{
|
||||||
|
// Like getOrDefault, but without reporting missing entry (noisy)
|
||||||
|
label idx = labelMin;
|
||||||
|
readIfPresent("triggerIndex", idx);
|
||||||
|
return idx;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::functionObjects::properties::setTrigger
|
||||||
|
(
|
||||||
|
const label triggeri,
|
||||||
|
bool increaseOnly
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const label currTriggeri = getTrigger();
|
||||||
|
|
||||||
|
if (increaseOnly ? (triggeri > currTriggeri) : (triggeri != currTriggeri))
|
||||||
|
{
|
||||||
|
set("triggerIndex", triggeri);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TBD: any special handling for triggeri == labelMin - eg, clearTrigger()
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::functionObjects::properties::foundObjectProperty
|
||||||
|
(
|
||||||
|
const word& objectName,
|
||||||
|
const word& entryName
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (found(objectName))
|
||||||
|
{
|
||||||
|
const dictionary& baseDict = subDict(objectName);
|
||||||
|
return baseDict.found(entryName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::functionObjects::properties::getObjectDict
|
||||||
|
(
|
||||||
|
const word& objectName,
|
||||||
|
const word& entryName,
|
||||||
|
dictionary& dict
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (found(objectName))
|
||||||
|
{
|
||||||
|
const dictionary& baseDict = subDict(objectName);
|
||||||
|
|
||||||
|
if (baseDict.found(entryName) && baseDict.isDict(entryName))
|
||||||
|
{
|
||||||
|
dict = baseDict.subDict(entryName);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::functionObjects::properties::hasResultObject
|
||||||
|
(
|
||||||
|
const word& objectName
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (found(resultsName_))
|
||||||
|
{
|
||||||
|
return subDict(resultsName_).found(objectName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::wordList Foam::functionObjects::properties::objectResultNames() const
|
||||||
|
{
|
||||||
|
if (found(resultsName_))
|
||||||
|
{
|
||||||
|
return subDict(resultsName_).sortedToc();
|
||||||
|
}
|
||||||
|
|
||||||
|
return wordList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::functionObjects::properties::hasResultObjectEntry
|
||||||
|
(
|
||||||
|
const word& objectName,
|
||||||
|
const word& entryName
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (found(resultsName_))
|
||||||
|
{
|
||||||
|
const dictionary& resultsDict = subDict(resultsName_);
|
||||||
|
|
||||||
|
if (resultsDict.found(objectName))
|
||||||
|
{
|
||||||
|
const dictionary& objectDict = resultsDict.subDict(objectName);
|
||||||
|
|
||||||
|
for (const entry& dEntry : objectDict)
|
||||||
|
{
|
||||||
|
const dictionary& dict = dEntry.dict();
|
||||||
|
|
||||||
|
if (dict.found(entryName))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::word Foam::functionObjects::properties::objectResultType
|
||||||
|
(
|
||||||
|
const word& objectName,
|
||||||
|
const word& entryName
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (found(resultsName_))
|
||||||
|
{
|
||||||
|
const dictionary& resultsDict = subDict(resultsName_);
|
||||||
|
|
||||||
|
if (resultsDict.found(objectName))
|
||||||
|
{
|
||||||
|
const dictionary& objectDict = resultsDict.subDict(objectName);
|
||||||
|
|
||||||
|
for (const entry& dEntry : objectDict)
|
||||||
|
{
|
||||||
|
const dictionary& dict = dEntry.dict();
|
||||||
|
|
||||||
|
if (dict.found(entryName))
|
||||||
|
{
|
||||||
|
return dict.dictName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return word::null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::wordList Foam::functionObjects::properties::objectResultEntries
|
||||||
|
(
|
||||||
|
const word& objectName
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
DynamicList<word> result;
|
||||||
|
|
||||||
|
if (found(resultsName_))
|
||||||
|
{
|
||||||
|
const dictionary& resultsDict = subDict(resultsName_);
|
||||||
|
|
||||||
|
if (resultsDict.found(objectName))
|
||||||
|
{
|
||||||
|
const dictionary& objectDict = resultsDict.subDict(objectName);
|
||||||
|
|
||||||
|
for (const entry& dEntry : objectDict)
|
||||||
|
{
|
||||||
|
const dictionary& dict = dEntry.dict();
|
||||||
|
|
||||||
|
result.append(dict.toc());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
wordList entries;
|
||||||
|
entries.transfer(result);
|
||||||
|
|
||||||
|
return entries;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::functionObjects::properties::writeResultEntries
|
||||||
|
(
|
||||||
|
const word& objectName,
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (found(resultsName_))
|
||||||
|
{
|
||||||
|
const dictionary& resultsDict = subDict(resultsName_);
|
||||||
|
|
||||||
|
if (resultsDict.found(objectName))
|
||||||
|
{
|
||||||
|
const dictionary& objectDict = resultsDict.subDict(objectName);
|
||||||
|
|
||||||
|
for (const word& dataFormat : objectDict.sortedToc())
|
||||||
|
{
|
||||||
|
os << " Type: " << dataFormat << nl;
|
||||||
|
|
||||||
|
const dictionary& resultDict = objectDict.subDict(dataFormat);
|
||||||
|
|
||||||
|
for (const word& result : resultDict.sortedToc())
|
||||||
|
{
|
||||||
|
os << " " << result << nl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::functionObjects::properties::writeAllResultEntries
|
||||||
|
(
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (found(resultsName_))
|
||||||
|
{
|
||||||
|
const dictionary& resultsDict = subDict(resultsName_);
|
||||||
|
|
||||||
|
for (const word& objectName : resultsDict.sortedToc())
|
||||||
|
{
|
||||||
|
os << "Object: " << objectName << endl;
|
||||||
|
|
||||||
|
writeResultEntries(objectName, os);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,250 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::functionObjects::properties
|
||||||
|
|
||||||
|
Description
|
||||||
|
Storage for function object properties, derived from IOdictionary.
|
||||||
|
Provides functionality to read/write state information (data required for
|
||||||
|
smooth restart behaviour) and results to/from the state dictionary
|
||||||
|
|
||||||
|
Note: cannot be accessed until after construction of thefunction objects,
|
||||||
|
since the owner container functionObjectList is owned by time, and time owns
|
||||||
|
[this] i.e. need to wait for time to be fully constructed.
|
||||||
|
|
||||||
|
See also
|
||||||
|
Foam::functionObject
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
functionObjectProperties.C
|
||||||
|
functionObjectPropertiesTemplates.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef functionObjects_properties_H
|
||||||
|
#define functionObjects_properties_H
|
||||||
|
|
||||||
|
#include "IOdictionary.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace functionObjects
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class properties Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class properties
|
||||||
|
:
|
||||||
|
public IOdictionary
|
||||||
|
{
|
||||||
|
// Private Member Data
|
||||||
|
|
||||||
|
//- Name of the results dictionary
|
||||||
|
static const word resultsName_;
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- No copy construct
|
||||||
|
properties(const properties&) = delete;
|
||||||
|
|
||||||
|
//- No copy assignment
|
||||||
|
void operator=(const properties&) = delete;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
explicit properties(const IOobject& io);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~properties() = default;
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return list of object names
|
||||||
|
wordList objectNames() const;
|
||||||
|
|
||||||
|
//- Return true if the object with objectName exists
|
||||||
|
bool hasObjectDict(const word& objectName) const;
|
||||||
|
|
||||||
|
//- Return access to the property dictionary
|
||||||
|
dictionary& propertyDict(const word& objectName);
|
||||||
|
|
||||||
|
|
||||||
|
// Properties
|
||||||
|
|
||||||
|
//- Get dictionary for named object. Creates one if required
|
||||||
|
dictionary& getObjectDict(const word& objectName);
|
||||||
|
|
||||||
|
//- Return true if the property exists
|
||||||
|
bool foundObjectProperty
|
||||||
|
(
|
||||||
|
const word& objectName,
|
||||||
|
const word& entryName
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Remove the trigger index from the properties
|
||||||
|
void clearTrigger();
|
||||||
|
|
||||||
|
//- Get the current trigger index
|
||||||
|
label getTrigger() const;
|
||||||
|
|
||||||
|
//- Set the trigger index. Normally only if greater than current
|
||||||
|
//
|
||||||
|
// \param triggeri the new trigger index
|
||||||
|
// \param increaseOnly (default) only change if new index
|
||||||
|
// is greater than the current index.
|
||||||
|
//
|
||||||
|
// \return True if the index changed
|
||||||
|
bool setTrigger(const label triggeri, bool increaseOnly = true);
|
||||||
|
|
||||||
|
//- Set dictionary from named object, return true if set
|
||||||
|
bool getObjectDict
|
||||||
|
(
|
||||||
|
const word& objectName,
|
||||||
|
const word& entryName,
|
||||||
|
dictionary& dict
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Retrieve generic property from named object
|
||||||
|
template<class Type>
|
||||||
|
Type getObjectProperty
|
||||||
|
(
|
||||||
|
const word& objectName,
|
||||||
|
const word& entryName,
|
||||||
|
const Type& defaultValue = Type(Zero)
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Set generic property from named object, return true if set
|
||||||
|
template<class Type>
|
||||||
|
bool getObjectProperty
|
||||||
|
(
|
||||||
|
const word& objectName,
|
||||||
|
const word& entryName,
|
||||||
|
Type& value
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Add generic property from named object
|
||||||
|
template<class Type>
|
||||||
|
void setObjectProperty
|
||||||
|
(
|
||||||
|
const word& objectName,
|
||||||
|
const word& entryName,
|
||||||
|
const Type& value
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Results
|
||||||
|
|
||||||
|
//- Add result from named object
|
||||||
|
template<class Type>
|
||||||
|
void setObjectResult
|
||||||
|
(
|
||||||
|
const word& objectName,
|
||||||
|
const word& entryName,
|
||||||
|
const Type& value
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Retrieve result from named object
|
||||||
|
template<class Type>
|
||||||
|
Type getObjectResult
|
||||||
|
(
|
||||||
|
const word& objectName,
|
||||||
|
const word& entryName,
|
||||||
|
const Type& defaultValue = Type(Zero)
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Set result from named object, return true if set
|
||||||
|
template<class Type>
|
||||||
|
bool getObjectResult
|
||||||
|
(
|
||||||
|
const word& objectName,
|
||||||
|
const word& entryName,
|
||||||
|
Type& value
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Return true if the object with objectName exists in results
|
||||||
|
bool hasResultObject(const word& objectName) const;
|
||||||
|
|
||||||
|
//- Return list of objects with results
|
||||||
|
wordList objectResultNames() const;
|
||||||
|
|
||||||
|
//- Return true if the object with objectName exists and has
|
||||||
|
//- entryName in its results
|
||||||
|
bool hasResultObjectEntry
|
||||||
|
(
|
||||||
|
const word& objectName,
|
||||||
|
const word& entryName
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Return the type of result
|
||||||
|
word objectResultType
|
||||||
|
(
|
||||||
|
const word& objectName,
|
||||||
|
const word& entryName
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Return result entries for named object
|
||||||
|
wordList objectResultEntries(const word& objectName) const;
|
||||||
|
|
||||||
|
//- Write the results entries for all objects to stream
|
||||||
|
void writeResultEntries(Ostream& os) const;
|
||||||
|
|
||||||
|
//- Write the results entries for named object to stream
|
||||||
|
void writeResultEntries(const word& objectName, Ostream& os) const;
|
||||||
|
|
||||||
|
//- Write the results entries for all objects to stream
|
||||||
|
void writeAllResultEntries(Ostream& os) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace functionObjects
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
#include "functionObjectPropertiesTemplates.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,163 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "IOdictionary.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Type Foam::functionObjects::properties::getObjectProperty
|
||||||
|
(
|
||||||
|
const word& objectName,
|
||||||
|
const word& entryName,
|
||||||
|
const Type& defaultValue
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
Type result = defaultValue;
|
||||||
|
getObjectProperty(objectName, entryName, result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
bool Foam::functionObjects::properties::getObjectProperty
|
||||||
|
(
|
||||||
|
const word& objectName,
|
||||||
|
const word& entryName,
|
||||||
|
Type& value
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (this->found(objectName))
|
||||||
|
{
|
||||||
|
const dictionary& baseDict = this->subDict(objectName);
|
||||||
|
return baseDict.readIfPresent(entryName, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::functionObjects::properties::setObjectProperty
|
||||||
|
(
|
||||||
|
const word& objectName,
|
||||||
|
const word& entryName,
|
||||||
|
const Type& value
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (!this->found(objectName))
|
||||||
|
{
|
||||||
|
this->add(objectName, dictionary());
|
||||||
|
}
|
||||||
|
|
||||||
|
dictionary& baseDict = this->subDict(objectName);
|
||||||
|
baseDict.add(entryName, value, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::functionObjects::properties::setObjectResult
|
||||||
|
(
|
||||||
|
const word& objectName,
|
||||||
|
const word& entryName,
|
||||||
|
const Type& value
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (!this->found(resultsName_))
|
||||||
|
{
|
||||||
|
this->add(resultsName_, dictionary());
|
||||||
|
}
|
||||||
|
|
||||||
|
dictionary& resultsDict = this->subDict(resultsName_);
|
||||||
|
|
||||||
|
if (!resultsDict.found(objectName))
|
||||||
|
{
|
||||||
|
resultsDict.add(objectName, dictionary());
|
||||||
|
}
|
||||||
|
|
||||||
|
dictionary& objectDict = resultsDict.subDict(objectName);
|
||||||
|
|
||||||
|
const word& dictTypeName = pTraits<Type>::typeName;
|
||||||
|
|
||||||
|
if (!objectDict.found(dictTypeName))
|
||||||
|
{
|
||||||
|
objectDict.add(dictTypeName, dictionary());
|
||||||
|
}
|
||||||
|
|
||||||
|
dictionary& resultTypeDict = objectDict.subDict(dictTypeName);
|
||||||
|
|
||||||
|
resultTypeDict.add(entryName, value, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Type Foam::functionObjects::properties::getObjectResult
|
||||||
|
(
|
||||||
|
const word& objectName,
|
||||||
|
const word& entryName,
|
||||||
|
const Type& defaultValue
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
Type result = defaultValue;
|
||||||
|
(void)getObjectResult(objectName, entryName, result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
bool Foam::functionObjects::properties::getObjectResult
|
||||||
|
(
|
||||||
|
const word& objectName,
|
||||||
|
const word& entryName,
|
||||||
|
Type& value
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (this->found(resultsName_))
|
||||||
|
{
|
||||||
|
const dictionary& resultsDict = this->subDict(resultsName_);
|
||||||
|
|
||||||
|
if (resultsDict.found(objectName))
|
||||||
|
{
|
||||||
|
const dictionary& objectDict = resultsDict.subDict(objectName);
|
||||||
|
|
||||||
|
const word& dictTypeName = pTraits<Type>::typeName;
|
||||||
|
|
||||||
|
if (objectDict.found(dictTypeName))
|
||||||
|
{
|
||||||
|
const dictionary& resultTypeDict =
|
||||||
|
objectDict.subDict(dictTypeName);
|
||||||
|
|
||||||
|
return resultTypeDict.readIfPresent<Type>(entryName, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015 OpenFOAM Foundation
|
Copyright (C) 2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -37,16 +37,20 @@ const Foam::word Foam::functionObjects::stateFunctionObject::resultsName_ =
|
|||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
const Foam::IOdictionary&
|
const Foam::functionObjects::properties&
|
||||||
Foam::functionObjects::stateFunctionObject::stateDict() const
|
Foam::functionObjects::stateFunctionObject::stateDict() const
|
||||||
{
|
{
|
||||||
return time_.functionObjects().stateDict();
|
return time_.functionObjects().propsDict();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::IOdictionary& Foam::functionObjects::stateFunctionObject::stateDict()
|
Foam::functionObjects::properties&
|
||||||
|
Foam::functionObjects::stateFunctionObject::stateDict()
|
||||||
{
|
{
|
||||||
return const_cast<IOdictionary&>(time_.functionObjects().stateDict());
|
return const_cast<functionObjects::properties&>
|
||||||
|
(
|
||||||
|
time_.functionObjects().propsDict()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -66,42 +70,29 @@ Foam::functionObjects::stateFunctionObject::stateFunctionObject
|
|||||||
|
|
||||||
Foam::dictionary& Foam::functionObjects::stateFunctionObject::propertyDict()
|
Foam::dictionary& Foam::functionObjects::stateFunctionObject::propertyDict()
|
||||||
{
|
{
|
||||||
IOdictionary& stateDict = this->stateDict();
|
return stateDict().getObjectDict(name());
|
||||||
|
|
||||||
if (!stateDict.found(name()))
|
|
||||||
{
|
|
||||||
stateDict.add(name(), dictionary());
|
|
||||||
}
|
|
||||||
|
|
||||||
return stateDict.subDict(name());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::functionObjects::stateFunctionObject::setTrigger
|
void Foam::functionObjects::stateFunctionObject::clearTrigger()
|
||||||
(
|
|
||||||
const label triggeri
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
IOdictionary& stateDict = this->stateDict();
|
return stateDict().clearTrigger();
|
||||||
|
|
||||||
label oldTriggeri =
|
|
||||||
stateDict.getOrDefault<label>("triggerIndex", labelMin);
|
|
||||||
|
|
||||||
if (triggeri > oldTriggeri)
|
|
||||||
{
|
|
||||||
stateDict.set("triggerIndex", triggeri);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::label Foam::functionObjects::stateFunctionObject::getTrigger() const
|
Foam::label Foam::functionObjects::stateFunctionObject::getTrigger() const
|
||||||
{
|
{
|
||||||
const IOdictionary& stateDict = this->stateDict();
|
return stateDict().getTrigger();
|
||||||
|
}
|
||||||
|
|
||||||
return stateDict.getOrDefault<label>("triggerIndex", labelMin);
|
|
||||||
|
bool Foam::functionObjects::stateFunctionObject::setTrigger
|
||||||
|
(
|
||||||
|
const label triggeri,
|
||||||
|
bool increaseOnly
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return stateDict().setTrigger(triggeri, increaseOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -110,15 +101,7 @@ bool Foam::functionObjects::stateFunctionObject::foundProperty
|
|||||||
const word& entryName
|
const word& entryName
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const IOdictionary& stateDict = this->stateDict();
|
return stateDict().foundObjectProperty(name(), entryName);
|
||||||
|
|
||||||
if (stateDict.found(name()))
|
|
||||||
{
|
|
||||||
const dictionary& baseDict = stateDict.subDict(name());
|
|
||||||
return baseDict.found(entryName);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -128,7 +111,7 @@ bool Foam::functionObjects::stateFunctionObject::getDict
|
|||||||
dictionary& dict
|
dictionary& dict
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return getObjectDict(name(), entryName, dict);
|
return stateDict().getObjectDict(name(), entryName, dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -139,19 +122,7 @@ bool Foam::functionObjects::stateFunctionObject::getObjectDict
|
|||||||
dictionary& dict
|
dictionary& dict
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const IOdictionary& stateDict = this->stateDict();
|
return stateDict().getObjectDict(objectName, entryName, dict);
|
||||||
|
|
||||||
if (stateDict.found(objectName))
|
|
||||||
{
|
|
||||||
const dictionary& baseDict = stateDict.subDict(objectName);
|
|
||||||
if (baseDict.found(entryName) && baseDict.isDict(entryName))
|
|
||||||
{
|
|
||||||
dict = baseDict.subDict(entryName);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -160,7 +131,7 @@ Foam::word Foam::functionObjects::stateFunctionObject::resultType
|
|||||||
const word& entryName
|
const word& entryName
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return objectResultType(name(), entryName);
|
return stateDict().objectResultType(name(), entryName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -170,79 +141,33 @@ Foam::word Foam::functionObjects::stateFunctionObject::objectResultType
|
|||||||
const word& entryName
|
const word& entryName
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
word result = word::null;
|
return stateDict().objectResultType(objectName, entryName);
|
||||||
const IOdictionary& stateDict = this->stateDict();
|
|
||||||
|
|
||||||
if (stateDict.found(resultsName_))
|
|
||||||
{
|
|
||||||
const dictionary& resultsDict = stateDict.subDict(resultsName_);
|
|
||||||
|
|
||||||
if (resultsDict.found(objectName))
|
|
||||||
{
|
|
||||||
const dictionary& objectDict = resultsDict.subDict(objectName);
|
|
||||||
|
|
||||||
for (const entry& dEntry : objectDict)
|
|
||||||
{
|
|
||||||
const dictionary& dict = dEntry.dict();
|
|
||||||
|
|
||||||
if (dict.found(entryName))
|
|
||||||
{
|
|
||||||
return dict.dictName();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::List<Foam::word>
|
Foam::wordList
|
||||||
Foam::functionObjects::stateFunctionObject::objectResultEntries() const
|
Foam::functionObjects::stateFunctionObject::objectResultEntries() const
|
||||||
{
|
{
|
||||||
return objectResultEntries(name());
|
return stateDict().objectResultEntries(name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::List<Foam::word>
|
Foam::wordList
|
||||||
Foam::functionObjects::stateFunctionObject::objectResultEntries
|
Foam::functionObjects::stateFunctionObject::objectResultEntries
|
||||||
(
|
(
|
||||||
const word& objectName
|
const word& objectName
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
DynamicList<word> result(2);
|
return stateDict().objectResultEntries(objectName);
|
||||||
|
|
||||||
const IOdictionary& stateDict = this->stateDict();
|
|
||||||
|
|
||||||
if (stateDict.found(resultsName_))
|
|
||||||
{
|
|
||||||
const dictionary& resultsDict = stateDict.subDict(resultsName_);
|
|
||||||
|
|
||||||
if (resultsDict.found(objectName))
|
|
||||||
{
|
|
||||||
const dictionary& objectDict = resultsDict.subDict(objectName);
|
|
||||||
|
|
||||||
for (const entry& dEntry : objectDict)
|
|
||||||
{
|
|
||||||
const dictionary& dict = dEntry.dict();
|
|
||||||
|
|
||||||
result.append(dict.toc());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
wordList entries;
|
|
||||||
entries.transfer(result);
|
|
||||||
|
|
||||||
return entries;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::stateFunctionObject::writeResultEntries
|
void Foam::functionObjects::stateFunctionObject::writeResultEntries
|
||||||
(
|
(
|
||||||
Ostream& os
|
Ostream& os
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
writeResultEntries(name(), os);
|
return stateDict().writeResultEntries(name(), os);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -252,29 +177,7 @@ void Foam::functionObjects::stateFunctionObject::writeResultEntries
|
|||||||
Ostream& os
|
Ostream& os
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const IOdictionary& stateDict = this->stateDict();
|
return stateDict().writeResultEntries(objectName, os);
|
||||||
|
|
||||||
if (stateDict.found(resultsName_))
|
|
||||||
{
|
|
||||||
const dictionary& resultsDict = stateDict.subDict(resultsName_);
|
|
||||||
|
|
||||||
if (resultsDict.found(objectName))
|
|
||||||
{
|
|
||||||
const dictionary& objectDict = resultsDict.subDict(objectName);
|
|
||||||
|
|
||||||
for (const word& dataFormat : objectDict.sortedToc())
|
|
||||||
{
|
|
||||||
os << " Type: " << dataFormat << nl;
|
|
||||||
|
|
||||||
const dictionary& resultDict = objectDict.subDict(dataFormat);
|
|
||||||
|
|
||||||
for (const word& result : resultDict.sortedToc())
|
|
||||||
{
|
|
||||||
os << " " << result << nl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -283,21 +186,7 @@ void Foam::functionObjects::stateFunctionObject::writeAllResultEntries
|
|||||||
Ostream& os
|
Ostream& os
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const IOdictionary& stateDict = this->stateDict();
|
return stateDict().writeAllResultEntries(os);
|
||||||
|
|
||||||
if (stateDict.found(resultsName_))
|
|
||||||
{
|
|
||||||
const dictionary& resultsDict = stateDict.subDict(resultsName_);
|
|
||||||
|
|
||||||
const wordList allObjectNames = resultsDict.sortedToc();
|
|
||||||
|
|
||||||
for (const word& objectName : allObjectNames)
|
|
||||||
{
|
|
||||||
os << "Object: " << objectName << endl;
|
|
||||||
|
|
||||||
writeResultEntries(objectName, os);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015 OpenFOAM Foundation
|
Copyright (C) 2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2019 OpenCFD Ltd.
|
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -50,12 +50,14 @@ SourceFiles
|
|||||||
#define functionObjects_stateFunctionObject_H
|
#define functionObjects_stateFunctionObject_H
|
||||||
|
|
||||||
#include "timeFunctionObject.H"
|
#include "timeFunctionObject.H"
|
||||||
|
#include "functionObjectProperties.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Forward Declarations
|
||||||
class IOdictionary;
|
class IOdictionary;
|
||||||
|
|
||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
@ -80,10 +82,10 @@ protected:
|
|||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
//- Return a const reference to the state dictionary
|
//- Return a const reference to the state dictionary
|
||||||
const IOdictionary& stateDict() const;
|
const functionObjects::properties& stateDict() const;
|
||||||
|
|
||||||
//- Return non-const access to the state dictionary
|
//- Return non-const access to the state dictionary
|
||||||
IOdictionary& stateDict();
|
functionObjects::properties& stateDict();
|
||||||
|
|
||||||
|
|
||||||
//- No copy construct
|
//- No copy construct
|
||||||
@ -116,11 +118,20 @@ public:
|
|||||||
//- Return true if the property exists
|
//- Return true if the property exists
|
||||||
bool foundProperty(const word& entryName) const;
|
bool foundProperty(const word& entryName) const;
|
||||||
|
|
||||||
|
//- Remove the trigger index from the properties
|
||||||
|
void clearTrigger();
|
||||||
|
|
||||||
//- Get the current trigger index
|
//- Get the current trigger index
|
||||||
label getTrigger() const;
|
label getTrigger() const;
|
||||||
|
|
||||||
//- Set the current trigger index
|
//- Set the trigger index. Normally only if greater than current
|
||||||
bool setTrigger(const label triggeri);
|
//
|
||||||
|
// \param triggeri the new trigger index
|
||||||
|
// \param increaseOnly (default) only change if new index
|
||||||
|
// is greater than the current index.
|
||||||
|
//
|
||||||
|
// \return True if the index changed
|
||||||
|
bool setTrigger(const label triggeri, bool increaseOnly = true);
|
||||||
|
|
||||||
//- Set dictionary, return true if set
|
//- Set dictionary, return true if set
|
||||||
bool getDict
|
bool getDict
|
||||||
@ -237,10 +248,10 @@ public:
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Retrieve the result entries
|
//- Retrieve the result entries
|
||||||
List<word> objectResultEntries() const;
|
wordList objectResultEntries() const;
|
||||||
|
|
||||||
//- Return result entries for named object
|
//- Return result entries for named object
|
||||||
List<word> objectResultEntries(const word& objectName) const;
|
wordList objectResultEntries(const word& objectName) const;
|
||||||
|
|
||||||
//- Write the results entries for all objects to stream
|
//- Write the results entries for all objects to stream
|
||||||
void writeResultEntries(Ostream& os) const;
|
void writeResultEntries(Ostream& os) const;
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015 OpenFOAM Foundation
|
Copyright (C) 2015 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2016 OpenCFD Ltd.
|
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -87,15 +87,7 @@ bool Foam::functionObjects::stateFunctionObject::getObjectProperty
|
|||||||
Type& value
|
Type& value
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const IOdictionary& stateDict = this->stateDict();
|
return stateDict().getObjectProperty(objectName, entryName, value);
|
||||||
|
|
||||||
if (stateDict.found(objectName))
|
|
||||||
{
|
|
||||||
const dictionary& baseDict = stateDict.subDict(objectName);
|
|
||||||
return baseDict.readIfPresent(entryName, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -107,15 +99,7 @@ void Foam::functionObjects::stateFunctionObject::setObjectProperty
|
|||||||
const Type& value
|
const Type& value
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
IOdictionary& stateDict = this->stateDict();
|
stateDict().setObjectProperty(objectName, entryName, value);
|
||||||
|
|
||||||
if (!stateDict.found(objectName))
|
|
||||||
{
|
|
||||||
stateDict.add(objectName, dictionary());
|
|
||||||
}
|
|
||||||
|
|
||||||
dictionary& baseDict = stateDict.subDict(objectName);
|
|
||||||
baseDict.add(entryName, value, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -138,32 +122,7 @@ void Foam::functionObjects::stateFunctionObject::setObjectResult
|
|||||||
const Type& value
|
const Type& value
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
IOdictionary& stateDict = this->stateDict();
|
stateDict().setObjectResult(objectName, entryName, value);
|
||||||
|
|
||||||
if (!stateDict.found(resultsName_))
|
|
||||||
{
|
|
||||||
stateDict.add(resultsName_, dictionary());
|
|
||||||
}
|
|
||||||
|
|
||||||
dictionary& resultsDict = stateDict.subDict(resultsName_);
|
|
||||||
|
|
||||||
if (!resultsDict.found(objectName))
|
|
||||||
{
|
|
||||||
resultsDict.add(name(), dictionary());
|
|
||||||
}
|
|
||||||
|
|
||||||
dictionary& objectDict = resultsDict.subDict(objectName);
|
|
||||||
|
|
||||||
const word& dictTypeName = pTraits<Type>::typeName;
|
|
||||||
|
|
||||||
if (!objectDict.found(dictTypeName))
|
|
||||||
{
|
|
||||||
objectDict.add(dictTypeName, dictionary());
|
|
||||||
}
|
|
||||||
|
|
||||||
dictionary& resultTypeDict = objectDict.subDict(dictTypeName);
|
|
||||||
|
|
||||||
resultTypeDict.add(entryName, value, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -200,29 +159,7 @@ bool Foam::functionObjects::stateFunctionObject::getObjectResult
|
|||||||
Type& value
|
Type& value
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const IOdictionary& stateDict = this->stateDict();
|
return stateDict().getObjectResult(objectName, entryName, value);
|
||||||
|
|
||||||
if (stateDict.found(resultsName_))
|
|
||||||
{
|
|
||||||
const dictionary& resultsDict = stateDict.subDict(resultsName_);
|
|
||||||
|
|
||||||
if (resultsDict.found(objectName))
|
|
||||||
{
|
|
||||||
const dictionary& objectDict = resultsDict.subDict(objectName);
|
|
||||||
|
|
||||||
const word& dictTypeName = pTraits<Type>::typeName;
|
|
||||||
|
|
||||||
if (objectDict.found(dictTypeName))
|
|
||||||
{
|
|
||||||
const dictionary& resultTypeDict =
|
|
||||||
objectDict.subDict(dictTypeName);
|
|
||||||
|
|
||||||
return resultTypeDict.readIfPresent<Type>(entryName, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -80,8 +80,7 @@ class timeControl
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
// Public Enumerations
|
||||||
// Public enumerations
|
|
||||||
|
|
||||||
//- Control mode
|
//- Control mode
|
||||||
enum class controlMode
|
enum class controlMode
|
||||||
@ -97,7 +96,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Private data
|
// Private Data
|
||||||
|
|
||||||
//- Input dictionary
|
//- Input dictionary
|
||||||
dictionary dict_;
|
dictionary dict_;
|
||||||
@ -108,13 +107,13 @@ private:
|
|||||||
//- Control mode (combination of time/trigger behaviour)
|
//- Control mode (combination of time/trigger behaviour)
|
||||||
controlMode controlMode_;
|
controlMode controlMode_;
|
||||||
|
|
||||||
//- Activation time - defaults to -VGREAT
|
//- Activation time - defaults to -VGREAT (ie, active)
|
||||||
scalar timeStart_;
|
scalar timeStart_;
|
||||||
|
|
||||||
//- De-activation time - defaults to VGREAT
|
//- De-activation time - defaults to VGREAT
|
||||||
scalar timeEnd_;
|
scalar timeEnd_;
|
||||||
|
|
||||||
//- Activation trigger index - defaults to labelMin
|
//- Activation trigger index - defaults to labelMax (ie, inactive)
|
||||||
label triggerStart_;
|
label triggerStart_;
|
||||||
|
|
||||||
//- De-activation trigger index - defaults to labelMax
|
//- De-activation trigger index - defaults to labelMax
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -33,10 +33,11 @@ template<class Type>
|
|||||||
Foam::Function1Types::Function1Expression<Type>::Function1Expression
|
Foam::Function1Types::Function1Expression<Type>::Function1Expression
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
Function1<Type>(entryName, dict),
|
Function1<Type>(entryName, dict, obrPtr),
|
||||||
dict_(dict),
|
dict_(dict),
|
||||||
valueExpr_(),
|
valueExpr_(),
|
||||||
driver_(1, dict_)
|
driver_(1, dict_)
|
||||||
@ -88,6 +89,8 @@ Type Foam::Function1Types::Function1Expression<Type>::value
|
|||||||
|
|
||||||
driver_.setArgument(x);
|
driver_.setArgument(x);
|
||||||
|
|
||||||
|
driver_.resetDb(this->whichDb());
|
||||||
|
|
||||||
driver_.parse(this->valueExpr_);
|
driver_.parse(this->valueExpr_);
|
||||||
|
|
||||||
expressions::exprResult result(driver_.result());
|
expressions::exprResult result(driver_.result());
|
||||||
@ -98,7 +101,9 @@ Type Foam::Function1Types::Function1Expression<Type>::value
|
|||||||
if (!result.hasValue() || !result.size() || !result.isType<Type>())
|
if (!result.hasValue() || !result.size() || !result.isType<Type>())
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Could not evaluate: " << this->valueExpr_
|
<< "Could not evaluate: " << this->valueExpr_ << nl
|
||||||
|
<< "Result size:" << result.size()
|
||||||
|
<< " type:" << result.valueType() << nl
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,7 +129,7 @@ void Foam::Function1Types::Function1Expression<Type>::writeData
|
|||||||
Ostream& os
|
Ostream& os
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// Function1-from-subdict so out dictionary contains
|
// Function1-from-subdict so output dictionary contains
|
||||||
// only the relevant entries.
|
// only the relevant entries.
|
||||||
dict_.writeEntry(this->name(), os);
|
dict_.writeEntry(this->name(), os);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -113,8 +113,13 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from entry name and dictionary
|
//- Construct from entry name, dictionary and optional registry
|
||||||
Function1Expression(const word& entryName, const dictionary& dict);
|
Function1Expression
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
|
);
|
||||||
|
|
||||||
//- Copy construct
|
//- Copy construct
|
||||||
explicit Function1Expression(const Function1Expression<Type>& rhs);
|
explicit Function1Expression(const Function1Expression<Type>& rhs);
|
||||||
|
|||||||
@ -210,10 +210,11 @@ Foam::Function1Types::CSV<Type>::CSV
|
|||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr,
|
||||||
const fileName& fName
|
const fileName& fName
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
TableBase<Type>(entryName, dict),
|
TableBase<Type>(entryName, dict, obrPtr),
|
||||||
nHeaderLine_(dict.get<label>("nHeaderLine")),
|
nHeaderLine_(dict.get<label>("nHeaderLine")),
|
||||||
refColumn_(dict.get<label>("refColumn")),
|
refColumn_(dict.get<label>("refColumn")),
|
||||||
componentColumns_(getComponentColumns("componentColumns", dict)),
|
componentColumns_(getComponentColumns("componentColumns", dict)),
|
||||||
@ -223,7 +224,7 @@ Foam::Function1Types::CSV<Type>::CSV
|
|||||||
{
|
{
|
||||||
read();
|
read();
|
||||||
|
|
||||||
TableBase<Type>::check();
|
TableBase<Type>::initialise();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 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.
|
||||||
@ -125,11 +125,12 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from entry name and dictionary
|
//- Construct from entry name, dictionary and optional registry
|
||||||
CSV
|
CSV
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr = nullptr,
|
||||||
const fileName& fName = fileName::null
|
const fileName& fName = fileName::null
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -34,10 +34,11 @@ template<class Type>
|
|||||||
Foam::Function1Types::Constant<Type>::Constant
|
Foam::Function1Types::Constant<Type>::Constant
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const Type& value
|
const Type& value,
|
||||||
|
const objectRegistry* obrPtr
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
Function1<Type>(entryName),
|
Function1<Type>(entryName, obrPtr),
|
||||||
value_(value)
|
value_(value)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -46,10 +47,11 @@ template<class Type>
|
|||||||
Foam::Function1Types::Constant<Type>::Constant
|
Foam::Function1Types::Constant<Type>::Constant
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
Function1<Type>(entryName, dict),
|
Function1<Type>(entryName, dict, obrPtr),
|
||||||
value_(Zero)
|
value_(Zero)
|
||||||
{
|
{
|
||||||
const entry* eptr = dict.findEntry(entryName, keyType::LITERAL);
|
const entry* eptr = dict.findEntry(entryName, keyType::LITERAL);
|
||||||
|
|||||||
@ -95,10 +95,20 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
Constant(const word& entryName, const Type& value);
|
Constant
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const Type& value,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
|
);
|
||||||
|
|
||||||
//- Construct from entry name and dictionary
|
//- Construct from entry name, dictionary and optional registry
|
||||||
Constant(const word& entryName, const dictionary& dict);
|
Constant
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
|
);
|
||||||
|
|
||||||
//- Construct from entry name and Istream
|
//- Construct from entry name and Istream
|
||||||
// Reads the constant value without the Function1 type
|
// Reads the constant value without the Function1 type
|
||||||
@ -121,6 +131,9 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- Change the constant value
|
||||||
|
inline void reset(const Type& val);
|
||||||
|
|
||||||
//- Return constant value
|
//- Return constant value
|
||||||
virtual inline Type value(const scalar) const;
|
virtual inline Type value(const scalar) const;
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,14 @@ License
|
|||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
inline Type Foam::Function1Types::Constant<Type>::value(const scalar x) const
|
inline void Foam::Function1Types::Constant<Type>::reset(const Type& val)
|
||||||
|
{
|
||||||
|
value_ = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
inline Type Foam::Function1Types::Constant<Type>::value(const scalar) const
|
||||||
{
|
{
|
||||||
return value_;
|
return value_;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -131,10 +131,15 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from entry name and dictionary
|
//- Construct from entry name, dictionary and optional registry
|
||||||
Cosine(const word& entryName, const dictionary& dict)
|
Cosine
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
|
)
|
||||||
:
|
:
|
||||||
Sine<Type>(entryName, dict)
|
Sine<Type>(entryName, dict, obrPtr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//- Copy construct
|
//- Copy construct
|
||||||
|
|||||||
@ -34,16 +34,25 @@ License
|
|||||||
// * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::Function1<Type>::Function1(const word& entryName)
|
Foam::Function1<Type>::Function1
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const objectRegistry* obrPtr
|
||||||
|
)
|
||||||
:
|
:
|
||||||
function1Base(entryName)
|
function1Base(entryName, obrPtr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::Function1<Type>::Function1(const word& entryName, const dictionary& dict)
|
Foam::Function1<Type>::Function1
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr
|
||||||
|
)
|
||||||
:
|
:
|
||||||
function1Base(entryName, dict)
|
function1Base(entryName, dict, obrPtr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -65,8 +74,7 @@ Type Foam::Function1<Type>::value(const scalar x) const
|
|||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Foam::Field<Type>>
|
Foam::tmp<Foam::Field<Type>> Foam::Function1<Type>::value
|
||||||
Foam::Function1<Type>::value
|
|
||||||
(
|
(
|
||||||
const scalarField& x
|
const scalarField& x
|
||||||
) const
|
) const
|
||||||
@ -85,8 +93,7 @@ Type Foam::Function1<Type>::integrate(const scalar x1, const scalar x2) const
|
|||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Foam::Field<Type>>
|
Foam::tmp<Foam::Field<Type>> Foam::Function1<Type>::integrate
|
||||||
Foam::Function1<Type>::integrate
|
|
||||||
(
|
(
|
||||||
const scalarField& x1,
|
const scalarField& x1,
|
||||||
const scalarField& x2
|
const scalarField& x2
|
||||||
@ -119,10 +126,11 @@ template<class Function1Type>
|
|||||||
Foam::FieldFunction1<Function1Type>::FieldFunction1
|
Foam::FieldFunction1<Function1Type>::FieldFunction1
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
Function1Type(entryName, dict)
|
Function1Type(entryName, dict, obrPtr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,7 @@ Description
|
|||||||
It accepts primitive or dictionary entries for dispatching to different
|
It accepts primitive or dictionary entries for dispatching to different
|
||||||
function types, but wraps unspecified types as "constant".
|
function types, but wraps unspecified types as "constant".
|
||||||
|
|
||||||
In the dictionary form, the coefficents are the dictionary itself.
|
In the dictionary form, the coefficients are the dictionary itself.
|
||||||
This is arguably the more readable form.
|
This is arguably the more readable form.
|
||||||
For example,
|
For example,
|
||||||
\verbatim
|
\verbatim
|
||||||
@ -49,7 +49,7 @@ Description
|
|||||||
}
|
}
|
||||||
\endverbatim
|
\endverbatim
|
||||||
|
|
||||||
In the primitive form, the coefficents are provided separately.
|
In the primitive form, the coefficients are provided separately.
|
||||||
For example,
|
For example,
|
||||||
\verbatim
|
\verbatim
|
||||||
<entryName> linearRamp;
|
<entryName> linearRamp;
|
||||||
@ -84,8 +84,6 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Forward Declarations
|
// Forward Declarations
|
||||||
class Time;
|
|
||||||
template<class Type> class Function1;
|
|
||||||
template<class Type> Ostream& operator<<(Ostream&, const Function1<Type>&);
|
template<class Type> Ostream& operator<<(Ostream&, const Function1<Type>&);
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
@ -106,6 +104,7 @@ class Function1
|
|||||||
const entry* eptr, // Eg, dict.findEntry(entryName)
|
const entry* eptr, // Eg, dict.findEntry(entryName)
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const word& redirectType,
|
const word& redirectType,
|
||||||
|
const objectRegistry* obrPtr,
|
||||||
const bool mandatory
|
const bool mandatory
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -133,19 +132,30 @@ public:
|
|||||||
dictionary,
|
dictionary,
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr
|
||||||
),
|
),
|
||||||
(entryName, dict)
|
(entryName, dict, obrPtr)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from entry name
|
//- Construct from entry name
|
||||||
explicit Function1(const word& entryName);
|
explicit Function1
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
|
);
|
||||||
|
|
||||||
//- Construct from entry name and dictionary (unused)
|
//- Construct from entry name, (unused) dictionary
|
||||||
Function1(const word& entryName, const dictionary& dict);
|
//- and optional registry
|
||||||
|
Function1
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
|
);
|
||||||
|
|
||||||
//- Copy construct
|
//- Copy construct
|
||||||
explicit Function1(const Function1<Type>& rhs);
|
explicit Function1(const Function1<Type>& rhs);
|
||||||
@ -162,6 +172,7 @@ public:
|
|||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const word& redirectType,
|
const word& redirectType,
|
||||||
|
const objectRegistry* obrPtr = nullptr,
|
||||||
const bool mandatory = true
|
const bool mandatory = true
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -172,6 +183,7 @@ public:
|
|||||||
std::initializer_list<std::pair<const char*,int>> compat,
|
std::initializer_list<std::pair<const char*,int>> compat,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const word& redirectType = word::null,
|
const word& redirectType = word::null,
|
||||||
|
const objectRegistry* obrPtr = nullptr,
|
||||||
const bool mandatory = true
|
const bool mandatory = true
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -180,6 +192,7 @@ public:
|
|||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr = nullptr,
|
||||||
const bool mandatory = true
|
const bool mandatory = true
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -188,7 +201,8 @@ public:
|
|||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const word& redirectType = word::null
|
const word& redirectType = word::null,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -202,6 +216,7 @@ public:
|
|||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
enum keyType::option matchOpt = keyType::LITERAL,
|
enum keyType::option matchOpt = keyType::LITERAL,
|
||||||
|
const objectRegistry* obrPtr = nullptr,
|
||||||
const bool mandatory = true
|
const bool mandatory = true
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -214,7 +229,8 @@ public:
|
|||||||
/// const word& entryName,
|
/// const word& entryName,
|
||||||
/// const dictionary& dict,
|
/// const dictionary& dict,
|
||||||
/// const Type& deflt,
|
/// const Type& deflt,
|
||||||
/// enum keyType::option matchOpt = keyType::LITERAL
|
/// enum keyType::option matchOpt = keyType::LITERAL,
|
||||||
|
/// const objectRegistry* obrPtr = nullptr
|
||||||
/// );
|
/// );
|
||||||
|
|
||||||
|
|
||||||
@ -279,7 +295,12 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from entry name and dictionary
|
//- Construct from entry name and dictionary
|
||||||
FieldFunction1(const word& entryName, const dictionary& dict);
|
FieldFunction1
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
|
);
|
||||||
|
|
||||||
//- Construct and return a clone
|
//- Construct and return a clone
|
||||||
virtual tmp<Function1<Type>> clone() const;
|
virtual tmp<Function1<Type>> clone() const;
|
||||||
|
|||||||
@ -38,6 +38,7 @@ Foam::Function1<Type>::New
|
|||||||
const entry* eptr,
|
const entry* eptr,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const word& redirectType,
|
const word& redirectType,
|
||||||
|
const objectRegistry* obrPtr,
|
||||||
const bool mandatory
|
const bool mandatory
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -86,7 +87,12 @@ Foam::Function1<Type>::New
|
|||||||
|
|
||||||
return autoPtr<Function1<Type>>
|
return autoPtr<Function1<Type>>
|
||||||
(
|
(
|
||||||
new Function1Types::Constant<Type>(entryName, constValue)
|
new Function1Types::Constant<Type>
|
||||||
|
(
|
||||||
|
entryName,
|
||||||
|
constValue,
|
||||||
|
obrPtr
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,7 +141,7 @@ Foam::Function1<Type>::New
|
|||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ctorPtr(entryName, *coeffs);
|
return ctorPtr(entryName, *coeffs, obrPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -146,6 +152,7 @@ Foam::Function1<Type>::New
|
|||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const word& redirectType,
|
const word& redirectType,
|
||||||
|
const objectRegistry* obrPtr,
|
||||||
const bool mandatory
|
const bool mandatory
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -155,6 +162,7 @@ Foam::Function1<Type>::New
|
|||||||
dict.findEntry(entryName, keyType::LITERAL),
|
dict.findEntry(entryName, keyType::LITERAL),
|
||||||
dict,
|
dict,
|
||||||
redirectType,
|
redirectType,
|
||||||
|
obrPtr,
|
||||||
mandatory
|
mandatory
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -168,6 +176,7 @@ Foam::Function1<Type>::NewCompat
|
|||||||
std::initializer_list<std::pair<const char*,int>> compat,
|
std::initializer_list<std::pair<const char*,int>> compat,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const word& redirectType,
|
const word& redirectType,
|
||||||
|
const objectRegistry* obrPtr,
|
||||||
const bool mandatory
|
const bool mandatory
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -177,6 +186,7 @@ Foam::Function1<Type>::NewCompat
|
|||||||
dict.findCompat(entryName, compat, keyType::LITERAL),
|
dict.findCompat(entryName, compat, keyType::LITERAL),
|
||||||
dict,
|
dict,
|
||||||
redirectType,
|
redirectType,
|
||||||
|
obrPtr,
|
||||||
mandatory
|
mandatory
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -188,10 +198,11 @@ Foam::Function1<Type>::New
|
|||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr,
|
||||||
const bool mandatory
|
const bool mandatory
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return Function1<Type>::New(entryName, dict, word::null, mandatory);
|
return Function1<Type>::New(entryName, dict, word::null, obrPtr, mandatory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -201,11 +212,12 @@ Foam::Function1<Type>::NewIfPresent
|
|||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const word& redirectType
|
const word& redirectType,
|
||||||
|
const objectRegistry* obrPtr
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// mandatory = false
|
// mandatory = false
|
||||||
return Function1<Type>::New(entryName, dict, redirectType, false);
|
return Function1<Type>::New(entryName, dict, redirectType, obrPtr, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -218,6 +230,7 @@ Foam::Function1<Type>::New
|
|||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
enum keyType::option matchOpt,
|
enum keyType::option matchOpt,
|
||||||
|
const objectRegistry* obrPtr,
|
||||||
const bool mandatory
|
const bool mandatory
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -259,6 +272,7 @@ Foam::Function1<Type>::New
|
|||||||
eptr, // Already resolved
|
eptr, // Already resolved
|
||||||
dict,
|
dict,
|
||||||
word::null,
|
word::null,
|
||||||
|
obrPtr,
|
||||||
mandatory
|
mandatory
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -292,12 +306,13 @@ Foam::Function1<Type>::New
|
|||||||
/// const word& entryName,
|
/// const word& entryName,
|
||||||
/// const dictionary& dict,
|
/// const dictionary& dict,
|
||||||
/// const Type& deflt,
|
/// const Type& deflt,
|
||||||
/// enum keyType::option matchOpt
|
/// enum keyType::option matchOpt,
|
||||||
|
/// const objectRegistry* obrPtr
|
||||||
/// )
|
/// )
|
||||||
/// {
|
/// {
|
||||||
/// auto fref
|
/// auto fref
|
||||||
/// (
|
/// (
|
||||||
/// Function1<Type>::New(entryName, dict, cache, matchOpt, false)
|
/// Function1<Type>::New(entryName, dict, cache, matchOpt, obrPtr,false)
|
||||||
/// );
|
/// );
|
||||||
///
|
///
|
||||||
/// if (!fref)
|
/// if (!fref)
|
||||||
@ -308,5 +323,4 @@ Foam::Function1<Type>::New
|
|||||||
/// return fref;
|
/// return fref;
|
||||||
/// }
|
/// }
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -26,38 +26,113 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "function1Base.H"
|
#include "function1Base.H"
|
||||||
|
#include "objectRegistry.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
const Foam::objectRegistry* Foam::function1Base::whichDb
|
||||||
|
(
|
||||||
|
const bool useTime
|
||||||
|
) const noexcept
|
||||||
|
{
|
||||||
|
if (obrPtr_ && useTime)
|
||||||
|
{
|
||||||
|
return &(obrPtr_->time());
|
||||||
|
}
|
||||||
|
|
||||||
|
return obrPtr_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::function1Base::function1Base(const word& entryName)
|
Foam::function1Base::function1Base
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const objectRegistry* obrPtr
|
||||||
|
)
|
||||||
:
|
:
|
||||||
refCount(),
|
refCount(),
|
||||||
name_(entryName)
|
name_(entryName),
|
||||||
|
obrPtr_(obrPtr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::function1Base::function1Base
|
Foam::function1Base::function1Base
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
refCount(),
|
refCount(),
|
||||||
name_(entryName)
|
name_(entryName),
|
||||||
|
obrPtr_(obrPtr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::function1Base::function1Base(const function1Base& rhs)
|
Foam::function1Base::function1Base(const function1Base& rhs)
|
||||||
:
|
:
|
||||||
refCount(),
|
refCount(),
|
||||||
name_(rhs.name_)
|
name_(rhs.name_),
|
||||||
|
obrPtr_(rhs.obrPtr_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// NOTE : do not delete obrPtr_ (no ownership)
|
||||||
|
Foam::function1Base::~function1Base()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::function1Base::convertTimeBase(const Time& t)
|
const Foam::objectRegistry& Foam::function1Base::obr() const
|
||||||
|
{
|
||||||
|
if (!obrPtr_)
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Object registry not set"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
return *obrPtr_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::Time& Foam::function1Base::time() const
|
||||||
|
{
|
||||||
|
if (!obrPtr_)
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Object registry not set"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return obrPtr_->time();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::function1Base::isTime() const noexcept
|
||||||
|
{
|
||||||
|
return (obrPtr_ && obrPtr_->isTimeDb());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::function1Base::resetDb(const objectRegistry* obrPtr) noexcept
|
||||||
|
{
|
||||||
|
obrPtr_ = obrPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::function1Base::resetDb(const objectRegistry& db) noexcept
|
||||||
|
{
|
||||||
|
obrPtr_ = &db;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::function1Base::userTimeToTime(const Time& t)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -27,12 +27,7 @@ Class
|
|||||||
Foam::function1Base
|
Foam::function1Base
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Top level data entry class for use in dictionaries. Provides a mechanism
|
Base class for template-invariant parts of Function1
|
||||||
to specify a variable as a certain type, e.g. constant or time varying, and
|
|
||||||
provide functions to return the (interpolated) value, and integral between
|
|
||||||
limits.
|
|
||||||
|
|
||||||
Extends the Function1 class by adding autoMap and rMap functions
|
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
function1Base.C
|
function1Base.C
|
||||||
@ -43,6 +38,7 @@ SourceFiles
|
|||||||
#define function1Base_H
|
#define function1Base_H
|
||||||
|
|
||||||
#include "dictionary.H"
|
#include "dictionary.H"
|
||||||
|
#include "objectRegistry.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -50,7 +46,7 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Forward Declarations
|
// Forward Declarations
|
||||||
class Time;
|
template<class Type> class Function1;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class function1Base Declaration
|
Class function1Base Declaration
|
||||||
@ -60,6 +56,12 @@ class function1Base
|
|||||||
:
|
:
|
||||||
public refCount
|
public refCount
|
||||||
{
|
{
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- The associated registry, the time registry or nullptr
|
||||||
|
const objectRegistry* whichDb(const bool useTime) const noexcept;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected Data
|
// Protected Data
|
||||||
@ -67,6 +69,9 @@ protected:
|
|||||||
//- Name of entry
|
//- Name of entry
|
||||||
const word name_;
|
const word name_;
|
||||||
|
|
||||||
|
//- Pointer to an object registry
|
||||||
|
const objectRegistry* obrPtr_;
|
||||||
|
|
||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
@ -78,18 +83,27 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from entry name
|
//- Construct from entry name and optional registry
|
||||||
explicit function1Base(const word& entryName);
|
explicit function1Base
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
|
);
|
||||||
|
|
||||||
//- Construct from entry name and dictionary (unused)
|
//- Construct from entry name, dictionary (unused) and optional registry
|
||||||
function1Base(const word& entryName, const dictionary& dict);
|
function1Base
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
|
);
|
||||||
|
|
||||||
//- Copy construct
|
//- Copy construct
|
||||||
explicit function1Base(const function1Base& rhs);
|
explicit function1Base(const function1Base& rhs);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~function1Base() = default;
|
virtual ~function1Base();
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
@ -97,16 +111,63 @@ public:
|
|||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- The name of the entry
|
//- The name of the entry
|
||||||
const word& name() const
|
const word& name() const noexcept
|
||||||
{
|
{
|
||||||
return name_;
|
return name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Return the associated registry or nullptr.
|
||||||
|
const objectRegistry* whichDb() const noexcept
|
||||||
|
{
|
||||||
|
return obrPtr_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Reset the associated objectRegistry
|
||||||
|
void resetDb(const objectRegistry* obrPtr = nullptr) noexcept;
|
||||||
|
|
||||||
|
//- Reset the associated objectRegistry
|
||||||
|
void resetDb(const objectRegistry& db) noexcept;
|
||||||
|
|
||||||
|
//- Return the object registry
|
||||||
|
// FatalError if object registry is not set
|
||||||
|
const objectRegistry& obr() const;
|
||||||
|
|
||||||
|
//- Return true if this function was created with the time database
|
||||||
|
bool isTime() const noexcept;
|
||||||
|
|
||||||
|
//- Return the time database
|
||||||
|
// FatalError if object registry is not set
|
||||||
|
const Time& time() const;
|
||||||
|
|
||||||
|
//- Return the mesh database if this Function1 was created using a mesh
|
||||||
|
// Note: relies on refCast failure if the type is not correct
|
||||||
|
template<class MeshType>
|
||||||
|
const MeshType& mesh(const word& regionName = word::null) const
|
||||||
|
{
|
||||||
|
const objectRegistry* ptr = whichDb(!regionName.empty());
|
||||||
|
|
||||||
|
if (!ptr)
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Object registry not set"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (regionName.empty())
|
||||||
|
{
|
||||||
|
return refCast<const MeshType>(*ptr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return ptr->lookupObject<MeshType>(regionName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Manipulation
|
// Manipulation
|
||||||
|
|
||||||
//- Convert time
|
//- Convert time
|
||||||
virtual void convertTimeBase(const Time& t);
|
virtual void userTimeToTime(const Time& t);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -25,55 +25,74 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "LimitRange.H"
|
#include "FunctionObjectTrigger.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::Function1Types::LimitRange<Type>::read(const dictionary& coeffs)
|
void Foam::Function1Types::FunctionObjectTrigger<Type>::read
|
||||||
|
(
|
||||||
|
const dictionary& coeffs
|
||||||
|
)
|
||||||
{
|
{
|
||||||
min_ = coeffs.get<scalar>("min");
|
triggers_ = coeffs.get<labelList>("triggers", keyType::LITERAL);
|
||||||
max_ = coeffs.get<scalar>("max");
|
defaultValue_ =
|
||||||
value_ = Function1<Type>::New("value", coeffs);
|
coeffs.getOrDefault("defaultValue", false, keyType::LITERAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::Function1Types::LimitRange<Type>::LimitRange
|
Foam::Function1Types::FunctionObjectTrigger<Type>::FunctionObjectTrigger
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
Function1<Type>(entryName)
|
Function1<Type>(entryName, dict, obrPtr),
|
||||||
|
triggers_(),
|
||||||
|
defaultValue_(false)
|
||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::Function1Types::LimitRange<Type>::LimitRange(const LimitRange<Type>& rhs)
|
Foam::Function1Types::FunctionObjectTrigger<Type>::FunctionObjectTrigger
|
||||||
|
(
|
||||||
|
const FunctionObjectTrigger<Type>& rhs
|
||||||
|
)
|
||||||
:
|
:
|
||||||
Function1<Type>(rhs),
|
Function1<Type>(rhs),
|
||||||
min_(rhs.min_),
|
triggers_(rhs.triggers_),
|
||||||
max_(rhs.max_),
|
defaultValue_(rhs.defaultValue_)
|
||||||
value_(rhs.value_.clone())
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::Function1Types::LimitRange<Type>::writeEntries(Ostream& os) const
|
void Foam::Function1Types::FunctionObjectTrigger<Type>::writeEntries
|
||||||
|
(
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
os.writeEntry("min", min_);
|
os.writeKeyword("triggers");
|
||||||
os.writeEntry("max", max_);
|
flatOutput(triggers_);
|
||||||
value_->writeData(os);
|
os.endEntry();
|
||||||
|
|
||||||
|
if (defaultValue_)
|
||||||
|
{
|
||||||
|
os.writeEntry("default", "true");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::Function1Types::LimitRange<Type>::writeData(Ostream& os) const
|
void Foam::Function1Types::FunctionObjectTrigger<Type>::writeData
|
||||||
|
(
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
Function1<Type>::writeData(os);
|
Function1<Type>::writeData(os);
|
||||||
os.endEntry();
|
os.endEntry();
|
||||||
@ -0,0 +1,178 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::Function1Types::FunctionObjectTrigger
|
||||||
|
|
||||||
|
Description
|
||||||
|
Returns a 0/1 value corresponding to function object trigger levels.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
\verbatim
|
||||||
|
<entryName> functionObjectTrigger;
|
||||||
|
<entryName>Coeffs
|
||||||
|
{
|
||||||
|
triggers (1 3 5);
|
||||||
|
defaultValue false; // Optional
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
Where:
|
||||||
|
\table
|
||||||
|
Property | Description | Required
|
||||||
|
triggers | List of active trigger states to check for | yes |
|
||||||
|
defaultValue | Treatment for unactivated trigger state | no | false
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
In some circumstances, it can be useful to treat an unactivated trigger
|
||||||
|
as being true. This is the role of the "defaultValue" keyword.
|
||||||
|
|
||||||
|
Note
|
||||||
|
- does not implement integrate()
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
FunctionObjectTrigger.C
|
||||||
|
FunctionObjectTriggerI.H
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef Function1Types_FunctionObjectTrigger_H
|
||||||
|
#define Function1Types_FunctionObjectTrigger_H
|
||||||
|
|
||||||
|
#include "Function1.H"
|
||||||
|
#include "labelList.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace Function1Types
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class FunctionObjectTrigger Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class FunctionObjectTrigger
|
||||||
|
:
|
||||||
|
public Function1<Type>
|
||||||
|
{
|
||||||
|
|
||||||
|
// Private Data
|
||||||
|
|
||||||
|
//- Trigger indices when it is considered active
|
||||||
|
labelList triggers_;
|
||||||
|
|
||||||
|
//- Treatment for unactivated trigger state (true/false)
|
||||||
|
bool defaultValue_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Is the trigger considered active?
|
||||||
|
inline bool active() const;
|
||||||
|
|
||||||
|
//- Read the coefficients from the given dictionary
|
||||||
|
void read(const dictionary& coeffs);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("functionObjectTrigger");
|
||||||
|
|
||||||
|
|
||||||
|
// Generated Methods
|
||||||
|
|
||||||
|
//- No copy assignment
|
||||||
|
void operator=(const FunctionObjectTrigger<Type>&) = delete;
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from entry name, dictionary and optional registry
|
||||||
|
FunctionObjectTrigger
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Copy construct
|
||||||
|
explicit FunctionObjectTrigger(const FunctionObjectTrigger<Type>& rhs);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<Function1<Type>> clone() const
|
||||||
|
{
|
||||||
|
return tmp<Function1<Type>>(new FunctionObjectTrigger<Type>(*this));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~FunctionObjectTrigger() = default;
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return the trigger indices
|
||||||
|
inline const labelList& triggers() const noexcept;
|
||||||
|
|
||||||
|
//- Change the trigger indices
|
||||||
|
inline void resetTriggers(const labelUList& indices);
|
||||||
|
|
||||||
|
|
||||||
|
//- Return 0/1 value at current time
|
||||||
|
virtual inline Type value(const scalar /*unused*/) const;
|
||||||
|
|
||||||
|
//- Integrate between two (scalar) values. Not implemented!
|
||||||
|
virtual inline Type integrate(const scalar, const scalar) const;
|
||||||
|
|
||||||
|
//- Write in dictionary format
|
||||||
|
virtual void writeData(Ostream& os) const;
|
||||||
|
|
||||||
|
//- Write coefficient entries in dictionary format
|
||||||
|
void writeEntries(Ostream& os) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Function1Types
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "FunctionObjectTriggerI.H"
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
#include "FunctionObjectTrigger.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -25,42 +25,64 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "LimitRange.H"
|
#include "FunctionObjectTrigger.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
inline Type Foam::Function1Types::LimitRange<Type>::value(const scalar t) const
|
inline bool Foam::Function1Types::FunctionObjectTrigger<Type>::active() const
|
||||||
{
|
{
|
||||||
scalar tlim = min(max(t, min_), max_);
|
if (triggers_.empty())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return value_->value(tlim);
|
const label idx = this->time().functionObjects().triggerIndex();
|
||||||
|
|
||||||
|
return
|
||||||
|
(
|
||||||
|
idx == labelMin ? defaultValue_ : triggers_.found(idx)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Type Foam::Function1Types::LimitRange<Type>::integrate
|
inline const Foam::labelList&
|
||||||
|
Foam::Function1Types::FunctionObjectTrigger<Type>::triggers() const noexcept
|
||||||
|
{
|
||||||
|
return triggers_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
inline void Foam::Function1Types::FunctionObjectTrigger<Type>::resetTriggers
|
||||||
|
(
|
||||||
|
const labelUList& indices
|
||||||
|
)
|
||||||
|
{
|
||||||
|
triggers_ = indices;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
inline Type Foam::Function1Types::FunctionObjectTrigger<Type>::value
|
||||||
|
(
|
||||||
|
const scalar /*unused*/
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return this->active() ? pTraits<Type>::one : pTraits<Type>::zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
inline Type Foam::Function1Types::FunctionObjectTrigger<Type>::integrate
|
||||||
(
|
(
|
||||||
const scalar x1,
|
const scalar x1,
|
||||||
const scalar x2
|
const scalar x2
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
scalar xlim0 = min(max(x1, min_), max_);
|
NotImplemented;
|
||||||
scalar xlim1 = min(max(x2, min_), max_);
|
return pTraits<Type>::zero;
|
||||||
|
|
||||||
Type intValue = value_->integrate(xlim0, xlim1);
|
|
||||||
|
|
||||||
if (x1 < min_)
|
|
||||||
{
|
|
||||||
intValue += (min(min_, x2) - x1)*this->value(min_);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (x2 > max_)
|
|
||||||
{
|
|
||||||
intValue += (x2 - max(max_, x1))*this->value(max_);
|
|
||||||
}
|
|
||||||
|
|
||||||
return intValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,109 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "FunctionObjectValue.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::Function1Types::FunctionObjectValue<Type>::read
|
||||||
|
(
|
||||||
|
const dictionary& coeffs
|
||||||
|
)
|
||||||
|
{
|
||||||
|
foName_ = coeffs.get<word>("functionObject");
|
||||||
|
foResultName_ = coeffs.get<word>("functionObjectResult");
|
||||||
|
haveDefaultValue_ = coeffs.readIfPresent("defaultValue", defaultValue_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::Function1Types::FunctionObjectValue<Type>::FunctionObjectValue
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr
|
||||||
|
)
|
||||||
|
:
|
||||||
|
Function1<Type>(entryName, dict, obrPtr),
|
||||||
|
foName_(),
|
||||||
|
foResultName_(),
|
||||||
|
defaultValue_(Zero),
|
||||||
|
haveDefaultValue_(false)
|
||||||
|
{
|
||||||
|
read(dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::Function1Types::FunctionObjectValue<Type>::FunctionObjectValue
|
||||||
|
(
|
||||||
|
const FunctionObjectValue<Type>& rhs
|
||||||
|
)
|
||||||
|
:
|
||||||
|
Function1<Type>(rhs),
|
||||||
|
foName_(rhs.foName_),
|
||||||
|
foResultName_(rhs.foResultName_),
|
||||||
|
defaultValue_(rhs.defaultValue_),
|
||||||
|
haveDefaultValue_(rhs.haveDefaultValue_)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::Function1Types::FunctionObjectValue<Type>::writeEntries
|
||||||
|
(
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
os.writeEntry("functionObject", foName_);
|
||||||
|
os.writeEntry("functionObjectResult", foResultName_);
|
||||||
|
|
||||||
|
if (haveDefaultValue_)
|
||||||
|
{
|
||||||
|
os.writeEntry("defaultValue", defaultValue_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::Function1Types::FunctionObjectValue<Type>::writeData
|
||||||
|
(
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
Function1<Type>::writeData(os);
|
||||||
|
os.endEntry();
|
||||||
|
|
||||||
|
os.beginBlock(word(this->name() + "Coeffs"));
|
||||||
|
writeEntries(os);
|
||||||
|
os.endBlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,163 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::Function1Types::FunctionObjectValue
|
||||||
|
|
||||||
|
Description
|
||||||
|
Returns a value retrieved from a function object result.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
\verbatim
|
||||||
|
<entryName> functionObjectValue;
|
||||||
|
<entryName>Coeffs
|
||||||
|
{
|
||||||
|
functionObject <name>;
|
||||||
|
functionObjectResult <function object result field>;
|
||||||
|
defaultValue <value>; // optional
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
Note
|
||||||
|
- does not implement integrate()
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
FunctionObjectValue.C
|
||||||
|
FunctionObjectValueI.H
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef Function1Types_FunctionObjectValue_H
|
||||||
|
#define Function1Types_FunctionObjectValue_H
|
||||||
|
|
||||||
|
#include "Function1.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace Function1Types
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class FunctionObjectValue Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class FunctionObjectValue
|
||||||
|
:
|
||||||
|
public Function1<Type>
|
||||||
|
{
|
||||||
|
// Private Data
|
||||||
|
|
||||||
|
//- Function object name
|
||||||
|
word foName_;
|
||||||
|
|
||||||
|
//- Function object result name
|
||||||
|
word foResultName_;
|
||||||
|
|
||||||
|
//- Default value when function object result is unavailable
|
||||||
|
Type defaultValue_;
|
||||||
|
|
||||||
|
//- Flag to indicate that default value is available
|
||||||
|
bool haveDefaultValue_;
|
||||||
|
|
||||||
|
|
||||||
|
// Private Member Functions
|
||||||
|
|
||||||
|
//- Read the coefficients from the given dictionary
|
||||||
|
void read(const dictionary& coeffs);
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("functionObjectValue");
|
||||||
|
|
||||||
|
|
||||||
|
// Generated Methods
|
||||||
|
|
||||||
|
//- No copy assignment
|
||||||
|
void operator=(const FunctionObjectValue<Type>&) = delete;
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from entry name, dictionary and optional registry
|
||||||
|
FunctionObjectValue
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Copy construct
|
||||||
|
explicit FunctionObjectValue(const FunctionObjectValue<Type>& rhs);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual tmp<Function1<Type>> clone() const
|
||||||
|
{
|
||||||
|
return tmp<Function1<Type>>(new FunctionObjectValue<Type>(*this));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~FunctionObjectValue() = default;
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return value at current time
|
||||||
|
virtual inline Type value(const scalar /*unused*/) const;
|
||||||
|
|
||||||
|
//- Integrate between two (scalar) values. Not implemented!
|
||||||
|
virtual Type integrate(const scalar x1, const scalar x2) const;
|
||||||
|
|
||||||
|
//- Write in dictionary format
|
||||||
|
virtual void writeData(Ostream& os) const;
|
||||||
|
|
||||||
|
//- Write coefficient entries in dictionary format
|
||||||
|
void writeEntries(Ostream& os) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Function1Types
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "FunctionObjectValueI.H"
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
#include "FunctionObjectValue.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,102 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "FunctionObjectValue.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
inline Type Foam::Function1Types::FunctionObjectValue<Type>::value
|
||||||
|
(
|
||||||
|
const scalar /*unused*/
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const auto& props = this->time().functionObjects().propsDict();
|
||||||
|
|
||||||
|
if (!props.hasResultObject(foName_))
|
||||||
|
{
|
||||||
|
if (haveDefaultValue_)
|
||||||
|
{
|
||||||
|
DebugInfo
|
||||||
|
<< " Function object " << foName_
|
||||||
|
<< " not found; using default value " << defaultValue_
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
return defaultValue_;
|
||||||
|
}
|
||||||
|
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Function object " << foName_
|
||||||
|
<< " results not found. Valid objects with results include: "
|
||||||
|
<< props.objectResultNames()
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!props.hasResultObjectEntry(foName_, foResultName_))
|
||||||
|
{
|
||||||
|
if (haveDefaultValue_)
|
||||||
|
{
|
||||||
|
DebugInfo
|
||||||
|
<< " Function object " << foName_
|
||||||
|
<< " result " << foResultName_
|
||||||
|
<< " not found; using default value " << defaultValue_
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
return defaultValue_;
|
||||||
|
}
|
||||||
|
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Function object " << foName_
|
||||||
|
<< " does not have a result field " << foResultName_ << nl
|
||||||
|
<< " Available result fields include: "
|
||||||
|
<< props.objectResultEntries(foName_)
|
||||||
|
<< exit(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
Type value = props.template getObjectResult<Type>(foName_, foResultName_);
|
||||||
|
|
||||||
|
DebugInfo
|
||||||
|
<< " Using " << foName_ << " function object value: " << value
|
||||||
|
<< endl;
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
inline Type Foam::Function1Types::FunctionObjectValue<Type>::integrate
|
||||||
|
(
|
||||||
|
const scalar x1,
|
||||||
|
const scalar x2
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
NotImplemented;
|
||||||
|
return pTraits<Type>::zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,178 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "InputValueMapper.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
const Foam::Enum
|
||||||
|
<
|
||||||
|
typename Foam::Function1Types::InputValueMapper<Type>::mappingMode
|
||||||
|
>
|
||||||
|
Foam::Function1Types::InputValueMapper<Type>::mappingModeNames_
|
||||||
|
({
|
||||||
|
{ mappingMode::NONE, "none" },
|
||||||
|
{ mappingMode::FUNCTION1, "function" },
|
||||||
|
{ mappingMode::MINMAX, "minMax" },
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::Function1Types::InputValueMapper<Type>::read
|
||||||
|
(
|
||||||
|
const dictionary& coeffs
|
||||||
|
)
|
||||||
|
{
|
||||||
|
mappingMode_ = mappingModeNames_.get("mode", coeffs);
|
||||||
|
|
||||||
|
switch (mappingMode_)
|
||||||
|
{
|
||||||
|
case mappingMode::NONE:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case mappingMode::FUNCTION1:
|
||||||
|
{
|
||||||
|
mappingValuePtr_.reset
|
||||||
|
(
|
||||||
|
Function1<scalar>::New("function", coeffs, this->obrPtr_)
|
||||||
|
);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case mappingMode::MINMAX:
|
||||||
|
{
|
||||||
|
min_ = coeffs.get<scalar>("min");
|
||||||
|
max_ = coeffs.get<scalar>("max");
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Unhandled enumeration " << mappingModeNames_[mappingMode_]
|
||||||
|
<< ". Available options are: " << mappingModeNames_.sortedToc()
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
value_ = Function1<Type>::New("value", coeffs, this->obrPtr_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::Function1Types::InputValueMapper<Type>::InputValueMapper
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr
|
||||||
|
)
|
||||||
|
:
|
||||||
|
Function1<Type>(entryName, obrPtr),
|
||||||
|
mappingMode_(mappingMode::NONE),
|
||||||
|
mappingValuePtr_(nullptr),
|
||||||
|
min_(0),
|
||||||
|
max_(0),
|
||||||
|
value_(nullptr)
|
||||||
|
{
|
||||||
|
read(dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::Function1Types::InputValueMapper<Type>::InputValueMapper
|
||||||
|
(
|
||||||
|
const InputValueMapper<Type>& rhs
|
||||||
|
)
|
||||||
|
:
|
||||||
|
Function1<Type>(rhs),
|
||||||
|
mappingMode_(rhs.mappingMode_),
|
||||||
|
mappingValuePtr_(rhs.mappingValuePtr_.clone()),
|
||||||
|
min_(rhs.min_),
|
||||||
|
max_(rhs.max_),
|
||||||
|
value_(rhs.value_.clone())
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::Function1Types::InputValueMapper<Type>::writeEntries
|
||||||
|
(
|
||||||
|
Ostream& os
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
os.writeEntry("mode", mappingModeNames_[mappingMode_]);
|
||||||
|
|
||||||
|
switch (mappingMode_)
|
||||||
|
{
|
||||||
|
case mappingMode::NONE:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case mappingMode::FUNCTION1:
|
||||||
|
{
|
||||||
|
mappingValuePtr_->writeData(os);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case mappingMode::MINMAX:
|
||||||
|
{
|
||||||
|
os.writeEntry("min", min_);
|
||||||
|
os.writeEntry("max", max_);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Unhandled enumeration " << mappingModeNames_[mappingMode_]
|
||||||
|
<< ". Available options are: " << mappingModeNames_.sortedToc()
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
value_->writeData(os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::Function1Types::InputValueMapper<Type>::writeData(Ostream& os) const
|
||||||
|
{
|
||||||
|
Function1<Type>::writeData(os);
|
||||||
|
os.endEntry();
|
||||||
|
|
||||||
|
os.beginBlock(word(this->name() + "Coeffs"));
|
||||||
|
writeEntries(os);
|
||||||
|
os.endBlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -24,18 +24,21 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::Function1Types::LimitRange
|
Foam::Function1Types::InputValueMapper
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Function1 wrapper that limits the input range of another Function1
|
Function1 wrapper that maps the input value prior to it being used by
|
||||||
|
another Function1.
|
||||||
|
|
||||||
Example usage for limiting a polynomial:
|
Example usage for limiting a polynomial:
|
||||||
\verbatim
|
\verbatim
|
||||||
<entryName>
|
<entryName>
|
||||||
{
|
{
|
||||||
type limitRange;
|
type inputValueMapper;
|
||||||
min 0.4;
|
mode minMax;
|
||||||
max 1.4;
|
|
||||||
|
min 0.4;
|
||||||
|
max 1.4;
|
||||||
|
|
||||||
value polynomial
|
value polynomial
|
||||||
(
|
(
|
||||||
@ -53,18 +56,24 @@ Description
|
|||||||
- poly(x) for 0.4 < x < 1.4.
|
- poly(x) for 0.4 < x < 1.4.
|
||||||
|
|
||||||
|
|
||||||
Example usage for limiting a file-based table:
|
Example usage for supplying a patch mass flux for a table lookup:
|
||||||
\verbatim
|
\verbatim
|
||||||
<entryName>
|
<entryName>
|
||||||
{
|
{
|
||||||
type limitRange;
|
type inputValueMapper;
|
||||||
min 0.4;
|
mode function;
|
||||||
max 1.4;
|
|
||||||
|
function
|
||||||
|
{
|
||||||
|
type functionObjectValue;
|
||||||
|
functionObject surfaceFieldValue1;
|
||||||
|
functionObjectResult sum(outlet,phi);
|
||||||
|
}
|
||||||
|
|
||||||
value
|
value
|
||||||
{
|
{
|
||||||
type table;
|
type table;
|
||||||
file "<system>/fanCurve.txt";
|
file "<system>/fanCurve.txt";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
\endverbatim
|
\endverbatim
|
||||||
@ -72,20 +81,34 @@ Description
|
|||||||
Where:
|
Where:
|
||||||
\table
|
\table
|
||||||
Property | Description | Required
|
Property | Description | Required
|
||||||
min | Minimum input value | yes
|
mode | Mapping mode (see below) | yes
|
||||||
max | Maximum input value | yes
|
function | Mapping Function1 | no*
|
||||||
|
min | Minimum input value | no*
|
||||||
|
max | Maximum input value | no*
|
||||||
value | Function of type Function1<Type> | yes
|
value | Function of type Function1<Type> | yes
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
|
Mapping modes include
|
||||||
|
- none : the input value is simply passed to the 'value' Function1
|
||||||
|
- function : the input value is passed through the 'function' Function1
|
||||||
|
before being passed to the 'value' Function1
|
||||||
|
- minMax : limits the input value to 'min' and 'max' values before being
|
||||||
|
passed to the 'value' Function1
|
||||||
|
|
||||||
|
Note
|
||||||
|
Replaces the LimitRange Function1 (v2106 and earlier)
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
LimitRange.C
|
InputValueMapper.C
|
||||||
|
InputValueMapperI.H
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef Function1Types_LimitRange_H
|
#ifndef Function1Types_InputValueMapper_H
|
||||||
#define Function1Types_LimitRange_H
|
#define Function1Types_InputValueMapper_H
|
||||||
|
|
||||||
#include "Function1.H"
|
#include "Function1.H"
|
||||||
|
#include "Enum.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -95,24 +118,56 @@ namespace Function1Types
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class LimitRange Declaration
|
Class InputValueMapper Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
class LimitRange
|
class InputValueMapper
|
||||||
:
|
:
|
||||||
public Function1<Type>
|
public Function1<Type>
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Public Enumerations
|
||||||
|
|
||||||
|
//- Input value mapping mode
|
||||||
|
enum class mappingMode
|
||||||
|
{
|
||||||
|
NONE,
|
||||||
|
FUNCTION1,
|
||||||
|
MINMAX
|
||||||
|
};
|
||||||
|
|
||||||
|
//- Names for the input value mapping modes
|
||||||
|
static const Enum<mappingMode> mappingModeNames_;
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
// Private Data
|
// Private Data
|
||||||
|
|
||||||
//- Minimum input value
|
//- Mapping mode
|
||||||
scalar min_;
|
mappingMode mappingMode_;
|
||||||
|
|
||||||
//- Maximum input value
|
// Function1 mapping
|
||||||
scalar max_;
|
|
||||||
|
|
||||||
//- Value function
|
//- Input value Function1
|
||||||
autoPtr<Function1<Type>> value_;
|
autoPtr<Function1<scalar>> mappingValuePtr_;
|
||||||
|
|
||||||
|
|
||||||
|
// Min/max mapping
|
||||||
|
|
||||||
|
//- Minimum input value
|
||||||
|
scalar min_;
|
||||||
|
|
||||||
|
//- Maximum input value
|
||||||
|
scalar max_;
|
||||||
|
|
||||||
|
|
||||||
|
// Function being wrapped
|
||||||
|
|
||||||
|
//- Value function
|
||||||
|
autoPtr<Function1<Type>> value_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
@ -124,26 +179,31 @@ class LimitRange
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("limitRange");
|
TypeName("inputValueMapper");
|
||||||
|
|
||||||
|
|
||||||
// Generated Methods
|
// Generated Methods
|
||||||
|
|
||||||
//- No copy assignment
|
//- No copy assignment
|
||||||
void operator=(const LimitRange<Type>&) = delete;
|
void operator=(const InputValueMapper<Type>&) = delete;
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from entry name and dictionary
|
//- Construct from entry name, dictionary and optional registry
|
||||||
LimitRange(const word& entryName, const dictionary& dict);
|
InputValueMapper
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
|
);
|
||||||
|
|
||||||
//- Copy construct
|
//- Copy construct
|
||||||
explicit LimitRange(const LimitRange<Type>& rhs);
|
explicit InputValueMapper(const InputValueMapper<Type>& rhs);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~LimitRange() = default;
|
virtual ~InputValueMapper() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
@ -169,10 +229,10 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#include "LimitRangeI.H"
|
#include "InputValueMapperI.H"
|
||||||
|
|
||||||
#ifdef NoRepository
|
#ifdef NoRepository
|
||||||
#include "LimitRange.C"
|
#include "InputValueMapper.C"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -0,0 +1,119 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | www.openfoam.com
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "InputValueMapper.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
inline Type Foam::Function1Types::InputValueMapper<Type>::value
|
||||||
|
(
|
||||||
|
const scalar t
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
switch (mappingMode_)
|
||||||
|
{
|
||||||
|
case mappingMode::NONE:
|
||||||
|
{
|
||||||
|
return value_->value(t);;
|
||||||
|
}
|
||||||
|
case mappingMode::FUNCTION1:
|
||||||
|
{
|
||||||
|
return value_->value(mappingValuePtr_->value(t));
|
||||||
|
}
|
||||||
|
case mappingMode::MINMAX:
|
||||||
|
{
|
||||||
|
scalar tlim = min(max(t, min_), max_);
|
||||||
|
|
||||||
|
return value_->value(tlim);
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Unhandled enumeration " << mappingModeNames_[mappingMode_]
|
||||||
|
<< ". Available options are: " << mappingModeNames_.sortedToc()
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return pTraits<Type>::zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Type Foam::Function1Types::InputValueMapper<Type>::integrate
|
||||||
|
(
|
||||||
|
const scalar x1,
|
||||||
|
const scalar x2
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
switch (mappingMode_)
|
||||||
|
{
|
||||||
|
case mappingMode::NONE:
|
||||||
|
{
|
||||||
|
return value_->integrate(x1, x2);
|
||||||
|
}
|
||||||
|
case mappingMode::FUNCTION1:
|
||||||
|
{
|
||||||
|
scalar x1Dash = mappingValuePtr_->value(x1);
|
||||||
|
scalar x2Dash = mappingValuePtr_->value(x2);
|
||||||
|
|
||||||
|
return value_->integrate(x1Dash, x2Dash);
|
||||||
|
}
|
||||||
|
case mappingMode::MINMAX:
|
||||||
|
{
|
||||||
|
scalar xlim0 = min(max(x1, min_), max_);
|
||||||
|
scalar xlim1 = min(max(x2, min_), max_);
|
||||||
|
|
||||||
|
Type intValue = value_->integrate(xlim0, xlim1);
|
||||||
|
|
||||||
|
if (x1 < min_)
|
||||||
|
{
|
||||||
|
intValue += (min(min_, x2) - x1)*this->value(min_);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x2 > max_)
|
||||||
|
{
|
||||||
|
intValue += (x2 - max(max_, x1))*this->value(max_);
|
||||||
|
}
|
||||||
|
|
||||||
|
return intValue;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "Unhandled enumeration " << mappingModeNames_[mappingMode_]
|
||||||
|
<< ". Available options are: " << mappingModeNames_.sortedToc()
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return pTraits<Type>::zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenFOAM Foundation
|
Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -30,9 +31,13 @@ License
|
|||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::Function1Types::OneConstant<Type>::OneConstant(const word& entryName)
|
Foam::Function1Types::OneConstant<Type>::OneConstant
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const objectRegistry* obrPtr
|
||||||
|
)
|
||||||
:
|
:
|
||||||
Function1<Type>(entryName)
|
Function1<Type>(entryName, obrPtr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -40,10 +45,11 @@ template<class Type>
|
|||||||
Foam::Function1Types::OneConstant<Type>::OneConstant
|
Foam::Function1Types::OneConstant<Type>::OneConstant
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
Function1<Type>(entryName, dict)
|
Function1<Type>(entryName, dict, obrPtr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenFOAM Foundation
|
Copyright (C) 2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -75,11 +75,20 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from entry name
|
//- Construct from entry name and optional registry
|
||||||
explicit OneConstant(const word& entryName);
|
explicit OneConstant
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
|
);
|
||||||
|
|
||||||
//- Construct from entry name and dictionary
|
//- Construct from entry name, dictionary and optional registry
|
||||||
OneConstant(const word& entryName, const dictionary& dict);
|
OneConstant
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
|
);
|
||||||
|
|
||||||
//- Construct and return a clone
|
//- Construct and return a clone
|
||||||
virtual tmp<Function1<Type>> clone() const
|
virtual tmp<Function1<Type>> clone() const
|
||||||
|
|||||||
@ -65,10 +65,11 @@ template<class Type>
|
|||||||
Foam::Function1Types::Polynomial<Type>::Polynomial
|
Foam::Function1Types::Polynomial<Type>::Polynomial
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
Function1<Type>(entryName, dict),
|
Function1<Type>(entryName, dict, obrPtr),
|
||||||
coeffs_(),
|
coeffs_(),
|
||||||
canIntegrate_(true)
|
canIntegrate_(true)
|
||||||
{
|
{
|
||||||
@ -104,10 +105,11 @@ template<class Type>
|
|||||||
Foam::Function1Types::Polynomial<Type>::Polynomial
|
Foam::Function1Types::Polynomial<Type>::Polynomial
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const List<Tuple2<Type, Type>>& coeffs
|
const List<Tuple2<Type, Type>>& coeffs,
|
||||||
|
const objectRegistry* obrPtr
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
Function1<Type>(entryName),
|
Function1<Type>(entryName, obrPtr),
|
||||||
coeffs_(coeffs),
|
coeffs_(coeffs),
|
||||||
canIntegrate_(true)
|
canIntegrate_(true)
|
||||||
{
|
{
|
||||||
@ -127,7 +129,7 @@ Foam::Function1Types::Polynomial<Type>::Polynomial(const Polynomial& poly)
|
|||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::Function1Types::Polynomial<Type>::convertTimeBase(const Time& t)
|
void Foam::Function1Types::Polynomial<Type>::userTimeToTime(const Time& t)
|
||||||
{
|
{
|
||||||
forAll(coeffs_, i)
|
forAll(coeffs_, i)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -108,14 +108,20 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from entry name and dictionary
|
//- Construct from entry name, dictionary and optional registry
|
||||||
Polynomial(const word& entryName, const dictionary& dict);
|
Polynomial
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
|
);
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
Polynomial
|
Polynomial
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const List<Tuple2<Type, Type>>& coeffs
|
const List<Tuple2<Type, Type>>& coeffs,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Copy constructor
|
//- Copy constructor
|
||||||
@ -135,7 +141,7 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Convert time
|
//- Convert time
|
||||||
virtual void convertTimeBase(const Time& t);
|
virtual void userTimeToTime(const Time& t);
|
||||||
|
|
||||||
//- Return Polynomial value
|
//- Return Polynomial value
|
||||||
virtual Type value(const scalar x) const;
|
virtual Type value(const scalar x) const;
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenFOAM Foundation
|
Copyright (C) 2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -28,24 +28,27 @@ License
|
|||||||
|
|
||||||
#include "Scale.H"
|
#include "Scale.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::Function1Types::Scale<Type>::read(const dictionary& coeffs)
|
void Foam::Function1Types::Scale<Type>::read(const dictionary& coeffs)
|
||||||
{
|
{
|
||||||
scale_ = Function1<scalar>::New("scale", coeffs);
|
scale_ = Function1<scalar>::New("scale", coeffs, this->obrPtr_);
|
||||||
value_ = Function1<Type>::New("value", coeffs);
|
value_ = Function1<Type>::New("value", coeffs, this->obrPtr_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::Function1Types::Scale<Type>::Scale
|
Foam::Function1Types::Scale<Type>::Scale
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
Function1<Type>(entryName)
|
Function1<Type>(entryName, obrPtr)
|
||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenFOAM Foundation
|
Copyright (C) 2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -122,11 +122,12 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from entry name and dictionary
|
//- Construct from entry name, dictionary and optional registry
|
||||||
Scale
|
Scale
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Copy construct
|
//- Copy construct
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2017 OpenFOAM Foundation
|
Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -34,20 +34,27 @@ template<class Type>
|
|||||||
Foam::Function1Types::Sine<Type>::Sine
|
Foam::Function1Types::Sine<Type>::Sine
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
Function1<Type>(entryName, dict),
|
Function1<Type>(entryName, dict, obrPtr),
|
||||||
t0_(dict.getOrDefault<scalar>("t0", 0)),
|
t0_(dict.getOrDefault<scalar>("t0", 0)),
|
||||||
amplitude_(Function1<scalar>::NewIfPresent("amplitude", dict)),
|
amplitude_
|
||||||
period_(Function1<scalar>::NewIfPresent("period", dict)),
|
(
|
||||||
|
Function1<scalar>::NewIfPresent("amplitude", dict, word::null, obrPtr)
|
||||||
|
),
|
||||||
|
period_
|
||||||
|
(
|
||||||
|
Function1<scalar>::NewIfPresent("period", dict, word::null, obrPtr)
|
||||||
|
),
|
||||||
frequency_(nullptr),
|
frequency_(nullptr),
|
||||||
scale_(Function1<Type>::New("scale", dict)),
|
scale_(Function1<Type>::New("scale", dict, obrPtr)),
|
||||||
level_(Function1<Type>::New("level", dict))
|
level_(Function1<Type>::New("level", dict, obrPtr))
|
||||||
{
|
{
|
||||||
if (!period_)
|
if (!period_)
|
||||||
{
|
{
|
||||||
frequency_ = Function1<scalar>::New("frequency", dict);
|
frequency_ = Function1<scalar>::New("frequency", dict, obrPtr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,9 +75,9 @@ Foam::Function1Types::Sine<Type>::Sine(const Sine<Type>& rhs)
|
|||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::Function1Types::Sine<Type>::convertTimeBase(const Time& t)
|
void Foam::Function1Types::Sine<Type>::userTimeToTime(const Time& t)
|
||||||
{
|
{
|
||||||
t0_ = t.timeToUserTime(t0_);
|
t0_ = t.userTimeToTime(t0_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2017 OpenFOAM Foundation
|
Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -181,8 +181,13 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from entry name and dictionary
|
//- Construct from entry name, dictionary and optional registry
|
||||||
Sine(const word& entryName, const dictionary& dict);
|
Sine
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
|
);
|
||||||
|
|
||||||
//- Copy construct
|
//- Copy construct
|
||||||
explicit Sine(const Sine<Type>& rhs);
|
explicit Sine(const Sine<Type>& rhs);
|
||||||
@ -195,7 +200,7 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Convert time
|
//- Convert time
|
||||||
virtual void convertTimeBase(const Time& t);
|
virtual void userTimeToTime(const Time& t);
|
||||||
|
|
||||||
//- Return value for time t
|
//- Return value for time t
|
||||||
virtual inline Type value(const scalar t) const
|
virtual inline Type value(const scalar t) const
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2017 OpenFOAM Foundation
|
Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2020 OpenCFD Ltd.
|
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -34,10 +34,11 @@ template<class Type>
|
|||||||
Foam::Function1Types::Square<Type>::Square
|
Foam::Function1Types::Square<Type>::Square
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
Sine<Type>(entryName, dict),
|
Sine<Type>(entryName, dict, obrPtr),
|
||||||
mark_(dict.getOrDefaultCompat<scalar>("mark", {{"markSpace", 2006}}, 1)),
|
mark_(dict.getOrDefaultCompat<scalar>("mark", {{"markSpace", 2006}}, 1)),
|
||||||
space_(dict.getOrDefault<scalar>("space", 1))
|
space_(dict.getOrDefault<scalar>("space", 1))
|
||||||
{}
|
{}
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2016-2017 OpenFOAM Foundation
|
Copyright (C) 2016-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -144,8 +144,13 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from entry name and dictionary
|
//- Construct from entry name, dictionary and optional registry
|
||||||
Square(const word& entryName, const dictionary& dict);
|
Square
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
|
);
|
||||||
|
|
||||||
//- Copy construct
|
//- Copy construct
|
||||||
explicit Square(const Square<Type>& rhs);
|
explicit Square(const Square<Type>& rhs);
|
||||||
|
|||||||
@ -34,10 +34,11 @@ template<class Type>
|
|||||||
Foam::Function1Types::Table<Type>::Table
|
Foam::Function1Types::Table<Type>::Table
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
TableBase<Type>(entryName, dict),
|
TableBase<Type>(entryName, dict, obrPtr),
|
||||||
fName_()
|
fName_()
|
||||||
{
|
{
|
||||||
const entry* eptr = dict.findEntry(entryName, keyType::LITERAL);
|
const entry* eptr = dict.findEntry(entryName, keyType::LITERAL);
|
||||||
@ -84,7 +85,7 @@ Foam::Function1Types::Table<Type>::Table
|
|||||||
dict.readEntry("values", this->table_);
|
dict.readEntry("values", this->table_);
|
||||||
}
|
}
|
||||||
|
|
||||||
TableBase<Type>::check();
|
TableBase<Type>::initialise();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -119,8 +119,13 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from entry name and dictionary.
|
//- Construct from entry name, dictionary and optional registry
|
||||||
Table(const word& entryName, const dictionary& dict);
|
Table
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
|
);
|
||||||
|
|
||||||
//- Copy construct
|
//- Copy construct
|
||||||
explicit Table(const Table<Type>& tbl);
|
explicit Table(const Table<Type>& tbl);
|
||||||
|
|||||||
@ -62,10 +62,11 @@ template<class Type>
|
|||||||
Foam::Function1Types::TableBase<Type>::TableBase
|
Foam::Function1Types::TableBase<Type>::TableBase
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const dictionary& dict
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
Function1<Type>(name, dict),
|
Function1<Type>(name, dict, obrPtr),
|
||||||
bounding_
|
bounding_
|
||||||
(
|
(
|
||||||
bounds::repeatableBoundingNames.getOrDefault
|
bounds::repeatableBoundingNames.getOrDefault
|
||||||
@ -103,17 +104,10 @@ Foam::Function1Types::TableBase<Type>::TableBase(const TableBase<Type>& tbl)
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::Function1Types::TableBase<Type>::~TableBase()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::Function1Types::TableBase<Type>::check() const
|
void Foam::Function1Types::TableBase<Type>::initialise()
|
||||||
{
|
{
|
||||||
if (!table_.size())
|
if (!table_.size())
|
||||||
{
|
{
|
||||||
@ -260,7 +254,7 @@ bool Foam::Function1Types::TableBase<Type>::checkMaxBounds
|
|||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::Function1Types::TableBase<Type>::convertTimeBase(const Time& t)
|
void Foam::Function1Types::TableBase<Type>::userTimeToTime(const Time& t)
|
||||||
{
|
{
|
||||||
for (auto& item : table_)
|
for (auto& item : table_)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -101,20 +101,25 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from dictionary - note table is not populated
|
//- Construct from dictionary - note table is not populated
|
||||||
TableBase(const word& name, const dictionary& dict);
|
TableBase
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
|
);
|
||||||
|
|
||||||
//- Copy constructor. Note: steals interpolator, tableSamples
|
//- Copy constructor. Note: steals interpolator, tableSamples
|
||||||
explicit TableBase(const TableBase<Type>& tbl);
|
explicit TableBase(const TableBase<Type>& tbl);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~TableBase();
|
virtual ~TableBase() = default;
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Check the table for size and consistency
|
//- Check the table for size and consistency
|
||||||
void check() const;
|
void initialise();
|
||||||
|
|
||||||
//- Check minimum table bounds
|
//- Check minimum table bounds
|
||||||
bool checkMinBounds(const scalar x, scalar& xDash) const;
|
bool checkMinBounds(const scalar x, scalar& xDash) const;
|
||||||
@ -123,7 +128,7 @@ public:
|
|||||||
bool checkMaxBounds(const scalar x, scalar& xDash) const;
|
bool checkMaxBounds(const scalar x, scalar& xDash) const;
|
||||||
|
|
||||||
//- Convert time
|
//- Convert time
|
||||||
virtual void convertTimeBase(const Time& t);
|
virtual void userTimeToTime(const Time& t);
|
||||||
|
|
||||||
//- Return Table value
|
//- Return Table value
|
||||||
virtual Type value(const scalar x) const;
|
virtual Type value(const scalar x) const;
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2016-2019 OpenCFD Ltd.
|
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -34,10 +34,11 @@ template<class Type>
|
|||||||
Foam::Function1Types::TableFile<Type>::TableFile
|
Foam::Function1Types::TableFile<Type>::TableFile
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
TableBase<Type>(entryName, dict),
|
TableBase<Type>(entryName, dict, obrPtr),
|
||||||
fName_()
|
fName_()
|
||||||
{
|
{
|
||||||
dict.readEntry("file", fName_);
|
dict.readEntry("file", fName_);
|
||||||
@ -56,7 +57,7 @@ Foam::Function1Types::TableFile<Type>::TableFile
|
|||||||
|
|
||||||
is >> this->table_;
|
is >> this->table_;
|
||||||
|
|
||||||
TableBase<Type>::check();
|
TableBase<Type>::initialise();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2019-2020 OpenCFD Ltd.
|
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -101,7 +101,12 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from entry name and "file" found in dictionary
|
//- Construct from entry name and "file" found in dictionary
|
||||||
TableFile(const word& entryName, const dictionary& dict);
|
TableFile
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
|
);
|
||||||
|
|
||||||
//- Copy construct
|
//- Copy construct
|
||||||
explicit TableFile(const TableFile<Type>& tbl);
|
explicit TableFile(const TableFile<Type>& tbl);
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenFOAM Foundation
|
Copyright (C) 2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -38,15 +38,12 @@ Description
|
|||||||
<entryName> uniform <value>
|
<entryName> uniform <value>
|
||||||
\endverbatim
|
\endverbatim
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
Uniform.C
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef Function1Types_Uniform_H
|
#ifndef Function1Types_Uniform_H
|
||||||
#define Function1Types_Uniform_H
|
#define Function1Types_Uniform_H
|
||||||
|
|
||||||
#include "Function1.H"
|
#include "Constant.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -81,8 +78,16 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from entry name and dictionary
|
//- Construct from entry name, dictionary and optional registry
|
||||||
Uniform(const word& entryName, const dictionary& dict);
|
Uniform
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
|
)
|
||||||
|
:
|
||||||
|
Constant<Type>(entryName, dict, obrPtr)
|
||||||
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -93,12 +98,6 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#ifdef NoRepository
|
|
||||||
#include "Uniform.C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenFOAM Foundation
|
Copyright (C) 2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -31,9 +31,13 @@ License
|
|||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::Function1Types::ZeroConstant<Type>::ZeroConstant(const word& entryName)
|
Foam::Function1Types::ZeroConstant<Type>::ZeroConstant
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const objectRegistry* obrPtr
|
||||||
|
)
|
||||||
:
|
:
|
||||||
Function1<Type>(entryName)
|
Function1<Type>(entryName, obrPtr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -41,10 +45,11 @@ template<class Type>
|
|||||||
Foam::Function1Types::ZeroConstant<Type>::ZeroConstant
|
Foam::Function1Types::ZeroConstant<Type>::ZeroConstant
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
Function1<Type>(entryName, dict)
|
Function1<Type>(entryName, dict, obrPtr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenFOAM Foundation
|
Copyright (C) 2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -84,11 +84,20 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from entry name
|
//- Construct from entry name and optional registry
|
||||||
explicit ZeroConstant(const word& entryName);
|
explicit ZeroConstant
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
|
);
|
||||||
|
|
||||||
//- Construct from entry name and dictionary
|
//- Construct from entry name, dictionary and optional registry
|
||||||
ZeroConstant(const word& entryName, const dictionary& dict);
|
ZeroConstant
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenFOAM Foundation
|
Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -43,10 +44,11 @@ namespace Function1Types
|
|||||||
Foam::Function1Types::halfCosineRamp::halfCosineRamp
|
Foam::Function1Types::halfCosineRamp::halfCosineRamp
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
ramp(entryName, dict)
|
ramp(entryName, dict, obrPtr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenFOAM Foundation
|
Copyright (C) 2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -67,8 +67,13 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from entry name and dictionary
|
//- Construct from entry name, dictionary and optional registry
|
||||||
halfCosineRamp(const word& entryName, const dictionary& dict);
|
halfCosineRamp
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenFOAM Foundation
|
Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -43,10 +44,11 @@ namespace Function1Types
|
|||||||
Foam::Function1Types::linearRamp::linearRamp
|
Foam::Function1Types::linearRamp::linearRamp
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
ramp(entryName, dict)
|
ramp(entryName, dict, obrPtr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenFOAM Foundation
|
Copyright (C) 2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -67,8 +67,13 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from entry name and dictionary
|
//- Construct from entry name, dictionary and optional registry
|
||||||
linearRamp(const word& entryName, const dictionary& dict);
|
linearRamp
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
|
|||||||
@ -38,7 +38,9 @@ License
|
|||||||
#include "Table.H"
|
#include "Table.H"
|
||||||
#include "TableFile.H"
|
#include "TableFile.H"
|
||||||
#include "Scale.H"
|
#include "Scale.H"
|
||||||
#include "LimitRange.H"
|
#include "InputValueMapper.H"
|
||||||
|
#include "FunctionObjectTrigger.H"
|
||||||
|
#include "FunctionObjectValue.H"
|
||||||
#include "fieldTypes.H"
|
#include "fieldTypes.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -57,7 +59,8 @@ License
|
|||||||
makeFunction1Type(Table, Type); \
|
makeFunction1Type(Table, Type); \
|
||||||
makeFunction1Type(TableFile, Type); \
|
makeFunction1Type(TableFile, Type); \
|
||||||
makeFunction1Type(Scale, Type); \
|
makeFunction1Type(Scale, Type); \
|
||||||
makeFunction1Type(LimitRange, Type);
|
makeFunction1Type(InputValueMapper, Type); \
|
||||||
|
makeFunction1Type(FunctionObjectValue, Type);
|
||||||
|
|
||||||
#define makeFieldFunction1s(Type) \
|
#define makeFieldFunction1s(Type) \
|
||||||
makeFunction1(Type); \
|
makeFunction1(Type); \
|
||||||
@ -71,6 +74,10 @@ namespace Foam
|
|||||||
makeFunction1(label);
|
makeFunction1(label);
|
||||||
makeFunction1Type(Constant, label);
|
makeFunction1Type(Constant, label);
|
||||||
|
|
||||||
|
makeFunction1Type(FunctionObjectTrigger, label);
|
||||||
|
makeFunction1Type(FunctionObjectTrigger, scalar);
|
||||||
|
// Only (label/scalar) makes sense for triggers
|
||||||
|
|
||||||
makeFunction1s(scalar);
|
makeFunction1s(scalar);
|
||||||
makeFunction1s(vector);
|
makeFunction1s(vector);
|
||||||
makeFunction1s(sphericalTensor);
|
makeFunction1s(sphericalTensor);
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenFOAM Foundation
|
Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -43,10 +44,11 @@ namespace Function1Types
|
|||||||
Foam::Function1Types::quadraticRamp::quadraticRamp
|
Foam::Function1Types::quadraticRamp::quadraticRamp
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
ramp(entryName, dict)
|
ramp(entryName, dict, obrPtr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenFOAM Foundation
|
Copyright (C) 2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -67,8 +67,13 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from entry name and dictionary
|
//- Construct from entry name, dictionary and optional registry
|
||||||
quadraticRamp(const word& entryName, const dictionary& dict);
|
quadraticRamp
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenFOAM Foundation
|
Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -43,7 +44,8 @@ namespace Function1Types
|
|||||||
Foam::Function1Types::quarterCosineRamp::quarterCosineRamp
|
Foam::Function1Types::quarterCosineRamp::quarterCosineRamp
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
ramp(entryName, dict)
|
ramp(entryName, dict)
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenFOAM Foundation
|
Copyright (C) 2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -67,8 +67,13 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from entry name and dictionary
|
//- Construct from entry name, dictionary and optional registry
|
||||||
quarterCosineRamp(const word& entryName, const dictionary& dict);
|
quarterCosineRamp
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenFOAM Foundation
|
Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -43,10 +44,11 @@ namespace Function1Types
|
|||||||
Foam::Function1Types::quarterSineRamp::quarterSineRamp
|
Foam::Function1Types::quarterSineRamp::quarterSineRamp
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
ramp(entryName, dict)
|
ramp(entryName, dict, obrPtr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenFOAM Foundation
|
Copyright (C) 2017 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -66,8 +67,13 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from entry name and dictionary
|
//- Construct from entry name, dictionary and optional registry
|
||||||
quarterSineRamp(const word& entryName, const dictionary& dict);
|
quarterSineRamp
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenFOAM Foundation
|
Copyright (C) 2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -40,10 +40,11 @@ void Foam::Function1Types::ramp::read(const dictionary& coeffs)
|
|||||||
Foam::Function1Types::ramp::ramp
|
Foam::Function1Types::ramp::ramp
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
Function1<scalar>(entryName, dict)
|
Function1<scalar>(entryName, dict, obrPtr)
|
||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
}
|
}
|
||||||
@ -58,10 +59,10 @@ void Foam::Function1Types::ramp::writeEntries(Ostream& os) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::Function1Types::ramp::convertTimeBase(const Time& t)
|
void Foam::Function1Types::ramp::userTimeToTime(const Time& t)
|
||||||
{
|
{
|
||||||
start_ = t.timeToUserTime(start_);
|
start_ = t.userTimeToTime(start_);
|
||||||
duration_ = t.timeToUserTime(duration_);
|
duration_ = t.userTimeToTime(duration_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenFOAM Foundation
|
Copyright (C) 2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -119,11 +119,12 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from entry name and dictionary
|
//- Construct from entry name, dictionary and optional registry
|
||||||
ramp
|
ramp
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -134,7 +135,7 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Convert time
|
//- Convert time
|
||||||
virtual void convertTimeBase(const Time& t);
|
virtual void userTimeToTime(const Time& t);
|
||||||
|
|
||||||
//- Return value for time t
|
//- Return value for time t
|
||||||
virtual scalar value(const scalar t) const = 0;
|
virtual scalar value(const scalar t) const = 0;
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -43,10 +43,11 @@ namespace Function1Types
|
|||||||
Foam::Function1Types::stepFunction::stepFunction
|
Foam::Function1Types::stepFunction::stepFunction
|
||||||
(
|
(
|
||||||
const word& entryName,
|
const word& entryName,
|
||||||
const dictionary& dict
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
ramp(entryName, dict)
|
ramp(entryName, dict, obrPtr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
\\ / A nd | www.openfoam.com
|
\\ / A nd | www.openfoam.com
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -66,8 +66,13 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from entry name and dictionary
|
//- Construct from entry name, dictionary and optional registry
|
||||||
stepFunction(const word& entryName, const dictionary& dict);
|
stepFunction
|
||||||
|
(
|
||||||
|
const word& entryName,
|
||||||
|
const dictionary& dict,
|
||||||
|
const objectRegistry* obrPtr = nullptr
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2012-2016 OpenFOAM Foundation
|
Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -40,9 +40,10 @@ Foam::TimeFunction1<Type>::TimeFunction1
|
|||||||
:
|
:
|
||||||
time_(runTime),
|
time_(runTime),
|
||||||
name_(entryName),
|
name_(entryName),
|
||||||
entry_(Function1<Type>::New(entryName, dict))
|
entry_(Function1<Type>::New(entryName, dict, &runTime))
|
||||||
{
|
{
|
||||||
entry_->convertTimeBase(runTime);
|
// Time conversion now handled by Function1 directly
|
||||||
|
// entry_->userTimeToTime(runTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -81,8 +82,8 @@ Foam::TimeFunction1<Type>::TimeFunction1
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::TimeFunction1<Type>::reset(const dictionary& dict)
|
void Foam::TimeFunction1<Type>::reset(const dictionary& dict)
|
||||||
{
|
{
|
||||||
entry_ = Function1<Type>::New(name_, dict);
|
entry_ = Function1<Type>::New(name_, dict, &time_);
|
||||||
entry_->convertTimeBase(time_);
|
entry_->userTimeToTime(time_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -110,7 +110,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField
|
|||||||
{
|
{
|
||||||
case fixedPower:
|
case fixedPower:
|
||||||
{
|
{
|
||||||
Q_ = Function1<scalar>::New("Q", dict);
|
Q_ = Function1<scalar>::New("Q", dict, &db());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case fixedHeatFlux:
|
case fixedHeatFlux:
|
||||||
@ -121,7 +121,7 @@ externalWallHeatFluxTemperatureFvPatchScalarField
|
|||||||
case fixedHeatTransferCoeff:
|
case fixedHeatTransferCoeff:
|
||||||
{
|
{
|
||||||
h_ = PatchFunction1<scalar>::New(patch().patch(), "h", dict);
|
h_ = PatchFunction1<scalar>::New(patch().patch(), "h", dict);
|
||||||
Ta_ = Function1<scalar>::New("Ta", dict);
|
Ta_ = Function1<scalar>::New("Ta", dict, &db());
|
||||||
|
|
||||||
if (dict.readIfPresent("thicknessLayers", thicknessLayers_))
|
if (dict.readIfPresent("thicknessLayers", thicknessLayers_))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -59,8 +59,8 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField
|
|||||||
fixedJumpFvPatchField<scalar>(p, iF),
|
fixedJumpFvPatchField<scalar>(p, iF),
|
||||||
phiName_(dict.getOrDefault<word>("phi", "phi")),
|
phiName_(dict.getOrDefault<word>("phi", "phi")),
|
||||||
rhoName_(dict.getOrDefault<word>("rho", "rho")),
|
rhoName_(dict.getOrDefault<word>("rho", "rho")),
|
||||||
D_(Function1<scalar>::New("D", dict)),
|
D_(Function1<scalar>::New("D", dict, &db())),
|
||||||
I_(Function1<scalar>::New("I", dict)),
|
I_(Function1<scalar>::New("I", dict, &db())),
|
||||||
length_(dict.get<scalar>("length")),
|
length_(dict.get<scalar>("length")),
|
||||||
uniformJump_(dict.getOrDefault("uniformJump", false))
|
uniformJump_(dict.getOrDefault("uniformJump", false))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2014-2016 OpenFOAM Foundation
|
Copyright (C) 2014-2016 OpenFOAM Foundation
|
||||||
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.
|
||||||
@ -45,10 +45,10 @@ atmBoundaryLayer::atmBoundaryLayer(const Time& time, const polyPatch& pp)
|
|||||||
ppMin_((boundBox(pp.points())).min()),
|
ppMin_((boundBox(pp.points())).min()),
|
||||||
time_(time),
|
time_(time),
|
||||||
patch_(pp),
|
patch_(pp),
|
||||||
flowDir_(time, "flowDir"),
|
flowDir_(nullptr),
|
||||||
zDir_(time, "zDir"),
|
zDir_(nullptr),
|
||||||
Uref_(time, "Uref"),
|
Uref_(nullptr),
|
||||||
Zref_(time, "Zref"),
|
Zref_(nullptr),
|
||||||
z0_(nullptr),
|
z0_(nullptr),
|
||||||
d_(nullptr)
|
d_(nullptr)
|
||||||
{}
|
{}
|
||||||
@ -72,10 +72,10 @@ atmBoundaryLayer::atmBoundaryLayer
|
|||||||
ppMin_((boundBox(pp.points())).min()),
|
ppMin_((boundBox(pp.points())).min()),
|
||||||
time_(time),
|
time_(time),
|
||||||
patch_(pp),
|
patch_(pp),
|
||||||
flowDir_(TimeFunction1<vector>(time, "flowDir", dict)),
|
flowDir_(Function1<vector>::New("flowDir", dict, &time)),
|
||||||
zDir_(TimeFunction1<vector>(time, "zDir", dict)),
|
zDir_(Function1<vector>::New("zDir", dict, &time)),
|
||||||
Uref_(TimeFunction1<scalar>(time, "Uref", dict)),
|
Uref_(Function1<scalar>::New("Uref", dict, &time)),
|
||||||
Zref_(TimeFunction1<scalar>(time, "Zref", dict)),
|
Zref_(Function1<scalar>::New("Zref", dict, &time)),
|
||||||
z0_(PatchFunction1<scalar>::New(pp, "z0", dict)),
|
z0_(PatchFunction1<scalar>::New(pp, "z0", dict)),
|
||||||
d_(PatchFunction1<scalar>::New(pp, "d", dict))
|
d_(PatchFunction1<scalar>::New(pp, "d", dict))
|
||||||
{}
|
{}
|
||||||
@ -96,10 +96,10 @@ atmBoundaryLayer::atmBoundaryLayer
|
|||||||
ppMin_(abl.ppMin_),
|
ppMin_(abl.ppMin_),
|
||||||
time_(abl.time_),
|
time_(abl.time_),
|
||||||
patch_(patch.patch()),
|
patch_(patch.patch()),
|
||||||
flowDir_(abl.flowDir_),
|
flowDir_(abl.flowDir_.clone()),
|
||||||
zDir_(abl.zDir_),
|
zDir_(abl.zDir_.clone()),
|
||||||
Uref_(abl.Uref_),
|
Uref_(abl.Uref_.clone()),
|
||||||
Zref_(abl.Zref_),
|
Zref_(abl.Zref_.clone()),
|
||||||
z0_(abl.z0_.clone(patch_)),
|
z0_(abl.z0_.clone(patch_)),
|
||||||
d_(abl.d_.clone(patch_))
|
d_(abl.d_.clone(patch_))
|
||||||
{}
|
{}
|
||||||
@ -129,13 +129,13 @@ atmBoundaryLayer::atmBoundaryLayer(const atmBoundaryLayer& abl)
|
|||||||
vector atmBoundaryLayer::flowDir() const
|
vector atmBoundaryLayer::flowDir() const
|
||||||
{
|
{
|
||||||
const scalar t = time_.timeOutputValue();
|
const scalar t = time_.timeOutputValue();
|
||||||
const vector dir(flowDir_.value(t));
|
const vector dir(flowDir_->value(t));
|
||||||
const scalar magDir = mag(dir);
|
const scalar magDir = mag(dir);
|
||||||
|
|
||||||
if (magDir < SMALL)
|
if (magDir < SMALL)
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "magnitude of " << flowDir_.name() << " = " << magDir
|
<< "magnitude of " << flowDir_->name() << " = " << magDir
|
||||||
<< " vector must be greater than zero"
|
<< " vector must be greater than zero"
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
@ -147,13 +147,13 @@ vector atmBoundaryLayer::flowDir() const
|
|||||||
vector atmBoundaryLayer::zDir() const
|
vector atmBoundaryLayer::zDir() const
|
||||||
{
|
{
|
||||||
const scalar t = time_.timeOutputValue();
|
const scalar t = time_.timeOutputValue();
|
||||||
const vector dir(zDir_.value(t));
|
const vector dir(zDir_->value(t));
|
||||||
const scalar magDir = mag(dir);
|
const scalar magDir = mag(dir);
|
||||||
|
|
||||||
if (magDir < SMALL)
|
if (magDir < SMALL)
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "magnitude of " << zDir_.name() << " = " << magDir
|
<< "magnitude of " << zDir_->name() << " = " << magDir
|
||||||
<< " vector must be greater than zero"
|
<< " vector must be greater than zero"
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
@ -165,13 +165,13 @@ vector atmBoundaryLayer::zDir() const
|
|||||||
tmp<scalarField> atmBoundaryLayer::Ustar(const scalarField& z0) const
|
tmp<scalarField> atmBoundaryLayer::Ustar(const scalarField& z0) const
|
||||||
{
|
{
|
||||||
const scalar t = time_.timeOutputValue();
|
const scalar t = time_.timeOutputValue();
|
||||||
const scalar Uref = Uref_.value(t);
|
const scalar Uref = Uref_->value(t);
|
||||||
const scalar Zref = Zref_.value(t);
|
const scalar Zref = Zref_->value(t);
|
||||||
|
|
||||||
if (Zref < 0)
|
if (Zref < 0)
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "Negative entry in " << Zref_.name() << " = " << Zref
|
<< "Negative entry in " << Zref_->name() << " = " << Zref
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,10 +274,10 @@ void atmBoundaryLayer::write(Ostream& os) const
|
|||||||
os.writeEntry("Cmu", Cmu_);
|
os.writeEntry("Cmu", Cmu_);
|
||||||
os.writeEntry("C1", C1_);
|
os.writeEntry("C1", C1_);
|
||||||
os.writeEntry("C2", C2_);
|
os.writeEntry("C2", C2_);
|
||||||
flowDir_.writeData(os);
|
flowDir_->writeData(os);
|
||||||
zDir_.writeData(os);
|
zDir_->writeData(os);
|
||||||
Uref_.writeData(os);
|
Uref_->writeData(os);
|
||||||
Zref_.writeData(os);
|
Zref_->writeData(os);
|
||||||
if (z0_)
|
if (z0_)
|
||||||
{
|
{
|
||||||
z0_->writeData(os) ;
|
z0_->writeData(os) ;
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2014-2018 OpenFOAM Foundation
|
Copyright (C) 2014-2018 OpenFOAM Foundation
|
||||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -157,12 +157,12 @@ Usage
|
|||||||
where the entries mean:
|
where the entries mean:
|
||||||
\table
|
\table
|
||||||
Property | Description | Type | Reqd | Deflt
|
Property | Description | Type | Reqd | Deflt
|
||||||
flowDir | Flow direction | TimeFunction1<vector> | yes | -
|
flowDir | Flow direction | Function1<vector> | yes | -
|
||||||
zDir | Ground-normal direction | TimeFunction1<vector> | yes | -
|
zDir | Ground-normal direction | Function1<vector> | yes | -
|
||||||
Uref | Reference mean streamwise flow speed being used in <!--
|
Uref | Reference mean streamwise flow speed being used in <!--
|
||||||
--> \f$u^*\f$ estimations [m/s] | TimeFunction1<scalar> | yes | -
|
--> \f$u^*\f$ estimations [m/s] | Function1<scalar> | yes | -
|
||||||
Zref | Reference height being used in \f$u^*\f$ estimations [m] <!--
|
Zref | Reference height being used in \f$u^*\f$ estimations [m] <!--
|
||||||
--> | TimeFunction1<scalar> | yes | -
|
--> | Function1<scalar> | yes | -
|
||||||
z0 | Surface roughness length [m] <!--
|
z0 | Surface roughness length [m] <!--
|
||||||
--> | PatchFunction1<scalar> | yes | -
|
--> | PatchFunction1<scalar> | yes | -
|
||||||
d | Displacement height [m] - see Notes <!--
|
d | Displacement height [m] - see Notes <!--
|
||||||
@ -217,7 +217,7 @@ SourceFiles
|
|||||||
#define atmBoundaryLayer_H
|
#define atmBoundaryLayer_H
|
||||||
|
|
||||||
#include "fvPatchFields.H"
|
#include "fvPatchFields.H"
|
||||||
#include "TimeFunction1.H"
|
#include "Function1.H"
|
||||||
#include "PatchFunction1.H"
|
#include "PatchFunction1.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -266,16 +266,16 @@ private:
|
|||||||
const polyPatch& patch_;
|
const polyPatch& patch_;
|
||||||
|
|
||||||
//- Streamwise flow direction
|
//- Streamwise flow direction
|
||||||
TimeFunction1<vector> flowDir_;
|
autoPtr<Function1<vector>> flowDir_;
|
||||||
|
|
||||||
//- Direction of the ground-normal coordinate
|
//- Direction of the ground-normal coordinate
|
||||||
TimeFunction1<vector> zDir_;
|
autoPtr<Function1<vector>> zDir_;
|
||||||
|
|
||||||
//- Reference mean streamwise flow speed being used in Ustar estimations
|
//- Reference mean streamwise flow speed being used in Ustar estimations
|
||||||
TimeFunction1<scalar> Uref_;
|
autoPtr<Function1<scalar>> Uref_;
|
||||||
|
|
||||||
//- Reference height being used in Ustar estimations
|
//- Reference height being used in Ustar estimations
|
||||||
TimeFunction1<scalar> Zref_;
|
autoPtr<Function1<scalar>> Zref_;
|
||||||
|
|
||||||
//- Surface roughness length
|
//- Surface roughness length
|
||||||
autoPtr<PatchFunction1<scalar>> z0_;
|
autoPtr<PatchFunction1<scalar>> z0_;
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2020 ENERCON GmbH
|
Copyright (C) 2020 ENERCON GmbH
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -62,7 +62,7 @@ atmTurbulentHeatFluxTemperatureFvPatchScalarField
|
|||||||
fixedGradientFvPatchScalarField(p, iF),
|
fixedGradientFvPatchScalarField(p, iF),
|
||||||
heatSource_(heatSourceType::POWER),
|
heatSource_(heatSourceType::POWER),
|
||||||
alphaEffName_("undefinedAlphaEff"),
|
alphaEffName_("undefinedAlphaEff"),
|
||||||
Cp0_(db().time(), "Cp0"),
|
Cp0_(nullptr),
|
||||||
q_(nullptr)
|
q_(nullptr)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ atmTurbulentHeatFluxTemperatureFvPatchScalarField
|
|||||||
fixedGradientFvPatchScalarField(ptf, p, iF, mapper),
|
fixedGradientFvPatchScalarField(ptf, p, iF, mapper),
|
||||||
heatSource_(ptf.heatSource_),
|
heatSource_(ptf.heatSource_),
|
||||||
alphaEffName_(ptf.alphaEffName_),
|
alphaEffName_(ptf.alphaEffName_),
|
||||||
Cp0_(ptf.Cp0_),
|
Cp0_(ptf.Cp0_.clone()),
|
||||||
q_(ptf.q_.clone(p.patch()))
|
q_(ptf.q_.clone(p.patch()))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ atmTurbulentHeatFluxTemperatureFvPatchScalarField
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
alphaEffName_(dict.get<word>("alphaEff")),
|
alphaEffName_(dict.get<word>("alphaEff")),
|
||||||
Cp0_(TimeFunction1<scalar>(db().time(), "Cp0", dict)),
|
Cp0_(Function1<scalar>::New("Cp0", dict, &db())),
|
||||||
q_(PatchFunction1<scalar>::New(p.patch(), "q", dict))
|
q_(PatchFunction1<scalar>::New(p.patch(), "q", dict))
|
||||||
{
|
{
|
||||||
if (dict.found("value") && dict.found("gradient"))
|
if (dict.found("value") && dict.found("gradient"))
|
||||||
@ -189,7 +189,7 @@ void atmTurbulentHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
|
|||||||
patch().lookupPatchField<volScalarField, scalar>(alphaEffName_);
|
patch().lookupPatchField<volScalarField, scalar>(alphaEffName_);
|
||||||
|
|
||||||
const scalar t = db().time().timeOutputValue();
|
const scalar t = db().time().timeOutputValue();
|
||||||
const scalar Cp0 = Cp0_.value(t);
|
const scalar Cp0 = Cp0_->value(t);
|
||||||
|
|
||||||
if (Cp0 < SMALL)
|
if (Cp0 < SMALL)
|
||||||
{
|
{
|
||||||
@ -233,7 +233,7 @@ void atmTurbulentHeatFluxTemperatureFvPatchScalarField::write(Ostream& os) const
|
|||||||
fixedGradientFvPatchScalarField::write(os);
|
fixedGradientFvPatchScalarField::write(os);
|
||||||
os.writeEntry("heatSource", heatSourceTypeNames[heatSource_]);
|
os.writeEntry("heatSource", heatSourceTypeNames[heatSource_]);
|
||||||
os.writeEntry("alphaEff", alphaEffName_);
|
os.writeEntry("alphaEff", alphaEffName_);
|
||||||
Cp0_.writeData(os);
|
Cp0_->writeData(os);
|
||||||
q_->writeData(os);
|
q_->writeData(os);
|
||||||
writeEntry("value", os);
|
writeEntry("value", os);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2020 ENERCON GmbH
|
Copyright (C) 2020 ENERCON GmbH
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -67,14 +67,14 @@ Usage
|
|||||||
alphaEff | Name of turbulent thermal diff. field [kg/m/s] <!--
|
alphaEff | Name of turbulent thermal diff. field [kg/m/s] <!--
|
||||||
--> | word | yes | -
|
--> | word | yes | -
|
||||||
Cp0 | Specific heat capacity [m2/s2/K] <!--
|
Cp0 | Specific heat capacity [m2/s2/K] <!--
|
||||||
--> | TimeFunction1<scalar> | yes | -
|
--> | Function1<scalar> | yes | -
|
||||||
q | Heat source value [W (power) or W/m2 (flux)] <!--
|
q | Heat source value [W (power) or W/m2 (flux)] <!--
|
||||||
--> | PatchFunction1<scalar> | yes | -
|
--> | PatchFunction1<scalar> | yes | -
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
The inherited entries are elaborated in:
|
The inherited entries are elaborated in:
|
||||||
- \link fixedGradientFvPatchScalarField.H \endlink
|
- \link fixedGradientFvPatchScalarField.H \endlink
|
||||||
- \link TimeFunction1.H \endlink
|
- \link Function1.H \endlink
|
||||||
- \link PatchFunction1.H \endlink
|
- \link PatchFunction1.H \endlink
|
||||||
|
|
||||||
Options for the \c heatSource entry:
|
Options for the \c heatSource entry:
|
||||||
@ -93,7 +93,7 @@ SourceFiles
|
|||||||
|
|
||||||
#include "fvPatchFields.H"
|
#include "fvPatchFields.H"
|
||||||
#include "fixedGradientFvPatchFields.H"
|
#include "fixedGradientFvPatchFields.H"
|
||||||
#include "TimeFunction1.H"
|
#include "Function1.H"
|
||||||
#include "PatchFunction1.H"
|
#include "PatchFunction1.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -131,7 +131,7 @@ class atmTurbulentHeatFluxTemperatureFvPatchScalarField
|
|||||||
word alphaEffName_;
|
word alphaEffName_;
|
||||||
|
|
||||||
//- Specific heat capacity [m2/s2/K]
|
//- Specific heat capacity [m2/s2/K]
|
||||||
TimeFunction1<scalar> Cp0_;
|
autoPtr<Function1<scalar>> Cp0_;
|
||||||
|
|
||||||
//- Heat power [W] or flux [W/m2]
|
//- Heat power [W] or flux [W/m2]
|
||||||
// Divided by density, rho, if used in kinematic form
|
// Divided by density, rho, if used in kinematic form
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2020 ENERCON GmbH
|
Copyright (C) 2020 ENERCON GmbH
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -73,7 +73,7 @@ atmAlphatkWallFunctionFvPatchScalarField
|
|||||||
fixedValueFvPatchScalarField(p, iF),
|
fixedValueFvPatchScalarField(p, iF),
|
||||||
Cmu_(0.09),
|
Cmu_(0.09),
|
||||||
kappa_(0.41),
|
kappa_(0.41),
|
||||||
Pr_(db().time(), "Pr"),
|
Pr_(nullptr),
|
||||||
Prt_(nullptr),
|
Prt_(nullptr),
|
||||||
z0_(nullptr)
|
z0_(nullptr)
|
||||||
{
|
{
|
||||||
@ -93,7 +93,7 @@ atmAlphatkWallFunctionFvPatchScalarField
|
|||||||
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
|
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
|
||||||
Cmu_(ptf.Cmu_),
|
Cmu_(ptf.Cmu_),
|
||||||
kappa_(ptf.kappa_),
|
kappa_(ptf.kappa_),
|
||||||
Pr_(ptf.Pr_),
|
Pr_(ptf.Pr_.clone()),
|
||||||
Prt_(ptf.Prt_.clone(p.patch())),
|
Prt_(ptf.Prt_.clone(p.patch())),
|
||||||
z0_(ptf.z0_.clone(p.patch()))
|
z0_(ptf.z0_.clone(p.patch()))
|
||||||
{
|
{
|
||||||
@ -128,7 +128,7 @@ atmAlphatkWallFunctionFvPatchScalarField
|
|||||||
scalarMinMax::ge(SMALL)
|
scalarMinMax::ge(SMALL)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
Pr_(TimeFunction1<scalar>(db().time(), "Pr", dict)),
|
Pr_(Function1<scalar>::New("Pr", dict, &db())),
|
||||||
Prt_(PatchFunction1<scalar>::New(p.patch(), "Prt", dict)),
|
Prt_(PatchFunction1<scalar>::New(p.patch(), "Prt", dict)),
|
||||||
z0_(PatchFunction1<scalar>::New(p.patch(), "z0", dict))
|
z0_(PatchFunction1<scalar>::New(p.patch(), "z0", dict))
|
||||||
{
|
{
|
||||||
@ -204,7 +204,7 @@ void atmAlphatkWallFunctionFvPatchScalarField::updateCoeffs()
|
|||||||
const scalar Cmu25 = pow025(Cmu_);
|
const scalar Cmu25 = pow025(Cmu_);
|
||||||
|
|
||||||
const scalar t = db().time().timeOutputValue();
|
const scalar t = db().time().timeOutputValue();
|
||||||
const scalar Pr = Pr_.value(t);
|
const scalar Pr = Pr_->value(t);
|
||||||
|
|
||||||
#ifdef FULLDEBUG
|
#ifdef FULLDEBUG
|
||||||
if (Pr < VSMALL)
|
if (Pr < VSMALL)
|
||||||
@ -289,7 +289,7 @@ void atmAlphatkWallFunctionFvPatchScalarField::write(Ostream& os) const
|
|||||||
fvPatchField<scalar>::write(os);
|
fvPatchField<scalar>::write(os);
|
||||||
os.writeEntry("Cmu", Cmu_);
|
os.writeEntry("Cmu", Cmu_);
|
||||||
os.writeEntry("kappa", kappa_);
|
os.writeEntry("kappa", kappa_);
|
||||||
Pr_.writeData(os);
|
Pr_->writeData(os);
|
||||||
Prt_->writeData(os);
|
Prt_->writeData(os);
|
||||||
z0_->writeData(os);
|
z0_->writeData(os);
|
||||||
writeEntry("value", os);
|
writeEntry("value", os);
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2020 ENERCON GmbH
|
Copyright (C) 2020 ENERCON GmbH
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -67,7 +67,7 @@ Usage
|
|||||||
\table
|
\table
|
||||||
Property | Description | Type | Reqd | Dflt
|
Property | Description | Type | Reqd | Dflt
|
||||||
type | Type name: atmAlphatkWallFunction | word | yes | -
|
type | Type name: atmAlphatkWallFunction | word | yes | -
|
||||||
Pr | Molecular Prandtl number | TimeFunction1<scalar> | yes | -
|
Pr | Molecular Prandtl number | Function1<scalar> | yes | -
|
||||||
Prt | Turbulent Prandtl number | PatchFunction1<scalar> | yes | -
|
Prt | Turbulent Prandtl number | PatchFunction1<scalar> | yes | -
|
||||||
z0 | Surface roughness length [m] | PatchFunction1<scalar> | yes | -
|
z0 | Surface roughness length [m] | PatchFunction1<scalar> | yes | -
|
||||||
Cmu | Empirical model constant | scalar | no | 0.09
|
Cmu | Empirical model constant | scalar | no | 0.09
|
||||||
@ -76,7 +76,7 @@ Usage
|
|||||||
|
|
||||||
The inherited entries are elaborated in:
|
The inherited entries are elaborated in:
|
||||||
- \link fixedValueFvPatchField.H \endlink
|
- \link fixedValueFvPatchField.H \endlink
|
||||||
- \link TimeFunction1.H \endlink
|
- \link Function1.H \endlink
|
||||||
- \link PatchFunction1.H \endlink
|
- \link PatchFunction1.H \endlink
|
||||||
|
|
||||||
See also
|
See also
|
||||||
@ -91,7 +91,7 @@ SourceFiles
|
|||||||
#define atmAlphatkWallFunctionFvPatchScalarField_H
|
#define atmAlphatkWallFunctionFvPatchScalarField_H
|
||||||
|
|
||||||
#include "fixedValueFvPatchFields.H"
|
#include "fixedValueFvPatchFields.H"
|
||||||
#include "TimeFunction1.H"
|
#include "Function1.H"
|
||||||
#include "PatchFunction1.H"
|
#include "PatchFunction1.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -120,7 +120,7 @@ protected:
|
|||||||
const scalar kappa_;
|
const scalar kappa_;
|
||||||
|
|
||||||
//- Molecular Prandtl number
|
//- Molecular Prandtl number
|
||||||
TimeFunction1<scalar> Pr_;
|
autoPtr<Function1<scalar>> Pr_;
|
||||||
|
|
||||||
//- Turbulent Prandtl number field
|
//- Turbulent Prandtl number field
|
||||||
autoPtr<PatchFunction1<scalar>> Prt_;
|
autoPtr<PatchFunction1<scalar>> Prt_;
|
||||||
|
|||||||
@ -76,7 +76,7 @@ Foam::porosityModels::powerLawLopesdaCostaZone::powerLawLopesdaCostaZone
|
|||||||
// function of the normalized vertical position
|
// function of the normalized vertical position
|
||||||
autoPtr<Function1<scalar>> SigmaFunc
|
autoPtr<Function1<scalar>> SigmaFunc
|
||||||
(
|
(
|
||||||
Function1<scalar>::New("Sigma", dict)
|
Function1<scalar>::New("Sigma", dict, &mesh)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Searchable triSurface for the top of the porous region
|
// Searchable triSurface for the top of the porous region
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -57,7 +57,7 @@ Foam::solidBodyMotionFunctions::rotatingMotion::rotatingMotion
|
|||||||
solidBodyMotionFunction(SBMFCoeffs, runTime),
|
solidBodyMotionFunction(SBMFCoeffs, runTime),
|
||||||
origin_(SBMFCoeffs_.get<vector>("origin")),
|
origin_(SBMFCoeffs_.get<vector>("origin")),
|
||||||
axis_(SBMFCoeffs_.get<vector>("axis")),
|
axis_(SBMFCoeffs_.get<vector>("axis")),
|
||||||
omega_(Function1<scalar>::New("omega", SBMFCoeffs_))
|
omega_(Function1<scalar>::New("omega", SBMFCoeffs_, &runTime))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ bool Foam::solidBodyMotionFunctions::rotatingMotion::read
|
|||||||
|
|
||||||
omega_.reset
|
omega_.reset
|
||||||
(
|
(
|
||||||
Function1<scalar>::New("omega", SBMFCoeffs_)
|
Function1<scalar>::New("omega", SBMFCoeffs_, &time_)
|
||||||
);
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -74,7 +74,7 @@ Foam::fa::externalHeatFluxSource::externalHeatFluxSource
|
|||||||
Q_(0),
|
Q_(0),
|
||||||
q_(0),
|
q_(0),
|
||||||
h_(0),
|
h_(0),
|
||||||
Ta_(),
|
Ta_(nullptr),
|
||||||
emissivity_(dict.getOrDefault<scalar>("emissivity", 0))
|
emissivity_(dict.getOrDefault<scalar>("emissivity", 0))
|
||||||
{
|
{
|
||||||
fieldNames_.resize(1, TName_);
|
fieldNames_.resize(1, TName_);
|
||||||
@ -194,7 +194,7 @@ bool Foam::fa::externalHeatFluxSource::read(const dictionary& dict)
|
|||||||
case fixedHeatTransferCoeff:
|
case fixedHeatTransferCoeff:
|
||||||
{
|
{
|
||||||
dict.readEntry("h", h_);
|
dict.readEntry("h", h_);
|
||||||
Ta_ = Function1<scalar>::New("Ta", dict);
|
Ta_ = Function1<scalar>::New("Ta", dict, &mesh_);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,7 +41,7 @@ void Foam::fa::jouleHeatingSource::initialiseSigma
|
|||||||
if (dict.found("sigma"))
|
if (dict.found("sigma"))
|
||||||
{
|
{
|
||||||
// Sigma to be defined using a Function1 type
|
// Sigma to be defined using a Function1 type
|
||||||
sigmaVsTPtr = Function1<Type>::New("sigma", dict);
|
sigmaVsTPtr = Function1<Type>::New("sigma", dict, &mesh_);
|
||||||
|
|
||||||
auto tsigma = tmp<AreaFieldType>::New
|
auto tsigma = tmp<AreaFieldType>::New
|
||||||
(
|
(
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
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.
|
||||||
@ -256,7 +256,7 @@ Foam::MRFZone::MRFZone
|
|||||||
),
|
),
|
||||||
origin_(coeffs_.get<vector>("origin")),
|
origin_(coeffs_.get<vector>("origin")),
|
||||||
axis_(coeffs_.get<vector>("axis").normalise()),
|
axis_(coeffs_.get<vector>("axis").normalise()),
|
||||||
omega_(Function1<scalar>::New("omega", coeffs_))
|
omega_(Function1<scalar>::New("omega", coeffs_, &mesh_))
|
||||||
{
|
{
|
||||||
if (cellZoneName_ == word::null)
|
if (cellZoneName_ == word::null)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2017 OpenFOAM Foundation
|
Copyright (C) 2017 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -58,7 +58,7 @@ Foam::porosityModels::solidification::solidification
|
|||||||
TName_(coeffs_.getOrDefault<word>("T", "T")),
|
TName_(coeffs_.getOrDefault<word>("T", "T")),
|
||||||
alphaName_(coeffs_.getOrDefault<word>("alpha", "none")),
|
alphaName_(coeffs_.getOrDefault<word>("alpha", "none")),
|
||||||
rhoName_(coeffs_.getOrDefault<word>("rho", "rho")),
|
rhoName_(coeffs_.getOrDefault<word>("rho", "rho")),
|
||||||
D_(Function1<scalar>::New("D", coeffs_))
|
D_(Function1<scalar>::New("D", coeffs_, &mesh))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -79,9 +80,12 @@ cylindricalInletVelocityFvPatchVectorField
|
|||||||
fixedValueFvPatchField<vector>(p, iF, dict),
|
fixedValueFvPatchField<vector>(p, iF, dict),
|
||||||
origin_(dict.getCompat<vector>("origin", {{"centre", 1712}})),
|
origin_(dict.getCompat<vector>("origin", {{"centre", 1712}})),
|
||||||
axis_(dict.lookup("axis")),
|
axis_(dict.lookup("axis")),
|
||||||
axialVelocity_(Function1<scalar>::New("axialVelocity", dict)),
|
axialVelocity_(Function1<scalar>::New("axialVelocity", dict, &db())),
|
||||||
radialVelocity_(Function1<scalar>::New("radialVelocity", dict)),
|
radialVelocity_
|
||||||
rpm_(Function1<scalar>::New("rpm", dict))
|
(
|
||||||
|
Function1<scalar>::New("radialVelocity", dict, &db())
|
||||||
|
),
|
||||||
|
rpm_(Function1<scalar>::New("rpm", dict, &db()))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -84,7 +84,7 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
|
|||||||
|
|
||||||
if (this->cyclicPatch().owner())
|
if (this->cyclicPatch().owner())
|
||||||
{
|
{
|
||||||
this->jumpTable_ = Function1<Type>::New("jumpTable", dict);
|
this->jumpTable_ = Function1<Type>::New("jumpTable", dict, &this->db());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dict.found("value"))
|
if (dict.found("value"))
|
||||||
|
|||||||
@ -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.
|
||||||
@ -103,10 +103,7 @@ Foam::fanPressureFvPatchScalarField::fanPressureFvPatchScalarField
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fanCurve_.reset
|
fanCurve_.reset(Function1<scalar>::New("fanCurve", dict, &db()));
|
||||||
(
|
|
||||||
Function1<scalar>::New("fanCurve", dict)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nonDimensional_)
|
if (nonDimensional_)
|
||||||
|
|||||||
@ -52,7 +52,7 @@ Foam::fixedMeanFvPatchField<Type>::fixedMeanFvPatchField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchField<Type>(p, iF, dict),
|
fixedValueFvPatchField<Type>(p, iF, dict),
|
||||||
meanValue_(Function1<Type>::New("meanValue", dict))
|
meanValue_(Function1<Type>::New("meanValue", dict, &this->db()))
|
||||||
{
|
{
|
||||||
this->patchType() = dict.getOrDefault<word>("patchType", word::null);
|
this->patchType() = dict.getOrDefault<word>("patchType", word::null);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,7 +53,7 @@ Foam::fixedMeanOutletInletFvPatchField<Type>::fixedMeanOutletInletFvPatchField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
outletInletFvPatchField<Type>(p, iF),
|
outletInletFvPatchField<Type>(p, iF),
|
||||||
meanValue_(Function1<Type>::New("meanValue", dict))
|
meanValue_(Function1<Type>::New("meanValue", dict, &this->db()))
|
||||||
{
|
{
|
||||||
this->phiName_ = dict.getOrDefault<word>("phi", "phi");
|
this->phiName_ = dict.getOrDefault<word>("phi", "phi");
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2015-2016 OpenFOAM Foundation
|
Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||||
Copyright (C) 2020 OpenCFD Ltd.
|
Copyright (C) 2020-2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -68,7 +68,7 @@ Foam::fixedProfileFvPatchField<Type>::fixedProfileFvPatchField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchField<Type>(p, iF, dict, false),
|
fixedValueFvPatchField<Type>(p, iF, dict, false),
|
||||||
profile_(Function1<Type>::New("profile", dict)),
|
profile_(Function1<Type>::New("profile", dict, &this->db())),
|
||||||
dir_(dict.lookup("direction")),
|
dir_(dict.lookup("direction")),
|
||||||
origin_(dict.get<scalar>("origin"))
|
origin_(dict.get<scalar>("origin"))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -70,12 +70,13 @@ flowRateInletVelocityFvPatchVectorField
|
|||||||
if (dict.found("volumetricFlowRate"))
|
if (dict.found("volumetricFlowRate"))
|
||||||
{
|
{
|
||||||
volumetric_ = true;
|
volumetric_ = true;
|
||||||
flowRate_ = Function1<scalar>::New("volumetricFlowRate", dict);
|
flowRate_ =
|
||||||
|
Function1<scalar>::New("volumetricFlowRate", dict, &db());
|
||||||
}
|
}
|
||||||
else if (dict.found("massFlowRate"))
|
else if (dict.found("massFlowRate"))
|
||||||
{
|
{
|
||||||
volumetric_ = false;
|
volumetric_ = false;
|
||||||
flowRate_ = Function1<scalar>::New("massFlowRate", dict);
|
flowRate_ = Function1<scalar>::New("massFlowRate", dict, &db());
|
||||||
rhoName_ = dict.getOrDefault<word>("rho", "rho");
|
rhoName_ = dict.getOrDefault<word>("rho", "rho");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -62,13 +62,14 @@ flowRateOutletVelocityFvPatchVectorField
|
|||||||
if (dict.found("volumetricFlowRate"))
|
if (dict.found("volumetricFlowRate"))
|
||||||
{
|
{
|
||||||
volumetric_ = true;
|
volumetric_ = true;
|
||||||
flowRate_ = Function1<scalar>::New("volumetricFlowRate", dict);
|
flowRate_ =
|
||||||
|
Function1<scalar>::New("volumetricFlowRate", dict, &db());
|
||||||
rhoName_ = "rho";
|
rhoName_ = "rho";
|
||||||
}
|
}
|
||||||
else if (dict.found("massFlowRate"))
|
else if (dict.found("massFlowRate"))
|
||||||
{
|
{
|
||||||
volumetric_ = false;
|
volumetric_ = false;
|
||||||
flowRate_ = Function1<scalar>::New("massFlowRate", dict);
|
flowRate_ = Function1<scalar>::New("massFlowRate", dict, &db());
|
||||||
rhoName_ = dict.getOrDefault<word>("rho", "rho");
|
rhoName_ = dict.getOrDefault<word>("rho", "rho");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -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.
|
||||||
@ -89,7 +89,7 @@ rotatingPressureInletOutletVelocityFvPatchVectorField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
pressureInletOutletVelocityFvPatchVectorField(p, iF, dict),
|
pressureInletOutletVelocityFvPatchVectorField(p, iF, dict),
|
||||||
omega_(Function1<vector>::New("omega", dict))
|
omega_(Function1<vector>::New("omega", dict, &db()))
|
||||||
{
|
{
|
||||||
patchType() = dict.getOrDefault<word>("patchType", word::null);
|
patchType() = dict.getOrDefault<word>("patchType", word::null);
|
||||||
calcTangentialVelocity();
|
calcTangentialVelocity();
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -68,7 +69,7 @@ rotatingTotalPressureFvPatchScalarField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
totalPressureFvPatchScalarField(p, iF, dict),
|
totalPressureFvPatchScalarField(p, iF, dict),
|
||||||
omega_(Function1<vector>::New("omega", dict))
|
omega_(Function1<vector>::New("omega", dict, &db()))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2021 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -57,7 +58,7 @@ rotatingWallVelocityFvPatchVectorField
|
|||||||
fixedValueFvPatchField<vector>(p, iF, dict, false),
|
fixedValueFvPatchField<vector>(p, iF, dict, false),
|
||||||
origin_(dict.lookup("origin")),
|
origin_(dict.lookup("origin")),
|
||||||
axis_(dict.lookup("axis")),
|
axis_(dict.lookup("axis")),
|
||||||
omega_(Function1<scalar>::New("omega", dict))
|
omega_(Function1<scalar>::New("omega", dict, &db()))
|
||||||
{
|
{
|
||||||
if (dict.found("value"))
|
if (dict.found("value"))
|
||||||
{
|
{
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user