Commit b708c23c authored by Andrew Heather's avatar Andrew Heather
Browse files

ENH: Clean-up after latest Foundation integrations

parent dcb1a95e
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"
......@@ -81,6 +81,7 @@ wmake $targetType rigidBodyDynamics
wmake $targetType rigidBodyMeshMotion
# Needs access to Turbulence
wmake $targetType thermophysicalModels/properties/liquidPropertiesFvPatchFields
wmake $targetType thermophysicalModels/thermophysicalPropertiesFvPatchFields/liquidProperties
#------------------------------------------------------------------------------
......@@ -58,7 +58,7 @@ FSD<CombThermoType, ThermoType>::FSD
(
this->coeffs(),
this->mesh(),
*this
*this
)
),
ft_
......@@ -190,14 +190,18 @@ void FSD<CombThermoType, ThermoType>::calculateSourceNorm()
volScalarField& omegaFuelBar = tomegaFuel.ref();
// Calculation of the mixture fraction variance (ftVar)
// TODO: generalize delta for RAS and LES.
const volScalarField& delta =
refCast<const compressible::LESModel>(this->turbulence()).delta();
const compressible::LESModel& lesModel =
YO2.db().lookupObject<compressible::LESModel>
(
turbulenceModel::propertiesName
);
const volScalarField& delta = lesModel.delta();
const volScalarField ftVar(Cv_*sqr(delta)*sqr(mgft));
// Thickened flame (average flame thickness for counterflow configuration
// is 1.5 mm)
volScalarField deltaF
(
delta/dimensionedScalar("flame", dimLength, 1.5e-3)
......
......@@ -19,16 +19,17 @@ eddyDissipationDiffusionModel/eddyDissipationDiffusionModels.C
laminar/laminars.C
/*
FSD/reactionRateFlameAreaModels/consumptionSpeed/consumptionSpeed.C
FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameArea.C
FSD/reactionRateFlameAreaModels/reactionRateFlameArea/reactionRateFlameAreaNew.C
FSD/reactionRateFlameAreaModels/relaxation/relaxation.C
FSD/FSDs.C
*/
diffusionMulticomponent/diffusionMulticomponents.C
zoneCombustion/zoneCombustions.C
noCombustion/noCombustions.C
......
......@@ -369,8 +369,10 @@ diffusionMulticomponent<CombThermoType, ThermoType>::correct()
template<class CombThermoType, class ThermoType>
Foam::tmp<Foam::fvScalarMatrix>
Foam::combustionModels::diffusionMulticomponent<CombThermoType, ThermoType>::
R(volScalarField& Y) const
Foam::combustionModels::diffusionMulticomponent<CombThermoType, ThermoType>::R
(
volScalarField& Y
) const
{
tmp<fvScalarMatrix> tSu(new fvScalarMatrix(Y, dimMass/dimTime));
......@@ -378,7 +380,7 @@ R(volScalarField& Y) const
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);
}
......@@ -389,15 +391,15 @@ R(volScalarField& Y) const
template<class CombThermoType, class ThermoType>
Foam::tmp<Foam::volScalarField>
Foam::combustionModels::diffusionMulticomponent<CombThermoType, ThermoType>::
dQ() const
Qdot() const
{
tmp<volScalarField> tdQ
tmp<volScalarField> tQdot
(
new volScalarField
(
IOobject
(
"dQ",
"Qdot",
this->mesh().time().timeName(),
this->mesh(),
IOobject::NO_READ,
......@@ -412,45 +414,11 @@ dQ() const
if (this->active())
{
volScalarField& dQ = tdQ.ref();
dQ = this->chemistryPtr_->dQ();
}
return tdQ;
}
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();
volScalarField& Qdot = tQdot.ref();
Qdot = this->chemistryPtr_->Qdot();
}
return tSh;
return tQdot;
}
......
......@@ -191,10 +191,7 @@ public:
virtual tmp<fvScalarMatrix> R(volScalarField& Y) const;
//- Heat release rate calculated from fuel consumption rate matrix
virtual tmp<volScalarField> dQ() const;
//- Return source for enthalpy equation [kg/m/s3]
virtual tmp<volScalarField> Sh() const;
virtual tmp<volScalarField> Qdot() const;
// IO
......
......@@ -196,10 +196,12 @@ void Foam::functionObjects::fieldMinMax::calcMinMaxFields
label mini = findMin(minVs);
scalar minValue = minVs[mini];
const label minCell = minCells[mini];
const vector& minC = minCs[mini];
label maxi = findMax(maxVs);
scalar maxValue = maxVs[maxi];
const label maxCell = minCells[maxi];
const vector& maxC = maxCs[maxi];
output
......
......@@ -986,11 +986,14 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::write()
{
if (validField<scalar>(weightFieldName_))
{
scalarField weightField = getFieldValues<scalar>
scalarField weightField
(
weightFieldName_,
true,
orientWeightField_
getFieldValues<scalar>
(
weightFieldName_,
true,
orientWeightField_
)
);
// Process the fields
......@@ -998,11 +1001,14 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::write()
}
else if (validField<vector>(weightFieldName_))
{
vectorField weightField = getFieldValues<vector>
vectorField weightField
(
weightFieldName_,
true,
orientWeightField_
getFieldValues<vector>
(
weightFieldName_,
true,
orientWeightField_
)
);
// Process the fields
......
......@@ -147,17 +147,6 @@ processSameTypeValues
break;
}
case opWeightedSum:
{
if (weightField.size())
{
result = sum(weightField*values);
}
else
{
result = sum(values);
}
break;
}
{
if (returnReduce(weightField.empty(), andOp<bool>()))
{
......@@ -165,7 +154,7 @@ processSameTypeValues
}
else
{
tmp<scalarField> weight = weightingFactor(weightField);
tmp<scalarField> weight(weightingFactor(weightField));
result = gSum(weight*values);
}
......@@ -202,7 +191,7 @@ processSameTypeValues
}
else
{
const scalarField factor = weightingFactor(weightField);
const scalarField factor(weightingFactor(weightField));
result = gSum(factor*values)/(gSum(factor) + ROOTVSMALL);
}
......@@ -217,7 +206,7 @@ processSameTypeValues
}
case opWeightedAreaAverage:
{
const scalarField factor = weightingFactor(weightField, Sf);
const scalarField factor(weightingFactor(weightField, Sf));
result = gSum(factor*values)/gSum(factor + ROOTVSMALL);
break;
......@@ -231,25 +220,11 @@ processSameTypeValues
}
case opWeightedAreaIntegrate:
{
const scalarField factor = weightingFactor(weightField, Sf);
const scalarField factor(weightingFactor(weightField, Sf));
result = gSum(factor*values);
break;
}
case opWeightedAreaIntegrate:
{
const scalarField magSf(mag(Sf));
if (weightField.size())
{
result = sum(weightField*magSf*values);
}
else
{
result = sum(magSf*values);
}
break;
}
case opMin:
{
result = gMin(values);
......
......@@ -379,6 +379,7 @@ void Foam::ParticleCollector<CloudType>::collectParcelConcentricCircles
scalar(nSector_)*theta/constant::mathematical::twoPi
);
}
}
if (secI != -1)
{
......
......@@ -42,9 +42,18 @@ namespace Foam
// * * * * * * * * * * * * * 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())
{
FatalErrorInFunction
......@@ -59,7 +68,8 @@ Foam::fileName Foam::triSurfaceMesh::checkFile(const IOobject& io)
Foam::fileName Foam::triSurfaceMesh::checkFile
(
const IOobject& io,
const dictionary& dict
const dictionary& dict,
const bool isGlobal
)
{
fileName fName;
......@@ -79,7 +89,8 @@ Foam::fileName Foam::triSurfaceMesh::checkFile
}
else
{
fName = io.filePath();
fName = (isGlobal ? io.globalFilePath() : io.localFilePath());
if (!exists(fName))
{
FatalErrorInFunction
......@@ -240,7 +251,7 @@ Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io)
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)),
minQuality_(-1),
surfaceClosed_(-1),
......@@ -273,7 +284,10 @@ Foam::triSurfaceMesh::triSurfaceMesh
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),
minQuality_(-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 * * * * * * * * * * * * * * * //
Foam::triSurfaceMesh::~triSurfaceMesh()
......
......@@ -93,10 +93,15 @@ class triSurfaceMesh
// Private Member Functions
//- 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
static fileName checkFile(const IOobject&, const dictionary&);
static fileName checkFile
(
const IOobject&,
const dictionary&,
const bool isGlobal
);
//- Helper function for isSurfaceClosed
static bool addFaceToEdge
......@@ -141,7 +146,7 @@ public:
//- Construct from triSurface
triSurfaceMesh(const IOobject&, const triSurface&);
//- Construct read.
//- Construct read
triSurfaceMesh(const IOobject& io);
//- 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
virtual ~triSurfaceMesh();
......@@ -285,9 +303,30 @@ public:
IOstream::versionNumber ver,
IOstream::compressionType cmp
) 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
......
......@@ -3,9 +3,9 @@ EXE_INC = \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude