ENH: Deprecated TimeFunction1 usage in favour of Function1

This commit is contained in:
Andrew Heather
2021-11-18 14:26:50 +00:00
committed by Mark Olesen
parent 925a2e724b
commit 9194cd5203
32 changed files with 237 additions and 225 deletions

View File

@ -56,11 +56,6 @@ void Foam::Function1Types::Polynomial<Type>::checkCoefficients()
<< "Polynomial " << this->name() << " cannot be integrated" << "Polynomial " << this->name() << " cannot be integrated"
<< endl; << endl;
} }
if (this->isTime())
{
convertTimeBase(this->time());
}
} }

View File

@ -50,11 +50,6 @@ Foam::Function1Types::Sine<Type>::Sine
{ {
frequency_ = Function1<scalar>::New("frequency", dict); frequency_ = Function1<scalar>::New("frequency", dict);
} }
if (this->isTime())
{
convertTimeBase(this->time());
}
} }

View File

@ -134,11 +134,6 @@ void Foam::Function1Types::TableBase<Type>::initialise()
prevValue = currValue; prevValue = currValue;
++i; ++i;
} }
if (this->isTime())
{
convertTimeBase(this->time());
}
} }

View File

@ -34,11 +34,6 @@ void Foam::Function1Types::ramp::read(const dictionary& coeffs)
{ {
start_ = coeffs.getOrDefault<scalar>("start", 0); start_ = coeffs.getOrDefault<scalar>("start", 0);
coeffs.readEntry("duration", duration_); coeffs.readEntry("duration", duration_);
if (isTime())
{
convertTimeBase(time());
}
} }

View File

@ -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) ;

View File

@ -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_;

View File

@ -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().time())),
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);
} }

View File

@ -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

View File

@ -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().time())),
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);

View File

@ -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_;

View File

