ENH: Adding option to thermalBaffle to be used as external/internal baffle

Now the thermal baffle can be extrapolated from a patch which is
  coupled to the bottom patch of the solid region.

  The user can set the T bc on the 'top' patch of the solid.

  The new keyword is 'internal' and its default is true. Check new
  tutorial for an example:

  tutorials/heatTransfer/buoyantSimpleFoam/roomWithThickCeiling/
This commit is contained in:
sergio
2020-04-06 15:24:39 -07:00
parent f644d78bde
commit 0eed8fa829
25 changed files with 1200 additions and 34 deletions

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -47,6 +48,7 @@ thermalBaffleFvPatchScalarField::thermalBaffleFvPatchScalarField
:
turbulentTemperatureRadCoupledMixedFvPatchScalarField(p, iF),
owner_(false),
internal_(true),
baffle_(),
dict_(dictionary::null),
extrudeMeshPtr_()
@ -69,6 +71,7 @@ thermalBaffleFvPatchScalarField::thermalBaffleFvPatchScalarField
mapper
),
owner_(ptf.owner_),
internal_(ptf.internal_),
baffle_(),
dict_(ptf.dict_),
extrudeMeshPtr_()
@ -84,6 +87,7 @@ thermalBaffleFvPatchScalarField::thermalBaffleFvPatchScalarField
:
turbulentTemperatureRadCoupledMixedFvPatchScalarField(p, iF, dict),
owner_(false),
internal_(true),
baffle_(),
dict_(dict),
extrudeMeshPtr_()
@ -93,27 +97,27 @@ thermalBaffleFvPatchScalarField::thermalBaffleFvPatchScalarField
typedef regionModels::thermalBaffleModels::thermalBaffleModel baffle;
if (thisMesh.name() == polyMesh::defaultRegion)
word regionName("none");
dict_.readIfPresent("region", regionName);
dict_.readIfPresent("internal", internal_);
const word baffleName("3DBaffle" + regionName);
if
(
!thisMesh.time().foundObject<fvMesh>(regionName)
&& regionName != "none"
)
{
const word regionName = dict_.lookupOrDefault<word>("region", "none");
const word baffleName("3DBaffle" + regionName);
if
(
!thisMesh.time().foundObject<fvMesh>(regionName)
&& regionName != "none"
)
if (extrudeMeshPtr_.empty())
{
if (extrudeMeshPtr_.empty())
{
createPatchMesh();
}
baffle_.reset(baffle::New(thisMesh, dict).ptr());
owner_ = true;
baffle_->rename(baffleName);
createPatchMesh();
}
baffle_.reset(baffle::New(thisMesh, dict).ptr());
owner_ = true;
baffle_->rename(baffleName);
}
}
@ -126,6 +130,7 @@ thermalBaffleFvPatchScalarField::thermalBaffleFvPatchScalarField
:
turbulentTemperatureRadCoupledMixedFvPatchScalarField(ptf, iF),
owner_(ptf.owner_),
internal_(ptf.internal_),
baffle_(),
dict_(ptf.dict_),
extrudeMeshPtr_()
@ -170,7 +175,15 @@ void thermalBaffleFvPatchScalarField::createPatchMesh()
patchNames[topPatchID] = word("top");
patchTypes[bottomPatchID] = mappedWallPolyPatch::typeName;
patchTypes[topPatchID] = mappedWallPolyPatch::typeName;
if (internal_)
{
patchTypes[topPatchID] = mappedWallPolyPatch::typeName;
}
else
{
patchTypes[topPatchID] = polyPatch::typeName;
}
if (dict_.get<bool>("columnCells"))
{
@ -189,17 +202,24 @@ void thermalBaffleFvPatchScalarField::createPatchMesh()
wordList inGroups(1);
inGroups[0] = coupleGroup;
// The bottomPatchID is coupled with this patch
dicts[bottomPatchID].add("coupleGroup", coupleGroup);
dicts[bottomPatchID].add("inGroups", inGroups);
dicts[bottomPatchID].add("sampleMode", mpp.sampleModeNames_[mpp.mode()]);
dicts[bottomPatchID].add("samplePatch", patch().name());
dicts[bottomPatchID].add("sampleRegion", thisMesh.name());
const word coupleGroupSlave =
coupleGroup.substr(0, coupleGroup.find('_')) + "_slave";
// Internal baffle needs a coupled on the topPatchID
if (internal_)
{
const word coupleGroupSlave =
coupleGroup.substr(0, coupleGroup.find('_')) + "_slave";
inGroups[0] = coupleGroupSlave;
dicts[topPatchID].add("coupleGroup", coupleGroupSlave);
dicts[topPatchID].add("inGroups", inGroups);
dicts[topPatchID].add("sampleMode", mpp.sampleModeNames_[mpp.mode()]);
inGroups[0] = coupleGroupSlave;
dicts[topPatchID].add("coupleGroup", coupleGroupSlave);
dicts[topPatchID].add("inGroups", inGroups);
dicts[topPatchID].add("sampleMode", mpp.sampleModeNames_[mpp.mode()]);
}
forAll(regionPatches, patchi)
@ -247,9 +267,7 @@ void thermalBaffleFvPatchScalarField::updateCoeffs()
return;
}
const fvMesh& thisMesh = patch().boundaryMesh().mesh();
if (owner_ && thisMesh.name() == polyMesh::defaultRegion)
if (owner_)
{
baffle_->evolve();
}
@ -262,9 +280,7 @@ void thermalBaffleFvPatchScalarField::write(Ostream& os) const
{
turbulentTemperatureRadCoupledMixedFvPatchScalarField::write(os);
const fvMesh& thisMesh = patch().boundaryMesh().mesh();
if (owner_ && (thisMesh.name() == polyMesh::defaultRegion))
if (owner_)
{
os.writeEntry("extrudeModel", dict_.get<word>("extrudeModel"));
@ -281,6 +297,8 @@ void thermalBaffleFvPatchScalarField::write(Ostream& os) const
os.writeEntry("region", dict_.get<word>("region"));
os.writeEntryIfDifferent<bool>("internal", true, internal_);
os.writeEntry("active", dict_.get<Switch>("active"));
os.writeKeyword("thermoType");

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -40,11 +41,53 @@ Description
The primary region creates the baffle region and evolves its energy
equation either:
- 1-D, normal to each patch face
- 2-D, normal and tangential components
- 3-D, normal and tangential components
The thermodynamic properties of the baffle material are specified via
dictionary entries on the master patch.
The underlying polyPatch on the primary region needs to be defined
as a complete mappedWall. i.e:
\verbatim
type mappedWall;
sampleMode nearestPatchFace;
samplePatch <patchName>;
sampleRegion <regionName>;
coupleGroup <coupleGroupName>;
\endverbatim
The /keyword{internal} is true when the thermal baffle is used on internal
faces and the baffle is coupled on both sides (bottom and top).
If this baffle is used on a patch set internal = false. By default is
true.
\table
Property | Description | Required | Default value
Tnbr | name of the field | no | T
qrNbr | name of the radiative flux in the nbr region | no | none
qr | name of the radiative flux in this region | no | none
thicknessLayers | inherited from temperatureCoupledBase | inherited
kappaLayers | inherited from temperatureCoupledBase | inherited
kappaMethod | inherited from temperatureCoupledBase | inherited
kappa | inherited from temperatureCoupledBase | inherited
thermalInertia | Add thermal inertia to wall node | no | false
region | Name of the solid region | yes
active | Active | yes
internal | Is the baffle an internal regiion | no | true
thermoType | Solid thermo type | yes
mixture | Mixture solid | yes
radiation | Radiation model in the solid | yes
extrudeModel | Extrude model | yes
nLayers | Number of cell across the ragion | yes
expansionRatio | Expansion ratio for the solid region | yes
columnCells | true for 1D or false for 3D region | yes
\endtable
Usage
Example of the boundary condition specification:
\verbatim
@ -61,8 +104,9 @@ Usage
value uniform 300;
// Baffle region name
regionName baffleRegion;
region baffleRegion;
active yes;
internal yes;
// Solid thermo in solid region
thermoType
@ -118,6 +162,9 @@ Usage
}
\endverbatim
If the thermal baffle is used on internal faces of the primary region,
then the slave in this region is defined as :
Slave patch on primary region:
\verbatim
<slavePatchName>
@ -195,6 +242,9 @@ class thermalBaffleFvPatchScalarField
//- Is the baffle owner
bool owner_;
//- Is the baffle internal
bool internal_;
//- Thermal baffle
autoPtr<regionModels::thermalBaffleModels::thermalBaffleModel> baffle_;

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -190,7 +191,7 @@ thermalBaffle::thermalBaffle
regionMesh().time().timeName(),
regionMesh(),
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
IOobject::AUTO_WRITE
),
regionMesh(),
dimensionedScalar(dimEnergy/dimVolume/dimTime, Zero)