STYLE: code tidying for icoReactingMultiPhaseInterFoam

- use Enum instead of NamedEnum
- shorter form for dimensionedScalar

- reduce verbosity about missed seeding for DTRM cloud.
  Re-enable old warnings in debug mode.
This commit is contained in:
Mark Olesen
2018-06-21 13:35:22 +02:00
parent 2f83248827
commit 736d358782
19 changed files with 127 additions and 160 deletions

View File

@ -118,7 +118,7 @@
surfaceScalarField& rhoPhi = fluid.rhoPhi(); surfaceScalarField& rhoPhi = fluid.rhoPhi();
// Construct incompressible turbulence model // Construct incompressible turbulence model
autoPtr<CompressibleTurbulenceModel<multiphaseSystem> > turbulence autoPtr<CompressibleTurbulenceModel<multiphaseSystem>> turbulence
( (
CompressibleTurbulenceModel<multiphaseSystem>::New CompressibleTurbulenceModel<multiphaseSystem>::New
( (

View File

@ -54,24 +54,16 @@ namespace Foam
0 0
); );
template<> } // End namespace Foam
const char* Foam::NamedEnum
<
Foam::radiation::laserDTRM::powerDistributionMode,
3
>::names[] =
{
"Gaussian",
"manual",
"uniform"
};
}
const Foam::NamedEnum
< const Foam::Enum<Foam::radiation::laserDTRM::powerDistributionMode>
Foam::radiation::laserDTRM::powerDistributionMode, Foam::radiation::laserDTRM::powerDistNames_
3 {
> Foam::radiation::laserDTRM::powerDistypeNames_; { powerDistributionMode::pdGaussian, "Gaussian" },
{ powerDistributionMode::pdManual, "manual" },
{ powerDistributionMode::pdUniform, "uniform" },
};
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -80,7 +72,7 @@ Foam::scalar Foam::radiation::laserDTRM::calculateIp(scalar r, scalar theta)
{ {
const scalar t = mesh_.time().value(); const scalar t = mesh_.time().value();
const scalar power = laserPower_->value(t); const scalar power = laserPower_->value(t);
switch(mode_) switch (mode_)
{ {
case pdGaussian: case pdGaussian:
{ {
@ -102,11 +94,13 @@ Foam::scalar Foam::radiation::laserDTRM::calculateIp(scalar r, scalar theta)
default: default:
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Unhandled type " << powerDistypeNames_ << "Unhandled type " << powerDistNames_[mode_]
<< abort(FatalError); << abort(FatalError);
return (0); break;
} }
} }
return 0;
} }
@ -154,7 +148,7 @@ void Foam::radiation::laserDTRM::initialiseReflection()
); );
} }
if (reflections_.size() > 0) if (reflections_.size())
{ {
reflectionSwitch_ = true; reflectionSwitch_ = true;
} }
@ -183,12 +177,16 @@ void Foam::radiation::laserDTRM::initialise()
// Find a vector on the area plane. Normal to laser direction // Find a vector on the area plane. Normal to laser direction
vector rArea = vector::zero; vector rArea = vector::zero;
scalar magr = 0.0; scalar magr = 0.0;
while (magr < VSMALL)
{ {
Random rnd(1234); Random rnd(1234);
vector v = rnd.sample01<vector>();
rArea = v - (v & lDir)*lDir; while (magr < VSMALL)
magr = mag(rArea); {
vector v = rnd.sample01<vector>();
rArea = v - (v & lDir)*lDir;
magr = mag(rArea);
}
} }
rArea /= mag(rArea); rArea /= mag(rArea);
@ -219,6 +217,9 @@ void Foam::radiation::laserDTRM::initialise()
} }
} }
// Count the number of missed positions
label nMissed = 0;
// Target position // Target position
point p1 = vector::zero; point p1 = vector::zero;
@ -288,9 +289,12 @@ void Foam::radiation::laserDTRM::initialise()
if (returnReduce(cellI, maxOp<label>()) == -1) if (returnReduce(cellI, maxOp<label>()) == -1)
{ {
WarningInFunction if (++nMissed <= 10)
<< "Cannot find owner cell for particle at position " << p0 {
<< endl; WarningInFunction
<< "Cannot find owner cell for focalPoint at "
<< p0 << endl;
}
} }
} }
} }
@ -302,11 +306,15 @@ void Foam::radiation::laserDTRM::initialise()
<< exit(FatalError); << exit(FatalError);
} }
if (nMissed)
{
Info<< "Seeding missed " << nMissed << " locations" << endl;
}
DebugInfo DebugInfo
<< "Total Power in the laser : " << power << endl << "Total Power in the laser : " << power << nl
<< "Total Area in the laser : " << area << endl << "Total Area in the laser : " << area << nl
<< "Number of particles in the laser : " << endl;
<< returnReduce(DTRMCloud_.size(), sumOp<label>()) << endl;
} }
@ -315,7 +323,7 @@ void Foam::radiation::laserDTRM::initialise()
Foam::radiation::laserDTRM::laserDTRM(const volScalarField& T) Foam::radiation::laserDTRM::laserDTRM(const volScalarField& T)
: :
radiationModel(typeName, T), radiationModel(typeName, T),
mode_(powerDistypeNames_.read(lookup("mode"))), mode_(powerDistNames_.lookup("mode", *this)),
DTRMCloud_(mesh_, "DTRMCloud", IDLList<DTRMParticle>()), DTRMCloud_(mesh_, "DTRMCloud", IDLList<DTRMParticle>()),
nParticles_(0), nParticles_(0),
ndTheta_(readLabel(lookup("nTheta"))), ndTheta_(readLabel(lookup("nTheta"))),
@ -344,7 +352,7 @@ Foam::radiation::laserDTRM::laserDTRM(const volScalarField& T)
reflectionSwitch_(false), reflectionSwitch_(false),
alphaCut_( lookupOrDefault<scalar>("alphaCut", 0.5)), alphaCut_(lookupOrDefault<scalar>("alphaCut", 0.5)),
Qin_ Qin_
( (
@ -357,7 +365,7 @@ Foam::radiation::laserDTRM::laserDTRM(const volScalarField& T)
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
mesh_, mesh_,
dimensionedScalar("Qin", dimPower/dimArea, 0.0) dimensionedScalar(dimPower/dimArea, Zero)
), ),
a_ a_
( (
@ -370,7 +378,7 @@ Foam::radiation::laserDTRM::laserDTRM(const volScalarField& T)
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
mesh_, mesh_,
dimensionedScalar("a", dimless/dimLength, 0.0) dimensionedScalar(dimless/dimLength, Zero)
), ),
e_ e_
( (
@ -383,7 +391,7 @@ Foam::radiation::laserDTRM::laserDTRM(const volScalarField& T)
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
mesh_, mesh_,
dimensionedScalar("a", dimless/dimLength, 0.0) dimensionedScalar(dimless/dimLength, Zero)
), ),
E_ E_
( (
@ -396,7 +404,7 @@ Foam::radiation::laserDTRM::laserDTRM(const volScalarField& T)
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
mesh_, mesh_,
dimensionedScalar("E", dimMass/dimLength/pow3(dimTime), 0.0) dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero)
), ),
Q_ Q_
( (
@ -409,7 +417,7 @@ Foam::radiation::laserDTRM::laserDTRM(const volScalarField& T)
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
mesh_, mesh_,
dimensionedScalar("Q", dimPower/dimVolume, 0.0) dimensionedScalar(dimPower/dimVolume, Zero)
) )
{ {
initialiseReflection(); initialiseReflection();
@ -425,7 +433,7 @@ Foam::radiation::laserDTRM::laserDTRM
) )
: :
radiationModel(typeName, dict, T), radiationModel(typeName, dict, T),
mode_(powerDistypeNames_.read(lookup("mode"))), mode_(powerDistNames_.lookup("mode", *this)),
DTRMCloud_(mesh_, "DTRMCloud", IDLList<DTRMParticle>()), DTRMCloud_(mesh_, "DTRMCloud", IDLList<DTRMParticle>()),
nParticles_(0), nParticles_(0),
ndTheta_(readLabel(lookup("nTheta"))), ndTheta_(readLabel(lookup("nTheta"))),
@ -453,7 +461,7 @@ Foam::radiation::laserDTRM::laserDTRM
reflectionSwitch_(false), reflectionSwitch_(false),
alphaCut_( lookupOrDefault<scalar>("alphaCut", 0.5)), alphaCut_(lookupOrDefault<scalar>("alphaCut", 0.5)),
Qin_ Qin_
( (
@ -466,7 +474,7 @@ Foam::radiation::laserDTRM::laserDTRM
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
mesh_, mesh_,
dimensionedScalar("Qin", dimPower/dimArea, 0.0) dimensionedScalar(dimPower/dimArea, Zero)
), ),
a_ a_
( (
@ -479,7 +487,7 @@ Foam::radiation::laserDTRM::laserDTRM
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
mesh_, mesh_,
dimensionedScalar("a", dimless/dimLength, 0.0) dimensionedScalar(dimless/dimLength, Zero)
), ),
e_ e_
( (
@ -492,7 +500,7 @@ Foam::radiation::laserDTRM::laserDTRM
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
mesh_, mesh_,
dimensionedScalar("a", dimless/dimLength, 0.0) dimensionedScalar(dimless/dimLength, Zero)
), ),
E_ E_
( (
@ -505,11 +513,11 @@ Foam::radiation::laserDTRM::laserDTRM
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
mesh_, mesh_,
dimensionedScalar("E", dimMass/dimLength/pow3(dimTime), 0.0) dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero)
), ),
Q_ Q_
( (
IOobject IOobject
( (
"Q", "Q",
mesh_.time().timeName(), mesh_.time().timeName(),
@ -518,7 +526,7 @@ Foam::radiation::laserDTRM::laserDTRM
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
mesh_, mesh_,
dimensionedScalar("Q", dimPower/pow3(dimLength), 0.0) dimensionedScalar(dimPower/pow3(dimLength), Zero)
) )
{ {
initialiseReflection(); initialiseReflection();
@ -575,15 +583,15 @@ void Foam::radiation::laserDTRM::calculate()
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
mesh_, mesh_,
dimensionedVector("zero", dimless, vector::zero) dimensionedVector(dimless, Zero)
) )
); );
volVectorField& nHat = tnHat.ref(); volVectorField& nHat = tnHat.ref();
// Reset the fields // Reset the fields
Qin_ == dimensionedScalar("zero", Qin_.dimensions(), 0); Qin_ == dimensionedScalar(Qin_.dimensions(), Zero);
Q_ == dimensionedScalar("zero", Q_.dimensions(), 0); Q_ == dimensionedScalar(Q_.dimensions(), Zero);
a_ = absorptionEmission_->a(); a_ = absorptionEmission_->a();
e_ = absorptionEmission_->e(); e_ = absorptionEmission_->e();
@ -598,18 +606,18 @@ void Foam::radiation::laserDTRM::calculate()
autoPtr<interpolationCellPoint<vector>> nHatIntrPtr; autoPtr<interpolationCellPoint<vector>> nHatIntrPtr;
UPtrList<reflectionModel> reflactionUPtr; UPtrList<reflectionModel> reflectionUPtr;
if (reflectionSwitch_) if (reflectionSwitch_)
{ {
reflactionUPtr.resize(reflections_.size()); reflectionUPtr.resize(reflections_.size());
label reflectionModelId(0); label reflectionModelId(0);
forAllIter(reflectionModelTable, reflections_, iter1) forAllIter(reflectionModelTable, reflections_, iter1)
{ {
reflectionModel& model = iter1()(); reflectionModel& model = iter1()();
reflactionUPtr.set(reflectionModelId, &model); reflectionUPtr.set(reflectionModelId, &model);
const word alpha1Name = "alpha." + iter1.key().first(); const word alpha1Name = "alpha." + iter1.key().first();
const word alpha2Name = "alpha." + iter1.key().second(); const word alpha2Name = "alpha." + iter1.key().second();
@ -667,7 +675,7 @@ void Foam::radiation::laserDTRM::calculate()
TInterp, TInterp,
nHatIntrPtr, nHatIntrPtr,
reflectingCells, reflectingCells,
reflactionUPtr, reflectionUPtr,
Q_ Q_
); );
@ -755,12 +763,7 @@ Foam::tmp<Foam::volScalarField> Foam::radiation::laserDTRM::Rp() const
false false
), ),
mesh_, mesh_,
dimensionedScalar dimensionedScalar(dimPower/dimVolume/pow4(dimTemperature), Zero)
(
"zero",
dimPower/dimVolume/pow4(dimTemperature),
0.0
)
); );
} }

