diff --git a/src/OpenFOAM/primitives/functions/Function1/Polynomial/PolynomialEntry.C b/src/OpenFOAM/primitives/functions/Function1/Polynomial/PolynomialEntry.C index 7d363bb2fc..d72f9a7cf7 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Polynomial/PolynomialEntry.C +++ b/src/OpenFOAM/primitives/functions/Function1/Polynomial/PolynomialEntry.C @@ -56,11 +56,6 @@ void Foam::Function1Types::Polynomial::checkCoefficients() << "Polynomial " << this->name() << " cannot be integrated" << endl; } - - if (this->isTime()) - { - convertTimeBase(this->time()); - } } diff --git a/src/OpenFOAM/primitives/functions/Function1/Sine/Sine.C b/src/OpenFOAM/primitives/functions/Function1/Sine/Sine.C index 0fee1197a1..9b928c7e16 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Sine/Sine.C +++ b/src/OpenFOAM/primitives/functions/Function1/Sine/Sine.C @@ -50,11 +50,6 @@ Foam::Function1Types::Sine::Sine { frequency_ = Function1::New("frequency", dict); } - - if (this->isTime()) - { - convertTimeBase(this->time()); - } } diff --git a/src/OpenFOAM/primitives/functions/Function1/Table/TableBase.C b/src/OpenFOAM/primitives/functions/Function1/Table/TableBase.C index 45e7a6d6ee..2bbfba78c2 100644 --- a/src/OpenFOAM/primitives/functions/Function1/Table/TableBase.C +++ b/src/OpenFOAM/primitives/functions/Function1/Table/TableBase.C @@ -134,11 +134,6 @@ void Foam::Function1Types::TableBase::initialise() prevValue = currValue; ++i; } - - if (this->isTime()) - { - convertTimeBase(this->time()); - } } diff --git a/src/OpenFOAM/primitives/functions/Function1/ramp/ramp.C b/src/OpenFOAM/primitives/functions/Function1/ramp/ramp.C index 76b236141b..b66acd4f32 100644 --- a/src/OpenFOAM/primitives/functions/Function1/ramp/ramp.C +++ b/src/OpenFOAM/primitives/functions/Function1/ramp/ramp.C @@ -34,11 +34,6 @@ void Foam::Function1Types::ramp::read(const dictionary& coeffs) { start_ = coeffs.getOrDefault("start", 0); coeffs.readEntry("duration", duration_); - - if (isTime()) - { - convertTimeBase(time()); - } } diff --git a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.C b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.C index a077f6391a..5c5d0b5acb 100644 --- a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.C +++ b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2014-2016 OpenFOAM Foundation - Copyright (C) 2018-2020 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -45,10 +45,10 @@ atmBoundaryLayer::atmBoundaryLayer(const Time& time, const polyPatch& pp) ppMin_((boundBox(pp.points())).min()), time_(time), patch_(pp), - flowDir_(time, "flowDir"), - zDir_(time, "zDir"), - Uref_(time, "Uref"), - Zref_(time, "Zref"), + flowDir_(nullptr), + zDir_(nullptr), + Uref_(nullptr), + Zref_(nullptr), z0_(nullptr), d_(nullptr) {} @@ -72,10 +72,10 @@ atmBoundaryLayer::atmBoundaryLayer ppMin_((boundBox(pp.points())).min()), time_(time), patch_(pp), - flowDir_(TimeFunction1(time, "flowDir", dict)), - zDir_(TimeFunction1(time, "zDir", dict)), - Uref_(TimeFunction1(time, "Uref", dict)), - Zref_(TimeFunction1(time, "Zref", dict)), + flowDir_(Function1::New("flowDir", dict, &time)), + zDir_(Function1::New("zDir", dict, &time)), + Uref_(Function1::New("Uref", dict, &time)), + Zref_(Function1::New("Zref", dict, &time)), z0_(PatchFunction1::New(pp, "z0", dict)), d_(PatchFunction1::New(pp, "d", dict)) {} @@ -96,10 +96,10 @@ atmBoundaryLayer::atmBoundaryLayer ppMin_(abl.ppMin_), time_(abl.time_), patch_(patch.patch()), - flowDir_(abl.flowDir_), - zDir_(abl.zDir_), - Uref_(abl.Uref_), - Zref_(abl.Zref_), + flowDir_(abl.flowDir_.clone()), + zDir_(abl.zDir_.clone()), + Uref_(abl.Uref_.clone()), + Zref_(abl.Zref_.clone()), z0_(abl.z0_.clone(patch_)), d_(abl.d_.clone(patch_)) {} @@ -129,13 +129,13 @@ atmBoundaryLayer::atmBoundaryLayer(const atmBoundaryLayer& abl) vector atmBoundaryLayer::flowDir() const { const scalar t = time_.timeOutputValue(); - const vector dir(flowDir_.value(t)); + const vector dir(flowDir_->value(t)); const scalar magDir = mag(dir); if (magDir < SMALL) { FatalErrorInFunction - << "magnitude of " << flowDir_.name() << " = " << magDir + << "magnitude of " << flowDir_->name() << " = " << magDir << " vector must be greater than zero" << abort(FatalError); } @@ -147,13 +147,13 @@ vector atmBoundaryLayer::flowDir() const vector atmBoundaryLayer::zDir() const { const scalar t = time_.timeOutputValue(); - const vector dir(zDir_.value(t)); + const vector dir(zDir_->value(t)); const scalar magDir = mag(dir); if (magDir < SMALL) { FatalErrorInFunction - << "magnitude of " << zDir_.name() << " = " << magDir + << "magnitude of " << zDir_->name() << " = " << magDir << " vector must be greater than zero" << abort(FatalError); } @@ -165,13 +165,13 @@ vector atmBoundaryLayer::zDir() const tmp atmBoundaryLayer::Ustar(const scalarField& z0) const { const scalar t = time_.timeOutputValue(); - const scalar Uref = Uref_.value(t); - const scalar Zref = Zref_.value(t); + const scalar Uref = Uref_->value(t); + const scalar Zref = Zref_->value(t); if (Zref < 0) { FatalErrorInFunction - << "Negative entry in " << Zref_.name() << " = " << Zref + << "Negative entry in " << Zref_->name() << " = " << Zref << abort(FatalError); } @@ -274,10 +274,10 @@ void atmBoundaryLayer::write(Ostream& os) const os.writeEntry("Cmu", Cmu_); os.writeEntry("C1", C1_); os.writeEntry("C2", C2_); - flowDir_.writeData(os); - zDir_.writeData(os); - Uref_.writeData(os); - Zref_.writeData(os); + flowDir_->writeData(os); + zDir_->writeData(os); + Uref_->writeData(os); + Zref_->writeData(os); if (z0_) { z0_->writeData(os) ; diff --git a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.H b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.H index bc3e84dcfb..362ff099a2 100644 --- a/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.H +++ b/src/atmosphericModels/derivedFvPatchFields/atmBoundaryLayer/atmBoundaryLayer.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2014-2018 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -157,12 +157,12 @@ Usage where the entries mean: \table Property | Description | Type | Reqd | Deflt - flowDir | Flow direction | TimeFunction1 | yes | - - zDir | Ground-normal direction | TimeFunction1 | yes | - + flowDir | Flow direction | Function1 | yes | - + zDir | Ground-normal direction | Function1 | yes | - Uref | Reference mean streamwise flow speed being used in \f$u^*\f$ estimations [m/s] | TimeFunction1 | yes | - + --> \f$u^*\f$ estimations [m/s] | Function1 | yes | - Zref | Reference height being used in \f$u^*\f$ estimations [m] | TimeFunction1 | yes | - + --> | Function1 | yes | - z0 | Surface roughness length [m] | PatchFunction1 | yes | - d | Displacement height [m] - see Notes | word | yes | - Cp0 | Specific heat capacity [m2/s2/K] | TimeFunction1 | yes | - + --> | Function1 | yes | - q | Heat source value [W (power) or W/m2 (flux)] | PatchFunction1 | yes | - \endtable The inherited entries are elaborated in: - \link fixedGradientFvPatchScalarField.H \endlink - - \link TimeFunction1.H \endlink + - \link Function1.H \endlink - \link PatchFunction1.H \endlink Options for the \c heatSource entry: @@ -93,7 +93,7 @@ SourceFiles #include "fvPatchFields.H" #include "fixedGradientFvPatchFields.H" -#include "TimeFunction1.H" +#include "Function1.H" #include "PatchFunction1.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -131,7 +131,7 @@ class atmTurbulentHeatFluxTemperatureFvPatchScalarField word alphaEffName_; //- Specific heat capacity [m2/s2/K] - TimeFunction1 Cp0_; + autoPtr> Cp0_; //- Heat power [W] or flux [W/m2] // Divided by density, rho, if used in kinematic form diff --git a/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmAlphatkWallFunction/atmAlphatkWallFunctionFvPatchScalarField.C b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmAlphatkWallFunction/atmAlphatkWallFunctionFvPatchScalarField.C index 844dcbc379..050997ca3a 100644 --- a/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmAlphatkWallFunction/atmAlphatkWallFunctionFvPatchScalarField.C +++ b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmAlphatkWallFunction/atmAlphatkWallFunctionFvPatchScalarField.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2020 ENERCON GmbH - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -73,7 +73,7 @@ atmAlphatkWallFunctionFvPatchScalarField fixedValueFvPatchScalarField(p, iF), Cmu_(0.09), kappa_(0.41), - Pr_(db().time(), "Pr"), + Pr_(nullptr), Prt_(nullptr), z0_(nullptr) { @@ -93,7 +93,7 @@ atmAlphatkWallFunctionFvPatchScalarField fixedValueFvPatchScalarField(ptf, p, iF, mapper), Cmu_(ptf.Cmu_), kappa_(ptf.kappa_), - Pr_(ptf.Pr_), + Pr_(ptf.Pr_.clone()), Prt_(ptf.Prt_.clone(p.patch())), z0_(ptf.z0_.clone(p.patch())) { @@ -128,7 +128,7 @@ atmAlphatkWallFunctionFvPatchScalarField scalarMinMax::ge(SMALL) ) ), - Pr_(TimeFunction1(db().time(), "Pr", dict)), + Pr_(Function1::New("Pr", dict, &db().time())), Prt_(PatchFunction1::New(p.patch(), "Prt", dict)), z0_(PatchFunction1::New(p.patch(), "z0", dict)) { @@ -204,7 +204,7 @@ void atmAlphatkWallFunctionFvPatchScalarField::updateCoeffs() const scalar Cmu25 = pow025(Cmu_); const scalar t = db().time().timeOutputValue(); - const scalar Pr = Pr_.value(t); + const scalar Pr = Pr_->value(t); #ifdef FULLDEBUG if (Pr < VSMALL) @@ -289,7 +289,7 @@ void atmAlphatkWallFunctionFvPatchScalarField::write(Ostream& os) const fvPatchField::write(os); os.writeEntry("Cmu", Cmu_); os.writeEntry("kappa", kappa_); - Pr_.writeData(os); + Pr_->writeData(os); Prt_->writeData(os); z0_->writeData(os); writeEntry("value", os); diff --git a/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmAlphatkWallFunction/atmAlphatkWallFunctionFvPatchScalarField.H b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmAlphatkWallFunction/atmAlphatkWallFunctionFvPatchScalarField.H index 598e1f4934..91a9eb7c53 100644 --- a/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmAlphatkWallFunction/atmAlphatkWallFunctionFvPatchScalarField.H +++ b/src/atmosphericModels/derivedFvPatchFields/wallFunctions/atmAlphatkWallFunction/atmAlphatkWallFunctionFvPatchScalarField.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2020 ENERCON GmbH - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -67,7 +67,7 @@ Usage \table Property | Description | Type | Reqd | Dflt type | Type name: atmAlphatkWallFunction | word | yes | - - Pr | Molecular Prandtl number | TimeFunction1 | yes | - + Pr | Molecular Prandtl number | Function1 | yes | - Prt | Turbulent Prandtl number | PatchFunction1 | yes | - z0 | Surface roughness length [m] | PatchFunction1 | yes | - Cmu | Empirical model constant | scalar | no | 0.09 @@ -76,7 +76,7 @@ Usage The inherited entries are elaborated in: - \link fixedValueFvPatchField.H \endlink - - \link TimeFunction1.H \endlink + - \link Function1.H \endlink - \link PatchFunction1.H \endlink See also @@ -91,7 +91,7 @@ SourceFiles #define atmAlphatkWallFunctionFvPatchScalarField_H #include "fixedValueFvPatchFields.H" -#include "TimeFunction1.H" +#include "Function1.H" #include "PatchFunction1.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -120,7 +120,7 @@ protected: const scalar kappa_; //- Molecular Prandtl number - TimeFunction1 Pr_; + autoPtr> Pr_; //- Turbulent Prandtl number field autoPtr> Prt_; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C index 926ee6225c..3d80440db8 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C @@ -27,7 +27,7 @@ License \*---------------------------------------------------------------------------*/ #include "ConeInjection.H" -#include "TimeFunction1.H" +#include "Function1.H" #include "mathematicalConstants.H" #include "unitConversion.H" @@ -55,38 +55,38 @@ Foam::ConeInjection::ConeInjection ), flowRateProfile_ ( - TimeFunction1 + Function1::New ( - owner.db().time(), "flowRateProfile", - this->coeffDict() + this->coeffDict(), + &owner.db().time() ) ), Umag_ ( - TimeFunction1 + Function1::New ( - owner.db().time(), "Umag", - this->coeffDict() + this->coeffDict(), + &owner.db().time() ) ), thetaInner_ ( - TimeFunction1 + Function1::New ( - owner.db().time(), "thetaInner", - this->coeffDict() + this->coeffDict(), + &owner.db().time() ) ), thetaOuter_ ( - TimeFunction1 + Function1::New ( - owner.db().time(), "thetaOuter", - this->coeffDict() + this->coeffDict(), + &owner.db().time() ) ), sizeDistribution_ @@ -132,7 +132,7 @@ Foam::ConeInjection::ConeInjection } // 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::ConeInjection injectorTetPts_(im.injectorTetPts_), duration_(im.duration_), parcelsPerInjector_(im.parcelsPerInjector_), - flowRateProfile_(im.flowRateProfile_), - Umag_(im.Umag_), - thetaInner_(im.thetaInner_), - thetaOuter_(im.thetaOuter_), + flowRateProfile_(im.flowRateProfile_.clone()), + Umag_(im.Umag_.clone()), + thetaInner_(im.thetaInner_.clone()), + thetaOuter_(im.thetaOuter_.clone()), sizeDistribution_(im.sizeDistribution_.clone()), nInjected_(im.nInjected_), injectorOrder_(im.injectorOrder_), @@ -220,7 +220,7 @@ Foam::label Foam::ConeInjection::parcelsToInject { 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_; @@ -243,7 +243,7 @@ Foam::scalar Foam::ConeInjection::volumeToInject { if ((time0 >= 0.0) && (time0 < duration_)) { - return flowRateProfile_.integrate(time0, time1); + return flowRateProfile_->integrate(time0, time1); } return 0.0; @@ -288,8 +288,8 @@ void Foam::ConeInjection::setProperties // Set direction vectors for position i scalar t = time - this->SOI_; - scalar ti = thetaInner_.value(t); - scalar to = thetaOuter_.value(t); + scalar ti = thetaInner_->value(t); + scalar to = thetaOuter_->value(t); scalar coneAngle = degToRad(rnd.position(ti, to)); scalar alpha = sin(coneAngle); @@ -302,7 +302,7 @@ void Foam::ConeInjection::setProperties dirVec.normalise(); // Set particle velocity - parcel.U() = Umag_.value(t)*dirVec; + parcel.U() = Umag_->value(t)*dirVec; // Set particle diameter parcel.d() = sizeDistribution_().sample(); diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.H index 2fc12a51a3..69e3663e7b 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2021-2017 OpenCFD Ltd. + Copyright (C) 2017-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -54,7 +54,7 @@ SourceFiles #include "InjectionModel.H" #include "distributionModel.H" #include "vectorList.H" -#include "TimeFunction1.H" +#include "Function1.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -91,16 +91,16 @@ class ConeInjection const label parcelsPerInjector_; //- Flow rate profile relative to SOI [] - const TimeFunction1 flowRateProfile_; + const autoPtr> flowRateProfile_; //- Parcel velocity magnitude relative to SOI [m/s] - const TimeFunction1 Umag_; + const autoPtr> Umag_; //- Inner half-cone angle relative to SOI [deg] - const TimeFunction1 thetaInner_; + const autoPtr> thetaInner_; //- Outer half-cone angle relative to SOI [deg] - const TimeFunction1 thetaOuter_; + const autoPtr> thetaOuter_; //- Parcel size distribution model const autoPtr sizeDistribution_; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C index 5e66eef113..a73f28650d 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,7 +27,7 @@ License \*---------------------------------------------------------------------------*/ #include "ConeNozzleInjection.H" -#include "TimeFunction1.H" +#include "Function1.H" #include "unitConversion.H" #include "distributionModel.H" @@ -74,7 +74,15 @@ void Foam::ConeNozzleInjection::setInjectionMethod() } case injectionMethod::imMovingPoint: { - positionVsTime_.reset(this->coeffDict()); + positionVsTime_.reset + ( + Function1::New + ( + "position", + this->coeffDict(), + &this->owner().db().time() + ) + ); break; } default: @@ -100,12 +108,28 @@ void Foam::ConeNozzleInjection::setFlowType() } case flowType::ftPressureDrivenVelocity: { - Pinj_.reset(this->coeffDict()); + Pinj_.reset + ( + Function1::New + ( + "Pinj", + this->coeffDict(), + &this->owner().db().time() + ) + ); break; } case flowType::ftFlowRateAndDischarge: { - Cd_.reset(this->coeffDict()); + Cd_.reset + ( + Function1::New + ( + "Cd", + this->coeffDict(), + &this->owner().db().time() + ) + ); break; } default: @@ -138,7 +162,7 @@ Foam::ConeNozzleInjection::ConeNozzleInjection outerDiameter_(this->coeffDict().getScalar("outerDiameter")), innerDiameter_(this->coeffDict().getScalar("innerDiameter")), duration_(this->coeffDict().getScalar("duration")), - positionVsTime_(owner.db().time(), "position"), + positionVsTime_(nullptr), position_(Zero), injectorCell_(-1), tetFacei_(-1), @@ -147,29 +171,29 @@ Foam::ConeNozzleInjection::ConeNozzleInjection parcelsPerSecond_(this->coeffDict().getScalar("parcelsPerSecond")), flowRateProfile_ ( - TimeFunction1 + Function1::New ( - owner.db().time(), "flowRateProfile", - this->coeffDict() + this->coeffDict(), + &owner.db().time() ) ), thetaInner_ ( - TimeFunction1 + Function1::New ( - owner.db().time(), "thetaInner", - this->coeffDict() + this->coeffDict(), + &owner.db().time() ) ), thetaOuter_ ( - TimeFunction1 + Function1::New ( - owner.db().time(), "thetaOuter", - this->coeffDict() + this->coeffDict(), + &owner.db().time() ) ), sizeDistribution_ @@ -185,8 +209,8 @@ Foam::ConeNozzleInjection::ConeNozzleInjection normal_(Zero), UMag_(0.0), - Cd_(owner.db().time(), "Cd"), - Pinj_(owner.db().time(), "Pinj") + Cd_(nullptr), + Pinj_(nullptr) { if (innerDiameter_ >= outerDiameter_) { @@ -224,7 +248,7 @@ Foam::ConeNozzleInjection::ConeNozzleInjection tanVec2_ = direction_^tanVec1_; // Set total volume to inject - this->volumeTotal_ = flowRateProfile_.integrate(0.0, duration_); + this->volumeTotal_ = flowRateProfile_->integrate(0.0, duration_); updateMesh(); } @@ -242,23 +266,23 @@ Foam::ConeNozzleInjection::ConeNozzleInjection outerDiameter_(im.outerDiameter_), innerDiameter_(im.innerDiameter_), duration_(im.duration_), - positionVsTime_(im.positionVsTime_), + positionVsTime_(im.positionVsTime_.clone()), position_(im.position_), injectorCell_(im.injectorCell_), tetFacei_(im.tetFacei_), tetPti_(im.tetPti_), direction_(im.direction_), parcelsPerSecond_(im.parcelsPerSecond_), - flowRateProfile_(im.flowRateProfile_), - thetaInner_(im.thetaInner_), - thetaOuter_(im.thetaOuter_), + flowRateProfile_(im.flowRateProfile_.clone()), + thetaInner_(im.thetaInner_.clone()), + thetaOuter_(im.thetaOuter_.clone()), sizeDistribution_(im.sizeDistribution_.clone()), tanVec1_(im.tanVec1_), tanVec2_(im.tanVec2_), normal_(im.normal_), UMag_(im.UMag_), - Cd_(im.Cd_), - Pinj_(im.Pinj_) + Cd_(im.Cd_.clone()), + Pinj_(im.Pinj_.clone()) {} @@ -329,7 +353,7 @@ Foam::scalar Foam::ConeNozzleInjection::volumeToInject { if ((time0 >= 0.0) && (time0 < duration_)) { - return flowRateProfile_.integrate(time0, time1); + return flowRateProfile_->integrate(time0, time1); } return 0.0; @@ -366,7 +390,7 @@ void Foam::ConeNozzleInjection::setPositionAndCell } case injectionMethod::imMovingPoint: { - position = positionVsTime_.value(time - this->SOI_); + position = positionVsTime_->value(time - this->SOI_); this->findCellAtPosition ( @@ -419,8 +443,8 @@ void Foam::ConeNozzleInjection::setProperties // Set particle velocity scalar t = time - this->SOI_; - scalar ti = thetaInner_.value(t); - scalar to = thetaOuter_.value(t); + scalar ti = thetaInner_->value(t); + scalar to = thetaOuter_->value(t); scalar coneAngle = degToRad(rndGen.sample01()*(to - ti) + ti); scalar alpha = sin(coneAngle); @@ -442,7 +466,7 @@ void Foam::ConeNozzleInjection::setProperties { scalar pAmbient = this->owner().pAmbient(); 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; break; } @@ -452,10 +476,10 @@ void Foam::ConeNozzleInjection::setProperties scalar Ai = 0.25*mathematical::pi*innerDiameter_*innerDiameter_; scalar massFlowRate = this->massTotal() - *flowRateProfile_.value(t) + *flowRateProfile_->value(t) /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; break; } diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.H index 2b3776b8db..90ea53a103 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeNozzleInjection/ConeNozzleInjection.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -78,7 +78,7 @@ namespace Foam // Forward declaration of classes template -class TimeFunction1; +class Function1; class distributionModel; @@ -134,7 +134,7 @@ private: scalar duration_; //- Position relative to SOI [] - TimeFunction1 positionVsTime_; + autoPtr> positionVsTime_; //- Injector position [m] vector position_; @@ -155,13 +155,13 @@ private: const label parcelsPerSecond_; //- Flow rate profile relative to SOI [] - const TimeFunction1 flowRateProfile_; + const autoPtr> flowRateProfile_; //- Inner half-cone angle relative to SOI [deg] - const TimeFunction1 thetaInner_; + const autoPtr> thetaInner_; //- Outer half-cone angle relative to SOI [deg] - const TimeFunction1 thetaOuter_; + const autoPtr> thetaOuter_; //- Parcel size PDF model const autoPtr sizeDistribution_; @@ -185,10 +185,10 @@ private: scalar UMag_; //- Discharge coefficient, relative to SOI [m/s] - TimeFunction1 Cd_; + autoPtr> Cd_; //- Injection pressure [Pa] - TimeFunction1 Pinj_; + autoPtr> Pinj_; // Private Member Functions diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InflationInjection/InflationInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InflationInjection/InflationInjection.C index fa23c0c8ed..52dd82c6de 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InflationInjection/InflationInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InflationInjection/InflationInjection.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -52,20 +52,20 @@ Foam::InflationInjection::InflationInjection duration_(this->coeffDict().getScalar("duration")), flowRateProfile_ ( - TimeFunction1 + Function1::New ( - owner.db().time(), "flowRateProfile", - this->coeffDict() + this->coeffDict(), + &owner.db().time() ) ), growthRate_ ( - TimeFunction1 + Function1::New ( - owner.db().time(), "growthRate", - this->coeffDict() + this->coeffDict(), + &owner.db().time() ) ), newParticles_(), @@ -119,7 +119,7 @@ Foam::InflationInjection::InflationInjection } // 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_; } @@ -136,8 +136,8 @@ Foam::InflationInjection::InflationInjection generationCells_(im.generationCells_), inflationCells_(im.inflationCells_), duration_(im.duration_), - flowRateProfile_(im.flowRateProfile_), - growthRate_(im.growthRate_), + flowRateProfile_(im.flowRateProfile_.clone()), + growthRate_(im.growthRate_.clone()), newParticles_(im.newParticles_), volumeAccumulator_(im.volumeAccumulator_), fraction_(im.fraction_), @@ -180,7 +180,7 @@ Foam::label Foam::InflationInjection::parcelsToInject List>& cellOccupancy = this->owner().cellOccupancy(); - scalar gR = growthRate_.value(time1); + scalar gR = growthRate_->value(time1); scalar dT = time1 - time0; @@ -215,7 +215,7 @@ Foam::label Foam::InflationInjection::parcelsToInject if ((time0 >= 0.0) && (time0 < duration_)) { volumeAccumulator_ += - fraction_*flowRateProfile_.integrate(time0, time1); + fraction_*flowRateProfile_->integrate(time0, time1); } labelHashSet cellCentresUsed; @@ -429,7 +429,7 @@ Foam::scalar Foam::InflationInjection::volumeToInject { if ((time0 >= 0.0) && (time0 < duration_)) { - return fraction_*flowRateProfile_.integrate(time0, time1); + return fraction_*flowRateProfile_->integrate(time0, time1); } return 0.0; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InflationInjection/InflationInjection.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InflationInjection/InflationInjection.H index bfacebb97d..a02771badb 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InflationInjection/InflationInjection.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InflationInjection/InflationInjection.H @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation + Copyright (C) 2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -89,10 +90,10 @@ class InflationInjection scalar duration_; //- Flow rate profile relative to SOI [m3/s] - TimeFunction1 flowRateProfile_; + autoPtr> flowRateProfile_; //- Growth rate of particle diameters towards target [m/s] - TimeFunction1 growthRate_; + autoPtr> growthRate_; //- Positions, velocities, diameters and target diameters of // new particles after splitting diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C index 94e4961ca8..58838ec65f 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C @@ -266,7 +266,7 @@ Foam::InjectionModel::InjectionModel(CloudType& owner) SOI_(0.0), volumeTotal_(this->template getModelProperty("volumeTotal")), massTotal_(0), - massFlowRate_(owner.db().time(), "massFlowRate"), + massFlowRate_(nullptr), massInjected_(this->template getModelProperty("massInjected")), nInjections_(this->template getModelProperty