@ -27,7 +27,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "ConeInjection.H" #include "ConeInjection.H"
#include "TimeFunction1.H" #include "Function1.H"
#include "mathematicalConstants.H" #include "mathematicalConstants.H"
#include "unitConversion.H" #include "unitConversion.H"
@ -55,38 +55,38 @@ Foam::ConeInjection<CloudType>::ConeInjection
), ),
flowRateProfile_ flowRateProfile_
( (
TimeFunction1<scalar> Function1<scalar>::New
( (
owner.db().time(),
"flowRateProfile", "flowRateProfile",
this->coeffDict() this->coeffDict(),
&owner.db().time()
) )
), ),
Umag_ Umag_
( (
TimeFunction1<scalar> Function1<scalar>::New
( (
owner.db().time(),
"Umag", "Umag",
this->coeffDict() this->coeffDict(),
&owner.db().time()
) )
), ),
thetaInner_ thetaInner_
( (
TimeFunction1<scalar> Function1<scalar>::New
( (
owner.db().time(),
"thetaInner", "thetaInner",
this->coeffDict() this->coeffDict(),
&owner.db().time()
) )
), ),
thetaOuter_ thetaOuter_
( (
TimeFunction1<scalar> Function1<scalar>::New
( (
owner.db().time(),
"thetaOuter", "thetaOuter",
this->coeffDict() this->coeffDict(),
&owner.db().time()
) )
), ),
sizeDistribution_ sizeDistribution_
@ -132,7 +132,7 @@ Foam::ConeInjection<CloudType>::ConeInjection
} }
// Set total volume to inject // Set total volume to inject
this->volumeTotal_ = flowRateProfile_.integrate(0.0, duration_); this->volumeTotal_ = flowRateProfile_->integrate(0.0, duration_);
} }
@ -149,10 +149,10 @@ Foam::ConeInjection<CloudType>::ConeInjection
injectorTetPts_(im.injectorTetPts_), injectorTetPts_(im.injectorTetPts_),
duration_(im.duration_), duration_(im.duration_),
parcelsPerInjector_(im.parcelsPerInjector_), parcelsPerInjector_(im.parcelsPerInjector_),
flowRateProfile_(im.flowRateProfile_), flowRateProfile_(im.flowRateProfile_.clone()),
Umag_(im.Umag_), Umag_(im.Umag_.clone()),
thetaInner_(im.thetaInner_), thetaInner_(im.thetaInner_.clone()),
thetaOuter_(im.thetaOuter_), thetaOuter_(im.thetaOuter_.clone()),
sizeDistribution_(im.sizeDistribution_.clone()), sizeDistribution_(im.sizeDistribution_.clone()),
nInjected_(im.nInjected_), nInjected_(im.nInjected_),
injectorOrder_(im.injectorOrder_), injectorOrder_(im.injectorOrder_),
@ -220,7 +220,7 @@ Foam::label Foam::ConeInjection<CloudType>::parcelsToInject
{ {
if ((time0 >= 0.0) && (time0 < duration_)) if ((time0 >= 0.0) && (time0 < duration_))
{ {
const scalar targetVolume = flowRateProfile_.integrate(0, time1); const scalar targetVolume = flowRateProfile_->integrate(0, time1);
const scalar volumeFraction = targetVolume/this->volumeTotal_; const scalar volumeFraction = targetVolume/this->volumeTotal_;
@ -243,7 +243,7 @@ Foam::scalar Foam::ConeInjection<CloudType>::volumeToInject
{ {
if ((time0 >= 0.0) && (time0 < duration_)) if ((time0 >= 0.0) && (time0 < duration_))
{ {
return flowRateProfile_.integrate(time0, time1); return flowRateProfile_->integrate(time0, time1);
} }
return 0.0; return 0.0;
@ -288,8 +288,8 @@ void Foam::ConeInjection<CloudType>::setProperties
// Set direction vectors for position i // Set direction vectors for position i
scalar t = time - this->SOI_; scalar t = time - this->SOI_;
scalar ti = thetaInner_.value(t); scalar ti = thetaInner_->value(t);
scalar to = thetaOuter_.value(t); scalar to = thetaOuter_->value(t);
scalar coneAngle = degToRad(rnd.position<scalar>(ti, to)); scalar coneAngle = degToRad(rnd.position<scalar>(ti, to));
scalar alpha = sin(coneAngle); scalar alpha = sin(coneAngle);
@ -302,7 +302,7 @@ void Foam::ConeInjection<CloudType>::setProperties
dirVec.normalise(); dirVec.normalise();
// Set particle velocity // Set particle velocity
parcel.U() = Umag_.value(t)*dirVec; parcel.U() = Umag_->value(t)*dirVec;
// Set particle diameter // Set particle diameter
parcel.d() = sizeDistribution_().sample(); parcel.d() = sizeDistribution_().sample();

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2021-2017 OpenCFD Ltd. Copyright (C) 2017-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -54,7 +54,7 @@ SourceFiles
#include "InjectionModel.H" #include "InjectionModel.H"
#include "distributionModel.H" #include "distributionModel.H"
#include "vectorList.H" #include "vectorList.H"
#include "TimeFunction1.H" #include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -91,16 +91,16 @@ class ConeInjection
const label parcelsPerInjector_; const label parcelsPerInjector_;
//- Flow rate profile relative to SOI [] //- Flow rate profile relative to SOI []
const TimeFunction1<scalar> flowRateProfile_; const autoPtr<Function1<scalar>> flowRateProfile_;
//- Parcel velocity magnitude relative to SOI [m/s] //- Parcel velocity magnitude relative to SOI [m/s]
const TimeFunction1<scalar> Umag_; const autoPtr<Function1<scalar>> Umag_;
//- Inner half-cone angle relative to SOI [deg] //- Inner half-cone angle relative to SOI [deg]
const TimeFunction1<scalar> thetaInner_; const autoPtr<Function1<scalar>> thetaInner_;
//- Outer half-cone angle relative to SOI [deg] //- Outer half-cone angle relative to SOI [deg]
const TimeFunction1<scalar> thetaOuter_; const autoPtr<Function1<scalar>> thetaOuter_;
//- Parcel size distribution model //- Parcel size distribution model
const autoPtr<distributionModel> sizeDistribution_; const autoPtr<distributionModel> sizeDistribution_;

View File

@ -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.
@ -27,7 +27,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "ConeNozzleInjection.H" #include "ConeNozzleInjection.H"
#include "TimeFunction1.H" #include "Function1.H"
#include "unitConversion.H" #include "unitConversion.H"
#include "distributionModel.H" #include "distributionModel.H"
@ -74,7 +74,15 @@ void Foam::ConeNozzleInjection<CloudType>::setInjectionMethod()
} }
case injectionMethod::imMovingPoint: case injectionMethod::imMovingPoint:
{ {
positionVsTime_.reset(this->coeffDict()); positionVsTime_.reset
(
Function1<vector>::New
(
"position",
this->coeffDict(),
&this->owner().db().time()
)
);
break; break;
} }
default: default:
@ -100,12 +108,28 @@ void Foam::ConeNozzleInjection<CloudType>::setFlowType()
} }
case flowType::ftPressureDrivenVelocity: case flowType::ftPressureDrivenVelocity:
{ {
Pinj_.reset(this->coeffDict()); Pinj_.reset
(
Function1<scalar>::New
(
"Pinj",
this->coeffDict(),
&this->owner().db().time()
)
);
break; break;
} }
case flowType::ftFlowRateAndDischarge: case flowType::ftFlowRateAndDischarge:
{ {
Cd_.reset(this->coeffDict()); Cd_.reset
(
Function1<scalar>::New
(
"Cd",
this->coeffDict(),
&this->owner().db().time()
)
);
break; break;
} }
default: default:
@ -138,7 +162,7 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection
outerDiameter_(this->coeffDict().getScalar("outerDiameter")), outerDiameter_(this->coeffDict().getScalar("outerDiameter")),
innerDiameter_(this->coeffDict().getScalar("innerDiameter")), innerDiameter_(this->coeffDict().getScalar("innerDiameter")),
duration_(this->coeffDict().getScalar("duration")), duration_(this->coeffDict().getScalar("duration")),
positionVsTime_(owner.db().time(), "position"), positionVsTime_(nullptr),
position_(Zero), position_(Zero),
injectorCell_(-1), injectorCell_(-1),
tetFacei_(-1), tetFacei_(-1),
@ -147,29 +171,29 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection
parcelsPerSecond_(this->coeffDict().getScalar("parcelsPerSecond")), parcelsPerSecond_(this->coeffDict().getScalar("parcelsPerSecond")),
flowRateProfile_ flowRateProfile_
( (
TimeFunction1<scalar> Function1<scalar>::New
( (
owner.db().time(),
"flowRateProfile", "flowRateProfile",
this->coeffDict() this->coeffDict(),
&owner.db().time()
) )
), ),
thetaInner_ thetaInner_
( (
TimeFunction1<scalar> Function1<scalar>::New
( (
owner.db().time(),
"thetaInner", "thetaInner",
this->coeffDict() this->coeffDict(),
&owner.db().time()
) )
), ),
thetaOuter_ thetaOuter_
( (
TimeFunction1<scalar> Function1<scalar>::New
( (
owner.db().time(),
"thetaOuter", "thetaOuter",
this->coeffDict() this->coeffDict(),
&owner.db().time()
) )
), ),
sizeDistribution_ sizeDistribution_
@ -185,8 +209,8 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection
normal_(Zero), normal_(Zero),
UMag_(0.0), UMag_(0.0),
Cd_(owner.db().time(), "Cd"), Cd_(nullptr),
Pinj_(owner.db().time(), "Pinj") Pinj_(nullptr)
{ {
if (innerDiameter_ >= outerDiameter_) if (innerDiameter_ >= outerDiameter_)
{ {
@ -224,7 +248,7 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection
tanVec2_ = direction_^tanVec1_; tanVec2_ = direction_^tanVec1_;
// Set total volume to inject // Set total volume to inject
this->volumeTotal_ = flowRateProfile_.integrate(0.0, duration_); this->volumeTotal_ = flowRateProfile_->integrate(0.0, duration_);
updateMesh(); updateMesh();
} }
@ -242,23 +266,23 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection
outerDiameter_(im.outerDiameter_), outerDiameter_(im.outerDiameter_),
innerDiameter_(im.innerDiameter_), innerDiameter_(im.innerDiameter_),
duration_(im.duration_), duration_(im.duration_),
positionVsTime_(im.positionVsTime_), positionVsTime_(im.positionVsTime_.clone()),
position_(im.position_), position_(im.position_),
injectorCell_(im.injectorCell_), injectorCell_(im.injectorCell_),
tetFacei_(im.tetFacei_), tetFacei_(im.tetFacei_),
tetPti_(im.tetPti_), tetPti_(im.tetPti_),
direction_(im.direction_), direction_(im.direction_),
parcelsPerSecond_(im.parcelsPerSecond_), parcelsPerSecond_(im.parcelsPerSecond_),
flowRateProfile_(im.flowRateProfile_), flowRateProfile_(im.flowRateProfile_.clone()),
thetaInner_(im.thetaInner_), thetaInner_(im.thetaInner_.clone()),
thetaOuter_(im.thetaOuter_), thetaOuter_(im.thetaOuter_.clone()),
sizeDistribution_(im.sizeDistribution_.clone()), sizeDistribution_(im.sizeDistribution_.clone()),
tanVec1_(im.tanVec1_), tanVec1_(im.tanVec1_),
tanVec2_(im.tanVec2_), tanVec2_(im.tanVec2_),
normal_(im.normal_), normal_(im.normal_),
UMag_(im.UMag_), UMag_(im.UMag_),
Cd_(im.Cd_), Cd_(im.Cd_.clone()),
Pinj_(im.Pinj_) Pinj_(im.Pinj_.clone())
{} {}
@ -329,7 +353,7 @@ Foam::scalar Foam::ConeNozzleInjection<CloudType>::volumeToInject
{ {
if ((time0 >= 0.0) && (time0 < duration_)) if ((time0 >= 0.0) && (time0 < duration_))
{ {
return flowRateProfile_.integrate(time0, time1); return flowRateProfile_->integrate(time0, time1);
} }
return 0.0; return 0.0;
@ -366,7 +390,7 @@ void Foam::ConeNozzleInjection<CloudType>::setPositionAndCell
} }
case injectionMethod::imMovingPoint: case injectionMethod::imMovingPoint:
{ {
position = positionVsTime_.value(time - this->SOI_); position = positionVsTime_->value(time - this->SOI_);
this->findCellAtPosition this->findCellAtPosition
( (
@ -419,8 +443,8 @@ void Foam::ConeNozzleInjection<CloudType>::setProperties
// Set particle velocity // Set particle velocity
scalar t = time - this->SOI_; scalar t = time - this->SOI_;
scalar ti = thetaInner_.value(t); scalar ti = thetaInner_->value(t);
scalar to = thetaOuter_.value(t); scalar to = thetaOuter_->value(t);
scalar coneAngle = degToRad(rndGen.sample01<scalar>()*(to - ti) + ti); scalar coneAngle = degToRad(rndGen.sample01<scalar>()*(to - ti) + ti);
scalar alpha = sin(coneAngle); scalar alpha = sin(coneAngle);
@ -442,7 +466,7 @@ void Foam::ConeNozzleInjection<CloudType>::setProperties
{ {
scalar pAmbient = this->owner().pAmbient(); scalar pAmbient = this->owner().pAmbient();
scalar rho = parcel.rho(); scalar rho = parcel.rho();
scalar UMag = ::sqrt(2.0*(Pinj_.value(t) - pAmbient)/rho); scalar UMag = ::sqrt(2.0*(Pinj_->value(t) - pAmbient)/rho);
parcel.U() = UMag*dirVec; parcel.U() = UMag*dirVec;
break; break;
} }
@ -452,10 +476,10 @@ void Foam::ConeNozzleInjection<CloudType>::setProperties
scalar Ai = 0.25*mathematical::pi*innerDiameter_*innerDiameter_; scalar Ai = 0.25*mathematical::pi*innerDiameter_*innerDiameter_;
scalar massFlowRate = scalar massFlowRate =
this->massTotal() this->massTotal()
*flowRateProfile_.value(t) *flowRateProfile_->value(t)
/this->volumeTotal(); /this->volumeTotal();
scalar Umag = massFlowRate/(parcel.rho()*Cd_.value(t)*(Ao - Ai)); scalar Umag = massFlowRate/(parcel.rho()*Cd_->value(t)*(Ao - Ai));
parcel.U() = Umag*dirVec; parcel.U() = Umag*dirVec;
break; break;
} }

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd. Copyright (C) 2018-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -78,7 +78,7 @@ namespace Foam
// Forward declaration of classes // Forward declaration of classes
template<class Type> template<class Type>
class TimeFunction1; class Function1;
class distributionModel; class distributionModel;
@ -134,7 +134,7 @@ private:
scalar duration_; scalar duration_;
//- Position relative to SOI [] //- Position relative to SOI []
TimeFunction1<vector> positionVsTime_; autoPtr<Function1<vector>> positionVsTime_;
//- Injector position [m] //- Injector position [m]
vector position_; vector position_;
@ -155,13 +155,13 @@ private:
const label parcelsPerSecond_; const label parcelsPerSecond_;
//- Flow rate profile relative to SOI [] //- Flow rate profile relative to SOI []
const TimeFunction1<scalar> flowRateProfile_; const autoPtr<Function1<scalar>> flowRateProfile_;
//- Inner half-cone angle relative to SOI [deg] //- Inner half-cone angle relative to SOI [deg]
const TimeFunction1<scalar> thetaInner_; const autoPtr<Function1<scalar>> thetaInner_;
//- Outer half-cone angle relative to SOI [deg] //- Outer half-cone angle relative to SOI [deg]
const TimeFunction1<scalar> thetaOuter_; const autoPtr<Function1<scalar>> thetaOuter_;
//- Parcel size PDF model //- Parcel size PDF model
const autoPtr<distributionModel> sizeDistribution_; const autoPtr<distributionModel> sizeDistribution_;
@ -185,10 +185,10 @@ private:
scalar UMag_; scalar UMag_;
//- Discharge coefficient, relative to SOI [m/s] //- Discharge coefficient, relative to SOI [m/s]
TimeFunction1<scalar> Cd_; autoPtr<Function1<scalar>> Cd_;
//- Injection pressure [Pa] //- Injection pressure [Pa]
TimeFunction1<scalar> Pinj_; autoPtr<Function1<scalar>> Pinj_;
// Private Member Functions // Private Member Functions

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 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.
@ -52,20 +52,20 @@ Foam::InflationInjection<CloudType>::InflationInjection
duration_(this->coeffDict().getScalar("duration")), duration_(this->coeffDict().getScalar("duration")),
flowRateProfile_ flowRateProfile_
( (
TimeFunction1<scalar> Function1<scalar>::New
( (
owner.db().time(),
"flowRateProfile", "flowRateProfile",
this->coeffDict() this->coeffDict(),
&owner.db().time()
) )
), ),
growthRate_ growthRate_
( (
TimeFunction1<scalar> Function1<scalar>::New
( (
owner.db().time(),
"growthRate", "growthRate",
this->coeffDict() this->coeffDict(),
&owner.db().time()
) )
), ),
newParticles_(), newParticles_(),
@ -119,7 +119,7 @@ Foam::InflationInjection<CloudType>::InflationInjection
} }
// Set total volume/mass to inject // Set total volume/mass to inject
this->volumeTotal_ = fraction_*flowRateProfile_.integrate(0.0, duration_); this->volumeTotal_ = fraction_*flowRateProfile_->integrate(0.0, duration_);
this->massTotal_ *= fraction_; this->massTotal_ *= fraction_;
} }
@ -136,8 +136,8 @@ Foam::InflationInjection<CloudType>::InflationInjection
generationCells_(im.generationCells_), generationCells_(im.generationCells_),
inflationCells_(im.inflationCells_), inflationCells_(im.inflationCells_),
duration_(im.duration_), duration_(im.duration_),
flowRateProfile_(im.flowRateProfile_), flowRateProfile_(im.flowRateProfile_.clone()),
growthRate_(im.growthRate_), growthRate_(im.growthRate_.clone()),
newParticles_(im.newParticles_), newParticles_(im.newParticles_),
volumeAccumulator_(im.volumeAccumulator_), volumeAccumulator_(im.volumeAccumulator_),
fraction_(im.fraction_), fraction_(im.fraction_),
@ -180,7 +180,7 @@ Foam::label Foam::InflationInjection<CloudType>::parcelsToInject
List<DynamicList<typename CloudType::parcelType*>>& cellOccupancy = List<DynamicList<typename CloudType::parcelType*>>& cellOccupancy =
this->owner().cellOccupancy(); this->owner().cellOccupancy();
scalar gR = growthRate_.value(time1); scalar gR = growthRate_->value(time1);
scalar dT = time1 - time0; scalar dT = time1 - time0;
@ -215,7 +215,7 @@ Foam::label Foam::InflationInjection<CloudType>::parcelsToInject
if ((time0 >= 0.0) && (time0 < duration_)) if ((time0 >= 0.0) && (time0 < duration_))
{ {
volumeAccumulator_ += volumeAccumulator_ +=
fraction_*flowRateProfile_.integrate(time0, time1); fraction_*flowRateProfile_->integrate(time0, time1);
} }
labelHashSet cellCentresUsed; labelHashSet cellCentresUsed;
@ -429,7 +429,7 @@ Foam::scalar Foam::InflationInjection<CloudType>::volumeToInject
{ {
if ((time0 >= 0.0) && (time0 < duration_)) if ((time0 >= 0.0) && (time0 < duration_))
{ {
return fraction_*flowRateProfile_.integrate(time0, time1); return fraction_*flowRateProfile_->integrate(time0, time1);
} }
return 0.0; return 0.0;

View File

@ -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.
@ -89,10 +90,10 @@ class InflationInjection
scalar duration_; scalar duration_;
//- Flow rate profile relative to SOI [m3/s] //- Flow rate profile relative to SOI [m3/s]
TimeFunction1<scalar> flowRateProfile_; autoPtr<Function1<scalar>> flowRateProfile_;
//- Growth rate of particle diameters towards target [m/s] //- Growth rate of particle diameters towards target [m/s]
TimeFunction1<scalar> growthRate_; autoPtr<Function1<scalar>> growthRate_;
//- Positions, velocities, diameters and target diameters of //- Positions, velocities, diameters and target diameters of
// new particles after splitting // new particles after splitting

View File

@ -266,7 +266,7 @@ Foam::InjectionModel<CloudType>::InjectionModel(CloudType& owner)
SOI_(0.0), SOI_(0.0),
volumeTotal_(this->template getModelProperty<scalar>("volumeTotal")), volumeTotal_(this->template getModelProperty<scalar>("volumeTotal")),
massTotal_(0), massTotal_(0),
massFlowRate_(owner.db().time(), "massFlowRate"), massFlowRate_(nullptr),
massInjected_(this->template getModelProperty<scalar>("massInjected")), massInjected_(this->template getModelProperty<scalar>("massInjected")),
nInjections_(this->template getModelProperty<label>("nInjections")), nInjections_(this->template getModelProperty<label>("nInjections")),
parcelsAddedTotal_ parcelsAddedTotal_
@ -297,7 +297,7 @@ Foam::InjectionModel<CloudType>::InjectionModel
SOI_(0.0), SOI_(0.0),
volumeTotal_(this->template getModelProperty<scalar>("volumeTotal")), volumeTotal_(this->template getModelProperty<scalar>("volumeTotal")),
massTotal_(0), massTotal_(0),
massFlowRate_(owner.db().time(), "massFlowRate"), massFlowRate_(nullptr),
massInjected_(this->template getModelProperty<scalar>("massInjected")), massInjected_(this->template getModelProperty<scalar>("massInjected")),
nInjections_(this->template getModelProperty<scalar>("nInjections")), nInjections_(this->template getModelProperty<scalar>("nInjections")),
parcelsAddedTotal_ parcelsAddedTotal_
@ -339,8 +339,16 @@ Foam::InjectionModel<CloudType>::InjectionModel
} }
else else
{ {
massFlowRate_.reset(this->coeffDict()); massFlowRate_.reset
massTotal_ = massFlowRate_.value(owner.db().time().value()); (
Function1<scalar>::New
(
"massFlowRate",
this->coeffDict(),
&owner.db().time()
)
);
massTotal_ = massFlowRate_->value(owner.db().time().value());
this->coeffDict().readIfPresent("SOI", SOI_); this->coeffDict().readIfPresent("SOI", SOI_);
} }
} }
@ -385,7 +393,7 @@ Foam::InjectionModel<CloudType>::InjectionModel
SOI_(im.SOI_), SOI_(im.SOI_),
volumeTotal_(im.volumeTotal_), volumeTotal_(im.volumeTotal_),
massTotal_(im.massTotal_), massTotal_(im.massTotal_),
massFlowRate_(im.massFlowRate_), massFlowRate_(im.massFlowRate_.clone()),
massInjected_(im.massInjected_), massInjected_(im.massInjected_),
nInjections_(im.nInjections_), nInjections_(im.nInjections_),
parcelsAddedTotal_(im.parcelsAddedTotal_), parcelsAddedTotal_(im.parcelsAddedTotal_),
@ -577,7 +585,7 @@ void Foam::InjectionModel<CloudType>::injectSteadyState
const polyMesh& mesh = this->owner().mesh(); const polyMesh& mesh = this->owner().mesh();
massTotal_ = massFlowRate_.value(mesh.time().value()); massTotal_ = massFlowRate_->value(mesh.time().value());
// Reset counters // Reset counters
time0_ = 0.0; time0_ = 0.0;

