mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Adding 'baseGroup' option to createBaffle.C to add a pair patches but in
different groups. This is used in 3D baffle where the generated patches are not
coupled.
The tutorial circuitBoardCooling has been updated.
This commit is contained in:
@ -43,6 +43,39 @@ defineTypeNameAndDebug(extrudePatchMesh, 0);
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
extrudePatchMesh::extrudePatchMesh
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const fvPatch& patch,
|
||||
const dictionary& dict,
|
||||
const word regionName,
|
||||
const List<polyPatch*>& regionPatches
|
||||
)
|
||||
:
|
||||
fvMesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
regionName,
|
||||
mesh.facesInstance(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE,
|
||||
true
|
||||
),
|
||||
xferCopy(pointField()),
|
||||
xferCopy(faceList()),
|
||||
xferCopy(labelList()),
|
||||
xferCopy(labelList()),
|
||||
false
|
||||
),
|
||||
extrudedPatch_(patch.patch()),
|
||||
dict_(dict)
|
||||
{
|
||||
extrudeMesh(regionPatches);
|
||||
}
|
||||
|
||||
|
||||
extrudePatchMesh::extrudePatchMesh
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
@ -68,11 +101,59 @@ extrudePatchMesh::extrudePatchMesh
|
||||
xferCopy(labelList()),
|
||||
false
|
||||
),
|
||||
extrudedPatch_(patch.patch())
|
||||
extrudedPatch_(patch.patch()),
|
||||
dict_(dict)
|
||||
{
|
||||
|
||||
List<polyPatch*> regionPatches(3);
|
||||
List<word> patchNames(regionPatches.size());
|
||||
List<word> patchTypes(regionPatches.size());
|
||||
PtrList<dictionary> dicts(regionPatches.size());
|
||||
|
||||
forAll (dicts, patchI)
|
||||
{
|
||||
if (!dicts.set(patchI))
|
||||
{
|
||||
dicts.set(patchI, new dictionary());
|
||||
}
|
||||
}
|
||||
|
||||
dicts[bottomPatchID] = dict_.subDict("bottomCoeffs");
|
||||
dicts[sidePatchID] = dict_.subDict("sideCoeffs");
|
||||
dicts[topPatchID] = dict_.subDict("topCoeffs");
|
||||
|
||||
forAll (dicts, patchI)
|
||||
{
|
||||
dicts[patchI].lookup("name") >> patchNames[patchI];
|
||||
dicts[patchI].lookup("type") >> patchTypes[patchI];
|
||||
}
|
||||
|
||||
forAll (regionPatches, patchI)
|
||||
{
|
||||
dictionary& patchDict = dicts[patchI];
|
||||
patchDict.set("nFaces", 0);
|
||||
patchDict.set("startFace", 0);
|
||||
|
||||
regionPatches[patchI] = polyPatch::New
|
||||
(
|
||||
patchNames[patchI],
|
||||
patchDict,
|
||||
patchI,
|
||||
mesh.boundaryMesh()
|
||||
).ptr();
|
||||
|
||||
}
|
||||
|
||||
extrudeMesh(regionPatches);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void extrudePatchMesh::extrudeMesh(const List<polyPatch*>& regionPatches)
|
||||
{
|
||||
if (this->boundaryMesh().size() == 0)
|
||||
{
|
||||
bool columnCells = readBool(dict.lookup("columnCells"));
|
||||
bool columnCells = readBool(dict_.lookup("columnCells"));
|
||||
|
||||
PackedBoolList nonManifoldEdge(extrudedPatch_.nEdges());
|
||||
for (label edgeI = 0; edgeI < extrudedPatch_.nInternalEdges(); edgeI++)
|
||||
@ -83,7 +164,7 @@ extrudePatchMesh::extrudePatchMesh
|
||||
}
|
||||
}
|
||||
|
||||
autoPtr<extrudeModel> model_(extrudeModel::New(dict));
|
||||
autoPtr<extrudeModel> model_(extrudeModel::New(dict_));
|
||||
|
||||
faceList pointGlobalRegions;
|
||||
faceList pointLocalRegions;
|
||||
@ -180,7 +261,7 @@ extrudePatchMesh::extrudePatchMesh
|
||||
pointLocalRegions,
|
||||
localRegionPoints
|
||||
);
|
||||
|
||||
/*
|
||||
List<polyPatch*> regionPatches(3);
|
||||
List<word> patchNames(regionPatches.size());
|
||||
List<word> patchTypes(regionPatches.size());
|
||||
@ -194,9 +275,9 @@ extrudePatchMesh::extrudePatchMesh
|
||||
}
|
||||
}
|
||||
|
||||
dicts[bottomPatchID] = dict.subDict("bottomCoeffs");
|
||||
dicts[sidePatchID] = dict.subDict("sideCoeffs");
|
||||
dicts[topPatchID] = dict.subDict("topCoeffs");
|
||||
dicts[bottomPatchID] = dict_.subDict("bottomCoeffs");
|
||||
dicts[sidePatchID] = dict_.subDict("sideCoeffs");
|
||||
dicts[topPatchID] = dict_.subDict("topCoeffs");
|
||||
|
||||
forAll (dicts, patchI)
|
||||
{
|
||||
@ -219,7 +300,7 @@ extrudePatchMesh::extrudePatchMesh
|
||||
).ptr();
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
this->clearOut();
|
||||
this->removeFvBoundary();
|
||||
this->addFvPatches(regionPatches, true);
|
||||
|
||||
@ -105,6 +105,15 @@ private:
|
||||
//- Const reference to the patch from which this mesh is extruded
|
||||
const polyPatch& extrudedPatch_;
|
||||
|
||||
//- Model dictionary
|
||||
dictionary dict_;
|
||||
|
||||
|
||||
// Private member functions
|
||||
|
||||
//- Extrude mesh using polyPatches
|
||||
void extrudeMesh(const List<polyPatch*>& regionPatches);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -123,6 +132,17 @@ public:
|
||||
const word
|
||||
);
|
||||
|
||||
//- Construct from mesh, patch, dictionary and new mesh
|
||||
// polyPatch information
|
||||
extrudePatchMesh
|
||||
(
|
||||
const fvMesh&,
|
||||
const fvPatch&,
|
||||
const dictionary&,
|
||||
const word,
|
||||
const List<polyPatch*>& polyPatches
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~extrudePatchMesh();
|
||||
|
||||
@ -25,6 +25,9 @@ License
|
||||
|
||||
#include "thermalBaffleFvPatchScalarField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "emptyPolyPatch.H"
|
||||
#include "polyPatch.H"
|
||||
#include "mappedWallPolyPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -114,17 +117,6 @@ thermalBaffleFvPatchScalarField
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -168,19 +160,79 @@ void thermalBaffleFvPatchScalarField::rmap
|
||||
|
||||
void thermalBaffleFvPatchScalarField::createPatchMesh()
|
||||
{
|
||||
const fvMesh& defaultRegion =
|
||||
db().time().lookupObject<fvMesh>(fvMesh::defaultRegion);
|
||||
|
||||
const fvMesh& thisMesh = patch().boundaryMesh().mesh();
|
||||
|
||||
word regionName = dict_.lookup("regionName");
|
||||
|
||||
List<polyPatch*> regionPatches(3);
|
||||
List<word> patchNames(regionPatches.size());
|
||||
List<word> patchTypes(regionPatches.size());
|
||||
List<dictionary> dicts(regionPatches.size());
|
||||
|
||||
patchNames[bottomPatchID] = word("bottom");
|
||||
patchNames[sidePatchID] = word("side");
|
||||
patchNames[topPatchID] = word("top");
|
||||
|
||||
patchTypes[bottomPatchID] = mappedWallPolyPatch::typeName;
|
||||
patchTypes[topPatchID] = mappedWallPolyPatch::typeName;
|
||||
|
||||
if (readBool(dict_.lookup("columnCells")))
|
||||
{
|
||||
patchTypes[sidePatchID] = emptyPolyPatch::typeName;
|
||||
}
|
||||
else
|
||||
{
|
||||
patchTypes[sidePatchID] = polyPatch::typeName;
|
||||
}
|
||||
|
||||
const mappedPatchBase& mpp =
|
||||
refCast<const mappedPatchBase>(patch().patch());
|
||||
|
||||
const word coupleGroup(mpp.coupleGroup());
|
||||
|
||||
wordList inGroups(1);
|
||||
inGroups[0] = coupleGroup;
|
||||
|
||||
dicts[bottomPatchID].add("coupleGroup", coupleGroup);
|
||||
dicts[bottomPatchID].add("inGroups", inGroups);
|
||||
dicts[bottomPatchID].add("sampleMode", mpp.sampleModeNames_[mpp.mode()]);
|
||||
|
||||
const label sepPos = coupleGroup.find('_');
|
||||
|
||||
const word coupleGroupSlave = coupleGroup(0, sepPos) + "_slave";
|
||||
|
||||
inGroups[0] = coupleGroupSlave;
|
||||
dicts[topPatchID].add("coupleGroup", coupleGroupSlave);
|
||||
dicts[topPatchID].add("inGroups", inGroups);
|
||||
dicts[topPatchID].add("sampleMode", mpp.sampleModeNames_[mpp.mode()]);
|
||||
|
||||
|
||||
forAll (regionPatches, patchI)
|
||||
{
|
||||
dictionary& patchDict = dicts[patchI];
|
||||
patchDict.set("nFaces", 0);
|
||||
patchDict.set("startFace", 0);
|
||||
|
||||
regionPatches[patchI] = polyPatch::New
|
||||
(
|
||||
patchTypes[patchI],
|
||||
patchNames[patchI],
|
||||
dicts[patchI],
|
||||
patchI,
|
||||
thisMesh.boundaryMesh()
|
||||
).ptr();
|
||||
}
|
||||
|
||||
extrudeMeshPtr_.reset
|
||||
(
|
||||
new extrudePatchMesh
|
||||
(
|
||||
defaultRegion,
|
||||
thisMesh,
|
||||
patch(),
|
||||
dict_,
|
||||
regionName
|
||||
regionName,
|
||||
regionPatches
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -182,6 +182,14 @@ class thermalBaffleFvPatchScalarField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Enumeration of patch IDs
|
||||
enum patchID
|
||||
{
|
||||
bottomPatchID,
|
||||
topPatchID,
|
||||
sidePatchID
|
||||
};
|
||||
|
||||
//- Is the baffle owner
|
||||
bool owner_;
|
||||
|
||||
|
||||
@ -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
|
||||
@ -47,7 +47,7 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
|
||||
:
|
||||
mixedFvPatchScalarField(p, iF),
|
||||
temperatureCoupledBase(patch(), "undefined", "undefined-K"),
|
||||
neighbourFieldName_("undefined-neighbourFieldName")
|
||||
TnbrName_("undefined-Tnbr")
|
||||
{
|
||||
this->refValue() = 0.0;
|
||||
this->refGrad() = 0.0;
|
||||
@ -66,7 +66,7 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
|
||||
:
|
||||
mixedFvPatchScalarField(ptf, p, iF, mapper),
|
||||
temperatureCoupledBase(patch(), ptf.KMethod(), ptf.kappaName()),
|
||||
neighbourFieldName_(ptf.neighbourFieldName_)
|
||||
TnbrName_(ptf.TnbrName_)
|
||||
{}
|
||||
|
||||
|
||||
@ -80,7 +80,7 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
|
||||
:
|
||||
mixedFvPatchScalarField(p, iF),
|
||||
temperatureCoupledBase(patch(), dict),
|
||||
neighbourFieldName_(dict.lookup("neighbourFieldName"))
|
||||
TnbrName_(dict.lookup("neighbourFieldName"))
|
||||
{
|
||||
if (!isA<mappedPatchBase>(this->patch().patch()))
|
||||
{
|
||||
@ -129,7 +129,7 @@ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
|
||||
:
|
||||
mixedFvPatchScalarField(wtcsf, iF),
|
||||
temperatureCoupledBase(patch(), wtcsf.KMethod(), wtcsf.kappaName()),
|
||||
neighbourFieldName_(wtcsf.neighbourFieldName_)
|
||||
TnbrName_(wtcsf.TnbrName_)
|
||||
{}
|
||||
|
||||
|
||||
@ -169,7 +169,7 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs()
|
||||
(
|
||||
nbrPatch.lookupPatchField<volScalarField, scalar>
|
||||
(
|
||||
neighbourFieldName_
|
||||
TnbrName_
|
||||
)
|
||||
);
|
||||
|
||||
@ -237,7 +237,7 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::write
|
||||
) const
|
||||
{
|
||||
mixedFvPatchScalarField::write(os);
|
||||
os.writeKeyword("neighbourFieldName")<< neighbourFieldName_
|
||||
os.writeKeyword("TnbrName")<< TnbrName_
|
||||
<< token::END_STATEMENT << nl;
|
||||
temperatureCoupledBase::write(os);
|
||||
}
|
||||
|
||||
@ -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
|
||||
@ -89,7 +89,7 @@ class turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
|
||||
// Private data
|
||||
|
||||
//- Name of field on the neighbour region
|
||||
const word neighbourFieldName_;
|
||||
const word TnbrName_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -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
|
||||
@ -84,9 +84,9 @@ turbulentTemperatureRadCoupledMixedFvPatchScalarField
|
||||
:
|
||||
mixedFvPatchScalarField(p, iF),
|
||||
temperatureCoupledBase(patch(), dict),
|
||||
TnbrName_(dict.lookup("Tnbr")),
|
||||
QrNbrName_(dict.lookup("QrNbr")),
|
||||
QrName_(dict.lookup("Qr"))
|
||||
TnbrName_(dict.lookupOrDefault<word>("Tnbr", "T")),
|
||||
QrNbrName_(dict.lookupOrDefault<word>("QrNbr", "none")),
|
||||
QrName_(dict.lookupOrDefault<word>("Qr", "none"))
|
||||
{
|
||||
if (!isA<mappedPatchBase>(this->patch().patch()))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user