mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Modification to regionModel and thermoBaffle models and bug in
externalWallHeatFlux
This commit is contained in:
@ -44,19 +44,22 @@ namespace regionModels
|
||||
void Foam::regionModels::regionModel::constructMeshObjects()
|
||||
{
|
||||
// construct region mesh
|
||||
regionMeshPtr_.reset
|
||||
(
|
||||
new fvMesh
|
||||
if (!time_.foundObject<fvMesh>(regionName_))
|
||||
{
|
||||
regionMeshPtr_.reset
|
||||
(
|
||||
IOobject
|
||||
new fvMesh
|
||||
(
|
||||
lookup("regionName"),
|
||||
time_.timeName(),
|
||||
time_,
|
||||
IOobject::MUST_READ
|
||||
IOobject
|
||||
(
|
||||
regionName_,
|
||||
time_.timeName(),
|
||||
time_,
|
||||
IOobject::MUST_READ
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -66,19 +69,22 @@ void Foam::regionModels::regionModel::constructMeshObjects
|
||||
)
|
||||
{
|
||||
// construct region mesh
|
||||
regionMeshPtr_.reset
|
||||
(
|
||||
new fvMesh
|
||||
if (!time_.foundObject<fvMesh>(regionName_))
|
||||
{
|
||||
regionMeshPtr_.reset
|
||||
(
|
||||
IOobject
|
||||
new fvMesh
|
||||
(
|
||||
dict.lookup("regionName"),
|
||||
time_.timeName(),
|
||||
time_,
|
||||
IOobject::MUST_READ
|
||||
IOobject
|
||||
(
|
||||
regionName_,
|
||||
time_.timeName(),
|
||||
time_,
|
||||
IOobject::MUST_READ
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -109,11 +115,18 @@ void Foam::regionModels::regionModel::initialise()
|
||||
|
||||
nBoundaryFaces += regionPatch.faceCells().size();
|
||||
|
||||
const mappedWallPolyPatch& mapPatch =
|
||||
refCast<const mappedWallPolyPatch>(regionPatch);
|
||||
const mappedPatchBase& mapPatch =
|
||||
refCast<const mappedPatchBase>(regionPatch);
|
||||
|
||||
const label primaryPatchI = mapPatch.samplePolyPatch().index();
|
||||
primaryPatchIDs.append(primaryPatchI);
|
||||
if
|
||||
(
|
||||
primaryMesh_.time().foundObject<polyMesh>(mapPatch.sampleRegion())
|
||||
)
|
||||
{
|
||||
|
||||
const label primaryPatchI = mapPatch.samplePolyPatch().index();
|
||||
primaryPatchIDs.append(primaryPatchI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -197,7 +210,8 @@ Foam::regionModels::regionModel::regionModel(const fvMesh& mesh)
|
||||
regionMeshPtr_(NULL),
|
||||
coeffs_(dictionary::null),
|
||||
primaryPatchIDs_(),
|
||||
intCoupledPatchIDs_()
|
||||
intCoupledPatchIDs_(),
|
||||
regionName_("none")
|
||||
{}
|
||||
|
||||
|
||||
@ -228,7 +242,8 @@ Foam::regionModels::regionModel::regionModel
|
||||
regionMeshPtr_(NULL),
|
||||
coeffs_(subOrEmptyDict(modelName + "Coeffs")),
|
||||
primaryPatchIDs_(),
|
||||
intCoupledPatchIDs_()
|
||||
intCoupledPatchIDs_(),
|
||||
regionName_(lookup("regionName"))
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
@ -273,7 +288,8 @@ Foam::regionModels::regionModel::regionModel
|
||||
regionMeshPtr_(NULL),
|
||||
coeffs_(dict.subOrEmptyDict(modelName + "Coeffs")),
|
||||
primaryPatchIDs_(),
|
||||
intCoupledPatchIDs_()
|
||||
intCoupledPatchIDs_(),
|
||||
regionName_(dict.lookup("regionName"))
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
@ -312,13 +328,6 @@ void Foam::regionModels::regionModel::evolve()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
if (primaryMesh_.changing())
|
||||
{
|
||||
FatalErrorIn("regionModel::evolve()")
|
||||
<< "Currently not possible to apply " << modelName_
|
||||
<< " model to moving mesh cases" << nl << abort(FatalError);
|
||||
}
|
||||
|
||||
Info<< "\nEvolving " << modelName_ << " for region "
|
||||
<< regionMesh().name() << endl;
|
||||
|
||||
|
||||
@ -117,6 +117,9 @@ protected:
|
||||
//- List of patch IDs internally coupled with the primary region
|
||||
labelList intCoupledPatchIDs_;
|
||||
|
||||
//- Region name
|
||||
word regionName_;
|
||||
|
||||
|
||||
// Protected member functions
|
||||
|
||||
|
||||
@ -60,7 +60,11 @@ inline const Foam::word& Foam::regionModels::regionModel::modelName() const
|
||||
|
||||
inline const Foam::fvMesh& Foam::regionModels::regionModel::regionMesh() const
|
||||
{
|
||||
if (!regionMeshPtr_.valid())
|
||||
if (time_.foundObject<fvMesh>(regionName_))
|
||||
{
|
||||
return time_.lookupObject<fvMesh>(regionName_);
|
||||
}
|
||||
else if (!regionMeshPtr_.valid())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
@ -75,7 +79,14 @@ inline const Foam::fvMesh& Foam::regionModels::regionModel::regionMesh() const
|
||||
|
||||
inline Foam::fvMesh& Foam::regionModels::regionModel::regionMesh()
|
||||
{
|
||||
if (!regionMeshPtr_.valid())
|
||||
if (time_.foundObject<fvMesh>(regionName_))
|
||||
{
|
||||
return const_cast<fvMesh&>
|
||||
(
|
||||
time_.lookupObject<fvMesh>(regionName_)
|
||||
);
|
||||
}
|
||||
else if (!regionMeshPtr_.valid())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
|
||||
@ -39,7 +39,6 @@ namespace regionModels
|
||||
|
||||
void Foam::regionModels::regionModel1D::constructMeshObjects()
|
||||
{
|
||||
const fvMesh& regionMesh = regionMeshPtr_();
|
||||
|
||||
nMagSfPtr_.reset
|
||||
(
|
||||
@ -49,11 +48,11 @@ void Foam::regionModels::regionModel1D::constructMeshObjects()
|
||||
(
|
||||
"nMagSf",
|
||||
time().timeName(),
|
||||
regionMesh,
|
||||
regionMesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
regionMesh,
|
||||
regionMesh(),
|
||||
dimensionedScalar("zero", dimArea, 0.0)
|
||||
)
|
||||
);
|
||||
@ -163,7 +162,7 @@ bool Foam::regionModels::regionModel1D::read(const dictionary& dict)
|
||||
{
|
||||
if (regionModel::read(dict))
|
||||
{
|
||||
moveMesh_.readIfPresent("moveMesh", dict);
|
||||
moveMesh_.readIfPresent("moveMesh", coeffs_);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -27,6 +27,7 @@ License
|
||||
#include "thermoBaffle2D.H"
|
||||
|
||||
#include "fvm.H"
|
||||
#include "fvcDiv.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
#include "fvMatrices.H"
|
||||
@ -58,6 +59,13 @@ bool thermoBaffle2D::read()
|
||||
}
|
||||
|
||||
|
||||
bool thermoBaffle2D::read(const dictionary& dict)
|
||||
{
|
||||
this->solution().lookup("nNonOrthCorr") >> nNonOrthCorr_;
|
||||
return regionModel1D::read(dict);
|
||||
}
|
||||
|
||||
|
||||
void thermoBaffle2D::solveEnergy()
|
||||
{
|
||||
if (debug)
|
||||
@ -128,6 +136,19 @@ void thermoBaffle2D::solveEnergy()
|
||||
Q
|
||||
);
|
||||
|
||||
if (moveMesh_)
|
||||
{
|
||||
surfaceScalarField phiMesh
|
||||
(
|
||||
fvc::interpolate(rhoCp*T_)*regionMesh().phi()
|
||||
);
|
||||
|
||||
TEqn -= fvc::div(phiMesh);
|
||||
}
|
||||
|
||||
Info<< "T gas min/max = " << min(T_).value() << ", "
|
||||
<< max(T_).value() << endl;
|
||||
|
||||
TEqn.relax();
|
||||
TEqn.solve();
|
||||
|
||||
@ -157,7 +178,7 @@ thermoBaffle2D::thermoBaffle2D
|
||||
regionMesh().time().timeName(),
|
||||
regionMesh(),
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
regionMesh(),
|
||||
dimensionedScalar
|
||||
@ -175,7 +196,7 @@ thermoBaffle2D::thermoBaffle2D
|
||||
regionMesh().time().timeName(),
|
||||
regionMesh(),
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
regionMesh(),
|
||||
dimensionedScalar
|
||||
@ -209,7 +230,7 @@ thermoBaffle2D::thermoBaffle2D
|
||||
regionMesh().time().timeName(),
|
||||
regionMesh(),
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
regionMesh(),
|
||||
dimensionedScalar
|
||||
@ -227,7 +248,7 @@ thermoBaffle2D::thermoBaffle2D
|
||||
regionMesh().time().timeName(),
|
||||
regionMesh(),
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
regionMesh(),
|
||||
dimensionedScalar
|
||||
|
||||
@ -102,9 +102,13 @@ protected:
|
||||
|
||||
// Protected member functions
|
||||
|
||||
//- Read control parameters from dictionary
|
||||
//- Read control parameters IO dictionary
|
||||
virtual bool read();
|
||||
|
||||
//- Read control parameters from dictionary
|
||||
virtual bool read(const dictionary& dict);
|
||||
|
||||
|
||||
// Equations
|
||||
|
||||
//- Solve energy equation
|
||||
|
||||
@ -53,6 +53,13 @@ bool thermoBaffleModel::read()
|
||||
}
|
||||
|
||||
|
||||
bool thermoBaffleModel::read(const dictionary& dict)
|
||||
{
|
||||
regionModel1D::read(dict);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void thermoBaffleModel::init()
|
||||
{
|
||||
if (active_)
|
||||
|
||||
@ -91,9 +91,12 @@ protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Read control parameters from dictionary
|
||||
//- Read control parameters from IO dictionary
|
||||
virtual bool read();
|
||||
|
||||
//- Read control parameters from dictionary
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@ -230,7 +230,7 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
|
||||
else //out
|
||||
{
|
||||
this->refGrad()[i] = 0.0;
|
||||
this->refValue()[i] = KDelta[i]*q[i] + patchInternalField()()[i];
|
||||
this->refValue()[i] = q[i]/KDelta[i] + patchInternalField()()[i];
|
||||
this->valueFraction()[i] = 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user