View File

@ -59,7 +59,7 @@ SourceFiles
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"
#include "CloudSubModelBase.H" #include "CloudSubModelBase.H"
#include "vector.H" #include "vector.H"
#include "TimeFunction1.H" #include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -110,7 +110,7 @@ protected:
scalar massTotal_; scalar massTotal_;
//- Mass flow rate profile for steady calculations //- Mass flow rate profile for steady calculations
TimeFunction1<scalar> massFlowRate_; autoPtr<Function1<scalar>> massFlowRate_;
//- Total mass injected to date [kg] //- Total mass injected to date [kg]
scalar massInjected_; scalar massInjected_;

View File

@ -27,7 +27,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "PatchFlowRateInjection.H" #include "PatchFlowRateInjection.H"
#include "TimeFunction1.H"
#include "distributionModel.H" #include "distributionModel.H"
#include "mathematicalConstants.H" #include "mathematicalConstants.H"
#include "surfaceFields.H" #include "surfaceFields.H"
@ -49,11 +48,11 @@ Foam::PatchFlowRateInjection<CloudType>::PatchFlowRateInjection
duration_(this->coeffDict().getScalar("duration")), duration_(this->coeffDict().getScalar("duration")),
concentration_ concentration_
( (
TimeFunction1<scalar> Function1<scalar>::New
( (
owner.db().time(),
"concentration", "concentration",
this->coeffDict() this->coeffDict(),
&owner.db().time()
) )
), ),
parcelConcentration_ parcelConcentration_
@ -91,7 +90,7 @@ Foam::PatchFlowRateInjection<CloudType>::PatchFlowRateInjection
phiName_(im.phiName_), phiName_(im.phiName_),
rhoName_(im.rhoName_), rhoName_(im.rhoName_),
duration_(im.duration_), duration_(im.duration_),
concentration_(im.concentration_), concentration_(im.concentration_.clone()),
parcelConcentration_(im.parcelConcentration_), parcelConcentration_(im.parcelConcentration_),
sizeDistribution_(im.sizeDistribution_.clone()) sizeDistribution_(im.sizeDistribution_.clone())
{} {}
@ -161,7 +160,7 @@ Foam::label Foam::PatchFlowRateInjection<CloudType>::parcelsToInject
{ {
scalar dt = time1 - time0; scalar dt = time1 - time0;
scalar c = concentration_.value(0.5*(time0 + time1)); scalar c = concentration_->value(0.5*(time0 + time1));
scalar nParcels = parcelConcentration_*c*flowRate()*dt; scalar nParcels = parcelConcentration_*c*flowRate()*dt;
@ -201,7 +200,7 @@ Foam::scalar Foam::PatchFlowRateInjection<CloudType>::volumeToInject
if ((time0 >= 0.0) && (time0 < duration_)) if ((time0 >= 0.0) && (time0 < duration_))
{ {
scalar c = concentration_.value(0.5*(time0 + time1)); scalar c = concentration_->value(0.5*(time0 + time1));
volume = c*(time1 - time0)*flowRate(); volume = c*(time1 - time0)*flowRate();
} }

View File

@ -54,7 +54,6 @@ SourceFiles
#include "InjectionModel.H" #include "InjectionModel.H"
#include "patchInjectionBase.H" #include "patchInjectionBase.H"
#include "TimeFunction1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -85,7 +84,7 @@ class PatchFlowRateInjection
scalar duration_; scalar duration_;
//- Concentration profile of particle volume to carrier volume [-] //- Concentration profile of particle volume to carrier volume [-]
const TimeFunction1<scalar> concentration_; const autoPtr<Function1<scalar>> concentration_;
//- Parcels to introduce per unit volume flow rate m3 [n/m3] //- Parcels to introduce per unit volume flow rate m3 [n/m3]
const scalar parcelConcentration_; const scalar parcelConcentration_;

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 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.
@ -27,7 +27,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "PatchInjection.H" #include "PatchInjection.H"
#include "TimeFunction1.H"
#include "distributionModel.H" #include "distributionModel.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -50,11 +49,11 @@ Foam::PatchInjection<CloudType>::PatchInjection
U0_(this->coeffDict().lookup("U0")), U0_(this->coeffDict().lookup("U0")),
flowRateProfile_ flowRateProfile_
( (
TimeFunction1<scalar> Function1<scalar>::New
( (
owner.db().time(),
"flowRateProfile", "flowRateProfile",
this->coeffDict() this->coeffDict(),
&owner.db().time()
) )
), ),
sizeDistribution_ sizeDistribution_
@ -71,7 +70,7 @@ Foam::PatchInjection<CloudType>::PatchInjection
patchInjectionBase::updateMesh(owner.mesh()); patchInjectionBase::updateMesh(owner.mesh());
// Set total volume/mass to inject // Set total volume/mass to inject
this->volumeTotal_ = flowRateProfile_.integrate(0.0, duration_); this->volumeTotal_ = flowRateProfile_->integrate(0.0, duration_);
} }
@ -86,7 +85,7 @@ Foam::PatchInjection<CloudType>::PatchInjection
duration_(im.duration_), duration_(im.duration_),
parcelsPerSecond_(im.parcelsPerSecond_), parcelsPerSecond_(im.parcelsPerSecond_),
U0_(im.U0_), U0_(im.U0_),
flowRateProfile_(im.flowRateProfile_), flowRateProfile_(im.flowRateProfile_.clone()),
sizeDistribution_(im.sizeDistribution_.clone()) sizeDistribution_(im.sizeDistribution_.clone())
{} {}
@ -155,7 +154,7 @@ Foam::scalar Foam::PatchInjection<CloudType>::volumeToInject
{ {
if ((time0 >= 0.0) && (time0 < duration_)) if ((time0 >= 0.0) && (time0 < duration_))
{ {
return flowRateProfile_.integrate(time0, time1); return flowRateProfile_->integrate(time0, time1);
} }
return 0.0; return 0.0;

View File

@ -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.
@ -59,9 +60,6 @@ SourceFiles
namespace Foam namespace Foam
{ {
template<class Type>
class TimeFunction1;
class distributionModel; class distributionModel;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
@ -86,7 +84,7 @@ class PatchInjection
const vector U0_; const vector U0_;
//- Flow rate profile relative to SOI [] //- Flow rate profile relative to SOI []
const TimeFunction1<scalar> flowRateProfile_; const autoPtr<Function1<scalar>> flowRateProfile_;
//- Parcel size distribution model //- Parcel size distribution model
const autoPtr<distributionModel> sizeDistribution_; const autoPtr<distributionModel> sizeDistribution_;

View File

@ -61,7 +61,7 @@ Foam::RBD::restraints::prescribedRotation::prescribedRotation
) )
: :
restraint(name, dict, model), restraint(name, dict, model),
omegaSet_(model_.time(), "omega"), omegaSet_(nullptr),
omega_(Zero), omega_(Zero),
oldMom_(Zero), oldMom_(Zero),
error0_(Zero), error0_(Zero),
@ -133,7 +133,7 @@ void Foam::RBD::restraints::prescribedRotation::restrain
// from the definition of the angular momentum: // from the definition of the angular momentum:
// moment = Inertia*ddt(omega) // moment = Inertia*ddt(omega)
vector error = omegaSet_.value(model_.time().value()) - omega; vector error = omegaSet_->value(model_.time().value()) - omega;
vector integral = integral0_ + error; vector integral = integral0_ + error;
vector derivative = (error - error0_); vector derivative = (error - error0_);
@ -146,7 +146,7 @@ void Foam::RBD::restraints::prescribedRotation::restrain
{ {
Info<< " angle " << theta*sign(a & axis_) << endl Info<< " angle " << theta*sign(a & axis_) << endl
<< " omega " << omega << endl << " omega " << omega << endl
<< " wanted " << omegaSet_.value(model_.time().value()) << endl << " wanted " << omegaSet_->value(model_.time().value()) << endl
<< " moment " << moment << endl << " moment " << moment << endl
<< " oldDir " << oldDir << endl << " oldDir " << oldDir << endl
<< " newDir " << newDir << endl << " newDir " << newDir << endl
@ -207,7 +207,7 @@ bool Foam::RBD::restraints::prescribedRotation::read
} }
// Read the actual entry // Read the actual entry
omegaSet_.reset(coeffs_); omegaSet_.reset(Function1<vector>::New("omega", coeffs_, &model_.time()));
return true; return true;
} }
@ -222,7 +222,7 @@ void Foam::RBD::restraints::prescribedRotation::write
os.writeEntry("referenceOrientation", refQ_); os.writeEntry("referenceOrientation", refQ_);
os.writeEntry("axis", axis_); os.writeEntry("axis", axis_);
omegaSet_.writeData(os); omegaSet_->writeData(os);
} }