View File

@ -61,7 +61,7 @@ SourceFiles
#include "interpolation2DTable.H" #include "interpolation2DTable.H"
#include "labelField.H" #include "labelField.H"
#include "phasePairKey.H" #include "phasePairKey.H"
#include "NamedEnum.H" #include "Enum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -111,8 +111,7 @@ private:
// Private data // Private data
static const Enum<powerDistributionMode> powerDistNames_;
static const NamedEnum<powerDistributionMode, 3> powerDistypeNames_;
//- Operating mode for power distribution //- Operating mode for power distribution
powerDistributionMode mode_; powerDistributionMode mode_;
@ -214,11 +213,11 @@ private:
) const; ) const;
//- Disallow default bitwise copy construct //- No copy construct
laserDTRM(const laserDTRM&); laserDTRM(const laserDTRM&) = delete;
//- Disallow default bitwise assignment //- No copy assignment
void operator=(const laserDTRM&); void operator=(const laserDTRM&) = delete;
public: public:
@ -242,23 +241,22 @@ public:
// Member functions // Member functions
// Edit
// Edit //- Solve radiation equation(s)
void calculate();
//- Solve radiation equation(s) //- Read radiation properties dictionary
void calculate(); bool read();
//- Read radiation properties dictionary
bool read();
// Access // Access
//- Source term component (for power of T^4) //- Source term component (for power of T^4)
virtual tmp<volScalarField> Rp() const; virtual tmp<volScalarField> Rp() const;
//- Source term component (constant) //- Source term component (constant)
virtual tmp<DimensionedField<scalar, volMesh> > Ru() const; virtual tmp<DimensionedField<scalar, volMesh>> Ru() const;
}; };

