mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of ssh://dm/home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -47,14 +47,15 @@ extrudePatchMesh::extrudePatchMesh
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const fvPatch& patch,
|
||||
const dictionary& dict
|
||||
const dictionary& dict,
|
||||
const word regionName
|
||||
)
|
||||
:
|
||||
fvMesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
dict.lookup("region"),
|
||||
regionName,
|
||||
mesh.facesInstance(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
|
||||
@ -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
|
||||
@ -25,12 +25,11 @@ Class
|
||||
extrudePatchMesh
|
||||
|
||||
Description
|
||||
Mesh at a patch created on the fly. The following entried should be used
|
||||
Mesh at a patch created on the fly. The following entry should be used
|
||||
on the field boundary dictionary:
|
||||
|
||||
// New Shell mesh data
|
||||
|
||||
region "regionMesh";
|
||||
extrudeModel linearNormal;
|
||||
linearNormalCoeffs
|
||||
{
|
||||
@ -120,7 +119,8 @@ public:
|
||||
(
|
||||
const fvMesh&,
|
||||
const fvPatch&,
|
||||
const dictionary&
|
||||
const dictionary&,
|
||||
const word
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -7,7 +7,9 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/mesh/extrudeModel/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lregionModels \
|
||||
@ -16,4 +18,5 @@ LIB_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lOpenFOAM \
|
||||
-lradiationModels
|
||||
-lradiationModels \
|
||||
-ldynamicMesh
|
||||
|
||||
@ -45,7 +45,8 @@ thermalBaffleFvPatchScalarField
|
||||
turbulentTemperatureRadCoupledMixedFvPatchScalarField(p, iF),
|
||||
owner_(false),
|
||||
baffle_(),
|
||||
dict_(dictionary::null)
|
||||
dict_(dictionary::null),
|
||||
extrudeMeshPtr_()
|
||||
{}
|
||||
|
||||
|
||||
@ -66,8 +67,9 @@ thermalBaffleFvPatchScalarField
|
||||
mapper
|
||||
),
|
||||
owner_(ptf.owner_),
|
||||
baffle_(ptf.baffle_),
|
||||
dict_(ptf.dict_)
|
||||
baffle_(),
|
||||
dict_(ptf.dict_),
|
||||
extrudeMeshPtr_()
|
||||
{}
|
||||
|
||||
|
||||
@ -82,47 +84,47 @@ thermalBaffleFvPatchScalarField
|
||||
turbulentTemperatureRadCoupledMixedFvPatchScalarField(p, iF, dict),
|
||||
owner_(false),
|
||||
baffle_(),
|
||||
dict_(dict)
|
||||
dict_(dict),
|
||||
extrudeMeshPtr_()
|
||||
{
|
||||
if (!isA<mappedPatchBase>(patch().patch()))
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"thermalBaffleFvPatchScalarField::"
|
||||
"thermalBaffleFvPatchScalarField\n"
|
||||
"(\n"
|
||||
" const fvPatch& p,\n"
|
||||
" const DimensionedField<scalar, volMesh>& iF,\n"
|
||||
" const dictionary& dict\n"
|
||||
")\n"
|
||||
) << "\n patch type '" << patch().type()
|
||||
<< "' not type '" << mappedPatchBase::typeName << "'"
|
||||
<< "\n for patch " << patch().name()
|
||||
<< " of field " << dimensionedInternalField().name()
|
||||
<< " in file " << dimensionedInternalField().objectPath()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
const mappedPatchBase& mpp =
|
||||
refCast<const mappedPatchBase>(patch().patch());
|
||||
|
||||
const word nbrMesh = mpp.sampleRegion();
|
||||
|
||||
const fvMesh& thisMesh = patch().boundaryMesh().mesh();
|
||||
|
||||
typedef regionModels::thermalBaffleModels::thermalBaffleModel baffle;
|
||||
|
||||
if
|
||||
(
|
||||
thisMesh.name() == polyMesh::defaultRegion
|
||||
&& !thisMesh.foundObject<baffle>(nbrMesh)
|
||||
&& !owner_
|
||||
)
|
||||
if (thisMesh.name() == polyMesh::defaultRegion)
|
||||
{
|
||||
Info << "Creating thermal baffle" << nbrMesh << endl;
|
||||
baffle_.reset(baffle::New(thisMesh, dict).ptr());
|
||||
owner_ = true;
|
||||
baffle_->rename(nbrMesh);
|
||||
const word regionName =
|
||||
dict_.lookupOrDefault<word>("regionName", "none");
|
||||
|
||||
const word baffleName("3DBaffle" + regionName);
|
||||
|
||||
if
|
||||
(
|
||||
!thisMesh.time().foundObject<fvMesh>(regionName)
|
||||
&& regionName != "none"
|
||||
)
|
||||
{
|
||||
if (extrudeMeshPtr_.empty())
|
||||
{
|
||||
createPatchMesh();
|
||||
}
|
||||
|
||||
baffle_.reset(baffle::New(thisMesh, dict).ptr());
|
||||
owner_ = true;
|
||||
baffle_->rename(baffleName);
|
||||
}
|
||||
else if //Backwards compatibility (if region exists)
|
||||
(
|
||||
thisMesh.time().foundObject<fvMesh>(regionName)
|
||||
&& baffle_.empty()
|
||||
&& regionName != "none"
|
||||
)
|
||||
{
|
||||
baffle_.reset(baffle::New(thisMesh, dict).ptr());
|
||||
owner_ = true;
|
||||
baffle_->rename(baffleName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -136,8 +138,9 @@ thermalBaffleFvPatchScalarField
|
||||
:
|
||||
turbulentTemperatureRadCoupledMixedFvPatchScalarField(ptf, iF),
|
||||
owner_(ptf.owner_),
|
||||
baffle_(ptf.baffle_),
|
||||
dict_(ptf.dict_)
|
||||
baffle_(),
|
||||
dict_(ptf.dict_),
|
||||
extrudeMeshPtr_()
|
||||
{}
|
||||
|
||||
|
||||
@ -163,6 +166,36 @@ void thermalBaffleFvPatchScalarField::rmap
|
||||
}
|
||||
|
||||
|
||||
void thermalBaffleFvPatchScalarField::createPatchMesh()
|
||||
{
|
||||
const fvMesh& defaultRegion =
|
||||
db().time().lookupObject<fvMesh>(fvMesh::defaultRegion);
|
||||
|
||||
word regionName = dict_.lookup("regionName");
|
||||
|
||||
extrudeMeshPtr_.reset
|
||||
(
|
||||
new extrudePatchMesh
|
||||
(
|
||||
defaultRegion,
|
||||
patch(),
|
||||
dict_,
|
||||
regionName
|
||||
)
|
||||
);
|
||||
|
||||
if (extrudeMeshPtr_.empty())
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"thermalBaffleFvPatchScalarField::createPatchMesh()\n"
|
||||
) << "Specified IOobject::MUST_READ_IF_MODIFIED but class"
|
||||
<< " patchMeshPtr not set."
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void thermalBaffleFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
if (this->updated())
|
||||
@ -189,27 +222,35 @@ void thermalBaffleFvPatchScalarField::write(Ostream& os) const
|
||||
|
||||
if (thisMesh.name() == polyMesh::defaultRegion && owner_)
|
||||
{
|
||||
word thermoModel = dict_.lookup("thermalBaffleModel");
|
||||
|
||||
os.writeKeyword("thermalBaffleModel")
|
||||
<< thermoModel
|
||||
<< token::END_STATEMENT << nl;
|
||||
os.writeKeyword("extrudeModel");
|
||||
os << word(dict_.lookup("extrudeModel"))
|
||||
<< token::END_STATEMENT << nl;
|
||||
|
||||
os.writeKeyword("nLayers");
|
||||
os << readLabel(dict_.lookup("nLayers"))
|
||||
<< token::END_STATEMENT << nl;
|
||||
|
||||
os.writeKeyword("expansionRatio");
|
||||
os << readScalar(dict_.lookup("expansionRatio"))
|
||||
<< token::END_STATEMENT << nl;
|
||||
|
||||
os.writeKeyword("columnCells");
|
||||
os << readBool(dict_.lookup("columnCells"))
|
||||
<< token::END_STATEMENT << nl;
|
||||
|
||||
word extrudeModel(word(dict_.lookup("extrudeModel")) + "Coeffs");
|
||||
os.writeKeyword(extrudeModel);
|
||||
os << dict_.subDict(extrudeModel) << nl;
|
||||
|
||||
word regionName = dict_.lookup("regionName");
|
||||
os.writeKeyword("regionName") << regionName
|
||||
<< token::END_STATEMENT << nl;
|
||||
|
||||
bool infoOutput = readBool(dict_.lookup("infoOutput"));
|
||||
os.writeKeyword("infoOutput") << infoOutput
|
||||
<< token::END_STATEMENT << nl;
|
||||
|
||||
bool active = readBool(dict_.lookup("active"));
|
||||
os.writeKeyword("active") << active
|
||||
<< token::END_STATEMENT << nl;
|
||||
|
||||
os.writeKeyword(word(thermoModel + "Coeffs"));
|
||||
os << dict_.subDict(thermoModel + "Coeffs") << nl;
|
||||
|
||||
os.writeKeyword("thermoType");
|
||||
os << dict_.subDict("thermoType") << nl;
|
||||
|
||||
|
||||
@ -42,78 +42,111 @@ Description
|
||||
dictionary entries.
|
||||
|
||||
\heading Patch usage
|
||||
|
||||
Example of the boundary condition specification:
|
||||
\verbatim
|
||||
myPatch
|
||||
{
|
||||
type compressible::temperatureThermoBaffle;
|
||||
|
||||
// Coupled boundary condition
|
||||
Tnbr T;
|
||||
kappa fluidThermo; // or solidThermo
|
||||
KappaName none;
|
||||
QrNbr Qr; // or none.Name of Qr field on neighbour region
|
||||
Qr Qr; // or none.Name of Qr field on local region
|
||||
|
||||
// Underlaying coupled boundary condition
|
||||
Tnbr T;
|
||||
kappa fluidThermo; // or solidThermo
|
||||
KappaName none;
|
||||
QrNbr Qr;//or none.Name of Qr field on neighbourregion
|
||||
Qr none;// or none.Name of Qr field on localregion
|
||||
value uniform 300;
|
||||
|
||||
// Thermo baffle model
|
||||
thermalBaffleModel thermalBaffle;
|
||||
regionName baffleRegion;
|
||||
infoOutput yes;
|
||||
active yes;
|
||||
thermalBaffleCoeffs
|
||||
{
|
||||
}
|
||||
regionName baffleRegion; // solid region name
|
||||
infoOutput yes;
|
||||
active yes;
|
||||
|
||||
|
||||
// Solid thermo
|
||||
thermoType
|
||||
{
|
||||
type heSolidThermo;
|
||||
mixture pureSolidMixture;
|
||||
transport constIso;
|
||||
thermo hConst;
|
||||
equationOfState rhoConst;
|
||||
specie specie;
|
||||
energy sensibleEnthalpy;
|
||||
}
|
||||
|
||||
mixture
|
||||
{
|
||||
specie
|
||||
// Solid thermo in solid region
|
||||
thermoType
|
||||
{
|
||||
nMoles 1;
|
||||
molWeight 20;
|
||||
type heSolidThermo;
|
||||
mixture pureSolidMixture;
|
||||
transport constIso;
|
||||
thermo hConst;
|
||||
equationOfState rhoConst;
|
||||
specie specie;
|
||||
energy sensibleEnthalpy;
|
||||
}
|
||||
transport
|
||||
{
|
||||
kappa 0.01;
|
||||
}
|
||||
thermodynamics
|
||||
{
|
||||
Hf 0;
|
||||
Cp 15;
|
||||
}
|
||||
density
|
||||
{
|
||||
rho 80;
|
||||
}
|
||||
}
|
||||
|
||||
radiation
|
||||
{
|
||||
radiationModel opaqueSolid;
|
||||
absorptionEmissionModel none;
|
||||
scatterModel none;
|
||||
}
|
||||
mixture
|
||||
{
|
||||
specie
|
||||
{
|
||||
nMoles 1;
|
||||
molWeight 20;
|
||||
}
|
||||
transport
|
||||
{
|
||||
kappa 0.01;
|
||||
}
|
||||
thermodynamics
|
||||
{
|
||||
Hf 0;
|
||||
Cp 15;
|
||||
}
|
||||
density
|
||||
{
|
||||
rho 80;
|
||||
}
|
||||
}
|
||||
|
||||
value uniform 300;
|
||||
radiation
|
||||
{
|
||||
radiationModel opaqueSolid;
|
||||
absorptionEmissionModel none;
|
||||
scatterModel none;
|
||||
}
|
||||
|
||||
|
||||
// Extrude model for new region
|
||||
|
||||
extrudeModel linearNormal;
|
||||
nLayers 50;
|
||||
expansionRatio 1;
|
||||
columnCells false; //3D or 1D
|
||||
linearNormalCoeffs
|
||||
{
|
||||
thickness 0.02;
|
||||
}
|
||||
|
||||
|
||||
// New mesh polyPatch information
|
||||
|
||||
bottomCoeffs
|
||||
{
|
||||
name "bottom";
|
||||
type mappedWall;
|
||||
sampleMode nearestPatchFace;
|
||||
samplePatch baffle3DWall_master;
|
||||
offsetMode uniform;
|
||||
offset (0 0 0);
|
||||
}
|
||||
|
||||
topCoeffs
|
||||
{
|
||||
name "top";
|
||||
type mappedWall;
|
||||
sampleMode nearestPatchFace;
|
||||
samplePatch baffle3DWall_slave;
|
||||
offsetMode uniform;
|
||||
offset (0 0 0);
|
||||
}
|
||||
|
||||
sideCoeffs
|
||||
{
|
||||
name "side";
|
||||
type patch;
|
||||
}
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
SeeAlso
|
||||
Foam::turbulentTemperatureRadCoupledMixedFvPatchScalarField
|
||||
Foam::turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
|
||||
Foam::regionModels::thermalBaffleModels::thermalBaffleModel
|
||||
|
||||
SourceFiles
|
||||
@ -128,6 +161,7 @@ SourceFiles
|
||||
#include "autoPtr.H"
|
||||
#include "regionModel.H"
|
||||
#include "thermalBaffleModel.H"
|
||||
#include "extrudePatchMesh.H"
|
||||
#include "turbulentTemperatureRadCoupledMixedFvPatchScalarField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -157,6 +191,14 @@ class thermalBaffleFvPatchScalarField
|
||||
//- Dictionary
|
||||
dictionary dict_;
|
||||
|
||||
//- Auto pointer to extrapolated mesh from patch
|
||||
autoPtr<extrudePatchMesh> extrudeMeshPtr_;
|
||||
|
||||
|
||||
// Private member functions
|
||||
|
||||
//- Extrude mesh
|
||||
void createPatchMesh();
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@ -53,11 +53,14 @@ autoPtr<thermalBaffleModel> thermalBaffleModel::New(const fvMesh& mesh)
|
||||
)
|
||||
);
|
||||
|
||||
thermalBafflePropertiesDict.lookup("thermalBaffleModel") >> modelType;
|
||||
word modelType =
|
||||
thermalBafflePropertiesDict.lookupOrDefault<word>
|
||||
(
|
||||
"thermalBaffleModel",
|
||||
"thermalBaffle"
|
||||
);
|
||||
}
|
||||
|
||||
Info<< "Selecting baffle model " << modelType << endl;
|
||||
|
||||
meshConstructorTable::iterator cstrIter =
|
||||
meshConstructorTablePtr_->find(modelType);
|
||||
|
||||
@ -82,9 +85,8 @@ autoPtr<thermalBaffleModel> thermalBaffleModel::New
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
word modelType = dict.lookup("thermalBaffleModel");
|
||||
|
||||
Info<< "Selecting baffle model " << modelType << endl;
|
||||
word modelType =
|
||||
dict.lookupOrDefault<word>("thermalBaffleModel", "thermalBaffle");
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(modelType);
|
||||
|
||||
@ -310,10 +310,7 @@ void Foam::chemistryModel<CompType, ThermoType>::derivatives
|
||||
}
|
||||
dT /= rho*cp;
|
||||
|
||||
// limit the time-derivative, this is more stable for the ODE
|
||||
// solver when calculating the allowed time step
|
||||
const scalar dTLimited = min(500.0, mag(dT));
|
||||
dcdt[nSpecie_] = -dT*dTLimited/(mag(dT) + 1.0e-10);
|
||||
dcdt[nSpecie_] = -dT;
|
||||
|
||||
// dp/dt = ...
|
||||
dcdt[nSpecie_ + 1] = 0.0;
|
||||
@ -743,7 +740,7 @@ Foam::scalar Foam::chemistryModel<CompType, ThermoType>::solve
|
||||
RR_[i][celli] = (c[i] - c0[i])*specieThermo_[i].W()/deltaT[celli];
|
||||
}
|
||||
}
|
||||
|
||||
Info << "deltaTMin " << deltaTMin << endl;
|
||||
return deltaTMin;
|
||||
}
|
||||
|
||||
|
||||
@ -46,13 +46,17 @@ thermalBaffle1DFvPatchScalarField
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
mappedPatchBase(p.patch()),
|
||||
mixedFvPatchScalarField(p, iF),
|
||||
TName_("T"),
|
||||
baffleActivated_(true),
|
||||
thickness_(p.size()),
|
||||
Qs_(p.size()),
|
||||
solidDict_(),
|
||||
solidPtr_(NULL)
|
||||
solidPtr_(NULL),
|
||||
QrPrevious_(p.size()),
|
||||
QrRelaxation_(0),
|
||||
QrName_("undefined-Qr")
|
||||
{}
|
||||
|
||||
|
||||
@ -66,13 +70,17 @@ thermalBaffle1DFvPatchScalarField
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
mappedPatchBase(p.patch(), ptf),
|
||||
mixedFvPatchScalarField(ptf, p, iF, mapper),
|
||||
TName_(ptf.TName_),
|
||||
baffleActivated_(ptf.baffleActivated_),
|
||||
thickness_(ptf.thickness_),
|
||||
Qs_(ptf.Qs_),
|
||||
solidDict_(ptf.solidDict_),
|
||||
solidPtr_(ptf.solidPtr_)
|
||||
solidPtr_(ptf.solidPtr_),
|
||||
QrPrevious_(ptf.QrPrevious_),
|
||||
QrRelaxation_(ptf.QrRelaxation_),
|
||||
QrName_(ptf.QrName_)
|
||||
{}
|
||||
|
||||
|
||||
@ -85,33 +93,25 @@ thermalBaffle1DFvPatchScalarField
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
mappedPatchBase
|
||||
(
|
||||
p.patch(),
|
||||
p.boundaryMesh().mesh().name(),
|
||||
NEARESTPATCHFACE,
|
||||
dict.lookup("samplePatch"),
|
||||
0.0
|
||||
),
|
||||
mixedFvPatchScalarField(p, iF),
|
||||
TName_("T"),
|
||||
baffleActivated_(readBool(dict.lookup("baffleActivated"))),
|
||||
thickness_(scalarField("thickness", dict, p.size())),
|
||||
Qs_(scalarField("Qs", dict, p.size())),
|
||||
baffleActivated_(dict.lookupOrDefault<bool>("baffleActivated", true)),
|
||||
thickness_(),
|
||||
Qs_(),
|
||||
solidDict_(dict),
|
||||
solidPtr_(new solidType(dict))
|
||||
solidPtr_(),
|
||||
QrPrevious_(p.size(), 0.0),
|
||||
QrRelaxation_(dict.lookupOrDefault<scalar>("relaxation", 0)),
|
||||
QrName_(dict.lookupOrDefault<word>("Qr", "none"))
|
||||
{
|
||||
if (!isA<mappedPatchBase>(this->patch().patch()))
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"thermalBaffle1DFvPatchScalarField::"
|
||||
"thermalBaffle1DFvPatchScalarField"
|
||||
"("
|
||||
"const fvPatch&,\n"
|
||||
"const DimensionedField<scalar, volMesh>&, "
|
||||
"const dictionary&"
|
||||
")"
|
||||
) << "\n patch type '" << patch().type()
|
||||
<< "' not type '" << mappedPatchBase::typeName << "'"
|
||||
<< "\n for patch " << patch().name()
|
||||
<< " of field " << dimensionedInternalField().name()
|
||||
<< " in file " << dimensionedInternalField().objectPath()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
|
||||
|
||||
if (dict.found("refValue") && baffleActivated_)
|
||||
@ -139,13 +139,17 @@ thermalBaffle1DFvPatchScalarField
|
||||
const thermalBaffle1DFvPatchScalarField& ptf
|
||||
)
|
||||
:
|
||||
mappedPatchBase(ptf.patch().patch(), ptf),
|
||||
mixedFvPatchScalarField(ptf),
|
||||
TName_(ptf.TName_),
|
||||
baffleActivated_(ptf.baffleActivated_),
|
||||
thickness_(ptf.thickness_),
|
||||
Qs_(ptf.Qs_),
|
||||
solidDict_(ptf.solidDict_),
|
||||
solidPtr_(ptf.solidPtr_)
|
||||
solidPtr_(ptf.solidPtr_),
|
||||
QrPrevious_(ptf.QrPrevious_),
|
||||
QrRelaxation_(ptf.QrRelaxation_),
|
||||
QrName_(ptf.QrName_)
|
||||
{}
|
||||
|
||||
|
||||
@ -157,29 +161,118 @@ thermalBaffle1DFvPatchScalarField
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
mappedPatchBase(ptf.patch().patch(), ptf),
|
||||
mixedFvPatchScalarField(ptf, iF),
|
||||
TName_(ptf.TName_),
|
||||
baffleActivated_(ptf.baffleActivated_),
|
||||
thickness_(ptf.thickness_),
|
||||
Qs_(ptf.Qs_),
|
||||
solidDict_(ptf.solidDict_),
|
||||
solidPtr_(ptf.solidPtr_)
|
||||
solidPtr_(ptf.solidPtr_),
|
||||
QrPrevious_(ptf.QrPrevious_),
|
||||
QrRelaxation_(ptf.QrRelaxation_),
|
||||
QrName_(ptf.QrName_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class solidType>
|
||||
const solidType& thermalBaffle1DFvPatchScalarField<solidType>::solidPtr() const
|
||||
bool thermalBaffle1DFvPatchScalarField<solidType>::owner() const
|
||||
{
|
||||
if (!solidPtr_.empty())
|
||||
const label patchi = patch().index();
|
||||
|
||||
const label nbrPatchi = samplePolyPatch().index();
|
||||
|
||||
return (patchi < nbrPatchi);
|
||||
}
|
||||
|
||||
|
||||
template<class solidType>
|
||||
const solidType& thermalBaffle1DFvPatchScalarField<solidType>::solid() const
|
||||
{
|
||||
if (this->owner())
|
||||
{
|
||||
if (solidPtr_.empty())
|
||||
{
|
||||
solidPtr_.reset(new solidType(solidDict_));
|
||||
}
|
||||
return solidPtr_();
|
||||
}
|
||||
else
|
||||
{
|
||||
solidPtr_.reset(new solidType(solidDict_));
|
||||
return solidPtr_();
|
||||
const fvPatch& nbrPatch =
|
||||
patch().boundaryMesh()[samplePolyPatch().index()];
|
||||
|
||||
const thermalBaffle1DFvPatchScalarField& nbrField =
|
||||
refCast<const thermalBaffle1DFvPatchScalarField>
|
||||
(
|
||||
nbrPatch.template lookupPatchField<volScalarField, scalar>(TName_)
|
||||
);
|
||||
|
||||
return nbrField.solid();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class solidType>
|
||||
const scalarField& thermalBaffle1DFvPatchScalarField<solidType>::
|
||||
baffleThickness() const
|
||||
{
|
||||
if (this->owner())
|
||||
{
|
||||
if (thickness_.size() > 0)
|
||||
{
|
||||
return thickness_;
|
||||
}
|
||||
else
|
||||
{
|
||||
thickness_ = scalarField("thickness", solidDict_, patch().size());
|
||||
return thickness_;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const fvPatch& nbrPatch =
|
||||
patch().boundaryMesh()[samplePolyPatch().index()];
|
||||
const thermalBaffle1DFvPatchScalarField& nbrField =
|
||||
refCast<const thermalBaffle1DFvPatchScalarField>
|
||||
(
|
||||
nbrPatch.template lookupPatchField<volScalarField, scalar>(TName_)
|
||||
);
|
||||
|
||||
return nbrField.thickness_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class solidType>
|
||||
const scalarField& thermalBaffle1DFvPatchScalarField<solidType>::Qs() const
|
||||
{
|
||||
if (this->owner())
|
||||
{
|
||||
if (Qs_.size() > 0)
|
||||
{
|
||||
return Qs_;
|
||||
}
|
||||
else
|
||||
{
|
||||
Qs_ = scalarField("Qs", solidDict_, patch().size());
|
||||
return Qs_;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const fvPatch& nbrPatch =
|
||||
patch().boundaryMesh()[samplePolyPatch().index()];
|
||||
|
||||
const thermalBaffle1DFvPatchScalarField& nbrField =
|
||||
refCast<const thermalBaffle1DFvPatchScalarField>
|
||||
(
|
||||
nbrPatch.template lookupPatchField<volScalarField, scalar>(TName_)
|
||||
);
|
||||
|
||||
return nbrField.Qs_;
|
||||
}
|
||||
}
|
||||
|
||||
@ -219,18 +312,14 @@ void thermalBaffle1DFvPatchScalarField<solidType>::updateCoeffs()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Since we're inside initEvaluate/evaluate there might be processor
|
||||
// comms underway. Change the tag we use.
|
||||
int oldTag = UPstream::msgType();
|
||||
UPstream::msgType() = oldTag+1;
|
||||
|
||||
const mappedPatchBase& mpp =
|
||||
refCast<const mappedPatchBase>(patch().patch());
|
||||
|
||||
const label patchi = patch().index();
|
||||
|
||||
const label nbrPatchi = mpp.samplePolyPatch().index();
|
||||
const label nbrPatchi = samplePolyPatch().index();
|
||||
|
||||
if (baffleActivated_)
|
||||
{
|
||||
@ -243,108 +332,49 @@ void thermalBaffle1DFvPatchScalarField<solidType>::updateCoeffs()
|
||||
);
|
||||
|
||||
// local properties
|
||||
|
||||
const scalarField kappaw(turbModel.kappaEff(patchi));
|
||||
|
||||
const fvPatchScalarField& Tp =
|
||||
patch().template lookupPatchField<volScalarField, scalar>(TName_);
|
||||
|
||||
const scalarField qDot(kappaw*Tp.snGrad());
|
||||
|
||||
scalarField Qr(Tp.size(), 0.0);
|
||||
|
||||
if (QrName_ != "none")
|
||||
{
|
||||
Qr = patch().template lookupPatchField<volScalarField, scalar>
|
||||
(QrName_);
|
||||
|
||||
Qr = QrRelaxation_*Qr + (1.0 - QrRelaxation_)*QrPrevious_;
|
||||
QrPrevious_ = Qr;
|
||||
}
|
||||
|
||||
tmp<scalarField> Ti = patchInternalField();
|
||||
|
||||
scalarField myh(patch().deltaCoeffs()*kappaw);
|
||||
scalarField myKDelta(patch().deltaCoeffs()*kappaw);
|
||||
|
||||
// nbr properties
|
||||
|
||||
const scalarField nbrKappaw(turbModel.kappaEff(nbrPatchi));
|
||||
|
||||
const fvPatchScalarField& nbrTw =
|
||||
// nrb properties
|
||||
const fvPatchScalarField& nbrTp =
|
||||
turbModel.thermo().T().boundaryField()[nbrPatchi];
|
||||
|
||||
scalarField nbrQDot(nbrKappaw*nbrTw.snGrad());
|
||||
mpp.map().distribute(nbrQDot);
|
||||
|
||||
const thermalBaffle1DFvPatchScalarField& nbrField =
|
||||
refCast<const thermalBaffle1DFvPatchScalarField>
|
||||
(
|
||||
nbrPatch.template lookupPatchField<volScalarField, scalar>(TName_)
|
||||
);
|
||||
|
||||
scalarField nbrTi(nbrField.patchInternalField());
|
||||
mpp.map().distribute(nbrTi);
|
||||
|
||||
scalarField nbrTp =
|
||||
nbrPatch.template lookupPatchField<volScalarField, scalar>(TName_);
|
||||
mpp.map().distribute(nbrTp);
|
||||
|
||||
scalarField nbrh(nbrPatch.deltaCoeffs()*nbrKappaw);
|
||||
mpp.map().distribute(nbrh);
|
||||
|
||||
|
||||
// heat source
|
||||
const scalarField Q(Qs_/thickness_);
|
||||
|
||||
tmp<scalarField> tKDeltaw(new scalarField(patch().size()));
|
||||
scalarField KDeltaw = tKDeltaw();
|
||||
|
||||
// Create fields for solid properties (p paramater not used)
|
||||
forAll(KDeltaw, i)
|
||||
// solid properties
|
||||
scalarField kappas(patch().size(), 0.0);
|
||||
forAll(kappas, i)
|
||||
{
|
||||
KDeltaw[i] =
|
||||
solidPtr().kappa(0.0, (Tp[i] + nbrTw[i])/2.0)/thickness_[i];
|
||||
kappas[i] = solid().kappa(0.0, (Tp[i] + nbrTp[i])/2.0);
|
||||
}
|
||||
|
||||
const scalarField q
|
||||
(
|
||||
(Ti() - nbrTi)/(1.0/KDeltaw + 1.0/nbrh + 1.0/myh)
|
||||
);
|
||||
scalarField KDeltaSolid(kappas/baffleThickness());
|
||||
|
||||
forAll(qDot, i)
|
||||
{
|
||||
if (Qs_[i] == 0)
|
||||
{
|
||||
this->refValue()[i] = Ti()[i] - q[i]/myh[i];
|
||||
this->refGrad()[i] = 0.0;
|
||||
this->valueFraction()[i] = 1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (q[i] > 0)
|
||||
{
|
||||
this->refValue()[i] =
|
||||
nbrTp[i]
|
||||
- Q[i]*thickness_[i]/(2*KDeltaw[i]);
|
||||
scalarField alpha(KDeltaSolid - Qr/Tp);
|
||||
|
||||
this->refGrad()[i] = 0.0;
|
||||
this->valueFraction()[i] =
|
||||
1.0
|
||||
/
|
||||
(
|
||||
1.0
|
||||
+ patch().deltaCoeffs()[i]*kappaw[i]/KDeltaw[i]
|
||||
);
|
||||
}
|
||||
else if (q[i] < 0)
|
||||
{
|
||||
this->refValue()[i] = 0.0;
|
||||
this->refGrad()[i] =
|
||||
(-nbrQDot[i] + Q[i]*thickness_[i])/kappaw[i];
|
||||
this->valueFraction()[i] = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
scalar Qt = Q[i]*thickness_[i];
|
||||
this->refValue()[i] = 0.0;
|
||||
this->refGrad()[i] = Qt/2/kappaw[i];
|
||||
this->valueFraction()[i] = 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
valueFraction() = alpha/(alpha + myKDelta);
|
||||
|
||||
refValue() = (KDeltaSolid*nbrTp + Qs()/2.0)/alpha;
|
||||
|
||||
if (debug)
|
||||
{
|
||||
scalar Q = gSum(patch().magSf()*qDot);
|
||||
scalar Q = gAverage(kappaw*snGrad());
|
||||
Info<< patch().boundaryMesh().mesh().name() << ':'
|
||||
<< patch().name() << ':'
|
||||
<< this->dimensionedInternalField().name() << " <- "
|
||||
@ -366,16 +396,21 @@ void thermalBaffle1DFvPatchScalarField<solidType>::updateCoeffs()
|
||||
}
|
||||
|
||||
template<class solidType>
|
||||
void thermalBaffle1DFvPatchScalarField<solidType>:: write(Ostream& os) const
|
||||
void thermalBaffle1DFvPatchScalarField<solidType>::write(Ostream& os) const
|
||||
{
|
||||
mixedFvPatchScalarField::write(os);
|
||||
os.writeKeyword("TName")
|
||||
<< TName_ << token::END_STATEMENT << nl;
|
||||
thickness_.writeEntry("thickness", os);
|
||||
os.writeKeyword("baffleActivated")
|
||||
<< baffleActivated_ << token::END_STATEMENT << nl;
|
||||
Qs_.writeEntry("Qs", os);
|
||||
solidPtr().write(os);
|
||||
mappedPatchBase::write(os);
|
||||
|
||||
if (this->owner())
|
||||
{
|
||||
baffleThickness().writeEntry("thickness", os);
|
||||
Qs().writeEntry("Qs", os);
|
||||
solid().write(os);
|
||||
}
|
||||
|
||||
os.writeKeyword("Qr")<< QrName_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("QrRelaxation")<< QrRelaxation_
|
||||
<< token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -24,9 +24,68 @@ License
|
||||
Class
|
||||
Foam::thermalBaffle1DFvPatchScalarField
|
||||
|
||||
Group
|
||||
grpThermoBoundaryConditions
|
||||
|
||||
Description
|
||||
Boundary which solves the 1D steady state heat transfer equation
|
||||
through a baffle.
|
||||
|
||||
This BC solves a steady 1D thermal baffle. The solid properties are
|
||||
specify as dictionary. Optionaly radiative heat flux (Qr) can be
|
||||
incorporated into the balance. Some under-relaxation might be needed on
|
||||
Qr.
|
||||
Baffle and solid properties need to be specified on the master side
|
||||
of the baffle.
|
||||
|
||||
\heading Patch usage
|
||||
Example of the boundary condition specification using constant
|
||||
solid thermo :
|
||||
|
||||
\verbatim
|
||||
myPatch_master
|
||||
{
|
||||
type compressible::thermalBaffle1D<hConstSolidThermoPhysics>;
|
||||
samplePatch myPatch_slave;
|
||||
|
||||
thickness uniform 0.005; // thickness [m]
|
||||
Qs uniform 100; // heat flux [W/m2]
|
||||
|
||||
Qr none;
|
||||
relaxation 0;
|
||||
|
||||
// Solid thermo
|
||||
specie
|
||||
{
|
||||
nMoles 1;
|
||||
molWeight 20;
|
||||
}
|
||||
transport
|
||||
{
|
||||
kappa 1;
|
||||
}
|
||||
thermodynamics
|
||||
{
|
||||
Hf 0;
|
||||
Cp 10;
|
||||
}
|
||||
equationOfState
|
||||
{
|
||||
rho 10;
|
||||
}
|
||||
|
||||
value uniform 300;
|
||||
}
|
||||
|
||||
myPatch_slave
|
||||
{
|
||||
type compressible::thermalBaffle1D<hConstSolidThermoPhysics>;
|
||||
samplePatch myPatch_master_master;
|
||||
|
||||
Qr none;
|
||||
relaxation 0;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
|
||||
|
||||
SourceFiles
|
||||
thermalBaffle1DFvPatchScalarField.C
|
||||
@ -38,7 +97,7 @@ SourceFiles
|
||||
|
||||
#include "mixedFvPatchFields.H"
|
||||
#include "autoPtr.H"
|
||||
|
||||
#include "mappedPatchBase.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -54,6 +113,7 @@ namespace compressible
|
||||
template<class solidType>
|
||||
class thermalBaffle1DFvPatchScalarField
|
||||
:
|
||||
public mappedPatchBase,
|
||||
public mixedFvPatchScalarField
|
||||
{
|
||||
// Private data
|
||||
@ -65,10 +125,10 @@ class thermalBaffle1DFvPatchScalarField
|
||||
bool baffleActivated_;
|
||||
|
||||
//- Baffle thickness [m]
|
||||
scalarField thickness_;
|
||||
mutable scalarField thickness_;
|
||||
|
||||
//- Superficial heat source [W/m2]
|
||||
scalarField Qs_;
|
||||
mutable scalarField Qs_;
|
||||
|
||||
//- Solid dictionary
|
||||
dictionary solidDict_;
|
||||
@ -76,11 +136,29 @@ class thermalBaffle1DFvPatchScalarField
|
||||
//- Solid thermo
|
||||
mutable autoPtr<solidType> solidPtr_;
|
||||
|
||||
//- Chache Qr for relaxation
|
||||
scalarField QrPrevious_;
|
||||
|
||||
//- Relaxation for Qr
|
||||
scalar QrRelaxation_;
|
||||
|
||||
//- Name of the radiative heat flux in local region
|
||||
const word QrName_;
|
||||
|
||||
|
||||
// Private members
|
||||
|
||||
//- Return non const solid thermo autoMap
|
||||
const solidType& solidPtr() const;
|
||||
//- Return const solid thermo
|
||||
const solidType& solid() const;
|
||||
|
||||
//- Return Qs from master
|
||||
const scalarField& Qs() const;
|
||||
|
||||
//- Return thickness from master
|
||||
const scalarField& baffleThickness() const;
|
||||
|
||||
//- Is Owner
|
||||
bool owner() const;
|
||||
|
||||
|
||||
public:
|
||||
@ -153,7 +231,6 @@ public:
|
||||
|
||||
// Member functions
|
||||
|
||||
|
||||
// Mapping functions
|
||||
|
||||
//- Map (and resize as needed) from self given a mapping object
|
||||
@ -170,8 +247,6 @@ public:
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user