mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -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::volScalarField> Foam::kineticTheoryModel::k() const
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::RASModels::kineticTheoryModel::k() const
|
||||
{
|
||||
notImplemented("kineticTheoryModel::k()");
|
||||
return nut_;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::kineticTheoryModel::epsilon() const
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::RASModels::kineticTheoryModel::epsilon() const
|
||||
{
|
||||
notImplemented("kineticTheoryModel::epsilon()");
|
||||
return nut_;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volSymmTensorField> Foam::kineticTheoryModel::R() const
|
||||
Foam::tmp<Foam::volSymmTensorField>
|
||||
Foam::RASModels::kineticTheoryModel::R() const
|
||||
{
|
||||
return tmp<volSymmTensorField>
|
||||
(
|
||||
@ -211,7 +214,8 @@ Foam::tmp<Foam::volSymmTensorField> Foam::kineticTheoryModel::R() const
|
||||
|
||||
|
||||
/*
|
||||
Foam::tmp<Foam::volScalarField> Foam::kineticTheoryModel::pp() const
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::RASModels::kineticTheoryModel::pp() const
|
||||
{
|
||||
|
||||
// Particle pressure coefficient
|
||||
@ -244,7 +248,8 @@ Foam::tmp<Foam::volScalarField> Foam::kineticTheoryModel::pp() const
|
||||
*/
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::kineticTheoryModel::pPrime() const
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::RASModels::kineticTheoryModel::pPrime() const
|
||||
{
|
||||
// Local references
|
||||
const volScalarField& alpha = this->alpha_;
|
||||
@ -271,7 +276,8 @@ Foam::tmp<Foam::volScalarField> Foam::kineticTheoryModel::pPrime() const
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::surfaceScalarField> Foam::kineticTheoryModel::pPrimef() const
|
||||
Foam::tmp<Foam::surfaceScalarField>
|
||||
Foam::RASModels::kineticTheoryModel::pPrimef() const
|
||||
{
|
||||
// Local references
|
||||
const volScalarField& alpha = this->alpha_;
|
||||
@ -298,7 +304,8 @@ Foam::tmp<Foam::surfaceScalarField> Foam::kineticTheoryModel::pPrimef() const
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volSymmTensorField> Foam::kineticTheoryModel::devRhoReff() const
|
||||
Foam::tmp<Foam::volSymmTensorField>
|
||||
Foam::RASModels::kineticTheoryModel::devRhoReff() const
|
||||
{
|
||||
return tmp<volSymmTensorField>
|
||||
(
|
||||
@ -320,7 +327,8 @@ Foam::tmp<Foam::volSymmTensorField> Foam::kineticTheoryModel::devRhoReff() const
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::fvVectorMatrix> Foam::kineticTheoryModel::divDevRhoReff
|
||||
Foam::tmp<Foam::fvVectorMatrix>
|
||||
Foam::RASModels::kineticTheoryModel::divDevRhoReff
|
||||
(
|
||||
volVectorField& U
|
||||
) const
|
||||
@ -338,7 +346,7 @@ Foam::tmp<Foam::fvVectorMatrix> Foam::kineticTheoryModel::divDevRhoReff
|
||||
}
|
||||
|
||||
|
||||
void Foam::kineticTheoryModel::correct()
|
||||
void Foam::RASModels::kineticTheoryModel::correct()
|
||||
{
|
||||
// Local references
|
||||
volScalarField alpha(max(this->alpha_, 0.0));
|
||||
|
||||
@ -61,6 +61,8 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class kineticTheoryModel Declaration
|
||||
@ -212,6 +214,7 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RASModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -26,258 +26,62 @@ License
|
||||
#include "PhaseIncompressibleTurbulenceModel.H"
|
||||
#include "phaseModel.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "makeTurbulenceModel.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef TurbulenceModel
|
||||
<
|
||||
#include "laminar.H"
|
||||
#include "RASModel.H"
|
||||
#include "LESModel.H"
|
||||
|
||||
makeBaseTurbulenceModel
|
||||
(
|
||||
volScalarField,
|
||||
geometricOneField,
|
||||
incompressibleTurbulenceModel,
|
||||
PhaseIncompressibleTurbulenceModel,
|
||||
phaseModel
|
||||
> basePhaseIncompressibleTransportTurbulenceModel;
|
||||
|
||||
defineTemplateRunTimeSelectionTable
|
||||
(
|
||||
basePhaseIncompressibleTransportTurbulenceModel,
|
||||
dictionary
|
||||
);
|
||||
|
||||
typedef PhaseIncompressibleTurbulenceModel<phaseModel>
|
||||
incompressibleTransportTurbulenceModel;
|
||||
}
|
||||
#define makeRASModel(Type) \
|
||||
makeTemplatedTurbulenceModel \
|
||||
(phaseModelPhaseIncompressibleTurbulenceModel, RAS, Type)
|
||||
|
||||
#define makeLESModel(Type) \
|
||||
makeTemplatedTurbulenceModel \
|
||||
(phaseModelPhaseIncompressibleTurbulenceModel, LES, Type)
|
||||
|
||||
#include "laminar.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef laminar<incompressibleTransportTurbulenceModel>
|
||||
incompressibleLaminar;
|
||||
|
||||
defineNamedTemplateTypeNameAndDebug(incompressibleLaminar, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
basePhaseIncompressibleTransportTurbulenceModel,
|
||||
incompressibleLaminar,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
#include "RASModel.H"
|
||||
#include "kEpsilon.H"
|
||||
makeRASModel(kEpsilon);
|
||||
|
||||
#include "LaheyKEpsilon.H"
|
||||
makeRASModel(LaheyKEpsilon);
|
||||
|
||||
#include "continuousGasKEpsilon.H"
|
||||
makeRASModel(continuousGasKEpsilon);
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef RASModel<incompressibleTransportTurbulenceModel>
|
||||
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<incompressibleTransportTurbulenceModel>
|
||||
incompressiblekEpsilon;
|
||||
|
||||
defineNamedTemplateTypeNameAndDebug(incompressiblekEpsilon, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
incompressibleRASModel,
|
||||
incompressiblekEpsilon,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
namespace RASModels
|
||||
{
|
||||
typedef LaheyKEpsilon<incompressibleTransportTurbulenceModel>
|
||||
incompressibleLaheyKEpsilon;
|
||||
|
||||
defineNamedTemplateTypeNameAndDebug(incompressibleLaheyKEpsilon, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
incompressibleRASModel,
|
||||
incompressibleLaheyKEpsilon,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
namespace RASModels
|
||||
{
|
||||
typedef continuousGasKEpsilon<incompressibleTransportTurbulenceModel>
|
||||
incompressiblecontinuousGasKEpsilon;
|
||||
|
||||
defineNamedTemplateTypeNameAndDebug
|
||||
(
|
||||
incompressiblecontinuousGasKEpsilon,
|
||||
0
|
||||
);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
incompressibleRASModel,
|
||||
incompressiblecontinuousGasKEpsilon,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
#include "continuousGasKEqn.H"
|
||||
makeLESModel(continuousGasKEqn);
|
||||
|
||||
|
||||
#include "kineticTheoryModel.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef PhaseIncompressibleTurbulenceModel<phaseModel>
|
||||
incompressibleTransportTurbulenceModel;
|
||||
|
||||
typedef RASModel<incompressibleTransportTurbulenceModel>
|
||||
incompressibleRASModel;
|
||||
|
||||
defineTypeNameAndDebug(kineticTheoryModel, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
incompressibleRASModel,
|
||||
kineticTheoryModel,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
makeTurbulenceModel
|
||||
(phaseModelPhaseIncompressibleTurbulenceModel, RAS, kineticTheoryModel);
|
||||
|
||||
|
||||
#include "phasePressureModel.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef PhaseIncompressibleTurbulenceModel<phaseModel>
|
||||
incompressibleTransportTurbulenceModel;
|
||||
|
||||
typedef RASModel<incompressibleTransportTurbulenceModel>
|
||||
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<incompressibleTransportTurbulenceModel>
|
||||
incompressibleLESModel;
|
||||
|
||||
defineNamedTemplateTypeNameAndDebug(incompressibleLESModel, 0);
|
||||
|
||||
defineTemplateRunTimeSelectionTable(incompressibleLESModel, dictionary);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
basePhaseIncompressibleTransportTurbulenceModel,
|
||||
incompressibleLESModel,
|
||||
dictionary
|
||||
);
|
||||
|
||||
namespace LESModels
|
||||
{
|
||||
typedef Smagorinsky<incompressibleTransportTurbulenceModel>
|
||||
incompressibleSmagorinsky;
|
||||
|
||||
defineNamedTemplateTypeNameAndDebug(incompressibleSmagorinsky, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
incompressibleLESModel,
|
||||
incompressibleSmagorinsky,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
namespace LESModels
|
||||
{
|
||||
typedef SmagorinskyZhang<incompressibleTransportTurbulenceModel>
|
||||
incompressibleSmagorinskyZhang;
|
||||
|
||||
defineNamedTemplateTypeNameAndDebug(incompressibleSmagorinskyZhang, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
incompressibleLESModel,
|
||||
incompressibleSmagorinskyZhang,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
namespace LESModels
|
||||
{
|
||||
typedef kEqn<incompressibleTransportTurbulenceModel>
|
||||
incompressiblekEqn;
|
||||
|
||||
defineNamedTemplateTypeNameAndDebug(incompressiblekEqn, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
incompressibleLESModel,
|
||||
incompressiblekEqn,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
namespace LESModels
|
||||
{
|
||||
typedef NicenoKEqn<incompressibleTransportTurbulenceModel>
|
||||
incompressibleNicenoKEqn;
|
||||
|
||||
defineNamedTemplateTypeNameAndDebug(incompressibleNicenoKEqn, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
incompressibleLESModel,
|
||||
incompressibleNicenoKEqn,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
namespace LESModels
|
||||
{
|
||||
typedef continuousGasKEqn<incompressibleTransportTurbulenceModel>
|
||||
incompressiblecontinuousGasKEqn;
|
||||
|
||||
defineNamedTemplateTypeNameAndDebug(incompressiblecontinuousGasKEqn, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
incompressibleLESModel,
|
||||
incompressiblecontinuousGasKEqn,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
makeTurbulenceModel
|
||||
(phaseModelPhaseIncompressibleTurbulenceModel, RAS, phasePressureModel);
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -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::volScalarField> Foam::phasePressureModel::k() const
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::RASModels::phasePressureModel::k() const
|
||||
{
|
||||
notImplemented("phasePressureModel::k()");
|
||||
return nut_;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::phasePressureModel::epsilon() const
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::RASModels::phasePressureModel::epsilon() const
|
||||
{
|
||||
notImplemented("phasePressureModel::epsilon()");
|
||||
return nut_;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volSymmTensorField> Foam::phasePressureModel::R() const
|
||||
Foam::tmp<Foam::volSymmTensorField>
|
||||
Foam::RASModels::phasePressureModel::R() const
|
||||
{
|
||||
return tmp<volSymmTensorField>
|
||||
(
|
||||
@ -145,7 +148,8 @@ Foam::tmp<Foam::volSymmTensorField> Foam::phasePressureModel::R() const
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::phasePressureModel::pPrime() const
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::RASModels::phasePressureModel::pPrime() const
|
||||
{
|
||||
return
|
||||
g0_
|
||||
@ -157,7 +161,8 @@ Foam::tmp<Foam::volScalarField> Foam::phasePressureModel::pPrime() const
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::surfaceScalarField> Foam::phasePressureModel::pPrimef() const
|
||||
Foam::tmp<Foam::surfaceScalarField>
|
||||
Foam::RASModels::phasePressureModel::pPrimef() const
|
||||
{
|
||||
return
|
||||
g0_
|
||||
@ -169,7 +174,8 @@ Foam::tmp<Foam::surfaceScalarField> Foam::phasePressureModel::pPrimef() const
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volSymmTensorField> Foam::phasePressureModel::devRhoReff() const
|
||||
Foam::tmp<Foam::volSymmTensorField>
|
||||
Foam::RASModels::phasePressureModel::devRhoReff() const
|
||||
{
|
||||
return tmp<volSymmTensorField>
|
||||
(
|
||||
@ -195,7 +201,8 @@ Foam::tmp<Foam::volSymmTensorField> Foam::phasePressureModel::devRhoReff() const
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::fvVectorMatrix> Foam::phasePressureModel::divDevRhoReff
|
||||
Foam::tmp<Foam::fvVectorMatrix>
|
||||
Foam::RASModels::phasePressureModel::divDevRhoReff
|
||||
(
|
||||
volVectorField& U
|
||||
) const
|
||||
@ -211,7 +218,7 @@ Foam::tmp<Foam::fvVectorMatrix> Foam::phasePressureModel::divDevRhoReff
|
||||
}
|
||||
|
||||
|
||||
void Foam::phasePressureModel::correct()
|
||||
void Foam::RASModels::phasePressureModel::correct()
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -60,6 +60,8 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class phasePressureModel Declaration
|
||||
@ -179,6 +181,7 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace RASModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -96,7 +96,8 @@ Foam::cachedRandom::cachedRandom(const cachedRandom& cr, const bool reset)
|
||||
|
||||
osRandomSeed(seed_);
|
||||
}
|
||||
else if (reset)
|
||||
|
||||
if (reset && samples_.size())
|
||||
{
|
||||
sampleI_ = 0;
|
||||
}
|
||||
|
||||
@ -26,116 +26,37 @@ License
|
||||
#include "CompressibleTurbulenceModel.H"
|
||||
#include "fluidThermo.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "makeTurbulenceModel.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef TurbulenceModel
|
||||
<
|
||||
#include "laminar.H"
|
||||
#include "RASModel.H"
|
||||
#include "LESModel.H"
|
||||
|
||||
makeBaseTurbulenceModel
|
||||
(
|
||||
geometricOneField,
|
||||
volScalarField,
|
||||
compressibleTurbulenceModel,
|
||||
CompressibleTurbulenceModel,
|
||||
fluidThermo
|
||||
> baseCompressibleFluidThermoTurbulenceModel;
|
||||
|
||||
defineTemplateRunTimeSelectionTable
|
||||
(
|
||||
baseCompressibleFluidThermoTurbulenceModel,
|
||||
dictionary
|
||||
);
|
||||
|
||||
#define makeRASModel(Type) \
|
||||
makeTemplatedTurbulenceModel \
|
||||
(fluidThermoCompressibleTurbulenceModel, RAS, Type)
|
||||
|
||||
typedef CompressibleTurbulenceModel<fluidThermo>
|
||||
compressibleFluidThermoTurbulenceModel;
|
||||
}
|
||||
#define makeLESModel(Type) \
|
||||
makeTemplatedTurbulenceModel \
|
||||
(fluidThermoCompressibleTurbulenceModel, LES, Type)
|
||||
|
||||
|
||||
#include "laminar.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef laminar<compressibleFluidThermoTurbulenceModel> compressibleLaminar;
|
||||
|
||||
defineNamedTemplateTypeNameAndDebug(compressibleLaminar, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
baseCompressibleFluidThermoTurbulenceModel,
|
||||
compressibleLaminar,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
#include "RASModel.H"
|
||||
#include "kEpsilon.H"
|
||||
makeRASModel(kEpsilon);
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef RASModel<compressibleFluidThermoTurbulenceModel>
|
||||
compressibleRASModel;
|
||||
|
||||
defineNamedTemplateTypeNameAndDebug(compressibleRASModel, 0);
|
||||
|
||||
defineTemplateRunTimeSelectionTable(compressibleRASModel, dictionary);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
baseCompressibleFluidThermoTurbulenceModel,
|
||||
compressibleRASModel,
|
||||
dictionary
|
||||
);
|
||||
|
||||
namespace RASModels
|
||||
{
|
||||
typedef kEpsilon<compressibleFluidThermoTurbulenceModel>
|
||||
compressibleKEpsilon;
|
||||
|
||||
defineNamedTemplateTypeNameAndDebug(compressibleKEpsilon, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
compressibleRASModel,
|
||||
compressibleKEpsilon,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#include "LESModel.H"
|
||||
#include "Smagorinsky.H"
|
||||
makeLESModel(Smagorinsky);
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef LESModel<compressibleFluidThermoTurbulenceModel>
|
||||
compressibleLESModel;
|
||||
|
||||
defineNamedTemplateTypeNameAndDebug(compressibleLESModel, 0);
|
||||
|
||||
defineTemplateRunTimeSelectionTable(compressibleLESModel, dictionary);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
baseCompressibleFluidThermoTurbulenceModel,
|
||||
compressibleLESModel,
|
||||
dictionary
|
||||
);
|
||||
|
||||
namespace LESModels
|
||||
{
|
||||
typedef Smagorinsky<compressibleFluidThermoTurbulenceModel>
|
||||
compressibleSmagorinsky;
|
||||
|
||||
defineNamedTemplateTypeNameAndDebug(compressibleSmagorinsky, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
compressibleLESModel,
|
||||
compressibleSmagorinsky,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
#include "kEqn.H"
|
||||
makeLESModel(kEqn);
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -26,136 +26,37 @@ License
|
||||
#include "IncompressibleTurbulenceModel.H"
|
||||
#include "transportModel.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "makeTurbulenceModel.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef TurbulenceModel
|
||||
<
|
||||
#include "laminar.H"
|
||||
#include "RASModel.H"
|
||||
#include "LESModel.H"
|
||||
|
||||
makeBaseTurbulenceModel
|
||||
(
|
||||
geometricOneField,
|
||||
geometricOneField,
|
||||
incompressibleTurbulenceModel,
|
||||
IncompressibleTurbulenceModel,
|
||||
transportModel
|
||||
> baseIncompressibleTransportTurbulenceModel;
|
||||
|
||||
defineTemplateRunTimeSelectionTable
|
||||
(
|
||||
baseIncompressibleTransportTurbulenceModel,
|
||||
dictionary
|
||||
);
|
||||
|
||||
typedef IncompressibleTurbulenceModel
|
||||
<
|
||||
transportModel
|
||||
> incompressibleTransportTurbulenceModel;
|
||||
}
|
||||
#define makeRASModel(Type) \
|
||||
makeTemplatedTurbulenceModel \
|
||||
(transportModelIncompressibleTurbulenceModel, RAS, Type)
|
||||
|
||||
#define makeLESModel(Type) \
|
||||
makeTemplatedTurbulenceModel \
|
||||
(transportModelIncompressibleTurbulenceModel, LES, Type)
|
||||
|
||||
#include "laminar.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef laminar<incompressibleTransportTurbulenceModel>
|
||||
incompressibleLaminar;
|
||||
|
||||
defineNamedTemplateTypeNameAndDebug(incompressibleLaminar, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
baseIncompressibleTransportTurbulenceModel,
|
||||
incompressibleLaminar,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#include "RASModel.H"
|
||||
#include "kEpsilon.H"
|
||||
makeRASModel(kEpsilon);
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef RASModel<incompressibleTransportTurbulenceModel>
|
||||
incompressibleRASModel;
|
||||
|
||||
defineNamedTemplateTypeNameAndDebug(incompressibleRASModel, 0);
|
||||
|
||||
defineTemplateRunTimeSelectionTable(incompressibleRASModel, dictionary);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
baseIncompressibleTransportTurbulenceModel,
|
||||
incompressibleRASModel,
|
||||
dictionary
|
||||
);
|
||||
|
||||
namespace RASModels
|
||||
{
|
||||
typedef kEpsilon<incompressibleTransportTurbulenceModel>
|
||||
incompressibleKEpsilon;
|
||||
|
||||
defineNamedTemplateTypeNameAndDebug(incompressibleKEpsilon, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
incompressibleRASModel,
|
||||
incompressibleKEpsilon,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#include "LESModel.H"
|
||||
#include "Smagorinsky.H"
|
||||
makeLESModel(Smagorinsky);
|
||||
|
||||
#include "kEqn.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef LESModel<incompressibleTransportTurbulenceModel>
|
||||
incompressibleLESModel;
|
||||
|
||||
defineNamedTemplateTypeNameAndDebug(incompressibleLESModel, 0);
|
||||
|
||||
defineTemplateRunTimeSelectionTable(incompressibleLESModel, dictionary);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
baseIncompressibleTransportTurbulenceModel,
|
||||
incompressibleLESModel,
|
||||
dictionary
|
||||
);
|
||||
|
||||
namespace LESModels
|
||||
{
|
||||
typedef Smagorinsky<incompressibleTransportTurbulenceModel>
|
||||
incompressibleSmagorinsky;
|
||||
|
||||
defineNamedTemplateTypeNameAndDebug(incompressibleSmagorinsky, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
incompressibleLESModel,
|
||||
incompressibleSmagorinsky,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
namespace LESModels
|
||||
{
|
||||
typedef kEqn<incompressibleTransportTurbulenceModel>
|
||||
incompressiblekEqn;
|
||||
|
||||
defineNamedTemplateTypeNameAndDebug(incompressiblekEqn, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
incompressibleLESModel,
|
||||
incompressiblekEqn,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
makeLESModel(kEqn);
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
126
src/TurbulenceModels/turbulenceModels/makeTurbulenceModel.H
Normal file
126
src/TurbulenceModels/turbulenceModels/makeTurbulenceModel.H
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#define makeBaseTurbulenceModel(Alpha, Rho, baseModel, BaseModel, Transport) \
|
||||
\
|
||||
namespace Foam \
|
||||
{ \
|
||||
typedef TurbulenceModel \
|
||||
< \
|
||||
Alpha, \
|
||||
Rho, \
|
||||
baseModel, \
|
||||
Transport \
|
||||
> Transport##baseModel; \
|
||||
\
|
||||
defineTemplateRunTimeSelectionTable \
|
||||
( \
|
||||
Transport##baseModel, \
|
||||
dictionary \
|
||||
); \
|
||||
\
|
||||
typedef BaseModel<Transport> Transport##BaseModel; \
|
||||
\
|
||||
\
|
||||
typedef laminar<Transport##BaseModel> Laminar##Transport##BaseModel; \
|
||||
\
|
||||
defineNamedTemplateTypeNameAndDebug(Laminar##Transport##BaseModel, 0); \
|
||||
\
|
||||
addToRunTimeSelectionTable \
|
||||
( \
|
||||
Transport##baseModel, \
|
||||
Laminar##Transport##BaseModel, \
|
||||
dictionary \
|
||||
); \
|
||||
\
|
||||
\
|
||||
typedef RASModel<Transport##BaseModel> RAS##Transport##BaseModel; \
|
||||
\
|
||||
defineNamedTemplateTypeNameAndDebug(RAS##Transport##BaseModel, 0); \
|
||||
\
|
||||
defineTemplateRunTimeSelectionTable \
|
||||
(RAS##Transport##BaseModel, dictionary); \
|
||||
\
|
||||
addToRunTimeSelectionTable \
|
||||
( \
|
||||
Transport##baseModel, \
|
||||
RAS##Transport##BaseModel, \
|
||||
dictionary \
|
||||
); \
|
||||
\
|
||||
\
|
||||
typedef LESModel<Transport##BaseModel> 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<BaseModel> 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 \
|
||||
); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -89,6 +89,14 @@ Foam::KinematicCloud<CloudType>::constProps() const
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
inline typename CloudType::particleType::constantProperties&
|
||||
Foam::KinematicCloud<CloudType>::constProps()
|
||||
{
|
||||
return constProps_;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
inline const Foam::dictionary&
|
||||
Foam::KinematicCloud<CloudType>::subModelProperties() const
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -41,6 +41,14 @@ Foam::ReactingCloud<CloudType>::constProps() const
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
inline typename CloudType::particleType::constantProperties&
|
||||
Foam::ReactingCloud<CloudType>::constProps()
|
||||
{
|
||||
return constProps_;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
inline const Foam::CompositionModel<Foam::ReactingCloud<CloudType> >&
|
||||
Foam::ReactingCloud<CloudType>::composition() const
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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<CloudType>::constProps() const
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
inline typename CloudType::particleType::constantProperties&
|
||||
Foam::ReactingMultiphaseCloud<CloudType>::constProps()
|
||||
{
|
||||
return constProps_;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
inline const Foam::DevolatilisationModel
|
||||
<
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -45,6 +45,14 @@ Foam::ThermoCloud<CloudType>::constProps() const
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
inline typename CloudType::particleType::constantProperties&
|
||||
Foam::ThermoCloud<CloudType>::constProps()
|
||||
{
|
||||
return constProps_;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
inline const Foam::SLGThermo& Foam::ThermoCloud<CloudType>::thermo() const
|
||||
{
|
||||
|
||||
@ -70,7 +70,7 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange
|
||||
const CompositionModel<reactingCloudType>& 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);
|
||||
|
||||
|
||||
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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<ParcelType>::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<ParcelType>::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<ParcelType>::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<ParcelType>::constantProperties::constantProperties
|
||||
|
||||
this->dict().lookup("constantVolume") >> constantVolume_;
|
||||
this->dict().lookup("Tvap") >> Tvap_;
|
||||
this->dict().lookup("Tbp") >> Tbp_;
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,8 +92,7 @@ inline Foam::ReactingParcel<ParcelType>::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<ParcelType>::constantProperties::constantProperties
|
||||
),
|
||||
pMin_(pMin),
|
||||
constantVolume_(constantVolume),
|
||||
Tvap_(Tvap),
|
||||
Tbp_(Tbp)
|
||||
Tvap_(Tvap)
|
||||
{}
|
||||
|
||||
|
||||
@ -212,14 +206,6 @@ Foam::ReactingParcel<ParcelType>::constantProperties::Tvap() const
|
||||
}
|
||||
|
||||
|
||||
template<class ParcelType>
|
||||
inline Foam::scalar
|
||||
Foam::ReactingParcel<ParcelType>::constantProperties::Tbp() const
|
||||
{
|
||||
return Tbp_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * ThermoParcel Member Functions * * * * * * * * * * * * //
|
||||
|
||||
template<class ParcelType>
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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<ParcelType>::constantProperties::TMax() const
|
||||
}
|
||||
|
||||
|
||||
template<class ParcelType>
|
||||
inline Foam::scalar&
|
||||
Foam::ThermoParcel<ParcelType>::constantProperties::TMax()
|
||||
{
|
||||
return TMax_;
|
||||
}
|
||||
|
||||
|
||||
template<class ParcelType>
|
||||
inline Foam::scalar
|
||||
Foam::ThermoParcel<ParcelType>::constantProperties::Cp0() const
|
||||
|
||||
@ -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
|
||||
|
||||
@ -242,19 +242,9 @@ Foam::scalar Foam::LiquidEvaporation<CloudType>::dh
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::LiquidEvaporation<CloudType>::TMax
|
||||
(
|
||||
const scalar pIn,
|
||||
const scalar TIn
|
||||
) const
|
||||
Foam::scalar Foam::LiquidEvaporation<CloudType>::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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -343,17 +343,10 @@ Foam::scalar Foam::LiquidEvaporationBoil<CloudType>::dh
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::LiquidEvaporationBoil<CloudType>::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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -179,11 +179,7 @@ Foam::scalar Foam::PhaseChangeModel<CloudType>::dh
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::PhaseChangeModel<CloudType>::TMax
|
||||
(
|
||||
const scalar,
|
||||
const scalar
|
||||
) const
|
||||
Foam::scalar Foam::PhaseChangeModel<CloudType>::TMax(const scalar) const
|
||||
{
|
||||
return GREAT;
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -76,6 +76,10 @@ void Foam::SprayParcel<ParcelType>::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<ParcelType>::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<reactingCloudType>& 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<ParcelType>::chi
|
||||
// liquid is boiling - calc boiling temperature
|
||||
|
||||
const liquidProperties& liq = composition.liquids().properties()[i];
|
||||
scalar TBoil = T0;
|
||||
|
||||
for (label k=0; k<nIter; k++)
|
||||
{
|
||||
scalar pBoil = liq.pv(p0, TBoil);
|
||||
|
||||
if (pBoil > 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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -1348,7 +1348,8 @@ bool Foam::autoSnapDriver::scaleMesh
|
||||
Foam::autoPtr<Foam::mapPolyMesh> 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::mapPolyMesh> 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<Time&>(mesh.time())++;
|
||||
@ -1834,10 +1866,23 @@ void Foam::autoSnapDriver::doSnap
|
||||
}
|
||||
|
||||
// Merge any introduced baffles.
|
||||
mergeZoneBaffles(baffles);
|
||||
{
|
||||
autoPtr<mapPolyMesh> 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
|
||||
|
||||
@ -474,7 +474,8 @@ public:
|
||||
autoPtr<mapPolyMesh> repatchToSurface
|
||||
(
|
||||
const snapParameters& snapParams,
|
||||
const labelList& adaptPatchIDs
|
||||
const labelList& adaptPatchIDs,
|
||||
const labelList& preserveFaces
|
||||
);
|
||||
|
||||
void doSnap
|
||||
|
||||
@ -864,7 +864,8 @@ public:
|
||||
const scalar minCos,
|
||||
const scalar concaveCos,
|
||||
const labelList& patchIDs,
|
||||
const dictionary& motionDict
|
||||
const dictionary& motionDict,
|
||||
const labelList& preserveFaces
|
||||
);
|
||||
|
||||
autoPtr<mapPolyMesh> doRemovePoints
|
||||
|
||||
@ -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
|
||||
@ -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<label>());
|
||||
|
||||
Info<< "Merging " << nFaceSets << " sets of faces." << nl << endl;
|
||||
|
||||
@ -34,114 +34,62 @@ License
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(fieldAverage, 0);
|
||||
|
||||
const word fieldAverage::EXT_MEAN = "Mean";
|
||||
const word fieldAverage::EXT_PRIME2MEAN = "Prime2Mean";
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::fieldAverage::resetFields(wordList& names)
|
||||
void Foam::fieldAverage::resetFields()
|
||||
{
|
||||
forAll(names, fieldI)
|
||||
forAll(faItems_, i)
|
||||
{
|
||||
if (names[fieldI].size())
|
||||
if (faItems_[i].mean())
|
||||
{
|
||||
obr_.checkOut(*obr_[names[fieldI]]);
|
||||
if (obr_.found(faItems_[i].meanFieldName()))
|
||||
{
|
||||
obr_.checkOut(*obr_[faItems_[i].meanFieldName()]);
|
||||
}
|
||||
}
|
||||
if (faItems_[i].prime2Mean())
|
||||
{
|
||||
if (obr_.found(faItems_[i].prime2MeanFieldName()))
|
||||
{
|
||||
obr_.checkOut(*obr_[faItems_[i].prime2MeanFieldName()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
names.clear();
|
||||
names.setSize(faItems_.size());
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldAverage::initialize()
|
||||
{
|
||||
resetFields(meanScalarFields_);
|
||||
resetFields(meanVectorFields_);
|
||||
resetFields(meanSphericalTensorFields_);
|
||||
resetFields(meanSymmTensorFields_);
|
||||
resetFields(meanTensorFields_);
|
||||
|
||||
resetFields(prime2MeanScalarFields_);
|
||||
resetFields(prime2MeanSymmTensorFields_);
|
||||
resetFields();
|
||||
|
||||
|
||||
// Add mean fields to the field lists
|
||||
forAll(faItems_, fieldI)
|
||||
{
|
||||
const word& fieldName = faItems_[fieldI].fieldName();
|
||||
if (obr_.foundObject<volScalarField>(fieldName))
|
||||
{
|
||||
addMeanField<scalar>(fieldI, meanScalarFields_);
|
||||
}
|
||||
else if (obr_.foundObject<volVectorField>(fieldName))
|
||||
{
|
||||
addMeanField<vector>(fieldI, meanVectorFields_);
|
||||
}
|
||||
else if (obr_.foundObject<volSphericalTensorField>(fieldName))
|
||||
{
|
||||
addMeanField<sphericalTensor>(fieldI, meanSphericalTensorFields_);
|
||||
}
|
||||
else if (obr_.foundObject<volSymmTensorField>(fieldName))
|
||||
{
|
||||
addMeanField<symmTensor>(fieldI, meanSymmTensorFields_);
|
||||
}
|
||||
else if (obr_.foundObject<volTensorField>(fieldName))
|
||||
{
|
||||
addMeanField<tensor>(fieldI, meanTensorFields_);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("Foam::fieldAverage::initialize()")
|
||||
<< "Requested field " << faItems_[fieldI].fieldName()
|
||||
<< " does not exist in the database" << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
addMeanField<scalar>(fieldI);
|
||||
addMeanField<vector>(fieldI);
|
||||
addMeanField<sphericalTensor>(fieldI);
|
||||
addMeanField<symmTensor>(fieldI);
|
||||
addMeanField<tensor>(fieldI);
|
||||
}
|
||||
|
||||
// Add prime-squared mean fields to the field lists
|
||||
forAll(faItems_, fieldI)
|
||||
{
|
||||
if (faItems_[fieldI].prime2Mean())
|
||||
{
|
||||
const word& fieldName = faItems_[fieldI].fieldName();
|
||||
if (!faItems_[fieldI].mean())
|
||||
{
|
||||
FatalErrorIn("Foam::fieldAverage::initialize()")
|
||||
<< "To calculate the prime-squared average, the "
|
||||
<< "mean average must also be selected for field "
|
||||
<< fieldName << nl << exit(FatalError);
|
||||
addPrime2MeanField<scalar, scalar>(fieldI);
|
||||
addPrime2MeanField<vector, symmTensor>(fieldI);
|
||||
}
|
||||
|
||||
if (obr_.foundObject<volScalarField>(fieldName))
|
||||
forAll(faItems_, fieldI)
|
||||
{
|
||||
addPrime2MeanField<scalar, scalar>
|
||||
(
|
||||
fieldI,
|
||||
meanScalarFields_,
|
||||
prime2MeanScalarFields_
|
||||
);
|
||||
}
|
||||
else if (obr_.foundObject<volVectorField>(fieldName))
|
||||
if (!faItems_[fieldI].active())
|
||||
{
|
||||
addPrime2MeanField<vector, symmTensor>
|
||||
(
|
||||
fieldI,
|
||||
meanVectorFields_,
|
||||
prime2MeanSymmTensorFields_
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("Foam::fieldAverage::initialize()")
|
||||
<< "prime2Mean average can only be applied to "
|
||||
<< "volScalarFields and volVectorFields"
|
||||
<< nl << " Field: " << fieldName << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
WarningIn("void Foam::fieldAverage::initialize()")
|
||||
<< "Field " << faItems_[fieldI].fieldName()
|
||||
<< " not found in database for averaging";
|
||||
}
|
||||
}
|
||||
|
||||
@ -173,33 +121,17 @@ void Foam::fieldAverage::calcAverages()
|
||||
|
||||
Info<< "Calculating averages" << nl << endl;
|
||||
|
||||
addMeanSqrToPrime2Mean<scalar, scalar>
|
||||
(
|
||||
meanScalarFields_,
|
||||
prime2MeanScalarFields_
|
||||
);
|
||||
addMeanSqrToPrime2Mean<vector, symmTensor>
|
||||
(
|
||||
meanVectorFields_,
|
||||
prime2MeanSymmTensorFields_
|
||||
);
|
||||
addMeanSqrToPrime2Mean<scalar, scalar>();
|
||||
addMeanSqrToPrime2Mean<vector, symmTensor>();
|
||||
|
||||
calculateMeanFields<scalar>(meanScalarFields_);
|
||||
calculateMeanFields<vector>(meanVectorFields_);
|
||||
calculateMeanFields<sphericalTensor>(meanSphericalTensorFields_);
|
||||
calculateMeanFields<symmTensor>(meanSymmTensorFields_);
|
||||
calculateMeanFields<tensor>(meanTensorFields_);
|
||||
calculateMeanFields<scalar>();
|
||||
calculateMeanFields<vector>();
|
||||
calculateMeanFields<sphericalTensor>();
|
||||
calculateMeanFields<symmTensor>();
|
||||
calculateMeanFields<tensor>();
|
||||
|
||||
calculatePrime2MeanFields<scalar, scalar>
|
||||
(
|
||||
meanScalarFields_,
|
||||
prime2MeanScalarFields_
|
||||
);
|
||||
calculatePrime2MeanFields<vector, symmTensor>
|
||||
(
|
||||
meanVectorFields_,
|
||||
prime2MeanSymmTensorFields_
|
||||
);
|
||||
calculatePrime2MeanFields<scalar, scalar>();
|
||||
calculatePrime2MeanFields<vector, symmTensor>();
|
||||
|
||||
forAll(faItems_, fieldI)
|
||||
{
|
||||
@ -211,14 +143,11 @@ void Foam::fieldAverage::calcAverages()
|
||||
|
||||
void Foam::fieldAverage::writeAverages() const
|
||||
{
|
||||
writeFieldList<scalar>(meanScalarFields_);
|
||||
writeFieldList<vector>(meanVectorFields_);
|
||||
writeFieldList<sphericalTensor>(meanSphericalTensorFields_);
|
||||
writeFieldList<symmTensor>(meanSymmTensorFields_);
|
||||
writeFieldList<tensor>(meanTensorFields_);
|
||||
|
||||
writeFieldList<scalar>(prime2MeanScalarFields_);
|
||||
writeFieldList<symmTensor>(prime2MeanSymmTensorFields_);
|
||||
writeFields<scalar>();
|
||||
writeFields<vector>();
|
||||
writeFields<sphericalTensor>();
|
||||
writeFields<symmTensor>();
|
||||
writeFields<tensor>();
|
||||
}
|
||||
|
||||
|
||||
@ -324,13 +253,6 @@ Foam::fieldAverage::fieldAverage
|
||||
resetOnOutput_(false),
|
||||
initialised_(false),
|
||||
faItems_(),
|
||||
meanScalarFields_(),
|
||||
meanVectorFields_(),
|
||||
meanSphericalTensorFields_(),
|
||||
meanSymmTensorFields_(),
|
||||
meanTensorFields_(),
|
||||
prime2MeanScalarFields_(),
|
||||
prime2MeanSymmTensorFields_(),
|
||||
totalIter_(),
|
||||
totalTime_()
|
||||
{
|
||||
|
||||
@ -29,9 +29,9 @@ Group
|
||||
|
||||
Description
|
||||
This function object calculates average quantities for a user-specified
|
||||
selection of fields. Fields are entered as a list of sub-dictionaries,
|
||||
which indicate the type of averages to perform, and can be updated during
|
||||
the calculation. The current options include:
|
||||
selection of volumetric and surface fields. Fields are entered as a list
|
||||
of sub-dictionaries, which indicate the type of averages to perform, and
|
||||
can be updated during the calculation. The current options include:
|
||||
- \c mean: arithmetic mean:
|
||||
\f[
|
||||
\overline{x} = \frac{1}{N}\displaystyle\sum\limits_{i=0}^N x_i
|
||||
@ -142,16 +142,7 @@ class fieldAverage
|
||||
{
|
||||
protected:
|
||||
|
||||
// File and field name extensions
|
||||
|
||||
//- Mean average
|
||||
static const word EXT_MEAN;
|
||||
|
||||
//- Prime-squared average
|
||||
static const word EXT_PRIME2MEAN;
|
||||
|
||||
|
||||
// Private data
|
||||
// Protected data
|
||||
|
||||
//- Name of this set of field averages.
|
||||
word name_;
|
||||
@ -178,22 +169,6 @@ protected:
|
||||
// calculated and output
|
||||
List<fieldAverageItem> faItems_;
|
||||
|
||||
|
||||
// Lists of averages
|
||||
|
||||
// Arithmetic mean fields
|
||||
wordList meanScalarFields_;
|
||||
wordList meanVectorFields_;
|
||||
wordList meanSphericalTensorFields_;
|
||||
wordList meanSymmTensorFields_;
|
||||
wordList meanTensorFields_;
|
||||
|
||||
// Prime-squared fields
|
||||
// Only applicable to volScalarFields / volVectorFields
|
||||
wordList prime2MeanScalarFields_;
|
||||
wordList prime2MeanSymmTensorFields_;
|
||||
|
||||
|
||||
// Counters
|
||||
|
||||
//- Iteration steps counter
|
||||
@ -209,24 +184,27 @@ protected:
|
||||
|
||||
//- Checkout fields (causes deletion) from the database
|
||||
// and reset lists
|
||||
void resetFields(wordList&);
|
||||
void resetFields();
|
||||
|
||||
//- Reset lists (clear existing values) and initialize averaging.
|
||||
// Check requested field averages are valid, populate field lists
|
||||
void initialize();
|
||||
|
||||
//- Add mean average field to list
|
||||
//- Add mean average field to database
|
||||
template<class Type>
|
||||
void addMeanField(const label, wordList&) const;
|
||||
void addMeanFieldType(const label fieldI);
|
||||
|
||||
//- Add prime-squared average field to list
|
||||
//- Add mean average field to database
|
||||
template<class Type>
|
||||
void addMeanField(const label fieldI);
|
||||
|
||||
//- Add prime-squared average field to database
|
||||
template<class Type1, class Type2>
|
||||
void addPrime2MeanField
|
||||
(
|
||||
const label,
|
||||
const wordList&,
|
||||
wordList&
|
||||
) const;
|
||||
void addPrime2MeanFieldType(const label fieldI);
|
||||
|
||||
//- Add prime-squared average field to database
|
||||
template<class Type1, class Type2>
|
||||
void addPrime2MeanField(const label fieldI);
|
||||
|
||||
|
||||
// Calculation functions
|
||||
@ -236,23 +214,27 @@ protected:
|
||||
|
||||
//- Calculate mean average fields
|
||||
template<class Type>
|
||||
void calculateMeanFields(const wordList&) const;
|
||||
void calculateMeanFieldType(const label fieldI) const;
|
||||
|
||||
//- Add mean-squared field value to prime-squared mean field
|
||||
template<class Type1, class Type2>
|
||||
void addMeanSqrToPrime2Mean
|
||||
(
|
||||
const wordList&,
|
||||
const wordList&
|
||||
) const;
|
||||
//- Calculate mean average fields
|
||||
template<class Type>
|
||||
void calculateMeanFields() const;
|
||||
|
||||
//- Calculate prime-squared average fields
|
||||
template<class Type1, class Type2>
|
||||
void calculatePrime2MeanFields
|
||||
(
|
||||
const wordList&,
|
||||
const wordList&
|
||||
) const;
|
||||
void calculatePrime2MeanFieldType(const label fieldI) const;
|
||||
|
||||
//- Calculate prime-squared average fields
|
||||
template<class Type1, class Type2>
|
||||
void calculatePrime2MeanFields() const;
|
||||
|
||||
//- Add mean-squared field value to prime-squared mean field
|
||||
template<class Type1, class Type2>
|
||||
void addMeanSqrToPrime2MeanType(const label fieldI) const;
|
||||
|
||||
//- Add mean-squared field value to prime-squared mean field
|
||||
template<class Type1, class Type2>
|
||||
void addMeanSqrToPrime2Mean() const;
|
||||
|
||||
|
||||
// I-O
|
||||
@ -262,7 +244,11 @@ protected:
|
||||
|
||||
//- Write fields
|
||||
template<class Type>
|
||||
void writeFieldList(const wordList&) const;
|
||||
void writeFieldType(const word& fieldName) const;
|
||||
|
||||
//- Write fields
|
||||
template<class Type>
|
||||
void writeFields() const;
|
||||
|
||||
//- Write averaging properties - steps and time
|
||||
void writeAveragingProperties() const;
|
||||
|
||||
@ -25,55 +25,41 @@ License
|
||||
|
||||
#include "fieldAverageItem.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "OFstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::fieldAverage::addMeanField
|
||||
(
|
||||
const label fieldI,
|
||||
wordList& meanFieldList
|
||||
) const
|
||||
void Foam::fieldAverage::addMeanFieldType(const label fieldI)
|
||||
{
|
||||
if (faItems_[fieldI].mean())
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
|
||||
faItems_[fieldI].active() = true;
|
||||
|
||||
const word& fieldName = faItems_[fieldI].fieldName();
|
||||
|
||||
word meanFieldName = fieldName + EXT_MEAN;
|
||||
if
|
||||
(
|
||||
(faItems_[fieldI].window() > 0)
|
||||
&& (faItems_[fieldI].windowName() != "")
|
||||
)
|
||||
{
|
||||
meanFieldName = meanFieldName + "_" + faItems_[fieldI].windowName();
|
||||
}
|
||||
const word& meanFieldName = faItems_[fieldI].meanFieldName();
|
||||
|
||||
Info<< "Reading/calculating field " << meanFieldName << nl << endl;
|
||||
|
||||
if (obr_.foundObject<fieldType>(meanFieldName))
|
||||
if (obr_.foundObject<Type>(meanFieldName))
|
||||
{
|
||||
meanFieldList[fieldI] = meanFieldName;
|
||||
// do nothing
|
||||
}
|
||||
else if (obr_.found(meanFieldName))
|
||||
{
|
||||
Info<< "Cannot allocate average field " << meanFieldName
|
||||
<< " since an object with that name already exists."
|
||||
<< " Disabling averaging." << nl << endl;
|
||||
meanFieldList[fieldI] = word::null;
|
||||
|
||||
faItems_[fieldI].mean() = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
const fieldType& baseField =
|
||||
obr_.lookupObject<fieldType>(fieldName);
|
||||
const Type& baseField = obr_.lookupObject<Type>(fieldName);
|
||||
|
||||
// Store on registry
|
||||
obr_.store
|
||||
(
|
||||
new fieldType
|
||||
new Type
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -86,65 +72,65 @@ void Foam::fieldAverage::addMeanField
|
||||
1*baseField
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
meanFieldList[fieldI] = meanFieldName;
|
||||
|
||||
template<class Type>
|
||||
void Foam::fieldAverage::addMeanField(const label fieldI)
|
||||
{
|
||||
if (faItems_[fieldI].mean())
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> volFieldType;
|
||||
typedef GeometricField<Type, fvsPatchField, surfaceMesh> surfFieldType;
|
||||
|
||||
const word& fieldName = faItems_[fieldI].fieldName();
|
||||
|
||||
if (obr_.foundObject<volFieldType>(fieldName))
|
||||
{
|
||||
addMeanFieldType<volFieldType>(fieldI);
|
||||
}
|
||||
else if (obr_.foundObject<surfFieldType>(fieldName))
|
||||
{
|
||||
addMeanFieldType<surfFieldType>(fieldI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type1, class Type2>
|
||||
void Foam::fieldAverage::addPrime2MeanField
|
||||
(
|
||||
const label fieldI,
|
||||
const wordList& meanFieldList,
|
||||
wordList& prime2MeanFieldList
|
||||
) const
|
||||
void Foam::fieldAverage::addPrime2MeanFieldType(const label fieldI)
|
||||
{
|
||||
if (faItems_[fieldI].mean() && meanFieldList[fieldI].size())
|
||||
{
|
||||
typedef GeometricField<Type1, fvPatchField, volMesh> fieldType1;
|
||||
typedef GeometricField<Type2, fvPatchField, volMesh> fieldType2;
|
||||
|
||||
const word& fieldName = faItems_[fieldI].fieldName();
|
||||
const word& meanFieldName = faItems_[fieldI].meanFieldName();
|
||||
const word& prime2MeanFieldName = faItems_[fieldI].prime2MeanFieldName();
|
||||
|
||||
word meanFieldName = fieldName + EXT_PRIME2MEAN;
|
||||
if
|
||||
(
|
||||
(faItems_[fieldI].window() > 0)
|
||||
&& (faItems_[fieldI].windowName() != "")
|
||||
)
|
||||
Info<< "Reading/calculating field " << prime2MeanFieldName << nl << endl;
|
||||
|
||||
if (obr_.foundObject<Type2>(prime2MeanFieldName))
|
||||
{
|
||||
meanFieldName = meanFieldName + "_" + faItems_[fieldI].windowName();
|
||||
// do nothing
|
||||
}
|
||||
|
||||
Info<< "Reading/calculating field " << meanFieldName << nl << endl;
|
||||
|
||||
if (obr_.foundObject<fieldType2>(meanFieldName))
|
||||
else if (obr_.found(prime2MeanFieldName))
|
||||
{
|
||||
prime2MeanFieldList[fieldI] = meanFieldName;
|
||||
}
|
||||
else if (obr_.found(meanFieldName))
|
||||
{
|
||||
Info<< "Cannot allocate average field " << meanFieldName
|
||||
Info<< "Cannot allocate average field " << prime2MeanFieldName
|
||||
<< " since an object with that name already exists."
|
||||
<< " Disabling averaging." << nl << endl;
|
||||
prime2MeanFieldList[fieldI] = word::null;
|
||||
|
||||
faItems_[fieldI].prime2Mean() = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
const fieldType1& baseField =
|
||||
obr_.lookupObject<fieldType1>(fieldName);
|
||||
const fieldType1& meanField =
|
||||
obr_.lookupObject<fieldType1>(meanFieldList[fieldI]);
|
||||
const Type1& baseField = obr_.lookupObject<Type1>(fieldName);
|
||||
const Type1& meanField = obr_.lookupObject<Type1>(meanFieldName);
|
||||
|
||||
obr_.store
|
||||
(
|
||||
new fieldType2
|
||||
new Type2
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
meanFieldName,
|
||||
prime2MeanFieldName,
|
||||
obr_.time().timeName(obr_.time().startTime().value()),
|
||||
obr_,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
@ -153,45 +139,75 @@ void Foam::fieldAverage::addPrime2MeanField
|
||||
sqr(baseField) - sqr(meanField)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
prime2MeanFieldList[fieldI] = meanFieldName;
|
||||
|
||||
template<class Type1, class Type2>
|
||||
void Foam::fieldAverage::addPrime2MeanField(const label fieldI)
|
||||
{
|
||||
typedef GeometricField<Type1, fvPatchField, volMesh> volFieldType1;
|
||||
typedef GeometricField<Type1, fvsPatchField, surfaceMesh> surfFieldType1;
|
||||
|
||||
typedef GeometricField<Type2, fvPatchField, volMesh> volFieldType2;
|
||||
typedef GeometricField<Type2, fvsPatchField, surfaceMesh> surfFieldType2;
|
||||
|
||||
if (faItems_[fieldI].prime2Mean())
|
||||
{
|
||||
const word& fieldName = faItems_[fieldI].fieldName();
|
||||
|
||||
if (!faItems_[fieldI].mean())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"void Foam::fieldAverage::addPrime2MeanField(const label) const"
|
||||
)
|
||||
<< "To calculate the prime-squared average, the "
|
||||
<< "mean average must also be selected for field "
|
||||
<< fieldName << nl << exit(FatalError);
|
||||
}
|
||||
|
||||
if (obr_.foundObject<volFieldType1>(fieldName))
|
||||
{
|
||||
addPrime2MeanFieldType<volFieldType1, volFieldType2>(fieldI);
|
||||
}
|
||||
else if (obr_.foundObject<surfFieldType1>(fieldName))
|
||||
{
|
||||
addPrime2MeanFieldType<surfFieldType1, surfFieldType2>(fieldI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::fieldAverage::calculateMeanFields(const wordList& meanFieldList)
|
||||
const
|
||||
void Foam::fieldAverage::calculateMeanFieldType(const label fieldI) const
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
|
||||
const word& fieldName = faItems_[fieldI].fieldName();
|
||||
|
||||
scalar dt = obr_.time().deltaTValue();
|
||||
if (obr_.foundObject<Type>(fieldName))
|
||||
{
|
||||
const Type& baseField = obr_.lookupObject<Type>(fieldName);
|
||||
|
||||
forAll(faItems_, i)
|
||||
{
|
||||
if (faItems_[i].mean() && meanFieldList[i].size())
|
||||
{
|
||||
const word& fieldName = faItems_[i].fieldName();
|
||||
const fieldType& baseField =
|
||||
obr_.lookupObject<fieldType>(fieldName);
|
||||
fieldType& meanField = const_cast<fieldType&>
|
||||
Type& meanField = const_cast<Type&>
|
||||
(
|
||||
obr_.lookupObject<fieldType>(meanFieldList[i])
|
||||
obr_.lookupObject<Type>(faItems_[fieldI].meanFieldName())
|
||||
);
|
||||
|
||||
scalar Dt = totalTime_[i];
|
||||
if (faItems_[i].iterBase())
|
||||
scalar dt = obr_.time().deltaTValue();
|
||||
scalar Dt = totalTime_[fieldI];
|
||||
|
||||
if (faItems_[fieldI].iterBase())
|
||||
{
|
||||
dt = 1.0;
|
||||
Dt = scalar(totalIter_[i]);
|
||||
Dt = scalar(totalIter_[fieldI]);
|
||||
}
|
||||
|
||||
scalar alpha = (Dt - dt)/Dt;
|
||||
scalar beta = dt/Dt;
|
||||
if (faItems_[i].window() > 0)
|
||||
|
||||
if (faItems_[fieldI].window() > 0)
|
||||
{
|
||||
const scalar w = faItems_[i].window();
|
||||
const scalar w = faItems_[fieldI].window();
|
||||
|
||||
if (Dt - dt >= w)
|
||||
{
|
||||
@ -203,52 +219,56 @@ const
|
||||
meanField = alpha*meanField + beta*baseField;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::fieldAverage::calculateMeanFields() const
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> volFieldType;
|
||||
typedef GeometricField<Type, fvsPatchField, surfaceMesh> surfFieldType;
|
||||
|
||||
forAll(faItems_, i)
|
||||
{
|
||||
if (faItems_[i].mean())
|
||||
{
|
||||
calculateMeanFieldType<volFieldType>(i);
|
||||
calculateMeanFieldType<surfFieldType>(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type1, class Type2>
|
||||
void Foam::fieldAverage::calculatePrime2MeanFields
|
||||
(
|
||||
const wordList& meanFieldList,
|
||||
const wordList& prime2MeanFieldList
|
||||
) const
|
||||
void Foam::fieldAverage::calculatePrime2MeanFieldType(const label fieldI) const
|
||||
{
|
||||
typedef GeometricField<Type1, fvPatchField, volMesh> fieldType1;
|
||||
typedef GeometricField<Type2, fvPatchField, volMesh> fieldType2;
|
||||
const word& fieldName = faItems_[fieldI].fieldName();
|
||||
|
||||
scalar dt = obr_.time().deltaTValue();
|
||||
if (obr_.foundObject<Type1>(fieldName))
|
||||
{
|
||||
const Type1& baseField = obr_.lookupObject<Type1>(fieldName);
|
||||
const Type1& meanField =
|
||||
obr_.lookupObject<Type1>(faItems_[fieldI].meanFieldName());
|
||||
|
||||
forAll(faItems_, i)
|
||||
{
|
||||
if
|
||||
Type2& prime2MeanField = const_cast<Type2&>
|
||||
(
|
||||
faItems_[i].prime2Mean()
|
||||
&& meanFieldList[i].size()
|
||||
&& prime2MeanFieldList[i].size()
|
||||
)
|
||||
{
|
||||
const word& fieldName = faItems_[i].fieldName();
|
||||
const fieldType1& baseField =
|
||||
obr_.lookupObject<fieldType1>(fieldName);
|
||||
const fieldType1& meanField =
|
||||
obr_.lookupObject<fieldType1>(meanFieldList[i]);
|
||||
fieldType2& prime2MeanField = const_cast<fieldType2&>
|
||||
(
|
||||
obr_.lookupObject<fieldType2>(prime2MeanFieldList[i])
|
||||
obr_.lookupObject<Type2>(faItems_[fieldI].prime2MeanFieldName())
|
||||
);
|
||||
|
||||
scalar Dt = totalTime_[i];
|
||||
if (faItems_[i].iterBase())
|
||||
scalar dt = obr_.time().deltaTValue();
|
||||
scalar Dt = totalTime_[fieldI];
|
||||
|
||||
if (faItems_[fieldI].iterBase())
|
||||
{
|
||||
dt = 1.0;
|
||||
Dt = scalar(totalIter_[i]);
|
||||
Dt = scalar(totalIter_[fieldI]);
|
||||
}
|
||||
|
||||
scalar alpha = (Dt - dt)/Dt;
|
||||
scalar beta = dt/Dt;
|
||||
if (faItems_[i].window() > 0)
|
||||
|
||||
if (faItems_[fieldI].window() > 0)
|
||||
{
|
||||
const scalar w = faItems_[i].window();
|
||||
const scalar w = faItems_[fieldI].window();
|
||||
|
||||
if (Dt - dt >= w)
|
||||
{
|
||||
@ -263,54 +283,100 @@ void Foam::fieldAverage::calculatePrime2MeanFields
|
||||
- sqr(meanField);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type1, class Type2>
|
||||
void Foam::fieldAverage::calculatePrime2MeanFields() const
|
||||
{
|
||||
typedef GeometricField<Type1, fvPatchField, volMesh> volFieldType1;
|
||||
typedef GeometricField<Type1, fvsPatchField, surfaceMesh> surfFieldType1;
|
||||
|
||||
typedef GeometricField<Type2, fvPatchField, volMesh> volFieldType2;
|
||||
typedef GeometricField<Type2, fvsPatchField, surfaceMesh> surfFieldType2;
|
||||
|
||||
forAll(faItems_, i)
|
||||
{
|
||||
if (faItems_[i].prime2Mean())
|
||||
{
|
||||
calculatePrime2MeanFieldType<volFieldType1, volFieldType2>(i);
|
||||
calculatePrime2MeanFieldType<surfFieldType1, surfFieldType2>(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type1, class Type2>
|
||||
void Foam::fieldAverage::addMeanSqrToPrime2Mean
|
||||
(
|
||||
const wordList& meanFieldList,
|
||||
const wordList& prime2MeanFieldList
|
||||
) const
|
||||
void Foam::fieldAverage::addMeanSqrToPrime2MeanType(const label fieldI) const
|
||||
{
|
||||
typedef GeometricField<Type1, fvPatchField, volMesh> fieldType1;
|
||||
typedef GeometricField<Type2, fvPatchField, volMesh> fieldType2;
|
||||
const word& fieldName = faItems_[fieldI].fieldName();
|
||||
|
||||
forAll(faItems_, i)
|
||||
if (obr_.foundObject<Type1>(fieldName))
|
||||
{
|
||||
if
|
||||
const Type1& meanField =
|
||||
obr_.lookupObject<Type1>(faItems_[fieldI].meanFieldName());
|
||||
|
||||
Type2& prime2MeanField = const_cast<Type2&>
|
||||
(
|
||||
faItems_[i].prime2Mean()
|
||||
&& meanFieldList[i].size()
|
||||
&& prime2MeanFieldList[i].size()
|
||||
)
|
||||
{
|
||||
const fieldType1& meanField =
|
||||
obr_.lookupObject<fieldType1>(meanFieldList[i]);
|
||||
fieldType2& prime2MeanField = const_cast<fieldType2&>
|
||||
(
|
||||
obr_.lookupObject<fieldType2>(prime2MeanFieldList[i])
|
||||
obr_.lookupObject<Type2>(faItems_[fieldI].prime2MeanFieldName())
|
||||
);
|
||||
|
||||
prime2MeanField += sqr(meanField);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type1, class Type2>
|
||||
void Foam::fieldAverage::addMeanSqrToPrime2Mean() const
|
||||
{
|
||||
typedef GeometricField<Type1, fvPatchField, volMesh> volFieldType1;
|
||||
typedef GeometricField<Type1, fvsPatchField, surfaceMesh> surfFieldType1;
|
||||
|
||||
typedef GeometricField<Type2, fvPatchField, volMesh> volFieldType2;
|
||||
typedef GeometricField<Type2, fvsPatchField, surfaceMesh> surfFieldType2;
|
||||
|
||||
forAll(faItems_, i)
|
||||
{
|
||||
if (faItems_[i].prime2Mean())
|
||||
{
|
||||
addMeanSqrToPrime2MeanType<volFieldType1, volFieldType2>(i);
|
||||
addMeanSqrToPrime2MeanType<surfFieldType1, surfFieldType2>(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::fieldAverage::writeFieldList(const wordList& fieldList) const
|
||||
void Foam::fieldAverage::writeFieldType(const word& fieldName) const
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
|
||||
|
||||
forAll(fieldList, i)
|
||||
if (obr_.foundObject<Type>(fieldName))
|
||||
{
|
||||
if (fieldList[i].size())
|
||||
{
|
||||
const fieldType& f = obr_.lookupObject<fieldType>(fieldList[i]);
|
||||
const Type& f = obr_.lookupObject<Type>(fieldName);
|
||||
f.write();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::fieldAverage::writeFields() const
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> volFieldType;
|
||||
typedef GeometricField<Type, fvsPatchField, surfaceMesh> surfFieldType;
|
||||
|
||||
forAll(faItems_, i)
|
||||
{
|
||||
if (faItems_[i].mean())
|
||||
{
|
||||
const word& fieldName = faItems_[i].meanFieldName();
|
||||
writeFieldType<volFieldType>(fieldName);
|
||||
writeFieldType<surfFieldType>(fieldName);
|
||||
}
|
||||
if (faItems_[i].prime2Mean())
|
||||
{
|
||||
const word& fieldName = faItems_[i].prime2MeanFieldName();
|
||||
writeFieldType<volFieldType>(fieldName);
|
||||
writeFieldType<surfFieldType>(fieldName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -29,6 +29,9 @@ License
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
const word fieldAverageItem::EXT_MEAN = "Mean";
|
||||
const word fieldAverageItem::EXT_PRIME2MEAN = "Prime2Mean";
|
||||
|
||||
template<>
|
||||
const char* Foam::NamedEnum
|
||||
<
|
||||
@ -50,9 +53,12 @@ const Foam::NamedEnum<Foam::fieldAverageItem::baseType, 2>
|
||||
|
||||
Foam::fieldAverageItem::fieldAverageItem()
|
||||
:
|
||||
active_(false),
|
||||
fieldName_("unknown"),
|
||||
mean_(0),
|
||||
meanFieldName_("unknown"),
|
||||
prime2Mean_(0),
|
||||
prime2MeanFieldName_("unknown"),
|
||||
base_(ITER),
|
||||
window_(-1.0),
|
||||
windowName_("")
|
||||
@ -61,9 +67,12 @@ Foam::fieldAverageItem::fieldAverageItem()
|
||||
|
||||
Foam::fieldAverageItem::fieldAverageItem(const fieldAverageItem& faItem)
|
||||
:
|
||||
active_(faItem.active_),
|
||||
fieldName_(faItem.fieldName_),
|
||||
mean_(faItem.mean_),
|
||||
meanFieldName_(faItem.meanFieldName_),
|
||||
prime2Mean_(faItem.prime2Mean_),
|
||||
prime2MeanFieldName_(faItem.prime2MeanFieldName_),
|
||||
base_(faItem.base_),
|
||||
window_(faItem.window_),
|
||||
windowName_(faItem.windowName_)
|
||||
@ -91,9 +100,12 @@ void Foam::fieldAverageItem::operator=(const fieldAverageItem& rhs)
|
||||
}
|
||||
|
||||
// Set updated values
|
||||
active_ = rhs.active_;
|
||||
fieldName_ = rhs.fieldName_;
|
||||
mean_ = rhs.mean_;
|
||||
meanFieldName_ = rhs.meanFieldName_;
|
||||
prime2Mean_ = rhs.prime2Mean_;
|
||||
prime2MeanFieldName_ = rhs.prime2MeanFieldName_;
|
||||
base_ = rhs.base_;
|
||||
window_ = rhs.window_;
|
||||
windowName_ = rhs.windowName_;
|
||||
|
||||
@ -78,6 +78,14 @@ public:
|
||||
|
||||
// Public data
|
||||
|
||||
// File and field name extensions
|
||||
|
||||
//- Mean average
|
||||
static const word EXT_MEAN;
|
||||
|
||||
//- Prime-squared average
|
||||
static const word EXT_PRIME2MEAN;
|
||||
|
||||
//- Enumeration defining the averaging base type
|
||||
enum baseType
|
||||
{
|
||||
@ -90,15 +98,24 @@ private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Active flag
|
||||
Switch active_;
|
||||
|
||||
//- Field name
|
||||
word fieldName_;
|
||||
|
||||
//- Compute mean flag
|
||||
Switch mean_;
|
||||
|
||||
//- Name of mean field
|
||||
word meanFieldName_;
|
||||
|
||||
//- Compute prime-squared mean flag
|
||||
Switch prime2Mean_;
|
||||
|
||||
//- Name of prime-squared mean field
|
||||
word prime2MeanFieldName_;
|
||||
|
||||
//- Averaging base type names
|
||||
static const NamedEnum<baseType, 2> baseTypeNames_;
|
||||
|
||||
@ -134,6 +151,18 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Return const access to the active flag
|
||||
const Switch& active() const
|
||||
{
|
||||
return active_;
|
||||
}
|
||||
|
||||
//- Return non-const access to the active flag
|
||||
Switch& active()
|
||||
{
|
||||
return active_;
|
||||
}
|
||||
|
||||
//- Return const access to the field name
|
||||
const word& fieldName() const
|
||||
{
|
||||
@ -146,12 +175,36 @@ public:
|
||||
return mean_;
|
||||
}
|
||||
|
||||
//- Return non-const access to the mean flag
|
||||
Switch& mean()
|
||||
{
|
||||
return mean_;
|
||||
}
|
||||
|
||||
//- Return const access to the mean field name
|
||||
const word& meanFieldName() const
|
||||
{
|
||||
return meanFieldName_;
|
||||
}
|
||||
|
||||
//- Return const access to the prime-squared mean flag
|
||||
const Switch& prime2Mean() const
|
||||
{
|
||||
return prime2Mean_;
|
||||
}
|
||||
|
||||
//- Return non-const access to the prime-squared mean flag
|
||||
Switch& prime2Mean()
|
||||
{
|
||||
return prime2Mean_;
|
||||
}
|
||||
|
||||
//- Return const access to the prime-squared mean field name
|
||||
const word& prime2MeanFieldName() const
|
||||
{
|
||||
return prime2MeanFieldName_;
|
||||
}
|
||||
|
||||
//- Return averaging base type name
|
||||
const word base() const
|
||||
{
|
||||
@ -197,7 +250,9 @@ public:
|
||||
return
|
||||
a.fieldName_ == b.fieldName_
|
||||
&& a.mean_ == b.mean_
|
||||
&& a.meanFieldName_ == b.meanFieldName_
|
||||
&& a.prime2Mean_ == b.prime2Mean_
|
||||
&& a.prime2MeanFieldName_ == b.prime2MeanFieldName_
|
||||
&& a.base_ == b.base_
|
||||
&& a.window_ == b.window_
|
||||
&& a.windowName_ == b.windowName_;
|
||||
|
||||
@ -31,9 +31,12 @@ License
|
||||
|
||||
Foam::fieldAverageItem::fieldAverageItem(Istream& is)
|
||||
:
|
||||
active_(false),
|
||||
fieldName_("unknown"),
|
||||
mean_(0),
|
||||
meanFieldName_("unknown"),
|
||||
prime2Mean_(0),
|
||||
prime2MeanFieldName_("unknown"),
|
||||
base_(ITER),
|
||||
window_(-1.0)
|
||||
{
|
||||
@ -47,6 +50,14 @@ Foam::fieldAverageItem::fieldAverageItem(Istream& is)
|
||||
base_ = baseTypeNames_[entry.lookup("base")];
|
||||
window_ = entry.lookupOrDefault<scalar>("window", -1.0);
|
||||
windowName_ = entry.lookupOrDefault<word>("windowName", "");
|
||||
|
||||
meanFieldName_ = fieldName_ + EXT_MEAN;
|
||||
prime2MeanFieldName_ = fieldName_ + EXT_PRIME2MEAN;
|
||||
if ((window_ > 0) && (windowName_ != ""))
|
||||
{
|
||||
meanFieldName_ = meanFieldName_ + "_" + windowName_;
|
||||
prime2MeanFieldName_ = prime2MeanFieldName_ + "_" + windowName_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -62,6 +73,7 @@ Foam::Istream& Foam::operator>>(Istream& is, fieldAverageItem& faItem)
|
||||
|
||||
const dictionaryEntry entry(dictionary::null, is);
|
||||
|
||||
faItem.active_ = false;
|
||||
faItem.fieldName_ = entry.keyword();
|
||||
entry.lookup("mean") >> faItem.mean_;
|
||||
entry.lookup("prime2Mean") >> faItem.prime2Mean_;
|
||||
@ -69,6 +81,18 @@ Foam::Istream& Foam::operator>>(Istream& is, fieldAverageItem& faItem)
|
||||
faItem.window_ = entry.lookupOrDefault<scalar>("window", -1.0);
|
||||
faItem.windowName_ = entry.lookupOrDefault<word>("windowName", "");
|
||||
|
||||
faItem.meanFieldName_ = faItem.fieldName_ + fieldAverageItem::EXT_MEAN;
|
||||
faItem.prime2MeanFieldName_ =
|
||||
faItem.fieldName_ + fieldAverageItem::EXT_PRIME2MEAN;
|
||||
|
||||
if ((faItem.window_ > 0) && (faItem.windowName_ != ""))
|
||||
{
|
||||
faItem.meanFieldName_ =
|
||||
faItem.meanFieldName_ + "_" + faItem.windowName_;
|
||||
|
||||
faItem.prime2MeanFieldName_ =
|
||||
faItem.prime2MeanFieldName_ + "_" + faItem.windowName_;
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
@ -34,10 +34,6 @@ License
|
||||
#include "mappedWallPolyPatch.H"
|
||||
#include "mapDistribute.H"
|
||||
|
||||
#include "cachedRandom.H"
|
||||
#include "normal.H"
|
||||
#include "mathematicalConstants.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
|
||||
@ -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
|
||||
@ -103,6 +103,18 @@ Foam::scalar Foam::liquidMixtureProperties::Tc(const scalarField& x) const
|
||||
}
|
||||
|
||||
|
||||
Foam::scalar Foam::liquidMixtureProperties::TMax(const scalar p) const
|
||||
{
|
||||
scalar T = -GREAT;
|
||||
forAll(properties_, i)
|
||||
{
|
||||
T = max(T, properties_[i].pvInvert(p));
|
||||
}
|
||||
|
||||
return T;
|
||||
}
|
||||
|
||||
|
||||
Foam::scalar Foam::liquidMixtureProperties::Tpc(const scalarField& x) const
|
||||
{
|
||||
scalar Tpc = 0.0;
|
||||
|
||||
@ -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
|
||||
@ -138,10 +138,12 @@ public:
|
||||
return components_.size();
|
||||
}
|
||||
|
||||
|
||||
//- Calculate the critical temperature of mixture
|
||||
scalar Tc(const scalarField& x) const;
|
||||
|
||||
//- Calculate the maximum temperature of mixture at given pressure
|
||||
scalar TMax(const scalar p) const;
|
||||
|
||||
//- Return pseudocritical temperature according to Kay's rule
|
||||
scalar Tpc(const scalarField& x) const;
|
||||
|
||||
|
||||
@ -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
|
||||
@ -344,44 +344,43 @@ Foam::scalar Foam::liquidProperties::D(scalar p, scalar T, scalar Wb) const
|
||||
|
||||
Foam::scalar Foam::liquidProperties::pvInvert(scalar p) const
|
||||
{
|
||||
scalar T = Tc_;
|
||||
scalar deltaT = 10.0;
|
||||
scalar dp0 = pv(p, T) - p;
|
||||
|
||||
|
||||
label n = 0;
|
||||
|
||||
while ((n < 200) && (mag(deltaT) > 1.0e-3))
|
||||
// Check for critical and solid phase conditions
|
||||
if (p >= Pc_)
|
||||
{
|
||||
n++;
|
||||
scalar pBoil = pv(p, T);
|
||||
scalar dp = pBoil - p;
|
||||
|
||||
if ((dp > 0.0) && (dp0 > 0.0))
|
||||
return Tc_;
|
||||
}
|
||||
else if (p < Pt_)
|
||||
{
|
||||
T -= deltaT;
|
||||
if (debug)
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"Foam::scalar Foam::liquidProperties::pvInvert(scalar) const"
|
||||
) << "Pressure below triple point pressure: "
|
||||
<< "p = " << p << " < Pt = " << Pt_ << nl << endl;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Set initial upper and lower bounds
|
||||
scalar Thi = Tc_;
|
||||
scalar Tlo = Tt_;
|
||||
|
||||
// Initialise T as boiling temperature under normal conditions
|
||||
scalar T = Tb_;
|
||||
|
||||
while ((Thi - Tlo) > 1.0e-4)
|
||||
{
|
||||
if ((pv(p, T) - p) <= 0.0)
|
||||
{
|
||||
Tlo = T;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((dp < 0.0) && (dp0 < 0.0))
|
||||
{
|
||||
T += deltaT;
|
||||
}
|
||||
else
|
||||
{
|
||||
deltaT *= 0.5;
|
||||
if ((dp > 0.0) && (dp0 < 0.0))
|
||||
{
|
||||
T -= deltaT;
|
||||
}
|
||||
else
|
||||
{
|
||||
T += deltaT;
|
||||
}
|
||||
}
|
||||
Thi = T;
|
||||
}
|
||||
|
||||
dp0 = dp;
|
||||
T = (Thi + Tlo)*0.5;
|
||||
}
|
||||
|
||||
return T;
|
||||
|
||||
@ -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
|
||||
@ -42,7 +42,8 @@ totalFlowRateAdvectiveDiffusiveFvPatchScalarField
|
||||
:
|
||||
mixedFvPatchField<scalar>(p, iF),
|
||||
phiName_("phi"),
|
||||
rhoName_("none")
|
||||
rhoName_("none"),
|
||||
massFluxFraction_(1.0)
|
||||
{
|
||||
refValue() = 0.0;
|
||||
refGrad() = 0.0;
|
||||
@ -60,7 +61,8 @@ totalFlowRateAdvectiveDiffusiveFvPatchScalarField
|
||||
:
|
||||
mixedFvPatchField<scalar>(p, iF),
|
||||
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "none"))
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "none")),
|
||||
massFluxFraction_(dict.lookupOrDefault<scalar>("massFluxFraction", 1.0))
|
||||
{
|
||||
|
||||
refValue() = 1.0;
|
||||
@ -91,7 +93,8 @@ totalFlowRateAdvectiveDiffusiveFvPatchScalarField
|
||||
:
|
||||
mixedFvPatchField<scalar>(ptf, p, iF, mapper),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_)
|
||||
rhoName_(ptf.rhoName_),
|
||||
massFluxFraction_(ptf.massFluxFraction_)
|
||||
{}
|
||||
|
||||
|
||||
@ -103,7 +106,8 @@ totalFlowRateAdvectiveDiffusiveFvPatchScalarField
|
||||
:
|
||||
mixedFvPatchField<scalar>(tppsf),
|
||||
phiName_(tppsf.phiName_),
|
||||
rhoName_(tppsf.rhoName_)
|
||||
rhoName_(tppsf.rhoName_),
|
||||
massFluxFraction_(tppsf.massFluxFraction_)
|
||||
{}
|
||||
|
||||
Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::
|
||||
@ -115,7 +119,8 @@ totalFlowRateAdvectiveDiffusiveFvPatchScalarField
|
||||
:
|
||||
mixedFvPatchField<scalar>(tppsf, iF),
|
||||
phiName_(tppsf.phiName_),
|
||||
rhoName_(tppsf.rhoName_)
|
||||
rhoName_(tppsf.rhoName_),
|
||||
massFluxFraction_(tppsf.massFluxFraction_)
|
||||
{}
|
||||
|
||||
|
||||
@ -160,7 +165,7 @@ void Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::updateCoeffs()
|
||||
|
||||
const scalarField alphap(turbulence.alphaEff(patchI));
|
||||
|
||||
refValue() = 1.0;
|
||||
refValue() = massFluxFraction_;
|
||||
refGrad() = 0.0;
|
||||
|
||||
valueFraction() =
|
||||
@ -192,6 +197,8 @@ write(Ostream& os) const
|
||||
fvPatchField<scalar>::write(os);
|
||||
os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("massFluxFraction") << massFluxFraction_
|
||||
<< token::END_STATEMENT << nl;
|
||||
this->writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
@ -25,7 +25,10 @@ Class
|
||||
Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField
|
||||
|
||||
Description
|
||||
Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField
|
||||
This BC is used for species inlets. The diffusion and advection fluxes are
|
||||
considered to calculate the inlet value for the species
|
||||
The massFluxFraction sets the fraction of the flux of each particular
|
||||
species.
|
||||
|
||||
SourceFiles
|
||||
totalFlowRateAdvectiveDiffusiveFvPatchScalarField.C
|
||||
@ -59,6 +62,8 @@ class totalFlowRateAdvectiveDiffusiveFvPatchScalarField
|
||||
// if neccessary
|
||||
word rhoName_;
|
||||
|
||||
//- Mass flux fraction
|
||||
scalar massFluxFraction_;
|
||||
|
||||
public:
|
||||
|
||||
@ -137,13 +142,6 @@ public:
|
||||
|
||||
// Member functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return reference to the name of the flux field
|
||||
word& phiName()
|
||||
{
|
||||
return phiName_;
|
||||
}
|
||||
|
||||
|
||||
// Mapping functions
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -7,5 +7,7 @@ cd ${0%/*} || exit 1 # run from this directory
|
||||
cleanCase
|
||||
|
||||
rm -rf constant/panelRegion/polyMesh
|
||||
rm -f 0/polyMesh/cellMap
|
||||
rm -f constant/polyMesh/boundary
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,22 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "constant";
|
||||
object energySourcesProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
(
|
||||
// none
|
||||
);
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,23 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "constant";
|
||||
object massSourcesProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
(
|
||||
// none
|
||||
);
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,23 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
location "constant";
|
||||
object momentumSourcesProperties;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
(
|
||||
// none
|
||||
);
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -37,6 +37,7 @@ boundaryField
|
||||
walls
|
||||
{
|
||||
type kqRWallFunction;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
frontAndBackPlanes
|
||||
|
||||
@ -37,6 +37,7 @@ boundaryField
|
||||
walls
|
||||
{
|
||||
type kqRWallFunction;
|
||||
value $internalField;
|
||||
}
|
||||
|
||||
frontAndBackPlanes
|
||||
|
||||
Reference in New Issue
Block a user