View File

@ -84,7 +84,6 @@ Foam::radiation::localDensityAbsorptionEmission::localDensityAbsorptionEmission
Foam::tmp<Foam::volScalarField> Foam::tmp<Foam::volScalarField>
Foam::radiation::localDensityAbsorptionEmission::aCont(const label bandI) const Foam::radiation::localDensityAbsorptionEmission::aCont(const label bandI) const
{ {
tmp<volScalarField> ta tmp<volScalarField> ta
( (
new volScalarField new volScalarField
@ -99,7 +98,7 @@ Foam::radiation::localDensityAbsorptionEmission::aCont(const label bandI) const
false false
), ),
mesh_, mesh_,
dimensionedScalar("zero", inv(dimLength), 0) dimensionedScalar(inv(dimLength), Zero)
) )
); );
@ -132,7 +131,7 @@ Foam::radiation::localDensityAbsorptionEmission::eCont(const label bandI) const
false false
), ),
mesh_, mesh_,
dimensionedScalar("zero", inv(dimLength), 0) dimensionedScalar(inv(dimLength), Zero)
) )
); );
@ -165,7 +164,7 @@ Foam::radiation::localDensityAbsorptionEmission::ECont(const label bandI) const
false false
), ),
mesh_, mesh_,
dimensionedScalar("zero", dimMass/dimLength/pow3(dimTime), 0.0) dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero)
) )
); );

