diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C index 9b4c373420..4e5686f3c3 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C @@ -29,7 +29,7 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::kineticTheoryModel::kineticTheoryModel +Foam::RASModels::kineticTheoryModel::kineticTheoryModel ( const volScalarField& alpha, const geometricOneField& rho, @@ -139,13 +139,13 @@ Foam::kineticTheoryModel::kineticTheoryModel // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::kineticTheoryModel::~kineticTheoryModel() +Foam::RASModels::kineticTheoryModel::~kineticTheoryModel() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::kineticTheoryModel::read() +bool Foam::RASModels::kineticTheoryModel::read() { if ( @@ -175,21 +175,24 @@ bool Foam::kineticTheoryModel::read() } -Foam::tmp Foam::kineticTheoryModel::k() const +Foam::tmp +Foam::RASModels::kineticTheoryModel::k() const { notImplemented("kineticTheoryModel::k()"); return nut_; } -Foam::tmp Foam::kineticTheoryModel::epsilon() const +Foam::tmp +Foam::RASModels::kineticTheoryModel::epsilon() const { notImplemented("kineticTheoryModel::epsilon()"); return nut_; } -Foam::tmp Foam::kineticTheoryModel::R() const +Foam::tmp +Foam::RASModels::kineticTheoryModel::R() const { return tmp ( @@ -211,7 +214,8 @@ Foam::tmp Foam::kineticTheoryModel::R() const /* -Foam::tmp Foam::kineticTheoryModel::pp() const +Foam::tmp +Foam::RASModels::kineticTheoryModel::pp() const { // Particle pressure coefficient @@ -244,7 +248,8 @@ Foam::tmp Foam::kineticTheoryModel::pp() const */ -Foam::tmp Foam::kineticTheoryModel::pPrime() const +Foam::tmp +Foam::RASModels::kineticTheoryModel::pPrime() const { // Local references const volScalarField& alpha = this->alpha_; @@ -271,7 +276,8 @@ Foam::tmp Foam::kineticTheoryModel::pPrime() const } -Foam::tmp Foam::kineticTheoryModel::pPrimef() const +Foam::tmp +Foam::RASModels::kineticTheoryModel::pPrimef() const { // Local references const volScalarField& alpha = this->alpha_; @@ -298,7 +304,8 @@ Foam::tmp Foam::kineticTheoryModel::pPrimef() const } -Foam::tmp Foam::kineticTheoryModel::devRhoReff() const +Foam::tmp +Foam::RASModels::kineticTheoryModel::devRhoReff() const { return tmp ( @@ -320,7 +327,8 @@ Foam::tmp Foam::kineticTheoryModel::devRhoReff() const } -Foam::tmp Foam::kineticTheoryModel::divDevRhoReff +Foam::tmp +Foam::RASModels::kineticTheoryModel::divDevRhoReff ( volVectorField& U ) const @@ -338,7 +346,7 @@ Foam::tmp Foam::kineticTheoryModel::divDevRhoReff } -void Foam::kineticTheoryModel::correct() +void Foam::RASModels::kineticTheoryModel::correct() { // Local references volScalarField alpha(max(this->alpha_, 0.0)); diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.H index 4f6164682f..776b523f56 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.H @@ -61,6 +61,8 @@ SourceFiles namespace Foam { +namespace RASModels +{ /*---------------------------------------------------------------------------*\ Class kineticTheoryModel Declaration @@ -212,6 +214,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace RASModels } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/phaseIncompressibleTurbulenceModels.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/phaseIncompressibleTurbulenceModels.C index a1817fefb5..2cf5da4021 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/phaseIncompressibleTurbulenceModels.C +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/phaseIncompressibleTurbulenceModels.C @@ -26,258 +26,62 @@ License #include "PhaseIncompressibleTurbulenceModel.H" #include "phaseModel.H" #include "addToRunTimeSelectionTable.H" - -namespace Foam -{ - typedef TurbulenceModel - < - volScalarField, - geometricOneField, - incompressibleTurbulenceModel, - phaseModel - > basePhaseIncompressibleTransportTurbulenceModel; - - defineTemplateRunTimeSelectionTable - ( - basePhaseIncompressibleTransportTurbulenceModel, - dictionary - ); - - typedef PhaseIncompressibleTurbulenceModel - incompressibleTransportTurbulenceModel; -} - +#include "makeTurbulenceModel.H" #include "laminar.H" - -namespace Foam -{ - typedef laminar - incompressibleLaminar; - - defineNamedTemplateTypeNameAndDebug(incompressibleLaminar, 0); - - addToRunTimeSelectionTable - ( - basePhaseIncompressibleTransportTurbulenceModel, - incompressibleLaminar, - dictionary - ); -} - - #include "RASModel.H" +#include "LESModel.H" + +makeBaseTurbulenceModel +( + volScalarField, + geometricOneField, + incompressibleTurbulenceModel, + PhaseIncompressibleTurbulenceModel, + phaseModel +); + +#define makeRASModel(Type) \ + makeTemplatedTurbulenceModel \ + (phaseModelPhaseIncompressibleTurbulenceModel, RAS, Type) + +#define makeLESModel(Type) \ + makeTemplatedTurbulenceModel \ + (phaseModelPhaseIncompressibleTurbulenceModel, LES, Type) + #include "kEpsilon.H" +makeRASModel(kEpsilon); + #include "LaheyKEpsilon.H" +makeRASModel(LaheyKEpsilon); + #include "continuousGasKEpsilon.H" +makeRASModel(continuousGasKEpsilon); -namespace Foam -{ - typedef RASModel - incompressibleRASModel; +#include "Smagorinsky.H" +makeLESModel(Smagorinsky); - defineNamedTemplateTypeNameAndDebug(incompressibleRASModel, 0); +#include "kEqn.H" +makeLESModel(kEqn); - defineTemplateRunTimeSelectionTable(incompressibleRASModel, dictionary); +#include "SmagorinskyZhang.H" +makeLESModel(SmagorinskyZhang); - addToRunTimeSelectionTable - ( - basePhaseIncompressibleTransportTurbulenceModel, - incompressibleRASModel, - dictionary - ); +#include "NicenoKEqn.H" +makeLESModel(NicenoKEqn); - namespace RASModels - { - typedef kEpsilon - incompressiblekEpsilon; - - defineNamedTemplateTypeNameAndDebug(incompressiblekEpsilon, 0); - - addToRunTimeSelectionTable - ( - incompressibleRASModel, - incompressiblekEpsilon, - dictionary - ); - } - - namespace RASModels - { - typedef LaheyKEpsilon - incompressibleLaheyKEpsilon; - - defineNamedTemplateTypeNameAndDebug(incompressibleLaheyKEpsilon, 0); - - addToRunTimeSelectionTable - ( - incompressibleRASModel, - incompressibleLaheyKEpsilon, - dictionary - ); - } - - namespace RASModels - { - typedef continuousGasKEpsilon - incompressiblecontinuousGasKEpsilon; - - defineNamedTemplateTypeNameAndDebug - ( - incompressiblecontinuousGasKEpsilon, - 0 - ); - - addToRunTimeSelectionTable - ( - incompressibleRASModel, - incompressiblecontinuousGasKEpsilon, - dictionary - ); - } -} +#include "continuousGasKEqn.H" +makeLESModel(continuousGasKEqn); #include "kineticTheoryModel.H" - -namespace Foam -{ - typedef PhaseIncompressibleTurbulenceModel - incompressibleTransportTurbulenceModel; - - typedef RASModel - incompressibleRASModel; - - defineTypeNameAndDebug(kineticTheoryModel, 0); - - addToRunTimeSelectionTable - ( - incompressibleRASModel, - kineticTheoryModel, - dictionary - ); -} +makeTurbulenceModel +(phaseModelPhaseIncompressibleTurbulenceModel, RAS, kineticTheoryModel); #include "phasePressureModel.H" - -namespace Foam -{ - typedef PhaseIncompressibleTurbulenceModel - incompressibleTransportTurbulenceModel; - - typedef RASModel - incompressibleRASModel; - - defineTypeNameAndDebug(phasePressureModel, 0); - - addToRunTimeSelectionTable - ( - incompressibleRASModel, - phasePressureModel, - dictionary - ); -} - - -#include "LESModel.H" -#include "Smagorinsky.H" -#include "SmagorinskyZhang.H" -#include "kEqn.H" -#include "NicenoKEqn.H" -#include "continuousGasKEqn.H" - -namespace Foam -{ - typedef LESModel - incompressibleLESModel; - - defineNamedTemplateTypeNameAndDebug(incompressibleLESModel, 0); - - defineTemplateRunTimeSelectionTable(incompressibleLESModel, dictionary); - - addToRunTimeSelectionTable - ( - basePhaseIncompressibleTransportTurbulenceModel, - incompressibleLESModel, - dictionary - ); - - namespace LESModels - { - typedef Smagorinsky - incompressibleSmagorinsky; - - defineNamedTemplateTypeNameAndDebug(incompressibleSmagorinsky, 0); - - addToRunTimeSelectionTable - ( - incompressibleLESModel, - incompressibleSmagorinsky, - dictionary - ); - } - - namespace LESModels - { - typedef SmagorinskyZhang - incompressibleSmagorinskyZhang; - - defineNamedTemplateTypeNameAndDebug(incompressibleSmagorinskyZhang, 0); - - addToRunTimeSelectionTable - ( - incompressibleLESModel, - incompressibleSmagorinskyZhang, - dictionary - ); - } - - namespace LESModels - { - typedef kEqn - incompressiblekEqn; - - defineNamedTemplateTypeNameAndDebug(incompressiblekEqn, 0); - - addToRunTimeSelectionTable - ( - incompressibleLESModel, - incompressiblekEqn, - dictionary - ); - } - - namespace LESModels - { - typedef NicenoKEqn - incompressibleNicenoKEqn; - - defineNamedTemplateTypeNameAndDebug(incompressibleNicenoKEqn, 0); - - addToRunTimeSelectionTable - ( - incompressibleLESModel, - incompressibleNicenoKEqn, - dictionary - ); - } - - namespace LESModels - { - typedef continuousGasKEqn - incompressiblecontinuousGasKEqn; - - defineNamedTemplateTypeNameAndDebug(incompressiblecontinuousGasKEqn, 0); - - addToRunTimeSelectionTable - ( - incompressibleLESModel, - incompressiblecontinuousGasKEqn, - dictionary - ); - } -} +makeTurbulenceModel +(phaseModelPhaseIncompressibleTurbulenceModel, RAS, phasePressureModel); // ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/phasePressureModel/phasePressureModel.C b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/phasePressureModel/phasePressureModel.C index dda70d3714..182515d71e 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/phasePressureModel/phasePressureModel.C +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/phasePressureModel/phasePressureModel.C @@ -28,7 +28,7 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::phasePressureModel::phasePressureModel +Foam::RASModels::phasePressureModel::phasePressureModel ( const volScalarField& alpha, const geometricOneField& rho, @@ -75,13 +75,13 @@ Foam::phasePressureModel::phasePressureModel // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::phasePressureModel::~phasePressureModel() +Foam::RASModels::phasePressureModel::~phasePressureModel() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::phasePressureModel::read() +bool Foam::RASModels::phasePressureModel::read() { if ( @@ -105,21 +105,24 @@ bool Foam::phasePressureModel::read() } -Foam::tmp Foam::phasePressureModel::k() const +Foam::tmp +Foam::RASModels::phasePressureModel::k() const { notImplemented("phasePressureModel::k()"); return nut_; } -Foam::tmp Foam::phasePressureModel::epsilon() const +Foam::tmp +Foam::RASModels::phasePressureModel::epsilon() const { notImplemented("phasePressureModel::epsilon()"); return nut_; } -Foam::tmp Foam::phasePressureModel::R() const +Foam::tmp +Foam::RASModels::phasePressureModel::R() const { return tmp ( @@ -145,7 +148,8 @@ Foam::tmp Foam::phasePressureModel::R() const } -Foam::tmp Foam::phasePressureModel::pPrime() const +Foam::tmp +Foam::RASModels::phasePressureModel::pPrime() const { return g0_ @@ -157,7 +161,8 @@ Foam::tmp Foam::phasePressureModel::pPrime() const } -Foam::tmp Foam::phasePressureModel::pPrimef() const +Foam::tmp +Foam::RASModels::phasePressureModel::pPrimef() const { return g0_ @@ -169,7 +174,8 @@ Foam::tmp Foam::phasePressureModel::pPrimef() const } -Foam::tmp Foam::phasePressureModel::devRhoReff() const +Foam::tmp +Foam::RASModels::phasePressureModel::devRhoReff() const { return tmp ( @@ -195,7 +201,8 @@ Foam::tmp Foam::phasePressureModel::devRhoReff() const } -Foam::tmp Foam::phasePressureModel::divDevRhoReff +Foam::tmp +Foam::RASModels::phasePressureModel::divDevRhoReff ( volVectorField& U ) const @@ -211,7 +218,7 @@ Foam::tmp Foam::phasePressureModel::divDevRhoReff } -void Foam::phasePressureModel::correct() +void Foam::RASModels::phasePressureModel::correct() {} diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/phasePressureModel/phasePressureModel.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/phasePressureModel/phasePressureModel.H index aebdf09014..6d85be7b65 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/phasePressureModel/phasePressureModel.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/phaseIncompressibleTurbulenceModels/phasePressureModel/phasePressureModel.H @@ -60,6 +60,8 @@ SourceFiles namespace Foam { +namespace RASModels +{ /*---------------------------------------------------------------------------*\ Class phasePressureModel Declaration @@ -179,6 +181,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace RASModels } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/primitives/random/cachedRandom/cachedRandom.C b/src/OpenFOAM/primitives/random/cachedRandom/cachedRandom.C index 71b73e8463..bbbc0dd344 100644 --- a/src/OpenFOAM/primitives/random/cachedRandom/cachedRandom.C +++ b/src/OpenFOAM/primitives/random/cachedRandom/cachedRandom.C @@ -96,7 +96,8 @@ Foam::cachedRandom::cachedRandom(const cachedRandom& cr, const bool reset) osRandomSeed(seed_); } - else if (reset) + + if (reset && samples_.size()) { sampleI_ = 0; } diff --git a/src/TurbulenceModels/compressible/compressibleTurbulenceModels.C b/src/TurbulenceModels/compressible/compressibleTurbulenceModels.C index 444908bfae..8d1542c22a 100644 --- a/src/TurbulenceModels/compressible/compressibleTurbulenceModels.C +++ b/src/TurbulenceModels/compressible/compressibleTurbulenceModels.C @@ -26,116 +26,37 @@ License #include "CompressibleTurbulenceModel.H" #include "fluidThermo.H" #include "addToRunTimeSelectionTable.H" - -namespace Foam -{ - typedef TurbulenceModel - < - geometricOneField, - volScalarField, - compressibleTurbulenceModel, - fluidThermo - > baseCompressibleFluidThermoTurbulenceModel; - - defineTemplateRunTimeSelectionTable - ( - baseCompressibleFluidThermoTurbulenceModel, - dictionary - ); - - - typedef CompressibleTurbulenceModel - compressibleFluidThermoTurbulenceModel; -} - +#include "makeTurbulenceModel.H" #include "laminar.H" - -namespace Foam -{ - typedef laminar compressibleLaminar; - - defineNamedTemplateTypeNameAndDebug(compressibleLaminar, 0); - - addToRunTimeSelectionTable - ( - baseCompressibleFluidThermoTurbulenceModel, - compressibleLaminar, - dictionary - ); -} - - #include "RASModel.H" -#include "kEpsilon.H" - -namespace Foam -{ - typedef RASModel - compressibleRASModel; - - defineNamedTemplateTypeNameAndDebug(compressibleRASModel, 0); - - defineTemplateRunTimeSelectionTable(compressibleRASModel, dictionary); - - addToRunTimeSelectionTable - ( - baseCompressibleFluidThermoTurbulenceModel, - compressibleRASModel, - dictionary - ); - - namespace RASModels - { - typedef kEpsilon - compressibleKEpsilon; - - defineNamedTemplateTypeNameAndDebug(compressibleKEpsilon, 0); - - addToRunTimeSelectionTable - ( - compressibleRASModel, - compressibleKEpsilon, - dictionary - ); - } -} - - #include "LESModel.H" + +makeBaseTurbulenceModel +( + geometricOneField, + volScalarField, + compressibleTurbulenceModel, + CompressibleTurbulenceModel, + fluidThermo +); + +#define makeRASModel(Type) \ + makeTemplatedTurbulenceModel \ + (fluidThermoCompressibleTurbulenceModel, RAS, Type) + +#define makeLESModel(Type) \ + makeTemplatedTurbulenceModel \ + (fluidThermoCompressibleTurbulenceModel, LES, Type) + +#include "kEpsilon.H" +makeRASModel(kEpsilon); + #include "Smagorinsky.H" +makeLESModel(Smagorinsky); -namespace Foam -{ - typedef LESModel - compressibleLESModel; - - defineNamedTemplateTypeNameAndDebug(compressibleLESModel, 0); - - defineTemplateRunTimeSelectionTable(compressibleLESModel, dictionary); - - addToRunTimeSelectionTable - ( - baseCompressibleFluidThermoTurbulenceModel, - compressibleLESModel, - dictionary - ); - - namespace LESModels - { - typedef Smagorinsky - compressibleSmagorinsky; - - defineNamedTemplateTypeNameAndDebug(compressibleSmagorinsky, 0); - - addToRunTimeSelectionTable - ( - compressibleLESModel, - compressibleSmagorinsky, - dictionary - ); - } -} +#include "kEqn.H" +makeLESModel(kEqn); // ************************************************************************* // diff --git a/src/TurbulenceModels/incompressible/incompressibleTurbulenceModels.C b/src/TurbulenceModels/incompressible/incompressibleTurbulenceModels.C index ab7890ebc6..50a813841e 100644 --- a/src/TurbulenceModels/incompressible/incompressibleTurbulenceModels.C +++ b/src/TurbulenceModels/incompressible/incompressibleTurbulenceModels.C @@ -26,136 +26,37 @@ License #include "IncompressibleTurbulenceModel.H" #include "transportModel.H" #include "addToRunTimeSelectionTable.H" - -namespace Foam -{ - typedef TurbulenceModel - < - geometricOneField, - geometricOneField, - incompressibleTurbulenceModel, - transportModel - > baseIncompressibleTransportTurbulenceModel; - - defineTemplateRunTimeSelectionTable - ( - baseIncompressibleTransportTurbulenceModel, - dictionary - ); - - typedef IncompressibleTurbulenceModel - < - transportModel - > incompressibleTransportTurbulenceModel; -} - +#include "makeTurbulenceModel.H" #include "laminar.H" - -namespace Foam -{ - typedef laminar - incompressibleLaminar; - - defineNamedTemplateTypeNameAndDebug(incompressibleLaminar, 0); - - addToRunTimeSelectionTable - ( - baseIncompressibleTransportTurbulenceModel, - incompressibleLaminar, - dictionary - ); -} - - - #include "RASModel.H" -#include "kEpsilon.H" - -namespace Foam -{ - typedef RASModel - incompressibleRASModel; - - defineNamedTemplateTypeNameAndDebug(incompressibleRASModel, 0); - - defineTemplateRunTimeSelectionTable(incompressibleRASModel, dictionary); - - addToRunTimeSelectionTable - ( - baseIncompressibleTransportTurbulenceModel, - incompressibleRASModel, - dictionary - ); - - namespace RASModels - { - typedef kEpsilon - incompressibleKEpsilon; - - defineNamedTemplateTypeNameAndDebug(incompressibleKEpsilon, 0); - - addToRunTimeSelectionTable - ( - incompressibleRASModel, - incompressibleKEpsilon, - dictionary - ); - } -} - - #include "LESModel.H" + +makeBaseTurbulenceModel +( + geometricOneField, + geometricOneField, + incompressibleTurbulenceModel, + IncompressibleTurbulenceModel, + transportModel +); + +#define makeRASModel(Type) \ + makeTemplatedTurbulenceModel \ + (transportModelIncompressibleTurbulenceModel, RAS, Type) + +#define makeLESModel(Type) \ + makeTemplatedTurbulenceModel \ + (transportModelIncompressibleTurbulenceModel, LES, Type) + +#include "kEpsilon.H" +makeRASModel(kEpsilon); + #include "Smagorinsky.H" +makeLESModel(Smagorinsky); + #include "kEqn.H" - -namespace Foam -{ - typedef LESModel - incompressibleLESModel; - - defineNamedTemplateTypeNameAndDebug(incompressibleLESModel, 0); - - defineTemplateRunTimeSelectionTable(incompressibleLESModel, dictionary); - - addToRunTimeSelectionTable - ( - baseIncompressibleTransportTurbulenceModel, - incompressibleLESModel, - dictionary - ); - - namespace LESModels - { - typedef Smagorinsky - incompressibleSmagorinsky; - - defineNamedTemplateTypeNameAndDebug(incompressibleSmagorinsky, 0); - - addToRunTimeSelectionTable - ( - incompressibleLESModel, - incompressibleSmagorinsky, - dictionary - ); - } - - - namespace LESModels - { - typedef kEqn - incompressiblekEqn; - - defineNamedTemplateTypeNameAndDebug(incompressiblekEqn, 0); - - addToRunTimeSelectionTable - ( - incompressibleLESModel, - incompressiblekEqn, - dictionary - ); - } -} +makeLESModel(kEqn); // ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/makeTurbulenceModel.H b/src/TurbulenceModels/turbulenceModels/makeTurbulenceModel.H new file mode 100644 index 0000000000..cea2079b45 --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/makeTurbulenceModel.H @@ -0,0 +1,126 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 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 . + +\*---------------------------------------------------------------------------*/ + +#define makeBaseTurbulenceModel(Alpha, Rho, baseModel, BaseModel, Transport) \ + \ + namespace Foam \ + { \ + typedef TurbulenceModel \ + < \ + Alpha, \ + Rho, \ + baseModel, \ + Transport \ + > Transport##baseModel; \ + \ + defineTemplateRunTimeSelectionTable \ + ( \ + Transport##baseModel, \ + dictionary \ + ); \ + \ + typedef BaseModel Transport##BaseModel; \ + \ + \ + typedef laminar Laminar##Transport##BaseModel; \ + \ + defineNamedTemplateTypeNameAndDebug(Laminar##Transport##BaseModel, 0); \ + \ + addToRunTimeSelectionTable \ + ( \ + Transport##baseModel, \ + Laminar##Transport##BaseModel, \ + dictionary \ + ); \ + \ + \ + typedef RASModel RAS##Transport##BaseModel; \ + \ + defineNamedTemplateTypeNameAndDebug(RAS##Transport##BaseModel, 0); \ + \ + defineTemplateRunTimeSelectionTable \ + (RAS##Transport##BaseModel, dictionary); \ + \ + addToRunTimeSelectionTable \ + ( \ + Transport##baseModel, \ + RAS##Transport##BaseModel, \ + dictionary \ + ); \ + \ + \ + typedef LESModel LES##Transport##BaseModel; \ + \ + defineNamedTemplateTypeNameAndDebug(LES##Transport##BaseModel, 0); \ + \ + defineTemplateRunTimeSelectionTable \ + (LES##Transport##BaseModel, dictionary); \ + \ + addToRunTimeSelectionTable \ + ( \ + Transport##baseModel, \ + LES##Transport##BaseModel, \ + dictionary \ + ); \ + } + + +#define makeTemplatedTurbulenceModel(BaseModel, SType, Type) \ + namespace Foam \ + { \ + namespace SType##Models \ + { \ + typedef Type Type##SType##BaseModel; \ + \ + defineNamedTemplateTypeNameAndDebug(Type##SType##BaseModel, 0); \ + \ + addToRunTimeSelectionTable \ + ( \ + SType##BaseModel, \ + Type##SType##BaseModel, \ + dictionary \ + ); \ + } \ + } + + +#define makeTurbulenceModel(BaseModel, SType, Type) \ + namespace Foam \ + { \ + namespace SType##Models \ + { \ + defineTypeNameAndDebug(Type, 0); \ + \ + addToRunTimeSelectionTable \ + ( \ + SType##BaseModel, \ + Type, \ + dictionary \ + ); \ + } \ + } + + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.H b/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.H index b2d1f2123e..3534d888a3 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/turbulentIntensityKineticEnergyInlet/turbulentIntensityKineticEnergyInletFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,7 +33,7 @@ Description mean velocity: \f[ - k_p = 1.5 I |U|^2 + k_p = 1.5 (I |U|)^2 \f] where diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H index cae86032ca..59f9fc7da8 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H @@ -350,6 +350,9 @@ public: inline const typename parcelType::constantProperties& constProps() const; + //- Return access to the constant properties + inline typename parcelType::constantProperties& constProps(); + //- Return reference to the sub-models dictionary inline const dictionary& subModelProperties() const; diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H index bef2f78a60..5ba48458f2 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H @@ -89,6 +89,14 @@ Foam::KinematicCloud::constProps() const } +template +inline typename CloudType::particleType::constantProperties& +Foam::KinematicCloud::constProps() +{ + return constProps_; +} + + template inline const Foam::dictionary& Foam::KinematicCloud::subModelProperties() const diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H index 2797250cc3..ed7d0202cb 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -206,6 +206,9 @@ public: inline const typename parcelType::constantProperties& constProps() const; + //- Return access to the constant properties + inline typename parcelType::constantProperties& constProps(); + // Sub-models diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloudI.H b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloudI.H index a5d5fc1e45..7abbc9f54a 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloudI.H @@ -41,6 +41,14 @@ Foam::ReactingCloud::constProps() const } +template +inline typename CloudType::particleType::constantProperties& +Foam::ReactingCloud::constProps() +{ + return constProps_; +} + + template inline const Foam::CompositionModel >& Foam::ReactingCloud::composition() const diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H index bb72273e3f..de157da343 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -211,6 +211,9 @@ public: inline const typename parcelType::constantProperties& constProps() const; + //- Return access to the constant properties + inline typename parcelType::constantProperties& constProps(); + // Sub-models diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloudI.H b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloudI.H index e4cef9783b..c7aa0e4aaf 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloudI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -41,6 +41,14 @@ Foam::ReactingMultiphaseCloud::constProps() const } +template +inline typename CloudType::particleType::constantProperties& +Foam::ReactingMultiphaseCloud::constProps() +{ + return constProps_; +} + + template inline const Foam::DevolatilisationModel < diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H index d746141aea..4f858d6643 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H @@ -225,6 +225,9 @@ public: inline const typename parcelType::constantProperties& constProps() const; + //- Return access to the constant properties + inline typename parcelType::constantProperties& constProps(); + //- Return const access to thermo package inline const SLGThermo& thermo() const; diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H index 80288cb52c..ea1b79f194 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H @@ -45,6 +45,14 @@ Foam::ThermoCloud::constProps() const } +template +inline typename CloudType::particleType::constantProperties& +Foam::ThermoCloud::constProps() +{ + return constProps_; +} + + template inline const Foam::SLGThermo& Foam::ThermoCloud::thermo() const { diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C index efb73ecae8..9c424896a0 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C @@ -70,7 +70,7 @@ void Foam::ReactingParcel::calcPhaseChange const CompositionModel& composition = td.cloud().composition(); - const scalar TMax = td.cloud().phaseChange().TMax(pc_, this->Tc_); + const scalar TMax = td.cloud().phaseChange().TMax(pc_); const scalar Tdash = min(T, TMax); const scalar Tsdash = min(Ts, TMax); diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H index 7b4fea251a..854e2f5730 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H @@ -83,9 +83,6 @@ public: //- Vaporisation temperature [K] scalar Tvap_; - //- Boiling point [K] - scalar Tbp_; - public: @@ -122,8 +119,7 @@ public: const scalar Pr, const scalar pMin, const Switch& constantVolume, - const scalar Tvap, - const scalar Tbp + const scalar Tvap ); @@ -137,9 +133,6 @@ public: //- Return const access to the vaporisation temperature inline scalar Tvap() const; - - //- Return const access to the boiling point - inline scalar Tbp() const; }; diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelI.H b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelI.H index e6c140973f..1329741c45 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelI.H +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -32,8 +32,7 @@ Foam::ReactingParcel::constantProperties::constantProperties() ParcelType::constantProperties(), pMin_(0.0), constantVolume_(false), - Tvap_(0.0), - Tbp_(0.0) + Tvap_(0.0) {} @@ -46,8 +45,7 @@ inline Foam::ReactingParcel::constantProperties::constantProperties ParcelType::constantProperties(cp), pMin_(cp.pMin_), constantVolume_(cp.constantVolume_), - Tvap_(cp.Tvap_), - Tbp_(cp.Tbp_) + Tvap_(cp.Tvap_) {} @@ -61,8 +59,7 @@ inline Foam::ReactingParcel::constantProperties::constantProperties ParcelType::constantProperties(parentDict, readFields), pMin_(1000.0), constantVolume_(false), - Tvap_(0.0), - Tbp_(0.0) + Tvap_(0.0) { if (readFields) { @@ -73,7 +70,6 @@ inline Foam::ReactingParcel::constantProperties::constantProperties this->dict().lookup("constantVolume") >> constantVolume_; this->dict().lookup("Tvap") >> Tvap_; - this->dict().lookup("Tbp") >> Tbp_; } } @@ -96,8 +92,7 @@ inline Foam::ReactingParcel::constantProperties::constantProperties const scalar Pr, const scalar pMin, const Switch& constantVolume, - const scalar Tvap, - const scalar Tbp + const scalar Tvap ) : ParcelType::constantProperties @@ -118,8 +113,7 @@ inline Foam::ReactingParcel::constantProperties::constantProperties ), pMin_(pMin), constantVolume_(constantVolume), - Tvap_(Tvap), - Tbp_(Tbp) + Tvap_(Tvap) {} @@ -212,14 +206,6 @@ Foam::ReactingParcel::constantProperties::Tvap() const } -template -inline Foam::scalar -Foam::ReactingParcel::constantProperties::Tbp() const -{ - return Tbp_; -} - - // * * * * * * * * * * ThermoParcel Member Functions * * * * * * * * * * * * // template diff --git a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H index 232b45d471..bf02ee1183 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -147,6 +147,9 @@ public: //- Return const access to maximum temperature [K] inline scalar TMax() const; + //- Return non-const access to maximum temperature [K] + inline scalar& TMax(); + //- Return const access to the particle specific heat capacity // [J/(kg.K)] inline scalar Cp0() const; diff --git a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelI.H b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelI.H index 85f7a0c3d5..73456a5519 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelI.H +++ b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -216,6 +216,14 @@ Foam::ThermoParcel::constantProperties::TMax() const } +template +inline Foam::scalar& +Foam::ThermoParcel::constantProperties::TMax() +{ + return TMax_; +} + + template inline Foam::scalar Foam::ThermoParcel::constantProperties::Cp0() const diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModelList.H b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModelList.H index 22213e2090..0480725269 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModelList.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModelList.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -114,7 +114,6 @@ public: void injectSteadyState(TrackData& td, const scalar trackTime); - // I-O //- Write injection info to stream diff --git a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C index b46ea2b5bf..8bd8a4d140 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C +++ b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C @@ -242,19 +242,9 @@ Foam::scalar Foam::LiquidEvaporation::dh template -Foam::scalar Foam::LiquidEvaporation::TMax -( - const scalar pIn, - const scalar TIn -) const +Foam::scalar Foam::LiquidEvaporation::TMax(const scalar pIn) const { - scalar T = -GREAT; - forAll(liquids_, i) - { - T = max(T, liquids_.properties()[i].pv(pIn, TIn)); - } - - return T; + return liquids_.TMax(pIn); } diff --git a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.H b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.H index 5a97dc7394..fb2e2cdd9c 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.H +++ b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.H @@ -132,7 +132,7 @@ public: ) const; //- Return maximum/limiting temperature - virtual scalar TMax(const scalar pIn, const scalar TIn) const; + virtual scalar TMax(const scalar pIn) const; }; diff --git a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporationBoil/LiquidEvaporationBoil.C b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporationBoil/LiquidEvaporationBoil.C index 8a88620992..6436d39605 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporationBoil/LiquidEvaporationBoil.C +++ b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporationBoil/LiquidEvaporationBoil.C @@ -343,17 +343,10 @@ Foam::scalar Foam::LiquidEvaporationBoil::dh template Foam::scalar Foam::LiquidEvaporationBoil::TMax ( - const scalar pIn, - const scalar TIn + const scalar pIn ) const { - scalar T = -GREAT; - forAll(liquids_, i) - { - T = max(T, liquids_.properties()[i].pv(pIn, TIn)); - } - - return T; + return liquids_.TMax(pIn); } diff --git a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporationBoil/LiquidEvaporationBoil.H b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporationBoil/LiquidEvaporationBoil.H index bf9ca867ce..2d11f55f32 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporationBoil/LiquidEvaporationBoil.H +++ b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporationBoil/LiquidEvaporationBoil.H @@ -142,7 +142,7 @@ public: ) const; //- Return maximum/limiting temperature - virtual scalar TMax(const scalar pIn, const scalar TIn) const; + virtual scalar TMax(const scalar pIn) const; }; diff --git a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/PhaseChangeModel/PhaseChangeModel.C b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/PhaseChangeModel/PhaseChangeModel.C index 7141ff9814..3ba13f27e1 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/PhaseChangeModel/PhaseChangeModel.C +++ b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/PhaseChangeModel/PhaseChangeModel.C @@ -179,11 +179,7 @@ Foam::scalar Foam::PhaseChangeModel::dh template -Foam::scalar Foam::PhaseChangeModel::TMax -( - const scalar, - const scalar -) const +Foam::scalar Foam::PhaseChangeModel::TMax(const scalar) const { return GREAT; } diff --git a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/PhaseChangeModel/PhaseChangeModel.H b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/PhaseChangeModel/PhaseChangeModel.H index ac6c5c06b3..f61031c758 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/PhaseChangeModel/PhaseChangeModel.H +++ b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/PhaseChangeModel/PhaseChangeModel.H @@ -185,7 +185,7 @@ public: ) const; //- Return maximum/limiting temperature - virtual scalar TMax(const scalar pIn, const scalar TIn) const; + virtual scalar TMax(const scalar pIn) const; //- Add to phase change mass void addToPhaseChangeMass(const scalar dMass); diff --git a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.C b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.C index d0d3814bc7..876fa675a1 100644 --- a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.C +++ b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.C @@ -76,6 +76,10 @@ void Foam::SprayParcel::calc } } + // set the maximum temperature limit + const scalar TMax = td.cloud().composition().liquids().TMax(this->pc_); + td.cloud().constProps().TMax() = TMax; + // store the parcel properties const scalarField& Y(this->Y()); scalarField X(td.cloud().composition().liquids().X(Y)); @@ -301,15 +305,12 @@ Foam::scalar Foam::SprayParcel::chi { // modifications to take account of the flash boiling on primary break-up - static label nIter = 200; - typedef typename TrackData::cloudType::reactingCloudType reactingCloudType; const CompositionModel& composition = td.cloud().composition(); scalar chi = 0.0; scalar T0 = this->T(); - scalar Tc0 = this->Tc(); scalar p0 = this->pc(); scalar pAmb = td.cloud().pAmbient(); @@ -322,21 +323,7 @@ Foam::scalar Foam::SprayParcel::chi // liquid is boiling - calc boiling temperature const liquidProperties& liq = composition.liquids().properties()[i]; - scalar TBoil = T0; - - for (label k=0; k p0) - { - TBoil = TBoil - (T0 - Tc0)/nIter; - } - else - { - break; - } - } + scalar TBoil = liq.pvInvert(p0); scalar hl = liq.hl(pAmb, TBoil); scalar iTp = liq.h(pAmb, T0) - liq.rho(pAmb, T0); diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C index 09afd2f1de..1d9ecc0bc7 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C @@ -2470,12 +2470,15 @@ void Foam::autoLayerDriver::mergePatchFacesUndo << " (0=straight, 180=fully concave)" << nl << endl; + const fvMesh& mesh = meshRefiner_.mesh(); + label nChanged = meshRefiner_.mergePatchFacesUndo ( minCos, concaveCos, meshRefiner_.meshedPatches(), - motionDict + motionDict, + labelList(mesh.nFaces() -1) ); nChanged += meshRefiner_.mergeEdgesUndo(minCos, motionDict); diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C index 12b3e8b2bf..f4cce333e4 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C @@ -1084,12 +1084,15 @@ void Foam::autoRefineDriver::mergePatchFaces << "----------------------------" << nl << endl; + const fvMesh& mesh = meshRefiner_.mesh(); + meshRefiner_.mergePatchFacesUndo ( Foam::cos(degToRad(45.0)), Foam::cos(degToRad(45.0)), meshRefiner_.meshedPatches(), - motionDict + motionDict, + labelList(mesh.nFaces(), -1) ); if (debug) diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C index 3927305177..b3910a26c4 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C @@ -1348,7 +1348,8 @@ bool Foam::autoSnapDriver::scaleMesh Foam::autoPtr Foam::autoSnapDriver::repatchToSurface ( const snapParameters& snapParams, - const labelList& adaptPatchIDs + const labelList& adaptPatchIDs, + const labelList& preserveFaces ) { const fvMesh& mesh = meshRefiner_.mesh(); @@ -1375,7 +1376,16 @@ Foam::autoPtr Foam::autoSnapDriver::repatchToSurface // Faces that do not move PackedBoolList isZonedFace(mesh.nFaces()); { - // 1. All faces on zoned surfaces + // 1. Preserve faces in preserveFaces list + forAll(preserveFaces, faceI) + { + if (preserveFaces[faceI] != -1) + { + isZonedFace.set(faceI, 1); + } + } + + // 2. All faces on zoned surfaces const wordList& faceZoneNames = surfaces.faceZoneNames(); const faceZoneMesh& fZones = mesh.faceZones(); @@ -1531,6 +1541,15 @@ void Foam::autoSnapDriver::doSnap baffles ); + // Keep copy of baffles + labelList origBaffles(mesh.nFaces(), -1); + + forAll(baffles, i) + { + const labelPair& baffle = baffles[i]; + origBaffles[baffle.first()] = baffle.second(); + origBaffles[baffle.second()] = baffle.first(); + } // Selectively 'forget' about the baffles, i.e. not check across them // or merge across them. @@ -1618,6 +1637,19 @@ void Foam::autoSnapDriver::doSnap ); meshRefinement::updateList(mapPtr().faceMap(), -1, filterFace); + const labelList& reverseFaceMap = mapPtr().reverseFaceMap(); + origBaffles.setSize(mesh.nFaces()); + origBaffles = -1; + + forAll(baffles, i) + { + labelPair& baffle = baffles[i]; + baffle.first() = reverseFaceMap[baffle.first()]; + baffle.second() = reverseFaceMap[baffle.second()]; + origBaffles[baffle.first()] = baffle.second(); + origBaffles[baffle.second()] = baffle.first(); + } + if (debug&meshRefinement::MESH) { const_cast(mesh.time())++; @@ -1834,10 +1866,23 @@ void Foam::autoSnapDriver::doSnap } // Merge any introduced baffles. - mergeZoneBaffles(baffles); + { + autoPtr mapPtr = mergeZoneBaffles(baffles); + + if (mapPtr.valid()) + { + forAll(origBaffles, faceI) + { + if (origBaffles[faceI] != -1) + { + origBaffles[faceI] = mapPtr->reverseFaceMap()[faceI]; + } + } + } + } // Repatch faces according to nearest. - repatchToSurface(snapParams, adaptPatchIDs); + repatchToSurface(snapParams, adaptPatchIDs, origBaffles); // Repatching might have caused faces to be on same patch and hence // mergeable so try again to merge coplanar faces @@ -1846,7 +1891,8 @@ void Foam::autoSnapDriver::doSnap featureCos, // minCos featureCos, // concaveCos meshRefiner_.meshedPatches(), - motionDict + motionDict, + origBaffles ); nChanged += meshRefiner_.mergeEdgesUndo @@ -1855,7 +1901,7 @@ void Foam::autoSnapDriver::doSnap motionDict ); - if (nChanged > 0 && debug&meshRefinement::MESH) + if (nChanged > 0 && debug & meshRefinement::MESH) { const_cast(mesh.time())++; Info<< "Writing patchFace merged mesh to time " diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H index f93ef62e08..c0a0adcde2 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.H @@ -474,7 +474,8 @@ public: autoPtr repatchToSurface ( const snapParameters& snapParams, - const labelList& adaptPatchIDs + const labelList& adaptPatchIDs, + const labelList& preserveFaces ); void doSnap diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H index 8d68415e22..1f8cf3f042 100644 --- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinement.H @@ -864,7 +864,8 @@ public: const scalar minCos, const scalar concaveCos, const labelList& patchIDs, - const dictionary& motionDict + const dictionary& motionDict, + const labelList& preserveFaces ); autoPtr doRemovePoints diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementMerge.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementMerge.C index c8ac47b5c5..b9a5aad7de 100644 --- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementMerge.C +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementMerge.C @@ -249,7 +249,8 @@ Foam::label Foam::meshRefinement::mergePatchFacesUndo const scalar minCos, const scalar concaveCos, const labelList& patchIDs, - const dictionary& motionDict + const dictionary& motionDict, + const labelList& preserveFaces ) { // Patch face merging engine @@ -280,7 +281,7 @@ Foam::label Foam::meshRefinement::mergePatchFacesUndo // Get all sets of faces that can be merged. Since only faces on the same // patch get merged there is no risk of e.g. patchID faces getting merged // with original patches (or even processor patches). There is a risk - // though of original patchfaces getting merged if they make a small + // though of original patch faces getting merged if they make a small // angle. Would be pretty weird starting mesh though. labelListList allFaceSets ( @@ -292,6 +293,27 @@ Foam::label Foam::meshRefinement::mergePatchFacesUndo ) ); + label compactI = 0; + forAll(allFaceSets, i) + { + bool keep = true; + const labelList& set = allFaceSets[i]; + forAll(set, j) + { + if (preserveFaces[set[j]] != -1) + { + keep = false; + break; + } + } + + if (keep && (compactI != i)) + { + allFaceSets[compactI++] = set; + } + } + allFaceSets.setSize(compactI); + label nFaceSets = returnReduce(allFaceSets.size(), sumOp