View File

@ -44,9 +44,9 @@ Usage
referenceOrientation | Orientation | no | I referenceOrientation | Orientation | no | I
axis | Rotation axis (in reference) | yes | axis | Rotation axis (in reference) | yes |
omega | Angular velocity (rad/s) | yes | omega | Angular velocity (rad/s) | yes |
relax | Relax moment with prevoius iter | yes relax | Relax moment with previous iter | yes
p | Propoptional corrector for PDI | yes p | Propoptional corrector for PDI | yes
d | Differencial corrector for PDI | yes d | Differential corrector for PDI | yes
i | Integral corrector for PDI | yes i | Integral corrector for PDI | yes
\endtable \endtable
@ -59,7 +59,7 @@ SourceFiles
#define prescribedRotation_H #define prescribedRotation_H
#include "rigidBodyRestraint.H" #include "rigidBodyRestraint.H"
#include "TimeFunction1.H" #include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -87,7 +87,7 @@ class prescribedRotation
vector axis_; vector axis_;
//- Rotational velocity [rad/sec] //- Rotational velocity [rad/sec]
TimeFunction1<vector> omegaSet_; autoPtr<Function1<vector>> omegaSet_;
//- Cache omega //- Cache omega
mutable vector omega_; mutable vector omega_;

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
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.
@ -83,11 +83,11 @@ void Foam::sixDoFRigidBodyMotionRestraints::linearSpringDamper::restrain
{ {
anchor_.reset anchor_.reset
( (
new TimeFunction1<vector> Function1<vector>::New
( (
motion.time(),
"anchor", "anchor",
coeffDict() coeffDict(),
&motion.time()
) )
); );
} }