View File

@ -99,28 +99,17 @@ public:
// Member Functions // Member Functions
// Access //- Absorption coefficient for continuous phase
tmp<volScalarField> aCont(const label bandI = 0) const;
// Absorption coefficient //- Emission coefficient for continuous phase
tmp<volScalarField> eCont(const label bandI = 0) const;
//- Absorption coefficient for continuous phase //- Emission contribution for continuous phase
tmp<volScalarField> aCont(const label bandI = 0) const; tmp<volScalarField> ECont(const label bandI = 0) const;
// Emission coefficient //- Is grey
//- Emission coefficient for continuous phase
tmp<volScalarField> eCont(const label bandI = 0) const;
// Emission contribution
//- Emission contribution for continuous phase
tmp<volScalarField> ECont(const label bandI = 0) const;
// Member Functions
inline bool isGrey() const inline bool isGrey() const
{ {
return true; return true;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd. \\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -59,12 +59,6 @@ Foam::radiation::Fresnel::Fresnel
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::radiation::Fresnel::~Fresnel()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::scalar Foam::radiation::Fresnel::rho Foam::scalar Foam::radiation::Fresnel::rho

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd. \\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,7 +25,7 @@ Class
Foam::radiation::Fresnel Foam::radiation::Fresnel
Description Description
Genral Fresnel reflection model bewtween a dialectric and an absorbing General Fresnel reflection model bewtween a dialectric and an absorbing
medium. medium.
Radiative heat transfer. Micheal Modest. 3dr Edition. Chapter 2.5 Radiative heat transfer. Micheal Modest. 3dr Edition. Chapter 2.5
@ -76,7 +76,7 @@ public:
Fresnel(const dictionary& dict, const fvMesh& mesh); Fresnel(const dictionary& dict, const fvMesh& mesh);
//- Destructor //- Destructor
virtual ~Fresnel(); virtual ~Fresnel() = default;
// Member Functions // Member Functions

View File

@ -90,5 +90,4 @@ Foam::vector Foam::radiation::FresnelLaser::R
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -25,7 +25,6 @@ Class
Foam::radiation::FresnelLaser Foam::radiation::FresnelLaser
Description Description
Modified Fresnel reflection model. Modified Fresnel reflection model.
\verbatim \verbatim

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd. \\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd. \\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd. \\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd. \\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd. \\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -35,18 +35,17 @@ Foam::radiation::reflectionModel::New
const fvMesh& mesh const fvMesh& mesh
) )
{ {
const word modelType(dict.lookup("type")); const word modelType(dict.get<word>("type"));
Info<< "Selecting reflectionModel " << modelType << endl; Info<< "Selecting reflectionModel " << modelType << endl;
const auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType); const auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
if (!cstrIter.found()) if (!cstrIter.found())
{ {
FatalIOErrorInFunction(dict) FatalIOErrorInFunction(dict)
<< "Unknown reflectionModel type " << "Unknown reflectionModel type " << modelType << nl << nl
<< modelType << nl << nl << "Valid types :" << nl
<< "Valid reflectionModel types are :" << nl
<< dictionaryConstructorTablePtr_->sortedToc() << dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalIOError); << exit(FatalIOError);
} }

