diff --git a/applications/solvers/modules/isothermalFilm/Make/options b/applications/solvers/modules/isothermalFilm/Make/options index a6e885b01c..0ba500e5a0 100644 --- a/applications/solvers/modules/isothermalFilm/Make/options +++ b/applications/solvers/modules/isothermalFilm/Make/options @@ -13,7 +13,6 @@ LIB_LIBS = \ -lmomentumTransportModels \ -lfilmCompressibleMomentumTransportModels \ -linterfaceProperties \ - -ldistributionModels \ -lfiniteVolume \ -lmeshTools \ -lsampling \ diff --git a/src/Allwmake b/src/Allwmake index edc53ccb82..300af5b91c 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -38,7 +38,6 @@ dummyThirdParty/Allwmake $targetType $* wmake $targetType finiteVolume wmake $targetType lagrangian/basic -wmake $targetType lagrangian/distributionModels wmake $targetType genericPatchFields wmake $targetType mesh/extrudeModel diff --git a/src/lagrangian/Allwmake b/src/lagrangian/Allwmake index 259c828900..a3d696d9b9 100755 --- a/src/lagrangian/Allwmake +++ b/src/lagrangian/Allwmake @@ -4,7 +4,6 @@ cd ${0%/*} || exit 1 # Run from this directory # Parse arguments for library compilation . $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments -wmake $targetType distributionModels wmake $targetType basic wmake $targetType solidParticle wmake $targetType parcel diff --git a/src/lagrangian/distributionModels/Make/files b/src/lagrangian/distributionModels/Make/files deleted file mode 100644 index aee429b06c..0000000000 --- a/src/lagrangian/distributionModels/Make/files +++ /dev/null @@ -1,13 +0,0 @@ -distributionModel/distributionModel.C -distributionModel/distributionModelNew.C - -exponential/exponential.C -fixedValue/fixedValue.C -general/general.C -multiNormal/multiNormal.C -normal/normal.C -RosinRammler/RosinRammler.C -massRosinRammler/massRosinRammler.C -uniform/uniform.C - -LIB = $(FOAM_LIBBIN)/libdistributionModels diff --git a/src/lagrangian/distributionModels/Make/options b/src/lagrangian/distributionModels/Make/options deleted file mode 100644 index 41306609f2..0000000000 --- a/src/lagrangian/distributionModels/Make/options +++ /dev/null @@ -1 +0,0 @@ -EXE_INC = diff --git a/src/lagrangian/distributionModels/RosinRammler/RosinRammler.C b/src/lagrangian/distributionModels/RosinRammler/RosinRammler.C deleted file mode 100644 index 5b004da62a..0000000000 --- a/src/lagrangian/distributionModels/RosinRammler/RosinRammler.C +++ /dev/null @@ -1,104 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -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 . - -\*---------------------------------------------------------------------------*/ - -#include "RosinRammler.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ -namespace distributionModels -{ - defineTypeNameAndDebug(RosinRammler, 0); - addToRunTimeSelectionTable(distributionModel, RosinRammler, dictionary); -} -} - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::distributionModels::RosinRammler::RosinRammler -( - const dictionary& dict, - Random& rndGen -) -: - distributionModel(typeName, dict, rndGen), - minValue_(distributionModelDict_.template lookup("minValue")), - maxValue_(distributionModelDict_.template lookup("maxValue")), - d_(distributionModelDict_.template lookup("d")), - n_(distributionModelDict_.template lookup("n")) -{ - check(); - info(); -} - - -Foam::distributionModels::RosinRammler::RosinRammler(const RosinRammler& p) -: - distributionModel(p), - minValue_(p.minValue_), - maxValue_(p.maxValue_), - d_(p.d_), - n_(p.n_) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::distributionModels::RosinRammler::~RosinRammler() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -Foam::scalar Foam::distributionModels::RosinRammler::sample() const -{ - const scalar minValueByDPowN = pow(minValue_/d_, n_); - const scalar K = 1 - exp(- pow(maxValue_/d_, n_) + minValueByDPowN); - const scalar y = rndGen_.sample01(); - return d_*pow(minValueByDPowN - log(1 - K*y), 1/n_); -} - - -Foam::scalar Foam::distributionModels::RosinRammler::minValue() const -{ - return minValue_; -} - - -Foam::scalar Foam::distributionModels::RosinRammler::maxValue() const -{ - return maxValue_; -} - - -Foam::scalar Foam::distributionModels::RosinRammler::meanValue() const -{ - return d_; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/distributionModels/RosinRammler/RosinRammler.H b/src/lagrangian/distributionModels/RosinRammler/RosinRammler.H deleted file mode 100644 index e306a15b75..0000000000 --- a/src/lagrangian/distributionModels/RosinRammler/RosinRammler.H +++ /dev/null @@ -1,128 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -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 . - -Class - Foam::distributionModels::RosinRammler - -Description - Rosin-Rammler distributionModel - - \f[ - CDF(x) = - (1 - exp(-(x/d)^n + (d_0/d)^n) - /(1 - exp(-(d_1/d)^n + (d_0/d)^n) - \f] - -SourceFiles - RosinRammler.C - -\*---------------------------------------------------------------------------*/ - -#ifndef RosinRammler_H -#define RosinRammler_H - -#include "distributionModel.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace distributionModels -{ - -/*---------------------------------------------------------------------------*\ - Class RosinRammler Declaration -\*---------------------------------------------------------------------------*/ - -class RosinRammler -: - public distributionModel -{ - // Private Data - - //- Distribution minimum - scalar minValue_; - - //- Distribution maximum - scalar maxValue_; - - // Model coefficients - - //- Scale parameter - scalar d_; - - //- Shape parameter - scalar n_; - - -public: - - //- Runtime type information - TypeName("RosinRammler"); - - - // Constructors - - //- Construct from components - RosinRammler(const dictionary& dict, Random& rndGen); - - //- Construct copy - RosinRammler(const RosinRammler& p); - - //- Construct and return a clone - virtual autoPtr clone() const - { - return autoPtr(new RosinRammler(*this)); - } - - - //- Destructor - virtual ~RosinRammler(); - - - // Member Functions - - //- Sample the distributionModel - virtual scalar sample() const; - - //- Return the minimum value - virtual scalar minValue() const; - - //- Return the maximum value - virtual scalar maxValue() const; - - //- Return the mean value - virtual scalar meanValue() const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace distributionModels -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/distributionModels/distributionModel/distributionModel.C b/src/lagrangian/distributionModels/distributionModel/distributionModel.C deleted file mode 100644 index 6367725c1d..0000000000 --- a/src/lagrangian/distributionModels/distributionModel/distributionModel.C +++ /dev/null @@ -1,97 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -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 . - -\*---------------------------------------------------------------------------*/ - -#include "distributionModel.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - defineTypeNameAndDebug(distributionModel, 0); - defineRunTimeSelectionTable(distributionModel, dictionary); -} - - -// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // - -void Foam::distributionModel::check() const -{ - if (minValue() < 0) - { - FatalErrorInFunction - << type() << "distribution: Minimum value must be greater than " - << "zero." << nl << "Supplied minValue = " << minValue() - << abort(FatalError); - } - - if (maxValue() < minValue()) - { - FatalErrorInFunction - << type() << "distribution: Maximum value is smaller than the " - << "minimum value:" << nl << " maxValue = " << maxValue() - << ", minValue = " << minValue() - << abort(FatalError); - } -} - - -void Foam::distributionModel::info() const -{ - Info<< " Distribution min: " << minValue() << " max: " << maxValue() - << " mean: " << meanValue() << endl; -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::distributionModel::distributionModel -( - const word& name, - const dictionary& dict, - Random& rndGen -) -: - distributionModelDict_(dict.subDict(name + "Distribution")), - rndGen_(rndGen) -{} - - -Foam::distributionModel::distributionModel -( - const distributionModel& p -) -: - distributionModelDict_(p.distributionModelDict_), - rndGen_(p.rndGen_) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::distributionModel::~distributionModel() -{} - - -// ************************************************************************* // diff --git a/src/lagrangian/distributionModels/distributionModel/distributionModel.H b/src/lagrangian/distributionModels/distributionModel/distributionModel.H deleted file mode 100644 index d2431f2e51..0000000000 --- a/src/lagrangian/distributionModels/distributionModel/distributionModel.H +++ /dev/null @@ -1,160 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -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 . - -Class - Foam::distributionModel - -Description - A library of runtime-selectable distribution models. - - Returns a sampled value given the expectation (nu) and variance (sigma^2) - - Current distribution models include: - - exponential - - fixedValue - - general - - multi-normal - - normal - - Rosin-Rammler - - Mass-based Rosin-Rammler - - uniform - -SourceFiles - distributionModel.C - distributionModelNew.C - -\*---------------------------------------------------------------------------*/ - -#ifndef distributionModel_H -#define distributionModel_H - -#include "IOdictionary.H" -#include "autoPtr.H" -#include "Random.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class distributionModel Declaration -\*---------------------------------------------------------------------------*/ - -class distributionModel -{ - -protected: - - // Protected data - - //- Coefficients dictionary - const dictionary distributionModelDict_; - - //- Reference to the random number generator - Random& rndGen_; - - - // Protected Member Functions - - //- Check that the distribution model is valid - virtual void check() const; - - //- Print information about the distribution - void info() const; - - -public: - - //-Runtime type information - TypeName("distributionModel"); - - - //- Declare runtime constructor selection table - declareRunTimeSelectionTable - ( - autoPtr, - distributionModel, - dictionary, - ( - const dictionary& dict, - Random& rndGen - ), - (dict, rndGen) - ); - - - // Constructors - - //- Construct from dictionary - distributionModel - ( - const word& name, - const dictionary& dict, - Random& rndGen - ); - - //- Construct copy - distributionModel(const distributionModel& p); - - //- Construct and return a clone - virtual autoPtr clone() const = 0; - - - //- Selector - static autoPtr New - ( - const dictionary& dict, - Random& rndGen - ); - - - //- Destructor - virtual ~distributionModel(); - - - // Member Functions - - //- Sample the distributionModel - virtual scalar sample() const = 0; - - //- Return the minimum value - virtual scalar minValue() const = 0; - - //- Return the maximum value - virtual scalar maxValue() const = 0; - - //- Return the mean value - virtual scalar meanValue() const = 0; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/distributionModels/exponential/exponential.C b/src/lagrangian/distributionModels/exponential/exponential.C deleted file mode 100644 index 6b6efc0aba..0000000000 --- a/src/lagrangian/distributionModels/exponential/exponential.C +++ /dev/null @@ -1,101 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -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 . - -\*---------------------------------------------------------------------------*/ - -#include "exponential.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ -namespace distributionModels -{ - defineTypeNameAndDebug(exponential, 0); - addToRunTimeSelectionTable(distributionModel, exponential, dictionary); -} -} - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::distributionModels::exponential::exponential -( - const dictionary& dict, - Random& rndGen -) -: - distributionModel(typeName, dict, rndGen), - minValue_(distributionModelDict_.template lookup("minValue")), - maxValue_(distributionModelDict_.template lookup("maxValue")), - lambda_(distributionModelDict_.template lookup("lambda")) -{ - check(); - info(); -} - - -Foam::distributionModels::exponential::exponential(const exponential& p) -: - distributionModel(p), - minValue_(p.minValue_), - maxValue_(p.maxValue_), - lambda_(p.lambda_) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::distributionModels::exponential::~exponential() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -Foam::scalar Foam::distributionModels::exponential::sample() const -{ - scalar y = rndGen_.sample01(); - scalar K = exp(-lambda_*maxValue_) - exp(-lambda_*minValue_); - return -(1.0/lambda_)*log(exp(-lambda_*minValue_) + y*K); -} - - -Foam::scalar Foam::distributionModels::exponential::minValue() const -{ - return minValue_; -} - - -Foam::scalar Foam::distributionModels::exponential::maxValue() const -{ - return maxValue_; -} - - -Foam::scalar Foam::distributionModels::exponential::meanValue() const -{ - return 1.0/lambda_; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/distributionModels/exponential/exponential.H b/src/lagrangian/distributionModels/exponential/exponential.H deleted file mode 100644 index 78acd2db83..0000000000 --- a/src/lagrangian/distributionModels/exponential/exponential.H +++ /dev/null @@ -1,119 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -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 . - -Class - Foam::distributionModels::exponential - -Description - exponential distribution model - -SourceFiles - exponential.C - -\*---------------------------------------------------------------------------*/ - -#ifndef exponential_H -#define exponential_H - -#include "distributionModel.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace distributionModels -{ - -/*---------------------------------------------------------------------------*\ - Class exponential Declaration -\*---------------------------------------------------------------------------*/ - -class exponential -: - public distributionModel -{ - // Private Data - - //- Distribution minimum - scalar minValue_; - - //- Distribution maximum - scalar maxValue_; - - - // Model coefficients - - scalar lambda_; - - -public: - - //- Runtime type information - TypeName("exponential"); - - - // Constructors - - //- Construct from components - exponential(const dictionary& dict, Random& rndGen); - - //- Construct copy - exponential(const exponential& p); - - //- Construct and return a clone - virtual autoPtr clone() const - { - return autoPtr(new exponential(*this)); - } - - - //- Destructor - virtual ~exponential(); - - - // Member Functions - - //- Sample the distributionModel - virtual scalar sample() const; - - //- Return the minimum value - virtual scalar minValue() const; - - //- Return the maximum value - virtual scalar maxValue() const; - - //- Return the mean value - virtual scalar meanValue() const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace distributionModels -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/distributionModels/fixedValue/fixedValue.C b/src/lagrangian/distributionModels/fixedValue/fixedValue.C deleted file mode 100644 index 17e63631b9..0000000000 --- a/src/lagrangian/distributionModels/fixedValue/fixedValue.C +++ /dev/null @@ -1,94 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -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 . - -\*---------------------------------------------------------------------------*/ - -#include "fixedValue.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ -namespace distributionModels -{ - defineTypeNameAndDebug(fixedValue, 0); - addToRunTimeSelectionTable(distributionModel, fixedValue, dictionary); -} -} - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::distributionModels::fixedValue::fixedValue -( - const dictionary& dict, - Random& rndGen -) -: - distributionModel(typeName, dict, rndGen), - value_(distributionModelDict_.template lookup("value")) -{ - info(); -} - - -Foam::distributionModels::fixedValue::fixedValue(const fixedValue& p) -: - distributionModel(p), - value_(p.value_) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::distributionModels::fixedValue::~fixedValue() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -Foam::scalar Foam::distributionModels::fixedValue::fixedValue::sample() const -{ - return value_; -} - - -Foam::scalar Foam::distributionModels::fixedValue::fixedValue::minValue() const -{ - return value_; -} - - -Foam::scalar Foam::distributionModels::fixedValue::fixedValue::maxValue() const -{ - return value_; -} - - -Foam::scalar Foam::distributionModels::fixedValue::fixedValue::meanValue() const -{ - return value_; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/distributionModels/general/general.C b/src/lagrangian/distributionModels/general/general.C deleted file mode 100644 index febe85ea8b..0000000000 --- a/src/lagrangian/distributionModels/general/general.C +++ /dev/null @@ -1,228 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -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 . - -\*---------------------------------------------------------------------------*/ - -#include "general.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ -namespace distributionModels -{ - defineTypeNameAndDebug(general, 0); - addToRunTimeSelectionTable(distributionModel, general, dictionary); -} -} - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::distributionModels::general::general -( - const dictionary& dict, - Random& rndGen -) -: - distributionModel(typeName, dict, rndGen), - xy_(distributionModelDict_.lookup("distribution")), - nEntries_(xy_.size()), - minValue_(xy_[0][0]), - maxValue_(xy_[nEntries_-1][0]), - meanValue_(0.0), - integral_(nEntries_), - cumulative_(distributionModelDict_.lookupOrDefault("cumulative", false)) -{ - check(); - - // Additional sanity checks - if (cumulative_ && xy_[0][1] != 0) - { - FatalErrorInFunction - << type() << "distribution: " - << "The cumulative distribution must start from zero." - << abort(FatalError); - } - - for (label i=0; i 0 && xy_[i][0] <= xy_[i-1][0]) - { - FatalErrorInFunction - << type() << "distribution: " - << "The points must be specified in ascending order." - << abort(FatalError); - } - - if (xy_[i][1] < 0) - { - FatalErrorInFunction - << type() << "distribution: " - << "The distribution can't be negative." - << abort(FatalError); - } - - if (i > 0 && cumulative_ && xy_[i][1] < xy_[i-1][1]) - { - FatalErrorInFunction - << type() << "distribution: " - << "Cumulative distribution must be non-decreasing." - << abort(FatalError); - } - } - - // Fill out the integral table (x, P(x<=0)) and calculate mean - // For density function: P(x<=0) = int f(x) and mean = int x*f(x) - // For cumulative function: mean = int 1-P(x<=0) = maxValue_ - int P(x<=0) - integral_[0] = 0.0; - for (label i=1; i(); - - // find the interval where y is in the table - label n=1; - while (integral_[n] <= y) - { - n++; - } - - scalar k = (xy_[n][1] - xy_[n-1][1])/(xy_[n][0] - xy_[n-1][0]); - scalar d = xy_[n-1][1] - k*xy_[n-1][0]; - - if (cumulative_) - { - return (y - d)/k; - } - - scalar alpha = y + xy_[n-1][0]*(0.5*k*xy_[n-1][0] + d) - integral_[n-1]; - scalar x = 0.0; - - // if k is small it is a linear equation, otherwise it is of second order - if (mag(k) > small) - { - scalar p = 2.0*d/k; - scalar q = -2.0*alpha/k; - scalar sqrtEr = sqrt(0.25*p*p - q); - - scalar x1 = -0.5*p + sqrtEr; - scalar x2 = -0.5*p - sqrtEr; - if ((x1 >= xy_[n-1][0]) && (x1 <= xy_[n][0])) - { - x = x1; - } - else - { - x = x2; - } - } - else - { - x = alpha/d; - } - - return x; -} - - -Foam::scalar Foam::distributionModels::general::minValue() const -{ - return minValue_; -} - - -Foam::scalar Foam::distributionModels::general::maxValue() const -{ - return maxValue_; -} - - -Foam::scalar Foam::distributionModels::general::meanValue() const -{ - return meanValue_; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/distributionModels/general/general.H b/src/lagrangian/distributionModels/general/general.H deleted file mode 100644 index 4c3019d339..0000000000 --- a/src/lagrangian/distributionModels/general/general.H +++ /dev/null @@ -1,139 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -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 . - -Class - Foam::distributionModels::general - -Description - A general distribution model where the distribution is specified as - (point, value) pairs. By default the values are assumed to represent - a probability density function, but the model also supports specifying a - cumulative distribution function. In both cases it is assumed that the - function is linear between the specified points. - - In both modes of operation the values are automatically normalised. - -SourceFiles - general.C - -\*---------------------------------------------------------------------------*/ - -#ifndef general_H -#define general_H - -#include "distributionModel.H" -#include "Vector.H" -#include "VectorSpace.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace distributionModels -{ - -/*---------------------------------------------------------------------------*\ - Class general Declaration -\*---------------------------------------------------------------------------*/ - -class general -: - public distributionModel -{ - // Private Data - - typedef VectorSpace, scalar, 2> pair; - - //- List of (x, y=f(x)) pairs - List xy_; - - //- Amount of entries in the xy_ list - label nEntries_; - - //- Distribution minimum - scalar minValue_; - - //- Distribution maximum - scalar maxValue_; - - //- Distribution mean - scalar meanValue_; - - //- Values of cumulative distribution function - List integral_; - - //- Is the distribution specified as cumulative or as density - Switch cumulative_; - - -public: - - //- Runtime type information - TypeName("general"); - - - // Constructors - - //- Construct from components - general(const dictionary& dict, Random& rndGen); - - //- Construct copy - general(const general& p); - - //- Construct and return a clone - virtual autoPtr clone() const - { - return autoPtr(new general(*this)); - } - - - //- Destructor - virtual ~general(); - - - // Member Functions - - //- Sample the distributionModel - virtual scalar sample() const; - - //- Return the minimum value - virtual scalar minValue() const; - - //- Return the maximum value - virtual scalar maxValue() const; - - //- Return the mean value - virtual scalar meanValue() const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace distributionModels -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/distributionModels/massRosinRammler/massRosinRammler.C b/src/lagrangian/distributionModels/massRosinRammler/massRosinRammler.C deleted file mode 100644 index 7b73151b60..0000000000 --- a/src/lagrangian/distributionModels/massRosinRammler/massRosinRammler.C +++ /dev/null @@ -1,115 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2023 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -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 . - -\*---------------------------------------------------------------------------*/ - -#include "massRosinRammler.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ -namespace distributionModels -{ - defineTypeNameAndDebug(massRosinRammler, 0); - addToRunTimeSelectionTable(distributionModel, massRosinRammler, dictionary); -} -} - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::distributionModels::massRosinRammler::massRosinRammler -( - const dictionary& dict, - Random& rndGen -) -: - distributionModel(typeName, dict, rndGen), - minValue_(distributionModelDict_.template lookup("minValue")), - maxValue_(distributionModelDict_.template lookup("maxValue")), - d_(distributionModelDict_.template lookup("d")), - n_(distributionModelDict_.template lookup("n")) -{ - check(); - info(); -} - - -Foam::distributionModels::massRosinRammler::massRosinRammler -( - const massRosinRammler& p -) -: - distributionModel(p), - minValue_(p.minValue_), - maxValue_(p.maxValue_), - d_(p.d_), - n_(p.n_) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::distributionModels::massRosinRammler::~massRosinRammler() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -Foam::scalar Foam::distributionModels::massRosinRammler::sample() const -{ - scalar d; - - // Re-sample if the calculated d is out of the physical range - do - { - const scalar a = 3/n_ + 1; - const scalar P = rndGen_.sample01(); - const scalar x = invIncGammaRatio_P(a, P); - d = d_*pow(x, 1/n_); - } while (d < minValue_ || d > maxValue_); - - return d; -} - - -Foam::scalar Foam::distributionModels::massRosinRammler::minValue() const -{ - return minValue_; -} - - -Foam::scalar Foam::distributionModels::massRosinRammler::maxValue() const -{ - return maxValue_; -} - - -Foam::scalar Foam::distributionModels::massRosinRammler::meanValue() const -{ - return d_; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/distributionModels/massRosinRammler/massRosinRammler.H b/src/lagrangian/distributionModels/massRosinRammler/massRosinRammler.H deleted file mode 100644 index b04ab511af..0000000000 --- a/src/lagrangian/distributionModels/massRosinRammler/massRosinRammler.H +++ /dev/null @@ -1,141 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2023 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -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 . - -Class - Foam::distributionModels::massRosinRammler - -Description - Corrected form of the Rosin-Rammler distribution which applies - coefficients relating to a number (q0) distribution of particle - diameters to parcels of fixed mass. - - Parcels of fixed mass are specified by the following setting: - \verbatim - parcelBasisType mass; - \endverbatim - - If coefficients for a mass/volume (q3) distribution are given - instead, then the standard Rosin-Rammler distribution can be applied - to parcels of fixed mass. - - See equation 10 in reference: - \verbatim - Yoon, S. S., Hewson, J. C., DesJardin, P. E., Glaze, D. J., - Black, A. R., & Skaggs, R. R. (2004). - Numerical modeling and experimental measurements of a high speed - solid-cone water spray for use in fire suppression applications. - International Journal of Multiphase Flow, 30(11), 1369-1388. - \endverbatim - -SourceFiles - massRosinRammler.C - -\*---------------------------------------------------------------------------*/ - -#ifndef massRosinRammler_H -#define massRosinRammler_H - -#include "distributionModel.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace distributionModels -{ - -/*---------------------------------------------------------------------------*\ - Class massRosinRammler Declaration -\*---------------------------------------------------------------------------*/ - -class massRosinRammler -: - public distributionModel -{ - // Private Data - - //- Distribution minimum - scalar minValue_; - - //- Distribution maximum - scalar maxValue_; - - //- Characteristic droplet size - scalar d_; - - //- Empirical dimensionless constant to specify the distribution width, - // sometimes referred to as the dispersion coefficient - scalar n_; - - -public: - - //- Runtime type information - TypeName("massRosinRammler"); - - - // Constructors - - //- Construct from components - massRosinRammler(const dictionary& dict, Random& rndGen); - - //- Construct copy - massRosinRammler(const massRosinRammler& p); - - //- Construct and return a clone - virtual autoPtr clone() const - { - return autoPtr(new massRosinRammler(*this)); - } - - - //- Destructor - virtual ~massRosinRammler(); - - - // Member Functions - - //- Sample the distributionModel - virtual scalar sample() const; - - //- Return the minimum value - virtual scalar minValue() const; - - //- Return the maximum value - virtual scalar maxValue() const; - - //- Return the mean value - virtual scalar meanValue() const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace distributionModels -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/distributionModels/multiNormal/multiNormal.C b/src/lagrangian/distributionModels/multiNormal/multiNormal.C deleted file mode 100644 index e65254d228..0000000000 --- a/src/lagrangian/distributionModels/multiNormal/multiNormal.C +++ /dev/null @@ -1,162 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -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 . - -\*---------------------------------------------------------------------------*/ - -#include "multiNormal.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ -namespace distributionModels -{ - defineTypeNameAndDebug(multiNormal, 0); - addToRunTimeSelectionTable(distributionModel, multiNormal, dictionary); -} -} - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::distributionModels::multiNormal::multiNormal -( - const dictionary& dict, - Random& rndGen -) -: - distributionModel(typeName, dict, rndGen), - minValue_(distributionModelDict_.template lookup("minValue")), - maxValue_(distributionModelDict_.template lookup("maxValue")), - range_(maxValue_ - minValue_), - expectation_(distributionModelDict_.lookup("expectation")), - variance_(distributionModelDict_.lookup("variance")), - strength_(distributionModelDict_.lookup("strength")) -{ - check(); - - scalar sMax = 0; - label n = strength_.size(); - for (label i=0; i(); - y = rndGen_.sample01(); - scalar p = 0.0; - - for (label i=0; i. - -Class - Foam::distributionModels::multiNormal - -Description - A multiNormal distribution model - - \verbatim - model = sum_i strength_i * exp(-0.5*((x - expectation_i)/variance_i)^2 ) - \endverbatim - - -SourceFiles - multiNormal.C - -\*---------------------------------------------------------------------------*/ - -#ifndef multiNormal_H -#define multiNormal_H - -#include "distributionModel.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace distributionModels -{ - -/*---------------------------------------------------------------------------*\ - Class multiNormal Declaration -\*---------------------------------------------------------------------------*/ - -class multiNormal -: - public distributionModel -{ - // Private Data - - //- Distribution minimum - scalar minValue_; - - //- Distribution maximum - scalar maxValue_; - - //- Distribution range - scalar range_; - - - // Model coefficients - - List expectation_; - List variance_; - List strength_; - - -public: - - //- Runtime type information - TypeName("multiNormal"); - - - // Constructors - - //- Construct from components - multiNormal(const dictionary& dict, Random& rndGen); - - //- Construct copy - multiNormal(const multiNormal& p); - - //- Construct and return a clone - virtual autoPtr clone() const - { - return autoPtr(new multiNormal(*this)); - } - - - //- Destructor - virtual ~multiNormal(); - - - // Member Functions - - //- Sample the distributionModel - virtual scalar sample() const; - - //- Return the minimum value - virtual scalar minValue() const; - - //- Return the maximum value - virtual scalar maxValue() const; - - //- Return the mean value - virtual scalar meanValue() const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace distributionModels -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/distributionModels/normal/normal.C b/src/lagrangian/distributionModels/normal/normal.C deleted file mode 100644 index a9d0294acb..0000000000 --- a/src/lagrangian/distributionModels/normal/normal.C +++ /dev/null @@ -1,129 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -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 . - -\*---------------------------------------------------------------------------*/ - -#include "normal.H" -#include "addToRunTimeSelectionTable.H" -#include "mathematicalConstants.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ -namespace distributionModels -{ - defineTypeNameAndDebug(normal, 0); - addToRunTimeSelectionTable(distributionModel, normal, dictionary); -} -} - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::distributionModels::normal::normal -( - const dictionary& dict, - Random& rndGen -) -: - distributionModel(typeName, dict, rndGen), - minValue_(distributionModelDict_.template lookup("minValue")), - maxValue_(distributionModelDict_.template lookup("maxValue")), - expectation_(distributionModelDict_.template lookup("expectation")), - variance_(distributionModelDict_.template lookup("variance")), - a_(0.147) -{ - check(); - info(); -} - - -Foam::distributionModels::normal::normal(const normal& p) -: - distributionModel(p), - minValue_(p.minValue_), - maxValue_(p.maxValue_), - expectation_(p.expectation_), - variance_(p.variance_), - a_(p.a_) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::distributionModels::normal::~normal() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -Foam::scalar Foam::distributionModels::normal::sample() const -{ - - scalar a = erf((minValue_ - expectation_)/variance_); - scalar b = erf((maxValue_ - expectation_)/variance_); - - scalar y = rndGen_.sample01(); - scalar x = erfInv(y*(b - a) + a)*variance_ + expectation_; - - // Note: numerical approximation of the inverse function yields slight - // inaccuracies - - x = min(max(x, minValue_), maxValue_); - - return x; -} - - -Foam::scalar Foam::distributionModels::normal::minValue() const -{ - return minValue_; -} - - -Foam::scalar Foam::distributionModels::normal::maxValue() const -{ - return maxValue_; -} - - -Foam::scalar Foam::distributionModels::normal::meanValue() const -{ - return expectation_; -} - - -Foam::scalar Foam::distributionModels::normal::erfInv(const scalar y) const -{ - scalar k = 2.0/(constant::mathematical::pi*a_) + 0.5*log(1.0 - y*y); - scalar h = log(1.0 - y*y)/a_; - scalar x = sqrt(-k + sqrt(k*k - h)); - if (y < 0.0) - { - x *= -1.0; - } - return x; -} - - -// ************************************************************************* // diff --git a/src/lagrangian/distributionModels/normal/normal.H b/src/lagrangian/distributionModels/normal/normal.H deleted file mode 100644 index a9ceb0262b..0000000000 --- a/src/lagrangian/distributionModels/normal/normal.H +++ /dev/null @@ -1,131 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -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 . - -Class - Foam::distributionModels::normal - -Description - A normal distribution model - - \verbatim - model = strength * exp(-0.5*((x - expectation)/variance)^2 ) - \endverbatim - - strength only has meaning if there's more than one distribution model - -SourceFiles - normal.C - -\*---------------------------------------------------------------------------*/ - -#ifndef normal_H -#define normal_H - -#include "distributionModel.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace distributionModels -{ - -/*---------------------------------------------------------------------------*\ - Class normal Declaration -\*---------------------------------------------------------------------------*/ - -class normal -: - public distributionModel -{ - // Private Data - - - //- Distribution minimum - scalar minValue_; - - //- Distribution maximum - scalar maxValue_; - - - // Model coefficients - - scalar expectation_; - scalar variance_; - - scalar a_; - - -public: - - //- Runtime type information - TypeName("normal"); - - - // Constructors - - //- Construct from components - normal(const dictionary& dict, Random& rndGen); - - //- Construct copy - normal(const normal& p); - - //- Construct and return a clone - virtual autoPtr clone() const - { - return autoPtr(new normal(*this)); - } - - - //- Destructor - virtual ~normal(); - - - // Member Functions - - //- Sample the distributionModel - virtual scalar sample() const; - - //- Return the minimum value - virtual scalar minValue() const; - - //- Return the maximum value - virtual scalar maxValue() const; - - //- Return the mean value - virtual scalar meanValue() const; - - virtual scalar erfInv(const scalar y) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace distributionModels -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/distributionModels/uniform/uniform.C b/src/lagrangian/distributionModels/uniform/uniform.C deleted file mode 100644 index c7276058a2..0000000000 --- a/src/lagrangian/distributionModels/uniform/uniform.C +++ /dev/null @@ -1,97 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -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 . - -\*---------------------------------------------------------------------------*/ - -#include "uniform.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ -namespace distributionModels -{ - defineTypeNameAndDebug(uniform, 0); - addToRunTimeSelectionTable(distributionModel, uniform, dictionary); -} -} - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::distributionModels::uniform::uniform -( - const dictionary& dict, - Random& rndGen -) -: - distributionModel(typeName, dict, rndGen), - minValue_(distributionModelDict_.template lookup("minValue")), - maxValue_(distributionModelDict_.template lookup("maxValue")) -{ - check(); - info(); -} - - -Foam::distributionModels::uniform::uniform(const uniform& p) -: - distributionModel(p), - minValue_(p.minValue_), - maxValue_(p.maxValue_) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::distributionModels::uniform::~uniform() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -Foam::scalar Foam::distributionModels::uniform::sample() const -{ - return rndGen_.scalarAB(minValue_, maxValue_); -} - - -Foam::scalar Foam::distributionModels::uniform::minValue() const -{ - return minValue_; -} - - -Foam::scalar Foam::distributionModels::uniform::maxValue() const -{ - return maxValue_; -} - - -Foam::scalar Foam::distributionModels::uniform::meanValue() const -{ - return 0.5*(minValue_ + maxValue_); -} - - -// ************************************************************************* // diff --git a/src/lagrangian/distributionModels/uniform/uniform.H b/src/lagrangian/distributionModels/uniform/uniform.H deleted file mode 100644 index daf715980d..0000000000 --- a/src/lagrangian/distributionModels/uniform/uniform.H +++ /dev/null @@ -1,114 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -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 . - -Class - Foam::distributionModels::uniform - -Description - Uniform/equally-weighted distribution model - -SourceFiles - uniform.C - -\*---------------------------------------------------------------------------*/ - -#ifndef uniform_H -#define uniform_H - -#include "distributionModel.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace distributionModels -{ - -/*---------------------------------------------------------------------------*\ - Class uniform Declaration -\*---------------------------------------------------------------------------*/ - -class uniform -: - public distributionModel -{ - // Private Data - - //- Distribution minimum - scalar minValue_; - - //- Distribution maximum - scalar maxValue_; - - -public: - - //- Runtime type information - TypeName("uniform"); - - - // Constructors - - //- Construct from components - uniform(const dictionary& dict, Random& rndGen); - - //- Construct copy - uniform(const uniform& p); - - //- Construct and return a clone - virtual autoPtr clone() const - { - return autoPtr(new uniform(*this)); - } - - - //- Destructor - virtual ~uniform(); - - - // Member Functions - - //- Sample the distributionModel - virtual scalar sample() const; - - //- Return the minimum value - virtual scalar minValue() const; - - //- Return the maximum value - virtual scalar maxValue() const; - - //- Return the mean value - virtual scalar meanValue() const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace distributionModels -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/parcel/Make/files b/src/lagrangian/parcel/Make/files index 1488e4ff53..3cae66b253 100644 --- a/src/lagrangian/parcel/Make/files +++ b/src/lagrangian/parcel/Make/files @@ -96,6 +96,9 @@ $(MPPICTIMESCALE)/equilibrium/equilibrium.C $(MPPICTIMESCALE)/nonEquilibrium/nonEquilibrium.C $(MPPICTIMESCALE)/isotropic/isotropic.C +# injection model +submodels/Momentum/InjectionModel/InjectionModel/injectionModel.C + # integration schemes integrationScheme/integrationScheme/integrationScheme.C integrationScheme/integrationScheme/integrationSchemeNew.C diff --git a/src/lagrangian/parcel/Make/options b/src/lagrangian/parcel/Make/options index d92ca22f5f..69084cc5d7 100644 --- a/src/lagrangian/parcel/Make/options +++ b/src/lagrangian/parcel/Make/options @@ -1,6 +1,5 @@ EXE_INC = \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ - -I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \ -I$(LIB_SRC)/physicalProperties/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ @@ -13,7 +12,6 @@ EXE_INC = \ LIB_LIBS = \ -llagrangian \ - -ldistributionModels \ -lspecie \ -lfluidThermophysicalModels \ -lthermophysicalProperties \ diff --git a/src/lagrangian/parcel/clouds/Templates/MomentumCloud/MomentumCloud.C b/src/lagrangian/parcel/clouds/Templates/MomentumCloud/MomentumCloud.C index 93425dd830..90bb34bae0 100644 --- a/src/lagrangian/parcel/clouds/Templates/MomentumCloud/MomentumCloud.C +++ b/src/lagrangian/parcel/clouds/Templates/MomentumCloud/MomentumCloud.C @@ -545,7 +545,7 @@ template void Foam::MomentumCloud::checkParcelProperties ( parcelType& parcel, - const bool fullyDescribed + const label injectori ) { if (parcel.typeId() == -1) diff --git a/src/lagrangian/parcel/clouds/Templates/MomentumCloud/MomentumCloud.H b/src/lagrangian/parcel/clouds/Templates/MomentumCloud/MomentumCloud.H index 1f1488379a..3e2e2a00c5 100644 --- a/src/lagrangian/parcel/clouds/Templates/MomentumCloud/MomentumCloud.H +++ b/src/lagrangian/parcel/clouds/Templates/MomentumCloud/MomentumCloud.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -539,7 +539,7 @@ public: void checkParcelProperties ( parcelType& parcel, - const bool fullyDescribed + const label injectori ); //- Store the current cloud state diff --git a/src/lagrangian/parcel/clouds/Templates/ReactingCloud/ReactingCloud.C b/src/lagrangian/parcel/clouds/Templates/ReactingCloud/ReactingCloud.C index 6caa681f71..12ed85665b 100644 --- a/src/lagrangian/parcel/clouds/Templates/ReactingCloud/ReactingCloud.C +++ b/src/lagrangian/parcel/clouds/Templates/ReactingCloud/ReactingCloud.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -208,12 +208,12 @@ template void Foam::ReactingCloud::checkParcelProperties ( parcelType& parcel, - const bool fullyDescribed + const label injectori ) { - CloudType::checkParcelProperties(parcel, fullyDescribed); + CloudType::checkParcelProperties(parcel, injectori); - if (fullyDescribed) + if (injectori != -1 && this->injectors()[injectori].fullyDescribed()) { checkSuppliedComposition ( @@ -222,9 +222,6 @@ void Foam::ReactingCloud::checkParcelProperties "YMixture" ); } - - // derived information - store initial mass - parcel.mass0() = parcel.mass(); } diff --git a/src/lagrangian/parcel/clouds/Templates/ReactingCloud/ReactingCloud.H b/src/lagrangian/parcel/clouds/Templates/ReactingCloud/ReactingCloud.H index 8bc4e6e584..d117215c7a 100644 --- a/src/lagrangian/parcel/clouds/Templates/ReactingCloud/ReactingCloud.H +++ b/src/lagrangian/parcel/clouds/Templates/ReactingCloud/ReactingCloud.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -265,7 +265,7 @@ public: void checkParcelProperties ( parcelType& parcel, - const bool fullyDescribed + const label injectori ); //- Store the current cloud state diff --git a/src/lagrangian/parcel/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C b/src/lagrangian/parcel/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C index e05c5e0bfb..478311db90 100644 --- a/src/lagrangian/parcel/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C +++ b/src/lagrangian/parcel/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -171,12 +171,14 @@ template void Foam::ReactingMultiphaseCloud::checkParcelProperties ( parcelType& parcel, - const bool fullyDescribed + const label injectori ) { - CloudType::checkParcelProperties(parcel, fullyDescribed); + CloudType::checkParcelProperties(parcel, injectori); - if (fullyDescribed) + parcel.mass0() = parcel.mass(); + + if (injectori != -1 && this->injectors()[injectori].fullyDescribed()) { label idGas = this->composition().idGas(); label idLiquid = this->composition().idLiquid(); diff --git a/src/lagrangian/parcel/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H b/src/lagrangian/parcel/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H index 4a7336b9d8..5b9808587e 100644 --- a/src/lagrangian/parcel/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H +++ b/src/lagrangian/parcel/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -261,7 +261,7 @@ public: void checkParcelProperties ( parcelType& parcel, - const bool fullyDescribed + const label injectori ); //- Store the current cloud state diff --git a/src/lagrangian/parcel/clouds/Templates/SprayCloud/SprayCloud.C b/src/lagrangian/parcel/clouds/Templates/SprayCloud/SprayCloud.C index b68ae6c891..fd9c1f50e3 100644 --- a/src/lagrangian/parcel/clouds/Templates/SprayCloud/SprayCloud.C +++ b/src/lagrangian/parcel/clouds/Templates/SprayCloud/SprayCloud.C @@ -26,6 +26,7 @@ License #include "SprayCloud.H" #include "AtomisationModel.H" #include "BreakupModel.H" +#include "ConeInjection.H" #include "parcelThermo.H" // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // @@ -163,19 +164,22 @@ template void Foam::SprayCloud::checkParcelProperties ( parcelType& parcel, - const bool fullyDescribed + const label injectori ) { - CloudType::checkParcelProperties(parcel, fullyDescribed); + CloudType::checkParcelProperties(parcel, injectori); - // store the injection position and initial drop size - parcel.position0() = parcel.position(this->mesh()); + // store the initial size and position parcel.d0() = parcel.d(); + parcel.mass0() = parcel.mass(); + parcel.position0() = parcel.position(this->mesh()); parcel.y() = breakup().y0(); parcel.yDot() = breakup().yDot0(); parcel.liquidCore() = atomisation().initLiquidCore(); + + parcel.injector() = injectori; } diff --git a/src/lagrangian/parcel/clouds/Templates/SprayCloud/SprayCloud.H b/src/lagrangian/parcel/clouds/Templates/SprayCloud/SprayCloud.H index 7dd93961fb..b5a7e88937 100644 --- a/src/lagrangian/parcel/clouds/Templates/SprayCloud/SprayCloud.H +++ b/src/lagrangian/parcel/clouds/Templates/SprayCloud/SprayCloud.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -50,6 +50,7 @@ namespace Foam { // Forward declaration of classes + template class AtomisationModel; @@ -215,7 +216,7 @@ public: void checkParcelProperties ( parcelType& parcel, - const bool fullyDescribed + const label injectori ); //- Store the current cloud state diff --git a/src/lagrangian/parcel/clouds/Templates/ThermoCloud/ThermoCloud.C b/src/lagrangian/parcel/clouds/Templates/ThermoCloud/ThermoCloud.C index 63aab27d5b..cb5a487fdb 100644 --- a/src/lagrangian/parcel/clouds/Templates/ThermoCloud/ThermoCloud.C +++ b/src/lagrangian/parcel/clouds/Templates/ThermoCloud/ThermoCloud.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -373,10 +373,10 @@ template void Foam::ThermoCloud::checkParcelProperties ( parcelType& parcel, - const bool fullyDescribed + const label injectori ) { - CloudType::checkParcelProperties(parcel, fullyDescribed); + CloudType::checkParcelProperties(parcel, injectori); } diff --git a/src/lagrangian/parcel/clouds/Templates/ThermoCloud/ThermoCloud.H b/src/lagrangian/parcel/clouds/Templates/ThermoCloud/ThermoCloud.H index 403225d1a2..0649f4a653 100644 --- a/src/lagrangian/parcel/clouds/Templates/ThermoCloud/ThermoCloud.H +++ b/src/lagrangian/parcel/clouds/Templates/ThermoCloud/ThermoCloud.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -55,6 +55,9 @@ namespace Foam class integrationScheme; +template +class InjectionModel; + template class HeatTransferModel; @@ -354,7 +357,7 @@ public: void checkParcelProperties ( parcelType& parcel, - const bool fullyDescribed + const label injectori ); //- Store the current cloud state diff --git a/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C b/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C index 3dc7405715..23d8bb664f 100644 --- a/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C +++ b/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -278,7 +278,7 @@ void Foam::ReactingMultiphaseParcel::calc d0, T0, mass0, - this->mass0_, + mass0_, YMix[GAS]*YGas_, YMix[LIQ]*YLiquid_, YMix[SLD]*YSolid_, @@ -716,6 +716,7 @@ Foam::ReactingMultiphaseParcel::ReactingMultiphaseParcel ) : ParcelType(p), + mass0_(p.mass0_), YGas_(p.YGas_), YLiquid_(p.YLiquid_), YSolid_(p.YSolid_), diff --git a/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H b/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H index 83ac2cdd6c..231dc98698 100644 --- a/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H +++ b/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -198,6 +198,9 @@ protected: // Parcel properties + //- Initial mass [kg] + scalar mass0_; + //- Mass fractions of gases [] scalarField YGas_; @@ -274,7 +277,8 @@ public: AddToPropertyList ( ParcelType, - " nGas(Y1..YN)" + " mass0" + + " nGas(Y1..YN)" + " nLiquid(Y1..YN)" + " nSolid(Y1..YN)" ); @@ -330,6 +334,9 @@ public: // Access + //- Return const access to initial mass [kg] + inline scalar mass0() const; + //- Return const access to mass fractions of gases inline const scalarField& YGas() const; @@ -345,6 +352,9 @@ public: // Edit + //- Return access to initial mass [kg] + inline scalar& mass0(); + //- Return access to mass fractions of gases inline scalarField& YGas(); diff --git a/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelI.H b/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelI.H index f4b936b893..fa71ff31f0 100644 --- a/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelI.H +++ b/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -78,6 +78,7 @@ inline Foam::ReactingMultiphaseParcel::ReactingMultiphaseParcel ) : ParcelType(mesh, coordinates, celli, tetFacei, tetPti, facei), + mass0_(0), YGas_(0), YLiquid_(0), YSolid_(0), @@ -94,6 +95,7 @@ inline Foam::ReactingMultiphaseParcel::ReactingMultiphaseParcel ) : ParcelType(mesh, position, celli), + mass0_(0), YGas_(0), YLiquid_(0), YSolid_(0), @@ -137,7 +139,14 @@ hRetentionCoeff() const } -// * * * * * * * * * * ThermoParcel Member Functions * * * * * * * * * * * * // +// * * * * * * * * ReactingMultiphaseParcel Member Functions * * * * * * * * // + +template +inline Foam::scalar Foam::ReactingMultiphaseParcel::mass0() const +{ + return mass0_; +} + template inline const Foam::scalarField& Foam::ReactingMultiphaseParcel:: @@ -171,6 +180,13 @@ Foam::ReactingMultiphaseParcel::canCombust() const } +template +inline Foam::scalar& Foam::ReactingMultiphaseParcel::mass0() +{ + return mass0_; +} + + template inline Foam::scalarField& Foam::ReactingMultiphaseParcel::YGas() { diff --git a/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C b/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C index 82e805e43d..ada650d56b 100644 --- a/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C +++ b/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,7 +35,7 @@ Foam::string Foam::ReactingMultiphaseParcel::propertyList_ = template const std::size_t Foam::ReactingMultiphaseParcel::sizeofFields_ ( - 0 + sizeof(scalar) ); @@ -49,6 +49,7 @@ Foam::ReactingMultiphaseParcel::ReactingMultiphaseParcel ) : ParcelType(is, readFields), + mass0_(0.0), YGas_(0), YLiquid_(0), YSolid_(0), @@ -60,7 +61,15 @@ Foam::ReactingMultiphaseParcel::ReactingMultiphaseParcel DynamicList Yl; DynamicList Ys; - is >> Yg >> Yl >> Ys; + if (is.format() == IOstream::ASCII) + { + is >> mass0_ >> Yg >> Yl >> Ys; + } + else + { + is.read(reinterpret_cast(&mass0_), sizeofFields_); + is >> Yg >> Yl >> Ys; + } YGas_.transfer(Yg); YLiquid_.transfer(Yl); @@ -106,6 +115,20 @@ void Foam::ReactingMultiphaseParcel::readFields ParcelType::readFields(c, compModel); + IOField mass0 + ( + c.fieldIOobject("mass0", IOobject::MUST_READ), + valid + ); + c.checkFieldIOobject(c, mass0); + + label i = 0; + forAllIter(typename CloudType, c, iter) + { + ReactingMultiphaseParcel& p = iter(); + p.mass0_ = mass0[i++]; + } + // Get names and sizes for each Y... const label idGas = compModel.idGas(); const wordList& gasNames = compModel.componentNames(idGas); @@ -207,8 +230,18 @@ void Foam::ReactingMultiphaseParcel::writeFields label np = c.size(); - // Write the composition fractions { + IOField mass0(c.fieldIOobject("mass0", IOobject::NO_READ), np); + + label i = 0; + forAllConstIter(typename CloudType, c, iter) + { + const ReactingMultiphaseParcel& p = iter(); + mass0[i++] = p.mass0_; + } + mass0.write(np > 0); + + // Write the composition fractions const wordList& stateLabels = compModel.stateLabels(); const label idGas = compModel.idGas(); @@ -301,6 +334,7 @@ Foam::Ostream& Foam::operator<< if (os.format() == IOstream::ASCII) { os << static_cast(p) + << token::SPACE << p.mass0() << token::SPACE << YGasLoc << token::SPACE << YLiquidLoc << token::SPACE << YSolidLoc; @@ -308,6 +342,11 @@ Foam::Ostream& Foam::operator<< else { os << static_cast(p); + os.write + ( + reinterpret_cast(&p.mass0_), + ReactingMultiphaseParcel::sizeofFields_ + ); os << YGasLoc << YLiquidLoc << YSolidLoc; } diff --git a/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcel.C b/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcel.C index 40bc1a59eb..cb53759792 100644 --- a/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcel.C +++ b/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -184,7 +184,6 @@ Foam::ReactingParcel::ReactingParcel ) : ParcelType(p), - mass0_(p.mass0_), Y_(p.Y_) {} diff --git a/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcel.H b/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcel.H index f7b02d2d32..7dfac5c877 100644 --- a/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcel.H +++ b/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -132,9 +132,6 @@ protected: // Parcel properties - //- Initial mass [kg] - scalar mass0_; - //- Mass fractions of mixture [] scalarField Y_; @@ -182,8 +179,7 @@ public: AddToPropertyList ( ParcelType, - " mass0" - + " nPhases(Y1..YN)" + " nPhases(Y1..YN)" ); @@ -233,18 +229,12 @@ public: // Access - //- Return const access to initial mass [kg] - inline scalar mass0() const; - //- Return const access to mass fractions of mixture [] inline const scalarField& Y() const; // Edit - //- Return access to initial mass [kg] - inline scalar& mass0(); - //- Return access to mass fractions of mixture [] inline scalarField& Y(); diff --git a/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcelI.H b/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcelI.H index b82b063afe..a4eece04dc 100644 --- a/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcelI.H +++ b/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcelI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -73,7 +73,6 @@ inline Foam::ReactingParcel::ReactingParcel ) : ParcelType(mesh, coordinates, celli, tetFacei, tetPti, facei), - mass0_(0.0), Y_(0) {} @@ -87,7 +86,6 @@ inline Foam::ReactingParcel::ReactingParcel ) : ParcelType(mesh, position, celli), - mass0_(0.0), Y_(0) {} @@ -110,14 +108,7 @@ Foam::ReactingParcel::constantProperties::constantVolume() const } -// * * * * * * * * * * ThermoParcel Member Functions * * * * * * * * * * * * // - -template -inline Foam::scalar Foam::ReactingParcel::mass0() const -{ - return mass0_; -} - +// * * * * * * * * * * ReactingParcel Member Functions * * * * * * * * * * * // template inline const Foam::scalarField& Foam::ReactingParcel::Y() const @@ -126,13 +117,6 @@ inline const Foam::scalarField& Foam::ReactingParcel::Y() const } -template -inline Foam::scalar& Foam::ReactingParcel::mass0() -{ - return mass0_; -} - - template inline Foam::scalarField& Foam::ReactingParcel::Y() { diff --git a/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcelIO.C b/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcelIO.C index 11245a0fdb..3d97805cfd 100644 --- a/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcelIO.C +++ b/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcelIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,7 +35,7 @@ Foam::string Foam::ReactingParcel::propertyList_ = template const std::size_t Foam::ReactingParcel::sizeofFields_ ( - sizeof(scalar) + 0 ); @@ -45,22 +45,13 @@ template Foam::ReactingParcel::ReactingParcel(Istream& is, bool readFields) : ParcelType(is, readFields), - mass0_(0.0), Y_(0) { if (readFields) { DynamicList Ymix; - if (is.format() == IOstream::ASCII) - { - is >> mass0_ >> Ymix; - } - else - { - is.read(reinterpret_cast(&mass0_), sizeofFields_); - is >> Ymix; - } + is >> Ymix; Y_.transfer(Ymix); } @@ -98,20 +89,6 @@ void Foam::ReactingParcel::readFields ParcelType::readFields(c); - IOField mass0 - ( - c.fieldIOobject("mass0", IOobject::MUST_READ), - valid - ); - c.checkFieldIOobject(c, mass0); - - label i = 0; - forAllIter(typename CloudType, c, iter) - { - ReactingParcel& p = iter(); - p.mass0_ = mass0[i++]; - } - // Get names and sizes for each Y... const wordList& phaseTypes = compModel.phaseTypes(); const label nPhases = phaseTypes.size(); @@ -121,7 +98,6 @@ void Foam::ReactingParcel::readFields stateLabels = compModel.stateLabels()[0]; } - // Set storage for each Y... for each parcel forAllIter(typename CloudType, c, iter) { @@ -173,16 +149,6 @@ void Foam::ReactingParcel::writeFields const label np = c.size(); { - IOField mass0(c.fieldIOobject("mass0", IOobject::NO_READ), np); - - label i = 0; - forAllConstIter(typename CloudType, c, iter) - { - const ReactingParcel& p = iter(); - mass0[i++] = p.mass0_; - } - mass0.write(np > 0); - // Write the composition fractions const wordList& phaseTypes = compModel.phaseTypes(); wordList stateLabels(phaseTypes.size(), ""); @@ -227,17 +193,11 @@ Foam::Ostream& Foam::operator<< if (os.format() == IOstream::ASCII) { os << static_cast(p) - << token::SPACE << p.mass0() << token::SPACE << p.Y(); } else { os << static_cast(p); - os.write - ( - reinterpret_cast(&p.mass0_), - ReactingParcel::sizeofFields_ - ); os << p.Y(); } diff --git a/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcel.C b/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcel.C index 8cfc7626dd..e543be3242 100644 --- a/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcel.C +++ b/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -153,6 +153,8 @@ void Foam::SprayParcel::calcAtomisation const scalar dt ) { + if (injector_ == -1) return; + typedef typename TrackCloudType::thermoCloudType thermoCloudType; const CompositionModel& composition = cloud.composition(); @@ -169,7 +171,7 @@ void Foam::SprayParcel::calcAtomisation // Calculate average gas density based on average temperature scalar rhoAv = td.pc()/(R*Tav); - scalar soi = cloud.injectors().timeStart(); + scalar soi = cloud.injectors()[injector_].timeStart(); scalar currentTime = cloud.db().time().value(); const vector& pos = this->position(td.mesh); const vector& injectionPos = this->position0(); @@ -179,10 +181,12 @@ void Foam::SprayParcel::calcAtomisation scalar Urel = mag(this->U()); scalar t0 = max(0.0, currentTime - this->age() - soi); - scalar t1 = min(t0 + dt, cloud.injectors().timeEnd() - soi); + scalar t1 = min(t0 + dt, cloud.injectors()[injector_].timeEnd() - soi); + + scalar rho0 = mass0_/this->volume(d0_); // This should be the vol flow rate from when the parcel was injected - scalar volFlowRate = cloud.injectors().volumeToInject(t0, t1)/dt; + scalar volFlowRate = cloud.injectors()[injector_].massToInject(t0, t1)/rho0; scalar chi = 0.0; if (atomisation.calcChi()) @@ -276,6 +280,7 @@ void Foam::SprayParcel::calcBreakup Urel, Urmag, this->tMom(), + injector_, dChild, parcelMassChild ) @@ -306,7 +311,6 @@ void Foam::SprayParcel::calcBreakup child->ms() = -great; child->injector() = this->injector(); child->tMom() = massChild/(Fcp.Sp() + Fncp.Sp()); - child->user() = 0.0; child->calcDispersion(cloud, td, dt); cloud.addParticle(child); @@ -426,8 +430,7 @@ Foam::SprayParcel::SprayParcel(const SprayParcel& p) tc_(p.tc_), ms_(p.ms_), injector_(p.injector_), - tMom_(p.tMom_), - user_(p.user_) + tMom_(p.tMom_) {} diff --git a/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcel.H b/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcel.H index bf96160e01..2669a93304 100644 --- a/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcel.H +++ b/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -146,9 +146,12 @@ protected: // Spray parcel properties - //- Initial droplet diameter + //- Initial droplet diameter [m] scalar d0_; + //- Initial mass [kg] + scalar mass0_; + //- Injection position vector position0_; @@ -176,16 +179,12 @@ protected: //- Stripped parcel mass due to breakup scalar ms_; - //- Injected from injector (needed e.g. for calculating distance - // from injector) - scalar injector_; + //- Injector id + label injector_; //- Momentum relaxation time (needed for calculating parcel acc.) scalar tMom_; - //- Passive scalar (extra variable to be defined by user) - scalar user_; - public: @@ -238,6 +237,9 @@ public: //- Return const access to initial droplet diameter inline scalar d0() const; + //- Return const access to initial mass [kg] + inline scalar mass0() const; + //- Return const access to initial droplet position inline const vector& position0() const; @@ -266,20 +268,20 @@ public: inline scalar ms() const; //- Return const access to injector id - inline scalar injector() const; + inline label injector() const; //- Return const access to momentum relaxation time inline scalar tMom() const; - //- Return const access to passive user scalar - inline scalar user() const; - // Edit //- Return access to initial droplet diameter inline scalar& d0(); + //- Return access to initial mass [kg] + inline scalar& mass0(); + //- Return access to initial droplet position inline vector& position0(); @@ -308,14 +310,11 @@ public: inline scalar& ms(); //- Return access to injector id - inline scalar& injector(); + inline label& injector(); //- Return access to momentum relaxation time inline scalar& tMom(); - //- Return access to passive user scalar - inline scalar& user(); - // Main calculation loop diff --git a/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcelI.H b/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcelI.H index cfbc1432c2..2185e80da0 100644 --- a/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcelI.H +++ b/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcelI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -118,6 +118,7 @@ inline Foam::SprayParcel::SprayParcel : ParcelType(mesh, coordinates, celli, tetFacei, tetPti, facei), d0_(this->d()), + mass0_(this->mass()), position0_(this->position(mesh)), sigma_(0.0), mu_(0.0), @@ -127,9 +128,8 @@ inline Foam::SprayParcel::SprayParcel yDot_(0.0), tc_(0.0), ms_(0.0), - injector_(1.0), - tMom_(great), - user_(0.0) + injector_(-1), + tMom_(great) {} @@ -143,6 +143,7 @@ inline Foam::SprayParcel::SprayParcel : ParcelType(mesh, position, celli), d0_(this->d()), + mass0_(this->mass()), position0_(this->position(mesh)), sigma_(0.0), mu_(0.0), @@ -152,9 +153,8 @@ inline Foam::SprayParcel::SprayParcel yDot_(0.0), tc_(0.0), ms_(0.0), - injector_(1.0), - tMom_(great), - user_(0.0) + injector_(-1), + tMom_(great) {} @@ -185,6 +185,13 @@ inline Foam::scalar Foam::SprayParcel::d0() const } +template +inline Foam::scalar Foam::SprayParcel::mass0() const +{ + return mass0_; +} + + template inline const Foam::vector& Foam::SprayParcel::position0() const { @@ -249,7 +256,7 @@ inline Foam::scalar Foam::SprayParcel::ms() const template -inline Foam::scalar Foam::SprayParcel::injector() const +inline Foam::label Foam::SprayParcel::injector() const { return injector_; } @@ -263,16 +270,16 @@ inline Foam::scalar Foam::SprayParcel::tMom() const template -inline Foam::scalar Foam::SprayParcel::user() const +inline Foam::scalar& Foam::SprayParcel::d0() { - return user_; + return d0_; } template -inline Foam::scalar& Foam::SprayParcel::d0() +inline Foam::scalar& Foam::SprayParcel::mass0() { - return d0_; + return mass0_; } @@ -340,7 +347,7 @@ inline Foam::scalar& Foam::SprayParcel::ms() template -inline Foam::scalar& Foam::SprayParcel::injector() +inline Foam::label& Foam::SprayParcel::injector() { return injector_; } @@ -353,11 +360,4 @@ inline Foam::scalar& Foam::SprayParcel::tMom() } -template -inline Foam::scalar& Foam::SprayParcel::user() -{ - return user_; -} - - // ************************************************************************* // diff --git a/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcelIO.C b/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcelIO.C index 4e09951e5c..7781a2c470 100644 --- a/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcelIO.C +++ b/src/lagrangian/parcel/parcels/Templates/SprayParcel/SprayParcelIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -42,6 +42,7 @@ Foam::SprayParcel::SprayParcel(Istream& is, bool readFields) : ParcelType(is, readFields), d0_(0.0), + mass0_(0.0), position0_(Zero), sigma_(0.0), mu_(0.0), @@ -51,15 +52,15 @@ Foam::SprayParcel::SprayParcel(Istream& is, bool readFields) yDot_(0.0), tc_(0.0), ms_(0.0), - injector_(1.0), - tMom_(great), - user_(0.0) + injector_(-1), + tMom_(great) { if (readFields) { if (is.format() == IOstream::ASCII) { d0_ = readScalar(is); + mass0_ = readScalar(is); is >> position0_; sigma_ = readScalar(is); mu_ = readScalar(is); @@ -69,9 +70,8 @@ Foam::SprayParcel::SprayParcel(Istream& is, bool readFields) yDot_ = readScalar(is); tc_ = readScalar(is); ms_ = readScalar(is); - injector_ = readScalar(is); + injector_ = readLabel(is); tMom_ = readScalar(is); - user_ = readScalar(is); } else { @@ -115,6 +115,9 @@ void Foam::SprayParcel::readFields IOField d0(c.fieldIOobject("d0", IOobject::MUST_READ), write); c.checkFieldIOobject(c, d0); + IOField mass0(c.fieldIOobject("mass0", IOobject::MUST_READ), write); + c.checkFieldIOobject(c, mass0); + IOField position0 ( c.fieldIOobject("position0", IOobject::MUST_READ), @@ -170,7 +173,7 @@ void Foam::SprayParcel::readFields ); c.checkFieldIOobject(c, ms); - IOField injector + IOField