ENH: Clean-up after latest Foundation integrations

This commit is contained in:
Andrew Heather
2017-03-27 14:34:01 +01:00
parent dcb1a95e35
commit b708c23cfc
17 changed files with 433 additions and 393 deletions

View File

@ -1,59 +0,0 @@
Info<< "Reading thermophysical properties\n" << endl;
autoPtr<fluidThermo> pThermo
(
fluidThermo::New(mesh)
);
fluidThermo& thermo = pThermo();
thermo.validate(args.executable(), "h", "e");
volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
thermo.rho()
);
volScalarField& p = thermo.p();
Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
#include "compressibleCreatePhi.H"
pressureControl pressureControl(p, rho, simple.dict());
mesh.setFluxRequired(p.name());
Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::turbulenceModel> turbulence
(
compressible::turbulenceModel::New
(
rho,
U,
phi,
thermo
)
);
dimensionedScalar initialMass = fvc::domainIntegrate(rho);
#include "createMRF.H"

View File

@ -81,6 +81,7 @@ wmake $targetType rigidBodyDynamics
wmake $targetType rigidBodyMeshMotion wmake $targetType rigidBodyMeshMotion
# Needs access to Turbulence # Needs access to Turbulence
wmake $targetType thermophysicalModels/properties/liquidPropertiesFvPatchFields
wmake $targetType thermophysicalModels/thermophysicalPropertiesFvPatchFields/liquidProperties
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -190,14 +190,18 @@ void FSD<CombThermoType, ThermoType>::calculateSourceNorm()
volScalarField& omegaFuelBar = tomegaFuel.ref(); volScalarField& omegaFuelBar = tomegaFuel.ref();
// Calculation of the mixture fraction variance (ftVar) // Calculation of the mixture fraction variance (ftVar)
// TODO: generalize delta for RAS and LES. const compressible::LESModel& lesModel =
const volScalarField& delta = YO2.db().lookupObject<compressible::LESModel>
refCast<const compressible::LESModel>(this->turbulence()).delta(); (
turbulenceModel::propertiesName
);
const volScalarField& delta = lesModel.delta();
const volScalarField ftVar(Cv_*sqr(delta)*sqr(mgft)); const volScalarField ftVar(Cv_*sqr(delta)*sqr(mgft));
// Thickened flame (average flame thickness for counterflow configuration // Thickened flame (average flame thickness for counterflow configuration
// is 1.5 mm) // is 1.5 mm)
volScalarField deltaF volScalarField deltaF
( (
delta/dimensionedScalar("flame", dimLength, 1.5e-3) delta/dimensionedScalar("flame", dimLength, 1.5e-3)

View File

@ -19,16 +19,17 @@ eddyDissipationDiffusionModel/eddyDissipationDiffusionModels.C
laminar/laminars.C laminar/laminars.C
/*
FSD/reactionRateFlameAreaModels/consumptionSpeed/consumptionSpeed.C FSD/reactionRateFlameAreaModels/consumptionSpeed/consumptionSpeed.C
FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameArea.C FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameArea.C
FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameAreaNew.C FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameAreaNew.C
FSD/reactionRateFlameAreaModels/relaxation/relaxation.C FSD/reactionRateFlameAreaModels/relaxation/relaxation.C
FSD/FSDs.C FSD/FSDs.C
*/
diffusionMulticomponent/diffusionMulticomponents.C diffusionMulticomponent/diffusionMulticomponents.C
zoneCombustion/zoneCombustions.C zoneCombustion/zoneCombustions.C
noCombustion/noCombustions.C noCombustion/noCombustions.C

View File

@ -369,8 +369,10 @@ diffusionMulticomponent<CombThermoType, ThermoType>::correct()
template<class CombThermoType, class ThermoType> template<class CombThermoType, class ThermoType>
Foam::tmp<Foam::fvScalarMatrix> Foam::tmp<Foam::fvScalarMatrix>
Foam::combustionModels::diffusionMulticomponent<CombThermoType, ThermoType>:: Foam::combustionModels::diffusionMulticomponent<CombThermoType, ThermoType>::R
R(volScalarField& Y) const (
volScalarField& Y
) const
{ {
tmp<fvScalarMatrix> tSu(new fvScalarMatrix(Y, dimMass/dimTime)); tmp<fvScalarMatrix> tSu(new fvScalarMatrix(Y, dimMass/dimTime));
@ -378,7 +380,7 @@ R(volScalarField& Y) const
if (this->active()) if (this->active())
{ {
const label specieI = this->thermo().composition().species()[Y.name()]; const label specieI = this->thermo().composition().species()[Y.member()];
Su += this->chemistryPtr_->RR(specieI); Su += this->chemistryPtr_->RR(specieI);
} }
@ -389,15 +391,15 @@ R(volScalarField& Y) const
template<class CombThermoType, class ThermoType> template<class CombThermoType, class ThermoType>
Foam::tmp<Foam::volScalarField> Foam::tmp<Foam::volScalarField>
Foam::combustionModels::diffusionMulticomponent<CombThermoType, ThermoType>:: Foam::combustionModels::diffusionMulticomponent<CombThermoType, ThermoType>::
dQ() const Qdot() const
{ {
tmp<volScalarField> tdQ tmp<volScalarField> tQdot
( (
new volScalarField new volScalarField
( (
IOobject IOobject
( (
"dQ", "Qdot",
this->mesh().time().timeName(), this->mesh().time().timeName(),
this->mesh(), this->mesh(),
IOobject::NO_READ, IOobject::NO_READ,
@ -412,45 +414,11 @@ dQ() const
if (this->active()) if (this->active())
{ {
volScalarField& dQ = tdQ.ref(); volScalarField& Qdot = tQdot.ref();
dQ = this->chemistryPtr_->dQ(); Qdot = this->chemistryPtr_->Qdot();
} }
return tdQ; return tQdot;
}
template<class CombThermoType, class ThermoType>
Foam::tmp<Foam::volScalarField>
Foam::combustionModels::diffusionMulticomponent<CombThermoType, ThermoType>::
Sh() const
{
tmp<volScalarField> tSh
(
new volScalarField
(
IOobject
(
"Sh",
this->mesh().time().timeName(),
this->mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
this->mesh(),
dimensionedScalar("zero", dimEnergy/dimTime/dimVolume, 0.0),
zeroGradientFvPatchScalarField::typeName
)
);
if (this->active())
{
scalarField& Sh = tSh.ref();
Sh = this->chemistryPtr_->Sh();
}
return tSh;
} }

View File

@ -191,10 +191,7 @@ public:
virtual tmp<fvScalarMatrix> R(volScalarField& Y) const; virtual tmp<fvScalarMatrix> R(volScalarField& Y) const;
//- Heat release rate calculated from fuel consumption rate matrix //- Heat release rate calculated from fuel consumption rate matrix
virtual tmp<volScalarField> dQ() const; virtual tmp<volScalarField> Qdot() const;
//- Return source for enthalpy equation [kg/m/s3]
virtual tmp<volScalarField> Sh() const;
// IO // IO

View File

@ -196,10 +196,12 @@ void Foam::functionObjects::fieldMinMax::calcMinMaxFields
label mini = findMin(minVs); label mini = findMin(minVs);
scalar minValue = minVs[mini]; scalar minValue = minVs[mini];
const label minCell = minCells[mini];
const vector& minC = minCs[mini]; const vector& minC = minCs[mini];
label maxi = findMax(maxVs); label maxi = findMax(maxVs);
scalar maxValue = maxVs[maxi]; scalar maxValue = maxVs[maxi];
const label maxCell = minCells[maxi];
const vector& maxC = maxCs[maxi]; const vector& maxC = maxCs[maxi];
output output

View File

@ -986,11 +986,14 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::write()
{ {
if (validField<scalar>(weightFieldName_)) if (validField<scalar>(weightFieldName_))
{ {
scalarField weightField = getFieldValues<scalar> scalarField weightField
(
getFieldValues<scalar>
( (
weightFieldName_, weightFieldName_,
true, true,
orientWeightField_ orientWeightField_
)
); );
// Process the fields // Process the fields
@ -998,11 +1001,14 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::write()
} }
else if (validField<vector>(weightFieldName_)) else if (validField<vector>(weightFieldName_))
{ {
vectorField weightField = getFieldValues<vector> vectorField weightField
(
getFieldValues<vector>
( (
weightFieldName_, weightFieldName_,
true, true,
orientWeightField_ orientWeightField_
)
); );
// Process the fields // Process the fields

View File

@ -147,17 +147,6 @@ processSameTypeValues
break; break;
} }
case opWeightedSum: case opWeightedSum:
{
if (weightField.size())
{
result = sum(weightField*values);
}
else
{
result = sum(values);
}
break;
}
{ {
if (returnReduce(weightField.empty(), andOp<bool>())) if (returnReduce(weightField.empty(), andOp<bool>()))
{ {
@ -165,7 +154,7 @@ processSameTypeValues
} }
else else
{ {
tmp<scalarField> weight = weightingFactor(weightField); tmp<scalarField> weight(weightingFactor(weightField));
result = gSum(weight*values); result = gSum(weight*values);
} }
@ -202,7 +191,7 @@ processSameTypeValues
} }
else else
{ {
const scalarField factor = weightingFactor(weightField); const scalarField factor(weightingFactor(weightField));
result = gSum(factor*values)/(gSum(factor) + ROOTVSMALL); result = gSum(factor*values)/(gSum(factor) + ROOTVSMALL);
} }
@ -217,7 +206,7 @@ processSameTypeValues
} }
case opWeightedAreaAverage: case opWeightedAreaAverage:
{ {
const scalarField factor = weightingFactor(weightField, Sf); const scalarField factor(weightingFactor(weightField, Sf));
result = gSum(factor*values)/gSum(factor + ROOTVSMALL); result = gSum(factor*values)/gSum(factor + ROOTVSMALL);
break; break;
@ -231,25 +220,11 @@ processSameTypeValues
} }
case opWeightedAreaIntegrate: case opWeightedAreaIntegrate:
{ {
const scalarField factor = weightingFactor(weightField, Sf); const scalarField factor(weightingFactor(weightField, Sf));
result = gSum(factor*values); result = gSum(factor*values);
break; break;
} }
case opWeightedAreaIntegrate:
{
const scalarField magSf(mag(Sf));
if (weightField.size())
{
result = sum(weightField*magSf*values);
}
else
{
result = sum(magSf*values);
}
break;
}
case opMin: case opMin:
{ {
result = gMin(values); result = gMin(values);

View File

@ -379,6 +379,7 @@ void Foam::ParticleCollector<CloudType>::collectParcelConcentricCircles
scalar(nSector_)*theta/constant::mathematical::twoPi scalar(nSector_)*theta/constant::mathematical::twoPi
); );
} }
}
if (secI != -1) if (secI != -1)
{ {

View File

@ -42,9 +42,18 @@ namespace Foam
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::fileName Foam::triSurfaceMesh::checkFile(const IOobject& io) Foam::fileName Foam::triSurfaceMesh::checkFile
(
const IOobject& io,
const bool isGlobal
)
{ {
const fileName fName(io.filePath()); const fileName fName
(
isGlobal
? io.globalFilePath()
: io.localFilePath()
);
if (fName.empty()) if (fName.empty())
{ {
FatalErrorInFunction FatalErrorInFunction
@ -59,7 +68,8 @@ Foam::fileName Foam::triSurfaceMesh::checkFile(const IOobject& io)
Foam::fileName Foam::triSurfaceMesh::checkFile Foam::fileName Foam::triSurfaceMesh::checkFile
( (
const IOobject& io, const IOobject& io,
const dictionary& dict const dictionary& dict,
const bool isGlobal
) )
{ {
fileName fName; fileName fName;
@ -79,7 +89,8 @@ Foam::fileName Foam::triSurfaceMesh::checkFile
} }
else else
{ {
fName = io.filePath(); fName = (isGlobal ? io.globalFilePath() : io.localFilePath());
if (!exists(fName)) if (!exists(fName))
{ {
FatalErrorInFunction FatalErrorInFunction
@ -240,7 +251,7 @@ Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io)
false // searchableSurface already registered under name false // searchableSurface already registered under name
) )
), ),
triSurface(checkFile(static_cast<const searchableSurface&>(*this))), triSurface(checkFile(static_cast<const searchableSurface&>(*this), true)),
triSurfaceRegionSearch(static_cast<const triSurface&>(*this)), triSurfaceRegionSearch(static_cast<const triSurface&>(*this)),
minQuality_(-1), minQuality_(-1),
surfaceClosed_(-1), surfaceClosed_(-1),
@ -273,7 +284,10 @@ Foam::triSurfaceMesh::triSurfaceMesh
false // searchableSurface already registered under name false // searchableSurface already registered under name
) )
), ),
triSurface(checkFile(static_cast<const searchableSurface&>(*this), dict)), triSurface
(
checkFile(static_cast<const searchableSurface&>(*this), dict, true)
),
triSurfaceRegionSearch(static_cast<const triSurface&>(*this), dict), triSurfaceRegionSearch(static_cast<const triSurface&>(*this), dict),
minQuality_(-1), minQuality_(-1),
surfaceClosed_(-1), surfaceClosed_(-1),
@ -307,6 +321,97 @@ Foam::triSurfaceMesh::triSurfaceMesh
} }
Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io, const bool isGlobal)
:
// Find instance for triSurfaceMesh
searchableSurface(io),
// Reused found instance in objectRegistry
objectRegistry
(
IOobject
(
io.name(),
searchableSurface::instance(),
io.local(),
io.db(),
io.readOpt(),
io.writeOpt(),
false // searchableSurface already registered under name
)
),
triSurface
(
checkFile(static_cast<const searchableSurface&>(*this), isGlobal)
),
triSurfaceRegionSearch(static_cast<const triSurface&>(*this)),
minQuality_(-1),
surfaceClosed_(-1),
outsideVolType_(volumeType::UNKNOWN)
{
const pointField& pts = triSurface::points();
bounds() = boundBox(pts, isGlobal);
}
Foam::triSurfaceMesh::triSurfaceMesh
(
const IOobject& io,
const dictionary& dict,
const bool isGlobal
)
:
searchableSurface(io),
// Reused found instance in objectRegistry
objectRegistry
(
IOobject
(
io.name(),
searchableSurface::instance(),
io.local(),
io.db(),
io.readOpt(),
io.writeOpt(),
false // searchableSurface already registered under name
)
),
triSurface
(
checkFile(static_cast<const searchableSurface&>(*this), dict, isGlobal)
),
triSurfaceRegionSearch(static_cast<const triSurface&>(*this), dict),
minQuality_(-1),
surfaceClosed_(-1),
outsideVolType_(volumeType::UNKNOWN)
{
// Reading from supplied file name instead of objectPath/filePath
dict.readIfPresent("file", fName_, false, false);
scalar scaleFactor = 0;
// Allow rescaling of the surface points
// eg, CAD geometries are often done in millimeters
if (dict.readIfPresent("scale", scaleFactor) && scaleFactor > 0)
{
Info<< searchableSurface::name() << " : using scale " << scaleFactor
<< endl;
triSurface::scalePoints(scaleFactor);
}
const pointField& pts = triSurface::points();
bounds() = boundBox(pts, isGlobal);
// Have optional minimum quality for normal calculation
if (dict.readIfPresent("minQuality", minQuality_) && minQuality_ > 0)
{
Info<< searchableSurface::name()
<< " : ignoring triangles with quality < "
<< minQuality_ << " for normals calculation." << endl;
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::triSurfaceMesh::~triSurfaceMesh() Foam::triSurfaceMesh::~triSurfaceMesh()

View File

@ -93,10 +93,15 @@ class triSurfaceMesh
// Private Member Functions // Private Member Functions
//- Return fileName to load IOobject from //- Return fileName to load IOobject from
static fileName checkFile(const IOobject& io); static fileName checkFile(const IOobject& io, const bool isGlobal);
//- Return fileName to load IOobject from. Optional override of fileName //- Return fileName to load IOobject from. Optional override of fileName
static fileName checkFile(const IOobject&, const dictionary&); static fileName checkFile
(
const IOobject&,
const dictionary&,
const bool isGlobal
);
//- Helper function for isSurfaceClosed //- Helper function for isSurfaceClosed
static bool addFaceToEdge static bool addFaceToEdge
@ -141,7 +146,7 @@ public:
//- Construct from triSurface //- Construct from triSurface
triSurfaceMesh(const IOobject&, const triSurface&); triSurfaceMesh(const IOobject&, const triSurface&);
//- Construct read. //- Construct read
triSurfaceMesh(const IOobject& io); triSurfaceMesh(const IOobject& io);
//- Construct from IO and dictionary (used by searchableSurface). //- Construct from IO and dictionary (used by searchableSurface).
@ -153,6 +158,19 @@ public:
); );
// Special constructors for use by distributedTriSurface. File search
// status (local/global) supplied.
triSurfaceMesh(const IOobject& io, const bool isGlobal);
triSurfaceMesh
(
const IOobject& io,
const dictionary& dict,
const bool isGlobal
);
//- Destructor //- Destructor
virtual ~triSurfaceMesh(); virtual ~triSurfaceMesh();
@ -285,9 +303,30 @@ public:
IOstream::versionNumber ver, IOstream::versionNumber ver,
IOstream::compressionType cmp IOstream::compressionType cmp
) const; ) const;
//- Is object global
virtual bool global() const
{
return true;
}
//- Return complete path + object name if the file exists
// either in the case/processor or case otherwise null
virtual fileName filePath() const
{
return searchableSurface::globalFilePath();
}
}; };
//- Template function for obtaining global status
template<>
inline bool typeGlobal<triSurfaceMesh>()
{
return true;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam

View File

@ -3,9 +3,9 @@ EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude -I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude
LIB_LIBS = \ LIB_LIBS = \
-lfiniteVolume \ -lfiniteVolume \
-lcompressibleTurbulenceModels \ -lcompressibleTurbulenceModels \
-lliquidProperties -lthermophysicalProperties