View File

@ -36,26 +36,13 @@ namespace Foam
} }
namespace Foam const Foam::Enum<Foam::interfaceCompositionModel::modelVariable>
Foam::interfaceCompositionModel::modelVariableNames
{ {
template<> { modelVariable::T, "temperature" },
const char* Foam::NamedEnum { modelVariable::P, "pressure" },
< { modelVariable::Y, "massFraction" },
Foam::interfaceCompositionModel::modelVariable, };
3
>::names[] =
{
"temperature",
"pressure",
"massFraction"
};
}
const Foam::NamedEnum
<
Foam::interfaceCompositionModel::modelVariable,
3
> Foam::interfaceCompositionModel::modelVariableNames;
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //

View File

@ -43,7 +43,7 @@ SourceFiles
#include "dictionary.H" #include "dictionary.H"
#include "hashedWordList.H" #include "hashedWordList.H"
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"
#include "NamedEnum.H" #include "Enum.H"
namespace Foam namespace Foam
{ {
@ -69,7 +69,7 @@ public:
Y /* mass fraction based */ Y /* mass fraction based */
}; };
static const NamedEnum<modelVariable, 3> modelVariableNames; static const Enum<modelVariable> modelVariableNames;
//- Enumeration for model variables //- Enumeration for model variables
modelVariable modelVariable_; modelVariable modelVariable_;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2017 OpenCFD Ltd. \\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -67,14 +67,14 @@ Foam::multiphaseSystem::multiphaseSystem
{ {
label phaseI = 0; label phaseI = 0;
phases_.setSize(phaseModels_.size()); phases_.setSize(phaseModels_.size());
forAllConstIter(HashTable<autoPtr<phaseModel> >, phaseModels_, iter) forAllConstIter(HashTable<autoPtr<phaseModel>>, phaseModels_, iter)
{ {
phaseModel& pm = const_cast<phaseModel&>(iter()()); phaseModel& pm = const_cast<phaseModel&>(iter()());
phases_.set(phaseI++, &pm); phases_.set(phaseI++, &pm);
} }
// Initiate Su and Sp // Initiate Su and Sp
forAllConstIter(HashTable<autoPtr<phaseModel> >, phaseModels_, iter) forAllConstIter(HashTable<autoPtr<phaseModel>>, phaseModels_, iter)
{ {
phaseModel& pm = const_cast<phaseModel&>(iter()()); phaseModel& pm = const_cast<phaseModel&>(iter()());
@ -90,7 +90,7 @@ Foam::multiphaseSystem::multiphaseSystem
mesh_ mesh_
), ),
mesh_, mesh_,
dimensionedScalar("Su", dimless/dimTime, 0.0) dimensionedScalar(dimless/dimTime, Zero)
) )
); );
@ -106,7 +106,7 @@ Foam::multiphaseSystem::multiphaseSystem
mesh_ mesh_
), ),
mesh_, mesh_,
dimensionedScalar("Sp", dimless/dimTime, 0.0) dimensionedScalar(dimless/dimTime, Zero)
) )
); );
} }
@ -274,7 +274,7 @@ void Foam::multiphaseSystem::solve()
mesh.solverDict("alpha").lookup("cAlphas") >> cAlphas_; mesh.solverDict("alpha").lookup("cAlphas") >> cAlphas_;
// Reset ddtAlphaMax // Reset ddtAlphaMax
ddtAlphaMax_ = dimensionedScalar("zero", dimless, 0.0); ddtAlphaMax_ = dimensionedScalar(dimless, Zero);
PtrList<surfaceScalarField> phiAlphaCorrs(phases_.size()); PtrList<surfaceScalarField> phiAlphaCorrs(phases_.size());
@ -387,8 +387,8 @@ void Foam::multiphaseSystem::solve()
forAllIter(UPtrList<phaseModel>, phases_, iter) forAllIter(UPtrList<phaseModel>, phases_, iter)
{ {
phaseModel& phase = iter(); phaseModel& phase = iter();
Su_[phase.name()] = dimensionedScalar("Su", dimless/dimTime, 0.0); Su_[phase.name()] = dimensionedScalar("Su", dimless/dimTime, Zero);
Sp_[phase.name()] = dimensionedScalar("Sp", dimless/dimTime, 0.0); Sp_[phase.name()] = dimensionedScalar("Sp", dimless/dimTime, Zero);
// Add alpha*div(U) // Add alpha*div(U)
const volScalarField& alpha = phase; const volScalarField& alpha = phase;
@ -439,7 +439,7 @@ void Foam::multiphaseSystem::solve()
mesh_ mesh_
), ),
mesh_, mesh_,
dimensionedScalar("sumAlpha", dimless, 0) dimensionedScalar(dimless, Zero)
); );
phasei = 0; phasei = 0;
@ -544,11 +544,11 @@ void Foam::multiphaseSystem::solve()
mesh_ mesh_
), ),
mesh_, mesh_,
dimensionedScalar("sumAlpha", dimless, 0) dimensionedScalar(dimless, Zero)
); );
// Reset rhoPhi // Reset rhoPhi
rhoPhi_ = dimensionedScalar("rhoPhi", dimMass/dimTime, 0.0); rhoPhi_ = dimensionedScalar("rhoPhi", dimMass/dimTime, Zero);
forAllIter(UPtrList<phaseModel>, phases_, iter) forAllIter(UPtrList<phaseModel>, phases_, iter)
{ {

View File

@ -148,7 +148,7 @@ protected:
//- Generate the phases //- Generate the phases
HashTable<autoPtr<phaseModel> > generatePhaseModels HashTable<autoPtr<phaseModel>> generatePhaseModels
( (
const wordList& names const wordList& names
) const; ) const;
@ -156,7 +156,7 @@ protected:
//- Generate the mixture flux //- Generate the mixture flux
tmp<surfaceScalarField> generatePhi tmp<surfaceScalarField> generatePhi
( (
const HashTable<autoPtr<phaseModel> >& phaseModels const HashTable<autoPtr<phaseModel>>& phaseModels
) const; ) const;
//- Generate pairs //- Generate pairs
@ -228,7 +228,7 @@ protected:
const word& modelName, const word& modelName,
HashTable HashTable
< <
HashTable<autoPtr<modelType> >, HashTable<autoPtr<modelType>>,
phasePairKey, phasePairKey,
phasePairKey::hash phasePairKey::hash
>& models >& models

View File

@ -132,7 +132,7 @@ void Foam::phaseSystem::generatePairsAndSubModels
const word& modelName, const word& modelName,
HashTable HashTable
< <
HashTable<autoPtr<modelType> >, HashTable<autoPtr<modelType>>,
phasePairKey, phasePairKey,
phasePairKey::hash phasePairKey::hash
>& models >& models
@ -160,7 +160,7 @@ void Foam::phaseSystem::generatePairsAndSubModels
models.insert models.insert
( (
key, key,
HashTable<autoPtr<modelType> >() HashTable<autoPtr<modelType>>()
); );
} }