View File

@ -44,7 +44,7 @@ SourceFiles
#include "sixDoFRigidBodyMotionRestraint.H" #include "sixDoFRigidBodyMotionRestraint.H"
#include "point.H" #include "point.H"
#include "TimeFunction1.H" #include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -66,7 +66,7 @@ class linearSpringDamper
//- Anchor point, where the spring is attached to an immovable //- Anchor point, where the spring is attached to an immovable
// object // object
mutable autoPtr<TimeFunction1<vector>> anchor_; mutable autoPtr<Function1<vector>> anchor_;
//- Reference point of attachment to the solid body //- Reference point of attachment to the solid body
point refAttachmentPt_; point refAttachmentPt_;

View File

@ -122,9 +122,11 @@ void Foam::radiation::fvDOM::initialise()
{ {
spectralDistributions_.reset spectralDistributions_.reset
( (
new TimeFunction1<scalarField> Function1<scalarField>::New
( (
mesh_.time(), "spectralDistribution", coeffs_ "spectralDistribution",
coeffs_,
&mesh_.time()
) )
); );

View File

@ -183,7 +183,7 @@ class fvDOM
scalarList spectralDistribution_; scalarList spectralDistribution_;
//- Time-dependent spectral distributions //- Time-dependent spectral distributions
autoPtr<TimeFunction1<scalarField>> spectralDistributions_; autoPtr<Function1<scalarField>> spectralDistributions_;
//- Solar calculator //- Solar calculator
autoPtr<solarCalculator> solarCalculator_; autoPtr<solarCalculator> solarCalculator_;

View File

@ -369,9 +369,11 @@ void Foam::radiation::solarLoad::initialise(const dictionary& coeffs)
{ {
spectralDistributions_.reset spectralDistributions_.reset
( (
new TimeFunction1<scalarField> Function1<scalarField>::New
( (
mesh_.time(), "spectralDistribution", coeffs "spectralDistribution",
coeffs,
&mesh_.time()
) )
); );

View File

@ -76,7 +76,7 @@ Usage
Property | Description | Type | Reqd | Deflt Property | Description | Type | Reqd | Deflt
useReflectedRays | Flag to use reflected rays | bool | yes | - useReflectedRays | Flag to use reflected rays | bool | yes | -
spectralDistribution | Spectral distribution for the integrated <!-- spectralDistribution | Spectral distribution for the integrated <!--
--> solar heat flux | TimeFunction1\<scalarField\> | yes | - --> solar heat flux | Function1\<scalarField\> | yes | -
solidCoupled | Flag to couple solids through mapped <!-- solidCoupled | Flag to couple solids through mapped <!--
--> boundary patch using qr | bool | no | true --> boundary patch using qr | bool | no | true
wallCoupled | Flag to couple wall patches using qr <!-- wallCoupled | Flag to couple wall patches using qr <!--
@ -88,7 +88,7 @@ Usage
The inherited entries are elaborated in: The inherited entries are elaborated in:
- \link radiationModel.H \endlink - \link radiationModel.H \endlink
- \link solarCalculator.H \endlink - \link solarCalculator.H \endlink
- \link TimeFunction1.H \endlink - \link Function1.H \endlink
SourceFiles SourceFiles
solarLoad.C solarLoad.C
@ -103,7 +103,7 @@ SourceFiles
#include "faceShading.H" #include "faceShading.H"
#include "faceReflecting.H" #include "faceReflecting.H"
#include "solarCalculator.H" #include "solarCalculator.H"
#include "TimeFunction1.H" #include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -148,7 +148,7 @@ class solarLoad
scalarList spectralDistribution_; scalarList spectralDistribution_;
//- Time-dependent spectral distributions //- Time-dependent spectral distributions
autoPtr<TimeFunction1<scalarField>> spectralDistributions_; autoPtr<Function1<scalarField>> spectralDistributions_;
//- Primary solar radiative heat flux per band [W/m2] //- Primary solar radiative heat flux per band [W/m2]
PtrList<volScalarField> qprimaryRad_; PtrList<volScalarField> qprimaryRad_;

View File

@ -203,21 +203,21 @@ void Foam::solarCalculator::initialise()
{ {
directSolarRads_.reset directSolarRads_.reset
( (
new TimeFunction1<scalar> Function1<scalar>::New
( (
mesh_.time(),
"directSolarRad", "directSolarRad",
dict_ dict_,
&mesh_.time()
) )
); );
diffuseSolarRads_.reset diffuseSolarRads_.reset
( (
new TimeFunction1<scalar> Function1<scalar>::New
( (
mesh_.time(),
"diffuseSolarRad", "diffuseSolarRad",
dict_ dict_,
&mesh_.time()
) )
); );

View File

@ -122,8 +122,8 @@ Usage
solarLoadCoeffs solarLoadCoeffs
{ {
sunLoadModel timeDependent; sunLoadModel timeDependent;
directSolarRad <TimeFunction1<scalar>>; directSolarRad <Function1<scalar>>;
diffuseSolarRad <TimeFunction1<scalar>>; diffuseSolarRad <Function1<scalar>>;
} }
\endverbatim \endverbatim
@ -131,10 +131,10 @@ Usage
\table \table
Property | Description | Type | Reqd | Deflt Property | Description | Type | Reqd | Deflt
directSolarRad | Time-series of direct solar irradiation <!-- directSolarRad | Time-series of direct solar irradiation <!--
--> [W/m2] | TimeFunction1\<scalar\> | yes | - --> [W/m2] | Function1\<scalar\> | yes | -
diffuseSolarRad | Time-series of diffuse solar irradiation on <!-- diffuseSolarRad | Time-series of diffuse solar irradiation on <!--
--> vertical surfaces [W/m2] <!-- --> vertical surfaces [W/m2] <!--
--> | TimeFunction1\<scalar\> | yes | - --> | Function1\<scalar\> | yes | -
\endtable \endtable
@ -223,7 +223,7 @@ SourceFiles
#include "DynamicField.H" #include "DynamicField.H"
#include "HashSet.H" #include "HashSet.H"
#include "coordinateSystem.H" #include "coordinateSystem.H"
#include "TimeFunction1.H" #include "Function1.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -316,10 +316,10 @@ private:
// sunLoadModel = timeDependent // sunLoadModel = timeDependent
//- Time-series of direct solar irradiation //- Time-series of direct solar irradiation
autoPtr<TimeFunction1<scalar>> directSolarRads_; autoPtr<Function1<scalar>> directSolarRads_;
//- Time-series of diffuse solar irradiation on vertical surfaces //- Time-series of diffuse solar irradiation on vertical surfaces
autoPtr<TimeFunction1<scalar>> diffuseSolarRads_; autoPtr<Function1<scalar>> diffuseSolarRads_;
// sunLoadModel = fairWeather // sunLoadModel = fairWeather