Merge branch 'master' of github.com-OpenFOAM:OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -154,7 +154,6 @@ public:
|
||||
);
|
||||
|
||||
|
||||
|
||||
// Destructor
|
||||
virtual ~cyclicTransform();
|
||||
|
||||
|
||||
@ -250,7 +250,6 @@ patchToPatch/rays/raysPatchToPatch.C
|
||||
mappedPatches/mappedPolyPatch/mappedPatchBase.C
|
||||
mappedPatches/mappedPolyPatch/mappedPolyPatch.C
|
||||
mappedPatches/mappedPolyPatch/mappedWallPolyPatch.C
|
||||
mappedPatches/mappedPolyPatch/mappedVariableThicknessWallPolyPatch.C
|
||||
|
||||
mappedPatches/mappedPointPatch/mappedPointPatch.C
|
||||
mappedPatches/mappedPointPatch/mappedWallPointPatch.C
|
||||
|
||||
@ -53,13 +53,12 @@ namespace Foam
|
||||
const char* Foam::NamedEnum
|
||||
<
|
||||
Foam::mappedPatchBase::sampleMode,
|
||||
6
|
||||
5
|
||||
>::names[] =
|
||||
{
|
||||
"nearestCell",
|
||||
"nearestPatchFace",
|
||||
"nearestPatchFaceAMI",
|
||||
"nearestPatchPoint",
|
||||
"nearestFace",
|
||||
"nearestOnlyCell"
|
||||
};
|
||||
@ -78,7 +77,7 @@ namespace Foam
|
||||
}
|
||||
|
||||
|
||||
const Foam::NamedEnum<Foam::mappedPatchBase::sampleMode, 6>
|
||||
const Foam::NamedEnum<Foam::mappedPatchBase::sampleMode, 5>
|
||||
Foam::mappedPatchBase::sampleModeNames_;
|
||||
|
||||
const Foam::NamedEnum<Foam::mappedPatchBase::offsetMode, 3>
|
||||
@ -87,6 +86,87 @@ const Foam::NamedEnum<Foam::mappedPatchBase::offsetMode, 3>
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
Foam::pointIndexHit Foam::mappedPatchBase::facePoint
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label facei,
|
||||
const polyMesh::cellDecomposition decompMode
|
||||
)
|
||||
{
|
||||
const point& fc = mesh.faceCentres()[facei];
|
||||
|
||||
switch (decompMode)
|
||||
{
|
||||
case polyMesh::FACE_PLANES:
|
||||
case polyMesh::FACE_CENTRE_TRIS:
|
||||
{
|
||||
// For both decompositions the face centre is guaranteed to be
|
||||
// on the face
|
||||
return pointIndexHit(true, fc, facei);
|
||||
}
|
||||
break;
|
||||
|
||||
case polyMesh::FACE_DIAG_TRIS:
|
||||
case polyMesh::CELL_TETS:
|
||||
{
|
||||
// Find the intersection of a ray from face centre to cell centre
|
||||
// Find intersection of (face-centre-decomposition) centre to
|
||||
// cell-centre with face-diagonal-decomposition triangles.
|
||||
|
||||
const pointField& p = mesh.points();
|
||||
const face& f = mesh.faces()[facei];
|
||||
|
||||
if (f.size() <= 3)
|
||||
{
|
||||
// Return centre of triangle.
|
||||
return pointIndexHit(true, fc, 0);
|
||||
}
|
||||
|
||||
label celli = mesh.faceOwner()[facei];
|
||||
const point& cc = mesh.cellCentres()[celli];
|
||||
vector d = fc-cc;
|
||||
|
||||
const label fp0 = mesh.tetBasePtIs()[facei];
|
||||
const point& basePoint = p[f[fp0]];
|
||||
|
||||
label fp = f.fcIndex(fp0);
|
||||
for (label i = 2; i < f.size(); i++)
|
||||
{
|
||||
const point& thisPoint = p[f[fp]];
|
||||
label nextFp = f.fcIndex(fp);
|
||||
const point& nextPoint = p[f[nextFp]];
|
||||
|
||||
const triPointRef tri(basePoint, thisPoint, nextPoint);
|
||||
pointHit hitInfo = tri.intersection
|
||||
(
|
||||
cc,
|
||||
d,
|
||||
intersection::algorithm::halfRay
|
||||
);
|
||||
|
||||
if (hitInfo.hit() && hitInfo.distance() > 0)
|
||||
{
|
||||
return pointIndexHit(true, hitInfo.hitPoint(), i-2);
|
||||
}
|
||||
|
||||
fp = nextFp;
|
||||
}
|
||||
|
||||
// Fall-back
|
||||
return pointIndexHit(false, fc, -1);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "problem" << abort(FatalError);
|
||||
return pointIndexHit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::pointField> Foam::mappedPatchBase::facePoints
|
||||
(
|
||||
const polyPatch& pp
|
||||
@ -115,6 +195,41 @@ Foam::tmp<Foam::pointField> Foam::mappedPatchBase::facePoints
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::pointField> Foam::mappedPatchBase::samplePoints
|
||||
(
|
||||
const pointField& fc
|
||||
) const
|
||||
{
|
||||
tmp<pointField> tfld(new pointField(fc));
|
||||
pointField& fld = tfld.ref();
|
||||
|
||||
switch (offsetMode_)
|
||||
{
|
||||
case UNIFORM:
|
||||
{
|
||||
fld += offset_;
|
||||
break;
|
||||
}
|
||||
case NONUNIFORM:
|
||||
{
|
||||
fld += offsets_;
|
||||
break;
|
||||
}
|
||||
case NORMAL:
|
||||
{
|
||||
// Get outwards pointing normal
|
||||
vectorField n(patch_.faceAreas());
|
||||
n /= mag(n);
|
||||
|
||||
fld += distance_*n;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return tfld;
|
||||
}
|
||||
|
||||
|
||||
void Foam::mappedPatchBase::collectSamples
|
||||
(
|
||||
const pointField& facePoints,
|
||||
@ -337,69 +452,6 @@ void Foam::mappedPatchBase::findSamples
|
||||
break;
|
||||
}
|
||||
|
||||
case NEARESTPATCHPOINT:
|
||||
{
|
||||
const polyPatch& pp = samplePolyPatch();
|
||||
|
||||
if (pp.empty())
|
||||
{
|
||||
forAll(samples, sampleI)
|
||||
{
|
||||
nearest[sampleI].second().first() = Foam::sqr(great);
|
||||
nearest[sampleI].second().second() = Pstream::myProcNo();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// patch (local) points
|
||||
treeBoundBox patchBb
|
||||
(
|
||||
treeBoundBox(pp.points(), pp.meshPoints()).extend(1e-4)
|
||||
);
|
||||
|
||||
indexedOctree<treeDataPoint> boundaryTree
|
||||
(
|
||||
treeDataPoint // all information needed to search faces
|
||||
(
|
||||
mesh.points(),
|
||||
pp.meshPoints() // selection of points to search on
|
||||
),
|
||||
patchBb, // overall search domain
|
||||
8, // maxLevel
|
||||
10, // leafsize
|
||||
3.0 // duplicity
|
||||
);
|
||||
|
||||
forAll(samples, sampleI)
|
||||
{
|
||||
const point& sample = samples[sampleI];
|
||||
|
||||
pointIndexHit& nearInfo = nearest[sampleI].first();
|
||||
nearInfo = boundaryTree.findNearest
|
||||
(
|
||||
sample,
|
||||
magSqr(patchBb.span())
|
||||
);
|
||||
|
||||
if (!nearInfo.hit())
|
||||
{
|
||||
nearest[sampleI].second().first() = Foam::sqr(great);
|
||||
nearest[sampleI].second().second() =
|
||||
Pstream::myProcNo();
|
||||
}
|
||||
else
|
||||
{
|
||||
const point& pt = nearInfo.hitPoint();
|
||||
|
||||
nearest[sampleI].second().first() = magSqr(pt-sample);
|
||||
nearest[sampleI].second().second() =
|
||||
Pstream::myProcNo();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case NEARESTFACE:
|
||||
{
|
||||
if (samplePatch().size() && samplePatch() != "none")
|
||||
@ -501,6 +553,36 @@ void Foam::mappedPatchBase::findSamples
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::mappedPatchBase::sampleSize() const
|
||||
{
|
||||
switch (mode_)
|
||||
{
|
||||
case NEARESTPATCHFACEAMI:
|
||||
{
|
||||
return samplePolyPatch().size();
|
||||
}
|
||||
case NEARESTCELL:
|
||||
{
|
||||
return sampleMesh().nCells();
|
||||
}
|
||||
case NEARESTPATCHFACE:
|
||||
{
|
||||
return samplePolyPatch().size();
|
||||
}
|
||||
case NEARESTFACE:
|
||||
{
|
||||
return sampleMesh().nFaces() - sampleMesh().nInternalFaces();
|
||||
}
|
||||
default:
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "problem." << abort(FatalError);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::mappedPatchBase::calcMapping() const
|
||||
{
|
||||
static bool hasWarned = false;
|
||||
@ -774,38 +856,6 @@ void Foam::mappedPatchBase::calcMapping() const
|
||||
}
|
||||
|
||||
|
||||
const Foam::autoPtr<Foam::searchableSurface>& Foam::mappedPatchBase::surfPtr()
|
||||
const
|
||||
{
|
||||
const word surfType(surfDict_.lookupOrDefault<word>("type", "none"));
|
||||
|
||||
if (!surfPtr_.valid() && surfType != "none")
|
||||
{
|
||||
word surfName(surfDict_.lookupOrDefault("name", patch_.name()));
|
||||
|
||||
const polyMesh& mesh = patch_.boundaryMesh().mesh();
|
||||
|
||||
surfPtr_ =
|
||||
searchableSurface::New
|
||||
(
|
||||
surfType,
|
||||
IOobject
|
||||
(
|
||||
surfName,
|
||||
mesh.time().constant(),
|
||||
searchableSurface::geometryDir(mesh.time()),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
surfDict_
|
||||
);
|
||||
}
|
||||
|
||||
return surfPtr_;
|
||||
}
|
||||
|
||||
|
||||
void Foam::mappedPatchBase::calcAMI() const
|
||||
{
|
||||
if (AMIPtr_.valid())
|
||||
@ -843,6 +893,31 @@ void Foam::mappedPatchBase::calcAMI() const
|
||||
meshTools::writeOBJ(osO, patch_.localFaces(), patch_.localPoints());
|
||||
}
|
||||
|
||||
// Get the projection surface, if any
|
||||
const word surfType(surfDict_.lookupOrDefault<word>("type", "none"));
|
||||
if (!surfPtr_.valid() && surfType != "none")
|
||||
{
|
||||
word surfName(surfDict_.lookupOrDefault("name", patch_.name()));
|
||||
|
||||
const polyMesh& mesh = patch_.boundaryMesh().mesh();
|
||||
|
||||
surfPtr_ =
|
||||
searchableSurface::New
|
||||
(
|
||||
surfType,
|
||||
IOobject
|
||||
(
|
||||
surfName,
|
||||
mesh.time().constant(),
|
||||
searchableSurface::geometryDir(mesh.time()),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
surfDict_
|
||||
);
|
||||
}
|
||||
|
||||
// Construct/apply AMI interpolation to determine addressing and weights
|
||||
AMIPtr_.reset
|
||||
(
|
||||
@ -850,7 +925,7 @@ void Foam::mappedPatchBase::calcAMI() const
|
||||
(
|
||||
patch_,
|
||||
samplePolyPatch(), // nbrPatch0,
|
||||
surfPtr(),
|
||||
surfPtr_,
|
||||
faceAreaIntersect::tmMesh,
|
||||
true,
|
||||
faceAreaWeightAMI::typeName,
|
||||
@ -1114,51 +1189,6 @@ Foam::mappedPatchBase::mappedPatchBase
|
||||
}
|
||||
|
||||
|
||||
Foam::mappedPatchBase::mappedPatchBase
|
||||
(
|
||||
const polyPatch& pp,
|
||||
const sampleMode mode,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
patch_(pp),
|
||||
sampleRegion_(dict.lookupOrDefault<word>("sampleRegion", "")),
|
||||
mode_(mode),
|
||||
samplePatch_(dict.lookupOrDefault<word>("samplePatch", "")),
|
||||
coupleGroup_(dict),
|
||||
offsetMode_(UNIFORM),
|
||||
offset_(Zero),
|
||||
offsets_(0),
|
||||
distance_(0.0),
|
||||
sameRegion_(sampleRegion_ == patch_.boundaryMesh().mesh().name()),
|
||||
mapPtr_(nullptr),
|
||||
AMIPtr_(nullptr),
|
||||
AMIReverse_(dict.lookupOrDefault<bool>("flipNormals", false)),
|
||||
surfPtr_(nullptr),
|
||||
surfDict_(dict.subOrEmptyDict("surface"))
|
||||
{
|
||||
if (mode != NEARESTPATCHFACE && mode != NEARESTPATCHFACEAMI)
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "Construct from sampleMode and dictionary only applicable for "
|
||||
<< " collocated patches in modes "
|
||||
<< sampleModeNames_[NEARESTPATCHFACE] << ','
|
||||
<< sampleModeNames_[NEARESTPATCHFACEAMI]
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
if (!coupleGroup_.valid())
|
||||
{
|
||||
if (sampleRegion_.empty())
|
||||
{
|
||||
// If no coupleGroup and no sampleRegion assume local region
|
||||
sampleRegion_ = patch_.boundaryMesh().mesh().name();
|
||||
sameRegion_ = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::mappedPatchBase::mappedPatchBase
|
||||
(
|
||||
const polyPatch& pp,
|
||||
@ -1216,17 +1246,7 @@ Foam::mappedPatchBase::mappedPatchBase
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::mappedPatchBase::~mappedPatchBase()
|
||||
{
|
||||
clearOut();
|
||||
}
|
||||
|
||||
|
||||
void Foam::mappedPatchBase::clearOut()
|
||||
{
|
||||
mapPtr_.clear();
|
||||
AMIPtr_.clear();
|
||||
surfPtr_.clear();
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
@ -1259,125 +1279,17 @@ const Foam::polyPatch& Foam::mappedPatchBase::samplePolyPatch() const
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::pointField> Foam::mappedPatchBase::samplePoints
|
||||
(
|
||||
const pointField& fc
|
||||
) const
|
||||
{
|
||||
tmp<pointField> tfld(new pointField(fc));
|
||||
pointField& fld = tfld.ref();
|
||||
|
||||
switch (offsetMode_)
|
||||
{
|
||||
case UNIFORM:
|
||||
{
|
||||
fld += offset_;
|
||||
break;
|
||||
}
|
||||
case NONUNIFORM:
|
||||
{
|
||||
fld += offsets_;
|
||||
break;
|
||||
}
|
||||
case NORMAL:
|
||||
{
|
||||
// Get outwards pointing normal
|
||||
vectorField n(patch_.faceAreas());
|
||||
n /= mag(n);
|
||||
|
||||
fld += distance_*n;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return tfld;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::pointField> Foam::mappedPatchBase::samplePoints() const
|
||||
{
|
||||
return samplePoints(facePoints(patch_));
|
||||
}
|
||||
|
||||
|
||||
Foam::pointIndexHit Foam::mappedPatchBase::facePoint
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label facei,
|
||||
const polyMesh::cellDecomposition decompMode
|
||||
)
|
||||
void Foam::mappedPatchBase::clearOut()
|
||||
{
|
||||
const point& fc = mesh.faceCentres()[facei];
|
||||
|
||||
switch (decompMode)
|
||||
{
|
||||
case polyMesh::FACE_PLANES:
|
||||
case polyMesh::FACE_CENTRE_TRIS:
|
||||
{
|
||||
// For both decompositions the face centre is guaranteed to be
|
||||
// on the face
|
||||
return pointIndexHit(true, fc, facei);
|
||||
}
|
||||
break;
|
||||
|
||||
case polyMesh::FACE_DIAG_TRIS:
|
||||
case polyMesh::CELL_TETS:
|
||||
{
|
||||
// Find the intersection of a ray from face centre to cell centre
|
||||
// Find intersection of (face-centre-decomposition) centre to
|
||||
// cell-centre with face-diagonal-decomposition triangles.
|
||||
|
||||
const pointField& p = mesh.points();
|
||||
const face& f = mesh.faces()[facei];
|
||||
|
||||
if (f.size() <= 3)
|
||||
{
|
||||
// Return centre of triangle.
|
||||
return pointIndexHit(true, fc, 0);
|
||||
}
|
||||
|
||||
label celli = mesh.faceOwner()[facei];
|
||||
const point& cc = mesh.cellCentres()[celli];
|
||||
vector d = fc-cc;
|
||||
|
||||
const label fp0 = mesh.tetBasePtIs()[facei];
|
||||
const point& basePoint = p[f[fp0]];
|
||||
|
||||
label fp = f.fcIndex(fp0);
|
||||
for (label i = 2; i < f.size(); i++)
|
||||
{
|
||||
const point& thisPoint = p[f[fp]];
|
||||
label nextFp = f.fcIndex(fp);
|
||||
const point& nextPoint = p[f[nextFp]];
|
||||
|
||||
const triPointRef tri(basePoint, thisPoint, nextPoint);
|
||||
pointHit hitInfo = tri.intersection
|
||||
(
|
||||
cc,
|
||||
d,
|
||||
intersection::algorithm::halfRay
|
||||
);
|
||||
|
||||
if (hitInfo.hit() && hitInfo.distance() > 0)
|
||||
{
|
||||
return pointIndexHit(true, hitInfo.hitPoint(), i-2);
|
||||
}
|
||||
|
||||
fp = nextFp;
|
||||
}
|
||||
|
||||
// Fall-back
|
||||
return pointIndexHit(false, fc, -1);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "problem" << abort(FatalError);
|
||||
return pointIndexHit();
|
||||
}
|
||||
}
|
||||
mapPtr_.clear();
|
||||
AMIPtr_.clear();
|
||||
surfPtr_.clear();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -42,10 +42,6 @@ Description
|
||||
- patches need not conform
|
||||
- uses AMI interpolation
|
||||
// - nearestFace : nearest boundary face on any patch
|
||||
// - nearestPatchPoint : nearest patch point (for coupled points
|
||||
// this might be any of the points so you have
|
||||
// to guarantee the point data is synchronised
|
||||
// beforehand)
|
||||
sampleMode nearestCell;
|
||||
|
||||
// If sampleMode is nearestPatchFace : patch to find faces of
|
||||
@ -113,7 +109,6 @@ public:
|
||||
NEARESTCELL, // nearest cell containing sample
|
||||
NEARESTPATCHFACE, // nearest face on selected patch
|
||||
NEARESTPATCHFACEAMI, // nearest patch face + AMI interpolation
|
||||
NEARESTPATCHPOINT, // nearest point on selected patch
|
||||
NEARESTFACE, // nearest face
|
||||
NEARESTONLYCELL // nearest cell (even if not containing cell)
|
||||
};
|
||||
@ -126,21 +121,18 @@ public:
|
||||
NORMAL // use face normal + distance
|
||||
};
|
||||
|
||||
static const NamedEnum<sampleMode, 6> sampleModeNames_;
|
||||
static const NamedEnum<sampleMode, 5> sampleModeNames_;
|
||||
|
||||
static const NamedEnum<offsetMode, 3> offsetModeNames_;
|
||||
|
||||
|
||||
//- Helper class for finding nearest
|
||||
// Nearest:
|
||||
// - point+local index
|
||||
// - sqr(distance)
|
||||
// - processor
|
||||
//- Helper class for finding nearest. Point and local index, squared
|
||||
// distance, and processor index.
|
||||
typedef Tuple2<pointIndexHit, Tuple2<scalar, label>> nearInfo;
|
||||
|
||||
//- Equality operator for nearest info
|
||||
class nearestEqOp
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
void operator()(nearInfo& x, const nearInfo& y) const
|
||||
@ -159,27 +151,6 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class maxProcEqOp
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
void operator()(nearInfo& x, const nearInfo& y) const
|
||||
{
|
||||
if (y.first().hit())
|
||||
{
|
||||
if (!x.first().hit())
|
||||
{
|
||||
x = y;
|
||||
}
|
||||
else if (y.second().second() > x.second().second())
|
||||
{
|
||||
x = y;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
@ -218,11 +189,7 @@ protected:
|
||||
|
||||
// Derived information
|
||||
|
||||
//- Communication schedule:
|
||||
//
|
||||
// - Cells/faces to sample per processor
|
||||
// - Patch faces to receive per processor
|
||||
// - schedule
|
||||
//- Distributor
|
||||
mutable autoPtr<distributionMap> mapPtr_;
|
||||
|
||||
|
||||
@ -243,10 +210,26 @@ protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Get a point on the face given a face decomposition method:
|
||||
// face-centre-tet : face centre. Returns index of face.
|
||||
// face-planes : face centre. Returns index of face.
|
||||
// face-diagonal : intersection of ray from cellcentre to
|
||||
// facecentre with any of the triangles.
|
||||
// Returns index (0..size-2) of triangle.
|
||||
static pointIndexHit facePoint
|
||||
(
|
||||
const polyMesh&,
|
||||
const label facei,
|
||||
const polyMesh::cellDecomposition
|
||||
);
|
||||
|
||||
//- Get the points from face-centre-decomposition face centres
|
||||
// and project them onto the face-diagonal-decomposition triangles.
|
||||
tmp<pointField> facePoints(const polyPatch&) const;
|
||||
|
||||
//- Get the sample points given the face points
|
||||
tmp<pointField> samplePoints(const pointField&) const;
|
||||
|
||||
//- Collect single list of samples and originating processor+face.
|
||||
void collectSamples
|
||||
(
|
||||
@ -267,8 +250,8 @@ protected:
|
||||
pointField& sampleLocations // actual representative location
|
||||
) const;
|
||||
|
||||
//- Get the sample points given the face points
|
||||
tmp<pointField> samplePoints(const pointField&) const;
|
||||
//- Return size of mapped mesh/patch/boundary
|
||||
label sampleSize() const;
|
||||
|
||||
//- Calculate mapping
|
||||
void calcMapping() const;
|
||||
@ -329,11 +312,6 @@ public:
|
||||
//- Construct from dictionary
|
||||
mappedPatchBase(const polyPatch&, const dictionary&);
|
||||
|
||||
//- Construct from dictionary and (collocated) sample mode
|
||||
// (only for nearestPatchFace, nearestPatchFaceAMI, nearestPatchPoint)
|
||||
// Assumes zero offset.
|
||||
mappedPatchBase(const polyPatch&, const sampleMode, const dictionary&);
|
||||
|
||||
//- Construct as copy, resetting patch
|
||||
mappedPatchBase(const polyPatch&, const mappedPatchBase&);
|
||||
|
||||
@ -352,8 +330,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
void clearOut();
|
||||
|
||||
// Access
|
||||
|
||||
//- What to sample
|
||||
@ -365,57 +341,27 @@ public:
|
||||
//- Patch (only if NEARESTPATCHFACE)
|
||||
inline const word& samplePatch() const;
|
||||
|
||||
//- PatchGroup (only if NEARESTPATCHFACE)
|
||||
inline const word& coupleGroup() const;
|
||||
|
||||
//- Return size of mapped mesh/patch/boundary
|
||||
inline label sampleSize() const;
|
||||
|
||||
//- Offset vector (from patch faces to destination mesh objects)
|
||||
inline const vector& offset() const;
|
||||
|
||||
//- Offset vector (from patch faces to destination mesh objects)
|
||||
inline const vectorField& offsets() const;
|
||||
|
||||
//- Cached sampleRegion != mesh.name()
|
||||
inline bool sameRegion() const;
|
||||
|
||||
//- Return reference to the parallel distribution map
|
||||
inline const distributionMap& map() const;
|
||||
|
||||
//- Return reference to the AMI interpolator
|
||||
inline const AMIInterpolation& AMI
|
||||
(
|
||||
const bool forceUpdate = false
|
||||
) const;
|
||||
|
||||
//- Return a pointer to the AMI projection surface
|
||||
const autoPtr<Foam::searchableSurface>& surfPtr() const;
|
||||
|
||||
//- Get the region mesh
|
||||
const polyMesh& sampleMesh() const;
|
||||
|
||||
//- Get the patch on the region
|
||||
const polyPatch& samplePolyPatch() const;
|
||||
|
||||
|
||||
// Helpers
|
||||
|
||||
//- Get the sample points
|
||||
tmp<pointField> samplePoints() const;
|
||||
|
||||
//- Get a point on the face given a face decomposition method:
|
||||
// face-centre-tet : face centre. Returns index of face.
|
||||
// face-planes : face centre. Returns index of face.
|
||||
// face-diagonal : intersection of ray from cellcentre to
|
||||
// facecentre with any of the triangles.
|
||||
// Returns index (0..size-2) of triangle.
|
||||
static pointIndexHit facePoint
|
||||
(
|
||||
const polyMesh&,
|
||||
const label facei,
|
||||
const polyMesh::cellDecomposition
|
||||
);
|
||||
|
||||
|
||||
// Edit
|
||||
|
||||
//- Clear out data on mesh change
|
||||
void clearOut();
|
||||
|
||||
|
||||
// Distribute
|
||||
|
||||
@ -23,6 +23,10 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "mappedPatchBase.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline const Foam::mappedPatchBase::sampleMode&
|
||||
Foam::mappedPatchBase::mode() const
|
||||
{
|
||||
@ -44,14 +48,12 @@ inline const Foam::word& Foam::mappedPatchBase::sampleRegion() const
|
||||
}
|
||||
|
||||
// Try and use patchGroup to find samplePatch and sampleRegion
|
||||
label samplePatchID = coupleGroup_.findOtherPatchID
|
||||
(
|
||||
patch_,
|
||||
sampleRegion_
|
||||
);
|
||||
const label samplePatchID =
|
||||
coupleGroup_.findOtherPatchID(patch_, sampleRegion_);
|
||||
|
||||
samplePatch_ = sampleMesh().boundaryMesh()[samplePatchID].name();
|
||||
}
|
||||
|
||||
return sampleRegion_;
|
||||
}
|
||||
|
||||
@ -70,71 +72,16 @@ inline const Foam::word& Foam::mappedPatchBase::samplePatch() const
|
||||
}
|
||||
|
||||
// Try and use patchGroup to find samplePatch and sampleRegion
|
||||
label samplePatchID = coupleGroup_.findOtherPatchID
|
||||
(
|
||||
patch_,
|
||||
sampleRegion_
|
||||
);
|
||||
const label samplePatchID =
|
||||
coupleGroup_.findOtherPatchID(patch_, sampleRegion_);
|
||||
|
||||
samplePatch_ = sampleMesh().boundaryMesh()[samplePatchID].name();
|
||||
}
|
||||
|
||||
return samplePatch_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::word& Foam::mappedPatchBase::coupleGroup() const
|
||||
{
|
||||
return coupleGroup_.name();
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::mappedPatchBase::sampleSize() const
|
||||
{
|
||||
switch (mode_)
|
||||
{
|
||||
case NEARESTPATCHFACEAMI:
|
||||
{
|
||||
return samplePolyPatch().size();
|
||||
}
|
||||
case NEARESTCELL:
|
||||
{
|
||||
return sampleMesh().nCells();
|
||||
}
|
||||
case NEARESTPATCHFACE:
|
||||
{
|
||||
return samplePolyPatch().size();
|
||||
}
|
||||
case NEARESTPATCHPOINT:
|
||||
{
|
||||
return samplePolyPatch().nPoints();
|
||||
}
|
||||
case NEARESTFACE:
|
||||
{
|
||||
const polyMesh& mesh = sampleMesh();
|
||||
return mesh.nFaces() - mesh.nInternalFaces();
|
||||
}
|
||||
default:
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "problem." << abort(FatalError);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::vector& Foam::mappedPatchBase::offset() const
|
||||
{
|
||||
return offset_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::vectorField& Foam::mappedPatchBase::offsets() const
|
||||
{
|
||||
return offsets_;
|
||||
}
|
||||
|
||||
|
||||
inline bool Foam::mappedPatchBase::sameRegion() const
|
||||
{
|
||||
return sameRegion_;
|
||||
@ -152,18 +99,4 @@ inline const Foam::distributionMap& Foam::mappedPatchBase::map() const
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::AMIInterpolation& Foam::mappedPatchBase::AMI
|
||||
(
|
||||
bool forceUpdate
|
||||
) const
|
||||
{
|
||||
if (forceUpdate || AMIPtr_.empty())
|
||||
{
|
||||
calcAMI();
|
||||
}
|
||||
|
||||
return AMIPtr_();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -23,6 +23,11 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "mappedPatchBase.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::mappedPatchBase::distribute(List<Type>& lst) const
|
||||
{
|
||||
@ -30,7 +35,11 @@ void Foam::mappedPatchBase::distribute(List<Type>& lst) const
|
||||
{
|
||||
case NEARESTPATCHFACEAMI:
|
||||
{
|
||||
lst = AMI().interpolateToSource(Field<Type>(move(lst)));
|
||||
if (AMIPtr_.empty())
|
||||
{
|
||||
calcAMI();
|
||||
}
|
||||
lst = AMIPtr_->interpolateToSource(Field<Type>(move(lst)));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -52,11 +61,11 @@ void Foam::mappedPatchBase::distribute
|
||||
{
|
||||
case NEARESTPATCHFACEAMI:
|
||||
{
|
||||
lst = AMI().interpolateToSource
|
||||
(
|
||||
Field<Type>(move(lst)),
|
||||
cop
|
||||
);
|
||||
if (AMIPtr_.empty())
|
||||
{
|
||||
calcAMI();
|
||||
}
|
||||
lst = AMIPtr_->interpolateToSource(Field<Type>(move(lst)), cop);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -87,7 +96,11 @@ void Foam::mappedPatchBase::reverseDistribute(List<Type>& lst) const
|
||||
{
|
||||
case NEARESTPATCHFACEAMI:
|
||||
{
|
||||
lst = AMI().interpolateToTarget(Field<Type>(move(lst)));
|
||||
if (AMIPtr_.empty())
|
||||
{
|
||||
calcAMI();
|
||||
}
|
||||
lst = AMIPtr_->interpolateToTarget(Field<Type>(move(lst)));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -110,21 +123,20 @@ void Foam::mappedPatchBase::reverseDistribute
|
||||
{
|
||||
case NEARESTPATCHFACEAMI:
|
||||
{
|
||||
lst = AMI().interpolateToTarget
|
||||
(
|
||||
Field<Type>(move(lst)),
|
||||
cop
|
||||
);
|
||||
if (AMIPtr_.empty())
|
||||
{
|
||||
calcAMI();
|
||||
}
|
||||
lst = AMIPtr_->interpolateToTarget(Field<Type>(move(lst)), cop);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
label cSize = sampleSize();
|
||||
distributionMapBase::distribute
|
||||
(
|
||||
Pstream::defaultCommsType,
|
||||
map().schedule(),
|
||||
cSize,
|
||||
sampleSize(),
|
||||
map().constructMap(),
|
||||
false,
|
||||
map().subMap(),
|
||||
|
||||
@ -172,9 +172,7 @@ Foam::mappedPolyPatch::mappedPolyPatch
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::mappedPolyPatch::~mappedPolyPatch()
|
||||
{
|
||||
mappedPatchBase::clearOut();
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
@ -1,174 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "mappedVariableThicknessWallPolyPatch.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(mappedVariableThicknessWallPolyPatch, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
polyPatch,
|
||||
mappedVariableThicknessWallPolyPatch,
|
||||
word
|
||||
);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
polyPatch,
|
||||
mappedVariableThicknessWallPolyPatch,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::mappedVariableThicknessWallPolyPatch::mappedVariableThicknessWallPolyPatch
|
||||
(
|
||||
const word& name,
|
||||
const label size,
|
||||
const label start,
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm,
|
||||
const word& patchType
|
||||
)
|
||||
:
|
||||
mappedWallPolyPatch(name, size, start, index, bm, patchType),
|
||||
thickness_(size)
|
||||
{}
|
||||
|
||||
|
||||
Foam::mappedVariableThicknessWallPolyPatch::mappedVariableThicknessWallPolyPatch
|
||||
(
|
||||
const word& name,
|
||||
const label size,
|
||||
const label start,
|
||||
const label index,
|
||||
const word& sampleRegion,
|
||||
const mappedPatchBase::sampleMode mode,
|
||||
const word& samplePatch,
|
||||
const vectorField& offset,
|
||||
const polyBoundaryMesh& bm
|
||||
)
|
||||
:
|
||||
mappedWallPolyPatch(name, size, start, index, bm, typeName),
|
||||
thickness_(size)
|
||||
{}
|
||||
|
||||
|
||||
Foam::mappedVariableThicknessWallPolyPatch::mappedVariableThicknessWallPolyPatch
|
||||
(
|
||||
const word& name,
|
||||
const label size,
|
||||
const label start,
|
||||
const label index,
|
||||
const word& sampleRegion,
|
||||
const mappedPatchBase::sampleMode mode,
|
||||
const word& samplePatch,
|
||||
const vector& offset,
|
||||
const polyBoundaryMesh& bm
|
||||
)
|
||||
:
|
||||
mappedWallPolyPatch(name, size, start, index, bm, typeName),
|
||||
thickness_(size)
|
||||
{}
|
||||
|
||||
|
||||
Foam::mappedVariableThicknessWallPolyPatch::mappedVariableThicknessWallPolyPatch
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm,
|
||||
const word& patchType
|
||||
)
|
||||
:
|
||||
mappedWallPolyPatch(name, dict, index, bm, patchType),
|
||||
thickness_(scalarField("thickness", dict, this->size()))
|
||||
{}
|
||||
|
||||
|
||||
Foam::mappedVariableThicknessWallPolyPatch::
|
||||
mappedVariableThicknessWallPolyPatch
|
||||
(
|
||||
const mappedVariableThicknessWallPolyPatch& pp,
|
||||
const polyBoundaryMesh& bm
|
||||
)
|
||||
:
|
||||
mappedWallPolyPatch(pp, bm),
|
||||
thickness_(pp.thickness_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::mappedVariableThicknessWallPolyPatch::mappedVariableThicknessWallPolyPatch
|
||||
(
|
||||
const mappedVariableThicknessWallPolyPatch& pp,
|
||||
const polyBoundaryMesh& bm,
|
||||
const label index,
|
||||
const label newSize,
|
||||
const label newStart
|
||||
)
|
||||
:
|
||||
mappedWallPolyPatch(pp, bm, index, newSize, newStart),
|
||||
thickness_(newSize)
|
||||
{}
|
||||
|
||||
|
||||
Foam::mappedVariableThicknessWallPolyPatch::mappedVariableThicknessWallPolyPatch
|
||||
(
|
||||
const mappedVariableThicknessWallPolyPatch& pp,
|
||||
const polyBoundaryMesh& bm,
|
||||
const label index,
|
||||
const labelUList& mapAddressing,
|
||||
const label newStart
|
||||
)
|
||||
:
|
||||
mappedWallPolyPatch(pp, bm, index, mapAddressing, newStart),
|
||||
thickness_(pp.size())
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::mappedVariableThicknessWallPolyPatch::
|
||||
~mappedVariableThicknessWallPolyPatch()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::mappedVariableThicknessWallPolyPatch::
|
||||
write(Foam::Ostream& os) const
|
||||
{
|
||||
writeEntry(os, "thickness", thickness_);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,238 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::mappedVariableThicknessWallPolyPatch
|
||||
|
||||
Description
|
||||
Foam::mappedVariableThicknessWallPolyPatch
|
||||
|
||||
SourceFiles
|
||||
mappedVariableThicknessWallPolyPatch.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef mappedVariableThicknessWallPolyPatch_H
|
||||
#define mappedVariableThicknessWallPolyPatch_H
|
||||
|
||||
#include "wallPolyPatch.H"
|
||||
#include "mappedWallPolyPatch.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class polyMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class mappedVariableThicknessWallPolyPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class mappedVariableThicknessWallPolyPatch
|
||||
:
|
||||
public mappedWallPolyPatch
|
||||
{
|
||||
|
||||
// Private Data
|
||||
|
||||
//- Thickness
|
||||
scalarList thickness_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("mappedWallVariableThickness");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
mappedVariableThicknessWallPolyPatch
|
||||
(
|
||||
const word& name,
|
||||
const label size,
|
||||
const label start,
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm,
|
||||
const word& patchType
|
||||
);
|
||||
|
||||
//- Construct from components
|
||||
mappedVariableThicknessWallPolyPatch
|
||||
(
|
||||
const word& name,
|
||||
const label size,
|
||||
const label start,
|
||||
const label index,
|
||||
const word& sampleRegion,
|
||||
const mappedPatchBase::sampleMode mode,
|
||||
const word& samplePatch,
|
||||
const vectorField& offset,
|
||||
const polyBoundaryMesh& bm
|
||||
);
|
||||
|
||||
//- Construct from components. Uniform offset.
|
||||
mappedVariableThicknessWallPolyPatch
|
||||
(
|
||||
const word& name,
|
||||
const label size,
|
||||
const label start,
|
||||
const label index,
|
||||
const word& sampleRegion,
|
||||
const mappedPatchBase::sampleMode mode,
|
||||
const word& samplePatch,
|
||||
const vector& offset,
|
||||
const polyBoundaryMesh& bm
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
mappedVariableThicknessWallPolyPatch
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm,
|
||||
const word& patchType
|
||||
);
|
||||
|
||||
//- Construct as copy, resetting the boundary mesh
|
||||
mappedVariableThicknessWallPolyPatch
|
||||
(
|
||||
const mappedVariableThicknessWallPolyPatch&,
|
||||
const polyBoundaryMesh&
|
||||
);
|
||||
|
||||
//- Construct given the original patch and resetting the
|
||||
// face list and boundary mesh information
|
||||
mappedVariableThicknessWallPolyPatch
|
||||
(
|
||||
const mappedVariableThicknessWallPolyPatch& pp,
|
||||
const polyBoundaryMesh& bm,
|
||||
const label index,
|
||||
const label newSize,
|
||||
const label newStart
|
||||
);
|
||||
|
||||
//- Construct given the original patch and a map
|
||||
mappedVariableThicknessWallPolyPatch
|
||||
(
|
||||
const mappedVariableThicknessWallPolyPatch& pp,
|
||||
const polyBoundaryMesh& bm,
|
||||
const label index,
|
||||
const labelUList& mapAddressing,
|
||||
const label newStart
|
||||
);
|
||||
|
||||
//- Construct and return a clone, resetting the boundary mesh
|
||||
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
|
||||
{
|
||||
return autoPtr<polyPatch>
|
||||
(
|
||||
new mappedVariableThicknessWallPolyPatch(*this, bm)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct and return a clone, resetting the face list
|
||||
// and boundary mesh
|
||||
virtual autoPtr<polyPatch> clone
|
||||
(
|
||||
const polyBoundaryMesh& bm,
|
||||
const label index,
|
||||
const label newSize,
|
||||
const label newStart
|
||||
) const
|
||||
{
|
||||
return autoPtr<polyPatch>
|
||||
(
|
||||
new mappedVariableThicknessWallPolyPatch
|
||||
(
|
||||
*this,
|
||||
bm,
|
||||
index,
|
||||
newSize,
|
||||
newStart
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct and return a clone, resetting the face list
|
||||
// and boundary mesh
|
||||
virtual autoPtr<polyPatch> clone
|
||||
(
|
||||
const polyBoundaryMesh& bm,
|
||||
const label index,
|
||||
const labelUList& mapAddressing,
|
||||
const label newStart
|
||||
) const
|
||||
{
|
||||
return autoPtr<polyPatch>
|
||||
(
|
||||
new mappedVariableThicknessWallPolyPatch
|
||||
(
|
||||
*this,
|
||||
bm,
|
||||
index,
|
||||
mapAddressing,
|
||||
newStart
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~mappedVariableThicknessWallPolyPatch();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return non const thickness
|
||||
scalarList& thickness()
|
||||
{
|
||||
return thickness_;
|
||||
}
|
||||
|
||||
|
||||
//- Return const thickness
|
||||
const scalarList& thickness() const
|
||||
{
|
||||
return thickness_;
|
||||
}
|
||||
|
||||
|
||||
//- Write the polyPatch data as a dictionary
|
||||
void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -178,9 +178,7 @@ Foam::mappedWallPolyPatch::mappedWallPolyPatch
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::mappedWallPolyPatch::~mappedWallPolyPatch()
|
||||
{
|
||||
mappedPatchBase::clearOut();
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
@ -4,6 +4,6 @@ makeType=${1:-libso}
|
||||
|
||||
wclean $makeType regionModel
|
||||
wclean $makeType surfaceFilmModels
|
||||
wclean $makeType thermalBaffleModels
|
||||
wclean $makeType thermalBaffle
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -6,6 +6,6 @@ cd ${0%/*} || exit 1 # Run from this directory
|
||||
|
||||
wmake $targetType regionModel
|
||||
wmake $targetType surfaceFilmModels
|
||||
wmake $targetType thermalBaffleModels
|
||||
wmake $targetType thermalBaffle
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -1,13 +1,4 @@
|
||||
# Region models
|
||||
regionModel/regionModel.C
|
||||
singleLayerRegion/singleLayerRegion.C
|
||||
regionModel1D/regionModel1D.C
|
||||
|
||||
# Boundary conditions
|
||||
derivedFvPatches/mappedVariableThicknessWall/mappedVariableThicknessWallFvPatch.C
|
||||
|
||||
regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObject.C
|
||||
regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectNew.C
|
||||
regionModelFunctionObject/regionModelFunctionObject/regionModelFunctionObjectList.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libregionModels
|
||||
|
||||
@ -1,64 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "mappedVariableThicknessWallFvPatch.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "regionModel1D.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(mappedVariableThicknessWallFvPatch, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
fvPatch,
|
||||
mappedVariableThicknessWallFvPatch,
|
||||
polyPatch
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::mappedVariableThicknessWallFvPatch::
|
||||
makeDeltaCoeffs(scalarField& dc) const
|
||||
{
|
||||
const mappedVariableThicknessWallPolyPatch& pp =
|
||||
refCast<const mappedVariableThicknessWallPolyPatch>(patch());
|
||||
|
||||
typedef regionModels::regionModel1D modelType;
|
||||
|
||||
const modelType& region1D =
|
||||
patch().boundaryMesh().mesh().time().lookupObject<modelType>
|
||||
(
|
||||
"thermalBaffleProperties"
|
||||
);
|
||||
|
||||
dc = 2.0/(pp.thickness()/region1D.nLayers());
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,93 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::mappedVariableThicknessWallFvPatch
|
||||
|
||||
Description
|
||||
Take thickness field and number of layers and returns deltaCoeffs
|
||||
as 2.0/thickness/nLayers.
|
||||
To be used with 1D thermo baffle.
|
||||
|
||||
SourceFiles
|
||||
mappedVariableThicknessWallFvPatch.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef mappedVariableThicknessWallFvPatch_H
|
||||
#define mappedVariableThicknessWallFvPatch_H
|
||||
|
||||
#include "wallFvPatch.H"
|
||||
#include "mappedVariableThicknessWallPolyPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class mappedVariableThicknessWallFvPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class mappedVariableThicknessWallFvPatch
|
||||
:
|
||||
public wallFvPatch
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Read neighbour cell distances from dictionary
|
||||
void makeDeltaCoeffs(scalarField& dc) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName(mappedVariableThicknessWallPolyPatch::typeName_());
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
mappedVariableThicknessWallFvPatch
|
||||
(
|
||||
const polyPatch& patch,
|
||||
const fvBoundaryMesh& bm
|
||||
)
|
||||
:
|
||||
wallFvPatch(patch, bm)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -267,8 +267,7 @@ Foam::regionModels::regionModel::regionModel
|
||||
outputPropertiesPtr_(nullptr),
|
||||
primaryPatchIDs_(),
|
||||
intCoupledPatchIDs_(),
|
||||
regionName_("none"),
|
||||
functions_(*this)
|
||||
regionName_("none")
|
||||
{}
|
||||
|
||||
|
||||
@ -300,8 +299,7 @@ Foam::regionModels::regionModel::regionModel
|
||||
outputPropertiesPtr_(nullptr),
|
||||
primaryPatchIDs_(),
|
||||
intCoupledPatchIDs_(),
|
||||
regionName_(lookup("regionName")),
|
||||
functions_(*this, subOrEmptyDict("functions"))
|
||||
regionName_(lookup("regionName"))
|
||||
{
|
||||
constructMeshObjects();
|
||||
initialise();
|
||||
@ -344,8 +342,7 @@ Foam::regionModels::regionModel::regionModel
|
||||
outputPropertiesPtr_(nullptr),
|
||||
primaryPatchIDs_(),
|
||||
intCoupledPatchIDs_(),
|
||||
regionName_(dict.lookup("regionName")),
|
||||
functions_(*this, subOrEmptyDict("functions"))
|
||||
regionName_(dict.lookup("regionName"))
|
||||
{
|
||||
constructMeshObjects();
|
||||
initialise();
|
||||
@ -398,9 +395,7 @@ void Foam::regionModels::regionModel::evolve()
|
||||
|
||||
|
||||
void Foam::regionModels::regionModel::preEvolveRegion()
|
||||
{
|
||||
functions_.preEvolveRegion();
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
void Foam::regionModels::regionModel::evolveRegion()
|
||||
@ -408,9 +403,7 @@ void Foam::regionModels::regionModel::evolveRegion()
|
||||
|
||||
|
||||
void Foam::regionModels::regionModel::postEvolveRegion()
|
||||
{
|
||||
functions_.postEvolveRegion();
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
void Foam::regionModels::regionModel::info()
|
||||
|
||||
@ -39,13 +39,11 @@ SourceFiles
|
||||
|
||||
#include "fvMesh.H"
|
||||
#include "timeIOdictionary.H"
|
||||
#include "regionModelFunctionObjectList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
namespace regionModels
|
||||
{
|
||||
|
||||
@ -110,9 +108,6 @@ protected:
|
||||
//- Region name
|
||||
word regionName_;
|
||||
|
||||
//- Region model function objects
|
||||
regionModelFunctionObjectList functions_;
|
||||
|
||||
|
||||
// Protected member functions
|
||||
|
||||
|
||||
@ -1,352 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "regionModel1D.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace regionModels
|
||||
{
|
||||
defineTypeNameAndDebug(regionModel1D, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
void Foam::regionModels::regionModel1D::constructMeshObjects()
|
||||
{
|
||||
nMagSfPtr_.reset
|
||||
(
|
||||
new surfaceScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"nMagSf",
|
||||
time().timeName(),
|
||||
regionMesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
regionMesh(),
|
||||
dimensionedScalar(dimArea, 0)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void Foam::regionModels::regionModel1D::initialise()
|
||||
{
|
||||
DebugInFunction << endl;
|
||||
|
||||
// Calculate boundaryFaceFaces and boundaryFaceCells
|
||||
|
||||
DynamicList<label> faceIDs;
|
||||
DynamicList<label> cellIDs;
|
||||
|
||||
label localPyrolysisFacei = 0;
|
||||
|
||||
const polyBoundaryMesh& rbm = regionMesh().boundaryMesh();
|
||||
|
||||
forAll(intCoupledPatchIDs_, i)
|
||||
{
|
||||
const label patchi = intCoupledPatchIDs_[i];
|
||||
const polyPatch& ppCoupled = rbm[patchi];
|
||||
forAll(ppCoupled, localFacei)
|
||||
{
|
||||
label facei = ppCoupled.start() + localFacei;
|
||||
label celli = -1;
|
||||
label nFaces = 0;
|
||||
label nCells = 0;
|
||||
do
|
||||
{
|
||||
label ownCelli = regionMesh().faceOwner()[facei];
|
||||
if (ownCelli != celli)
|
||||
{
|
||||
celli = ownCelli;
|
||||
}
|
||||
else
|
||||
{
|
||||
celli = regionMesh().faceNeighbour()[facei];
|
||||
}
|
||||
nCells++;
|
||||
cellIDs.append(celli);
|
||||
const cell& cFaces = regionMesh().cells()[celli];
|
||||
facei = cFaces.opposingFaceLabel(facei, regionMesh().faces());
|
||||
faceIDs.append(facei);
|
||||
nFaces++;
|
||||
} while (regionMesh().isInternalFace(facei));
|
||||
|
||||
boundaryFaceOppositeFace_[localPyrolysisFacei] = facei;
|
||||
faceIDs.remove(); // remove boundary face.
|
||||
nFaces--;
|
||||
|
||||
boundaryFaceFaces_[localPyrolysisFacei].transfer(faceIDs);
|
||||
boundaryFaceCells_[localPyrolysisFacei].transfer(cellIDs);
|
||||
|
||||
localPyrolysisFacei++;
|
||||
nLayers_ = nCells;
|
||||
}
|
||||
}
|
||||
|
||||
boundaryFaceOppositeFace_.setSize(localPyrolysisFacei);
|
||||
boundaryFaceFaces_.setSize(localPyrolysisFacei);
|
||||
boundaryFaceCells_.setSize(localPyrolysisFacei);
|
||||
|
||||
surfaceScalarField& nMagSf = nMagSfPtr_();
|
||||
surfaceScalarField::Boundary& nMagSfBf = nMagSf.boundaryFieldRef();
|
||||
|
||||
localPyrolysisFacei = 0;
|
||||
|
||||
forAll(intCoupledPatchIDs_, i)
|
||||
{
|
||||
const label patchi = intCoupledPatchIDs_[i];
|
||||
const polyPatch& ppCoupled = rbm[patchi];
|
||||
const vectorField& pNormals = ppCoupled.faceNormals();
|
||||
nMagSfBf[patchi] = regionMesh().Sf().boundaryField()[patchi] & pNormals;
|
||||
forAll(pNormals, localFacei)
|
||||
{
|
||||
const vector& n = pNormals[localFacei];
|
||||
const labelList& faces = boundaryFaceFaces_[localPyrolysisFacei++];
|
||||
forAll(faces, facei)
|
||||
{
|
||||
const label faceID = faces[facei];
|
||||
nMagSf[faceID] = regionMesh().Sf()[faceID] & n;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
bool Foam::regionModels::regionModel1D::read()
|
||||
{
|
||||
if (regionModel::read())
|
||||
{
|
||||
moveMesh_.readIfPresent("moveMesh", coeffs_);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Foam::regionModels::regionModel1D::read(const dictionary& dict)
|
||||
{
|
||||
if (regionModel::read(dict))
|
||||
{
|
||||
moveMesh_.readIfPresent("moveMesh", coeffs_);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::labelField> Foam::regionModels::regionModel1D::moveMesh
|
||||
(
|
||||
const scalarList& deltaV,
|
||||
const scalar minDelta
|
||||
)
|
||||
{
|
||||
tmp<labelField> tcellMoveMap(new labelField(regionMesh().nCells(), 0));
|
||||
labelField& cellMoveMap = tcellMoveMap.ref();
|
||||
|
||||
if (!moveMesh_)
|
||||
{
|
||||
return cellMoveMap;
|
||||
}
|
||||
|
||||
pointField oldPoints = regionMesh().points();
|
||||
pointField newPoints = oldPoints;
|
||||
|
||||
const polyBoundaryMesh& bm = regionMesh().boundaryMesh();
|
||||
|
||||
label totalFaceId = 0;
|
||||
forAll(intCoupledPatchIDs_, localPatchi)
|
||||
{
|
||||
label patchi = intCoupledPatchIDs_[localPatchi];
|
||||
const polyPatch pp = bm[patchi];
|
||||
const vectorField& cf = regionMesh().Cf().boundaryField()[patchi];
|
||||
|
||||
forAll(pp, patchFacei)
|
||||
{
|
||||
const labelList& faces = boundaryFaceFaces_[totalFaceId];
|
||||
const labelList& cells = boundaryFaceCells_[totalFaceId];
|
||||
|
||||
const vector n = pp.faceNormals()[patchFacei];
|
||||
const vector sf = pp.faceAreas()[patchFacei];
|
||||
|
||||
List<point> oldCf(faces.size() + 1);
|
||||
oldCf[0] = cf[patchFacei];
|
||||
forAll(faces, i)
|
||||
{
|
||||
oldCf[i + 1] = regionMesh().faceCentres()[faces[i]];
|
||||
}
|
||||
|
||||
vector newDelta = Zero;
|
||||
point nbrCf = oldCf[0];
|
||||
|
||||
forAll(faces, i)
|
||||
{
|
||||
const label facei = faces[i];
|
||||
const label celli = cells[i];
|
||||
|
||||
const face f = regionMesh().faces()[facei];
|
||||
|
||||
newDelta += (deltaV[celli]/mag(sf))*n;
|
||||
|
||||
vector localDelta = Zero;
|
||||
forAll(f, pti)
|
||||
{
|
||||
const label pointi = f[pti];
|
||||
|
||||
if
|
||||
(
|
||||
mag((nbrCf - (oldPoints[pointi] + newDelta)) & n)
|
||||
> minDelta
|
||||
)
|
||||
{
|
||||
newPoints[pointi] = oldPoints[pointi] + newDelta;
|
||||
localDelta = newDelta;
|
||||
cellMoveMap[celli] = 1;
|
||||
}
|
||||
}
|
||||
nbrCf = oldCf[i + 1] + localDelta;
|
||||
}
|
||||
// Modify boundary
|
||||
const label bFacei = boundaryFaceOppositeFace_[totalFaceId];
|
||||
const face f = regionMesh().faces()[bFacei];
|
||||
const label celli = cells[cells.size() - 1];
|
||||
newDelta += (deltaV[celli]/mag(sf))*n;
|
||||
forAll(f, pti)
|
||||
{
|
||||
const label pointi = f[pti];
|
||||
if
|
||||
(
|
||||
mag((nbrCf - (oldPoints[pointi] + newDelta)) & n)
|
||||
> minDelta
|
||||
)
|
||||
{
|
||||
newPoints[pointi] = oldPoints[pointi] + newDelta;
|
||||
cellMoveMap[celli] = 1;
|
||||
}
|
||||
}
|
||||
totalFaceId ++;
|
||||
}
|
||||
}
|
||||
// Move points
|
||||
regionMesh().movePoints(newPoints);
|
||||
|
||||
return tcellMoveMap;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::regionModels::regionModel1D::regionModel1D
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const word& regionType
|
||||
)
|
||||
:
|
||||
regionModel(mesh, regionType),
|
||||
boundaryFaceFaces_(),
|
||||
boundaryFaceCells_(),
|
||||
boundaryFaceOppositeFace_(),
|
||||
nLayers_(0),
|
||||
nMagSfPtr_(nullptr),
|
||||
moveMesh_(false)
|
||||
{}
|
||||
|
||||
|
||||
Foam::regionModels::regionModel1D::regionModel1D
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const word& regionType,
|
||||
const word& modelName,
|
||||
bool readFields
|
||||
)
|
||||
:
|
||||
regionModel(mesh, regionType, modelName, false),
|
||||
boundaryFaceFaces_(regionMesh().nCells()),
|
||||
boundaryFaceCells_(regionMesh().nCells()),
|
||||
boundaryFaceOppositeFace_(regionMesh().nCells()),
|
||||
nLayers_(0),
|
||||
nMagSfPtr_(nullptr),
|
||||
moveMesh_(true)
|
||||
{
|
||||
constructMeshObjects();
|
||||
initialise();
|
||||
|
||||
if (readFields)
|
||||
{
|
||||
read();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::regionModels::regionModel1D::regionModel1D
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const word& regionType,
|
||||
const word& modelName,
|
||||
const dictionary& dict,
|
||||
bool readFields
|
||||
)
|
||||
:
|
||||
regionModel(mesh, regionType, modelName, dict, readFields),
|
||||
boundaryFaceFaces_(regionMesh().nCells()),
|
||||
boundaryFaceCells_(regionMesh().nCells()),
|
||||
boundaryFaceOppositeFace_(regionMesh().nCells()),
|
||||
nLayers_(0),
|
||||
nMagSfPtr_(nullptr),
|
||||
moveMesh_(false)
|
||||
{
|
||||
constructMeshObjects();
|
||||
initialise();
|
||||
|
||||
if (readFields)
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::regionModels::regionModel1D::~regionModel1D()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,196 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::regionModels::regionModel1D
|
||||
|
||||
Description
|
||||
Base class for 1-D region models
|
||||
|
||||
SourceFiles
|
||||
regionModel1D.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef regionModel1D_H
|
||||
#define regionModel1D_H
|
||||
|
||||
#include "regionModel.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "labelList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace regionModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class regionModel1D Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class regionModel1D
|
||||
:
|
||||
public regionModel
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construction
|
||||
regionModel1D(const regionModel1D&) = delete;
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const regionModel1D&) = delete;
|
||||
|
||||
//- Construct region mesh and fields
|
||||
void constructMeshObjects();
|
||||
|
||||
//- Initialise the region
|
||||
void initialise();
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
// Region addressing - per internally coupled patch face walking out
|
||||
|
||||
//- Global face IDs
|
||||
labelListList boundaryFaceFaces_;
|
||||
|
||||
//- Global cell IDs
|
||||
labelListList boundaryFaceCells_;
|
||||
|
||||
//- Global boundary face IDs opposite coupled patch
|
||||
labelList boundaryFaceOppositeFace_;
|
||||
|
||||
//- Number of layers in the region
|
||||
label nLayers_;
|
||||
|
||||
|
||||
// Geometry
|
||||
|
||||
//- Face area magnitude normal to patch
|
||||
autoPtr<surfaceScalarField> nMagSfPtr_;
|
||||
|
||||
//- Flag to allow mesh movement
|
||||
Switch moveMesh_;
|
||||
|
||||
|
||||
// Protected member functions
|
||||
|
||||
//- Read control parameters from dictionary
|
||||
virtual bool read();
|
||||
|
||||
//- Read control parameters from dictionary
|
||||
virtual bool read(const dictionary& dict);
|
||||
|
||||
//- Move mesh points according to change in cell volumes
|
||||
// Returns map ordered by cell where 1 = cell moved, 0 = cell unchanged
|
||||
tmp<labelField> moveMesh
|
||||
(
|
||||
const scalarList& deltaV,
|
||||
const scalar minDelta = 0.0
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("regionModel1D");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
regionModel1D
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const word& regionType
|
||||
);
|
||||
|
||||
//- Construct from mesh, region type and name
|
||||
regionModel1D
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const word& regionType,
|
||||
const word& modelName,
|
||||
bool readFields = true
|
||||
);
|
||||
|
||||
//- Construct from mesh, region type and name and dict
|
||||
regionModel1D
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const word& regionType,
|
||||
const word& modelName,
|
||||
const dictionary& dict,
|
||||
bool readFields = true
|
||||
);
|
||||
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~regionModel1D();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
// Addressing
|
||||
|
||||
//- Return the global face IDs
|
||||
inline const labelListList& boundaryFaceFaces() const;
|
||||
|
||||
//- Return the global cell IDs
|
||||
inline const labelListList& boundaryFaceCells() const;
|
||||
|
||||
//- Return the global boundary face IDs opposite coupled patch
|
||||
inline const labelList& boundaryFaceOppositeFace() const;
|
||||
|
||||
|
||||
// Geometry
|
||||
|
||||
//- Return the face area magnitudes / [m^2]
|
||||
inline const surfaceScalarField& nMagSf() const;
|
||||
|
||||
//- Return the number of layers in the region
|
||||
inline label nLayers() const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace regionModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "regionModel1DI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,70 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "regionModel1D.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
inline const Foam::labelListList&
|
||||
Foam::regionModels::regionModel1D::boundaryFaceFaces() const
|
||||
{
|
||||
return boundaryFaceFaces_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::labelListList&
|
||||
Foam::regionModels::regionModel1D::boundaryFaceCells() const
|
||||
{
|
||||
return boundaryFaceCells_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::labelList&
|
||||
Foam::regionModels::regionModel1D::boundaryFaceOppositeFace() const
|
||||
{
|
||||
return boundaryFaceOppositeFace_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::surfaceScalarField&
|
||||
Foam::regionModels::regionModel1D::nMagSf() const
|
||||
{
|
||||
if (!nMagSfPtr_.valid())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Face normal areas not available" << abort(FatalError);
|
||||
}
|
||||
|
||||
return nMagSfPtr_();
|
||||
}
|
||||
|
||||
|
||||
inline Foam::label Foam::regionModels::regionModel1D::nLayers() const
|
||||
{
|
||||
return nLayers_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,102 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "regionModelFunctionObject.H"
|
||||
#include "regionModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace regionModels
|
||||
{
|
||||
defineTypeNameAndDebug(regionModelFunctionObject, 0);
|
||||
defineRunTimeSelectionTable(regionModelFunctionObject, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::regionModels::regionModelFunctionObject::regionModelFunctionObject
|
||||
(
|
||||
regionModel& region
|
||||
)
|
||||
:
|
||||
dict_(dictionary::null),
|
||||
regionModel_(region),
|
||||
modelType_("modelType")
|
||||
{}
|
||||
|
||||
|
||||
Foam::regionModels::regionModelFunctionObject::regionModelFunctionObject
|
||||
(
|
||||
const dictionary& dict,
|
||||
regionModel& region,
|
||||
const word& type
|
||||
)
|
||||
:
|
||||
dict_(dict),
|
||||
regionModel_(region),
|
||||
modelType_(type)
|
||||
{}
|
||||
|
||||
|
||||
Foam::regionModels::regionModelFunctionObject::regionModelFunctionObject
|
||||
(
|
||||
const regionModelFunctionObject& rmfo
|
||||
)
|
||||
:
|
||||
dict_(rmfo.dict_),
|
||||
regionModel_(rmfo.regionModel_),
|
||||
modelType_(rmfo.modelType_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::regionModels::regionModelFunctionObject::~regionModelFunctionObject()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::regionModels::regionModelFunctionObject::preEvolveRegion()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::regionModels::regionModelFunctionObject::postEvolveRegion()
|
||||
{
|
||||
if (regionModel_.regionMesh().time().writeTime())
|
||||
{
|
||||
write();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::regionModels::regionModelFunctionObject::write() const
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,157 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::regionModels::regionModelFunctionObject
|
||||
|
||||
Description
|
||||
Region model function object base class
|
||||
|
||||
SourceFiles
|
||||
regionModelFunctionObject.C
|
||||
regionModelFunctionObjectNew.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef regionModelFunctionObject_H
|
||||
#define regionModelFunctionObject_H
|
||||
|
||||
#include "IOdictionary.H"
|
||||
#include "autoPtr.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
namespace regionModels
|
||||
{
|
||||
|
||||
class regionModel;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class regionModelFunctionObject Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class regionModelFunctionObject
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Dictionary
|
||||
dictionary dict_;
|
||||
|
||||
//- Reference to the region model
|
||||
regionModel& regionModel_;
|
||||
|
||||
//- Model type name
|
||||
word modelType_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("regionModelFunctionObject");
|
||||
|
||||
//- Declare runtime constructor selection table
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
regionModelFunctionObject,
|
||||
dictionary,
|
||||
(
|
||||
const dictionary& dict,
|
||||
regionModel& region
|
||||
),
|
||||
(dict, region)
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null from region
|
||||
regionModelFunctionObject(regionModel& region);
|
||||
|
||||
//- Construct from dictionary
|
||||
regionModelFunctionObject
|
||||
(
|
||||
const dictionary& dict,
|
||||
regionModel& region,
|
||||
const word& modelType
|
||||
);
|
||||
|
||||
//- Construct copy
|
||||
regionModelFunctionObject(const regionModelFunctionObject& ppm);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<regionModelFunctionObject> clone() const
|
||||
{
|
||||
return autoPtr<regionModelFunctionObject>
|
||||
(
|
||||
new regionModelFunctionObject(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~regionModelFunctionObject();
|
||||
|
||||
|
||||
//- Selector
|
||||
static autoPtr<regionModelFunctionObject> New
|
||||
(
|
||||
const dictionary& dict,
|
||||
regionModel& region,
|
||||
const word& modelType
|
||||
);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Evaluation
|
||||
|
||||
//- Pre-evolve region hook
|
||||
virtual void preEvolveRegion();
|
||||
|
||||
//- Post-evolve region hook
|
||||
virtual void postEvolveRegion();
|
||||
|
||||
// I-O
|
||||
|
||||
//- write
|
||||
virtual void write() const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace regionModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,124 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "regionModelFunctionObjectList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::regionModels::regionModelFunctionObjectList::regionModelFunctionObjectList
|
||||
(
|
||||
regionModel& region
|
||||
)
|
||||
:
|
||||
PtrList<regionModelFunctionObject>(),
|
||||
regionModel_(region),
|
||||
dict_(dictionary::null)
|
||||
{}
|
||||
|
||||
|
||||
Foam::regionModels::regionModelFunctionObjectList::regionModelFunctionObjectList
|
||||
(
|
||||
regionModel& region,
|
||||
const dictionary& dict,
|
||||
const bool readFields
|
||||
)
|
||||
:
|
||||
PtrList<regionModelFunctionObject>(),
|
||||
regionModel_(region),
|
||||
dict_(dict)
|
||||
{
|
||||
if (readFields)
|
||||
{
|
||||
wordList modelNames(dict.toc());
|
||||
|
||||
Info<< " Selecting region model functions" << endl;
|
||||
|
||||
if (modelNames.size() > 0)
|
||||
{
|
||||
this->setSize(modelNames.size());
|
||||
|
||||
forAll(modelNames, i)
|
||||
{
|
||||
const word& modelName = modelNames[i];
|
||||
|
||||
this->set
|
||||
(
|
||||
i,
|
||||
regionModelFunctionObject::New
|
||||
(
|
||||
dict,
|
||||
region,
|
||||
modelName
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< " none" << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::regionModels::regionModelFunctionObjectList::regionModelFunctionObjectList
|
||||
(
|
||||
const regionModelFunctionObjectList& cfol
|
||||
)
|
||||
:
|
||||
PtrList<regionModelFunctionObject>(cfol),
|
||||
regionModel_(cfol.regionModel_),
|
||||
dict_(cfol.dict_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::regionModels::regionModelFunctionObjectList::
|
||||
~regionModelFunctionObjectList()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::regionModels::regionModelFunctionObjectList::preEvolveRegion()
|
||||
{
|
||||
forAll(*this, i)
|
||||
{
|
||||
this->operator[](i).preEvolveRegion();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::regionModels::regionModelFunctionObjectList::postEvolveRegion()
|
||||
{
|
||||
forAll(*this, i)
|
||||
{
|
||||
this->operator[](i).postEvolveRegion();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,133 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::regionModels::regionModelFunctionObjectList
|
||||
|
||||
Description
|
||||
List of cloud function objects
|
||||
|
||||
SourceFiles
|
||||
regionModelFunctionObjectListI.H
|
||||
regionModelFunctionObjectList.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef regionModelFunctionObjectList_H
|
||||
#define regionModelFunctionObjectList_H
|
||||
|
||||
#include "PtrList.H"
|
||||
#include "regionModelFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace regionModels
|
||||
{
|
||||
|
||||
class regionModel;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class regionModelFunctionObjectList Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class regionModelFunctionObjectList
|
||||
:
|
||||
public PtrList<regionModelFunctionObject>
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected Data
|
||||
|
||||
//- Reference to the region region model
|
||||
regionModel& regionModel_;
|
||||
|
||||
//- Dictionary
|
||||
const dictionary dict_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Null constructor
|
||||
regionModelFunctionObjectList(regionModel& region);
|
||||
|
||||
//- Construct from mesh
|
||||
regionModelFunctionObjectList
|
||||
(
|
||||
regionModel& region,
|
||||
const dictionary& dict,
|
||||
const bool readFields = true
|
||||
);
|
||||
|
||||
//- Construct copy
|
||||
regionModelFunctionObjectList
|
||||
(
|
||||
const regionModelFunctionObjectList& rmfol
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~regionModelFunctionObjectList();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return const access to the cloud region
|
||||
inline const regionModel& region() const;
|
||||
|
||||
//- Return references to the cloud region
|
||||
inline regionModel& region();
|
||||
|
||||
//- Return the forces dictionary
|
||||
inline const dictionary& dict() const;
|
||||
|
||||
|
||||
// Evaluation
|
||||
|
||||
//- Pre-evolve hook
|
||||
virtual void preEvolveRegion();
|
||||
|
||||
//- Post-evolve hook
|
||||
virtual void postEvolveRegion();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace regionModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "regionModelFunctionObjectListI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,47 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
inline const Foam::regionModels::regionModel&
|
||||
Foam::regionModels::regionModelFunctionObjectList::region() const
|
||||
{
|
||||
return regionModel_;
|
||||
}
|
||||
|
||||
|
||||
inline Foam::regionModels::regionModel&
|
||||
Foam::regionModels::regionModelFunctionObjectList::region()
|
||||
{
|
||||
return regionModel_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::dictionary&
|
||||
Foam::regionModels::regionModelFunctionObjectList::dict() const
|
||||
{
|
||||
return dict_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,67 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "regionModelFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::regionModels::regionModelFunctionObject>
|
||||
Foam::regionModels::regionModelFunctionObject::New
|
||||
(
|
||||
const dictionary& dict,
|
||||
regionModel& region,
|
||||
const word& modelName
|
||||
)
|
||||
{
|
||||
const word modelType = dict.subDict(modelName).lookup("type");
|
||||
|
||||
Info<< " " << modelType << endl;
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(modelType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Unknown region model function type "
|
||||
<< modelType << nl << nl
|
||||
<< "Valid region model function types are:" << nl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return
|
||||
autoPtr<regionModelFunctionObject>
|
||||
(
|
||||
cstrIter()
|
||||
(
|
||||
dict.subDict(modelName),
|
||||
region
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
5
src/regionModels/thermalBaffle/Make/files
Normal file
5
src/regionModels/thermalBaffle/Make/files
Normal file
@ -0,0 +1,5 @@
|
||||
thermalBaffle/thermalBaffle.C
|
||||
|
||||
derivedFvPatchFields/thermalBaffle/thermalBaffleFvPatchScalarField.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libthermalBaffle
|
||||
@ -244,7 +244,7 @@ thermalBaffleFvPatchScalarField::initBaffleMesh() const
|
||||
}
|
||||
|
||||
|
||||
autoPtr<regionModels::thermalBaffleModel>
|
||||
autoPtr<regionModels::thermalBaffle>
|
||||
thermalBaffleFvPatchScalarField::initBaffle() const
|
||||
{
|
||||
if (!owner())
|
||||
@ -264,7 +264,10 @@ thermalBaffleFvPatchScalarField::initBaffle() const
|
||||
dictionary dict(dict_);
|
||||
dict.add("regionName", mpp.sampleRegion());
|
||||
|
||||
return regionModels::thermalBaffleModel::New(mesh, dict);
|
||||
return autoPtr<regionModels::thermalBaffle>
|
||||
(
|
||||
new regionModels::thermalBaffle("thermalBaffle", mesh, dict)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -135,7 +135,7 @@ Usage
|
||||
|
||||
See also
|
||||
Foam::compressible::turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
|
||||
Foam::regionModels::thermalBaffleModels::thermalBaffleModel
|
||||
Foam::regionModels::thermalBaffle
|
||||
|
||||
SourceFiles
|
||||
thermalBaffleFvPatchScalarField.C
|
||||
@ -145,7 +145,7 @@ SourceFiles
|
||||
#ifndef thermalBaffleFvPatchScalarField_H
|
||||
#define thermalBaffleFvPatchScalarField_H
|
||||
|
||||
#include "thermalBaffleModel.H"
|
||||
#include "thermalBaffle.H"
|
||||
#include "extrudePatchMesh.H"
|
||||
#include "turbulentTemperatureRadCoupledMixedFvPatchScalarField.H"
|
||||
|
||||
@ -176,7 +176,7 @@ class thermalBaffleFvPatchScalarField
|
||||
autoPtr<extrudePatchMesh> baffleMeshPtr_;
|
||||
|
||||
//- Thermal baffle model
|
||||
autoPtr<regionModels::thermalBaffleModel> bafflePtr_;
|
||||
autoPtr<regionModels::thermalBaffle> bafflePtr_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
@ -197,7 +197,7 @@ class thermalBaffleFvPatchScalarField
|
||||
autoPtr<extrudePatchMesh> initBaffleMesh() const;
|
||||
|
||||
//- Construct and return the thermal baffle model
|
||||
autoPtr<regionModels::thermalBaffleModel> initBaffle() const;
|
||||
autoPtr<regionModels::thermalBaffle> initBaffle() const;
|
||||
|
||||
|
||||
public:
|
||||
204
src/regionModels/thermalBaffle/thermalBaffle/DeltaInfoData.H
Normal file
204
src/regionModels/thermalBaffle/thermalBaffle/DeltaInfoData.H
Normal file
@ -0,0 +1,204 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::DeltaInfoData
|
||||
|
||||
Description
|
||||
Class to be used with FaceCellWave which calculates the delta (thickness)
|
||||
across a layered mesh
|
||||
|
||||
SourceFiles
|
||||
DeltaInfoDataI.H
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef DeltaInfoData_H
|
||||
#define DeltaInfoData_H
|
||||
|
||||
#include "pointField.H"
|
||||
#include "face.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class polyPatch;
|
||||
class polyMesh;
|
||||
class transformer;
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
template<class Type>
|
||||
class DeltaInfoData;
|
||||
template<class Type>
|
||||
Ostream& operator<<(Ostream&, const DeltaInfoData<Type>&);
|
||||
template<class Type>
|
||||
Istream& operator>>(Istream&, DeltaInfoData<Type>&);
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class DeltaInfoData Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
class DeltaInfoData
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- Direction of propagation (+1 or -1) relative to the face normal.
|
||||
// Only valid when on a face. Takes a value of 0 when in a cell.
|
||||
label direction_;
|
||||
|
||||
//- The previous face index. Only valid when in a cell. Takes a value
|
||||
// of -1 if on a face.
|
||||
label prevFace_;
|
||||
|
||||
//- Data
|
||||
Type data_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
inline DeltaInfoData();
|
||||
|
||||
//- Construct for a face given a direction and data
|
||||
inline DeltaInfoData(const label direction, const Type& data);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the data
|
||||
inline const Type& data() const;
|
||||
|
||||
|
||||
// Needed by FaceCellWave
|
||||
|
||||
//- Check whether the DeltaInfoData has been changed at all or still
|
||||
// contains original (invalid) value.
|
||||
template<class TrackingData>
|
||||
inline bool valid(TrackingData& td) const;
|
||||
|
||||
//- Check for identical geometrical data. Used for checking
|
||||
// consistency across cyclics.
|
||||
template<class TrackingData>
|
||||
inline bool sameGeometry
|
||||
(
|
||||
const polyMesh&,
|
||||
const DeltaInfoData<Type>&,
|
||||
const scalar,
|
||||
TrackingData& td
|
||||
) const;
|
||||
|
||||
//- Transform across an interface
|
||||
template<class TrackingData>
|
||||
inline void transform
|
||||
(
|
||||
const polyPatch& patch,
|
||||
const label patchFacei,
|
||||
const transformer& transform,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Influence of neighbouring face
|
||||
template<class TrackingData>
|
||||
inline bool updateCell
|
||||
(
|
||||
const polyMesh&,
|
||||
const label thisCelli,
|
||||
const label neighbourFacei,
|
||||
const DeltaInfoData<Type>& neighbourInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Influence of neighbouring cell
|
||||
template<class TrackingData>
|
||||
inline bool updateFace
|
||||
(
|
||||
const polyMesh&,
|
||||
const label thisFacei,
|
||||
const label neighbourCelli,
|
||||
const DeltaInfoData<Type>& neighbourInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Influence of different value on same face
|
||||
template<class TrackingData>
|
||||
inline bool updateFace
|
||||
(
|
||||
const polyMesh&,
|
||||
const label thisFacei,
|
||||
const DeltaInfoData<Type>& neighbourInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
);
|
||||
|
||||
//- Test equality
|
||||
template<class TrackingData>
|
||||
inline bool equal
|
||||
(
|
||||
const DeltaInfoData<Type>&,
|
||||
TrackingData& td
|
||||
) const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
inline bool operator==(const DeltaInfoData<Type>&) const;
|
||||
inline bool operator!=(const DeltaInfoData<Type>&) const;
|
||||
|
||||
|
||||
// IOstream Operators
|
||||
|
||||
friend Ostream& operator<< <Type>
|
||||
(
|
||||
Ostream&,
|
||||
const DeltaInfoData<Type>&
|
||||
);
|
||||
friend Istream& operator>> <Type>
|
||||
(
|
||||
Istream&,
|
||||
DeltaInfoData<Type>&
|
||||
);
|
||||
};
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "DeltaInfoDataI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
233
src/regionModels/thermalBaffle/thermalBaffle/DeltaInfoDataI.H
Normal file
233
src/regionModels/thermalBaffle/thermalBaffle/DeltaInfoDataI.H
Normal file
@ -0,0 +1,233 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "DeltaInfoData.H"
|
||||
#include "polyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
inline Foam::DeltaInfoData<Type>::DeltaInfoData()
|
||||
:
|
||||
direction_(0),
|
||||
prevFace_(-labelMax),
|
||||
data_()
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
inline Foam::DeltaInfoData<Type>::DeltaInfoData
|
||||
(
|
||||
const label direction,
|
||||
const Type& data
|
||||
)
|
||||
:
|
||||
direction_(direction),
|
||||
prevFace_(-labelMax),
|
||||
data_(data)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
inline const Type& Foam::DeltaInfoData<Type>::data() const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::DeltaInfoData<Type>::valid(TrackingData& td) const
|
||||
{
|
||||
return direction_ != 0 || prevFace_ != -labelMax;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::DeltaInfoData<Type>::sameGeometry
|
||||
(
|
||||
const polyMesh&,
|
||||
const DeltaInfoData<Type>& l,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
template<class TrackingData>
|
||||
inline void Foam::DeltaInfoData<Type>::transform
|
||||
(
|
||||
const polyPatch& patch,
|
||||
const label patchFacei,
|
||||
const transformer& transform,
|
||||
TrackingData& td
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
template<class Type>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::DeltaInfoData<Type>::updateCell
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label thisCelli,
|
||||
const label neighbourFacei,
|
||||
const DeltaInfoData<Type>& neighbourDeltaInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
const bool o = thisCelli == mesh.faceOwner()[neighbourFacei];
|
||||
|
||||
if (o == (neighbourDeltaInfo.direction_ < 0))
|
||||
{
|
||||
direction_ = 0;
|
||||
prevFace_ = neighbourFacei;
|
||||
data_ = neighbourDeltaInfo.data_;
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::DeltaInfoData<Type>::updateFace
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label thisFacei,
|
||||
const label neighbourCelli,
|
||||
const DeltaInfoData<Type>& neighbourDeltaInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
const cell& c = mesh.cells()[neighbourCelli];
|
||||
const label prevFacei = neighbourDeltaInfo.prevFace_;
|
||||
const label nextFacei = c.opposingFaceLabel(prevFacei, mesh.faces());
|
||||
|
||||
if (nextFacei == thisFacei)
|
||||
{
|
||||
const label direction =
|
||||
mesh.faceOwner()[thisFacei] == neighbourCelli ? +1 : -1;
|
||||
|
||||
direction_ = direction;
|
||||
prevFace_ = -labelMax;
|
||||
data_ = neighbourDeltaInfo.data_;
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::DeltaInfoData<Type>::updateFace
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label thisFacei,
|
||||
const DeltaInfoData<Type>& neighbourDeltaInfo,
|
||||
const scalar tol,
|
||||
TrackingData& td
|
||||
)
|
||||
{
|
||||
const label direction = -neighbourDeltaInfo.direction_;
|
||||
|
||||
direction_ = direction;
|
||||
prevFace_ = -labelMax;
|
||||
data_ = neighbourDeltaInfo.data_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
template<class TrackingData>
|
||||
inline bool Foam::DeltaInfoData<Type>::equal
|
||||
(
|
||||
const DeltaInfoData<Type>& rhs,
|
||||
TrackingData& td
|
||||
) const
|
||||
{
|
||||
return operator==(rhs);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
inline bool Foam::DeltaInfoData<Type>::operator==
|
||||
(
|
||||
const Foam::DeltaInfoData<Type>& rhs
|
||||
) const
|
||||
{
|
||||
return direction_ == rhs.direction_ && prevFace_ == rhs.prevFace_;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
inline bool Foam::DeltaInfoData<Type>::operator!=
|
||||
(
|
||||
const Foam::DeltaInfoData<Type>& rhs
|
||||
) const
|
||||
{
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const DeltaInfoData<Type>& l)
|
||||
{
|
||||
return os
|
||||
<< l.direction_ << token::SPACE
|
||||
<< l.prevFace_ << token::SPACE
|
||||
<< l.data_;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::Istream& Foam::operator>>(Istream& is, DeltaInfoData<Type>& l)
|
||||
{
|
||||
return is >> l.direction_ >> l.prevFace_ >> l.data_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -24,13 +24,14 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "thermalBaffle.H"
|
||||
|
||||
#include "fvm.H"
|
||||
#include "fvcDiv.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
#include "fvMatrices.H"
|
||||
#include "absorptionEmissionModel.H"
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
#include "wedgePolyPatch.H"
|
||||
#include "emptyPolyPatch.H"
|
||||
#include "FaceCellWave.H"
|
||||
#include "DeltaInfoData.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -38,29 +39,149 @@ namespace Foam
|
||||
{
|
||||
namespace regionModels
|
||||
{
|
||||
namespace thermalBaffleModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(thermalBaffle, 0);
|
||||
|
||||
addToRunTimeSelectionTable(thermalBaffleModel, thermalBaffle, mesh);
|
||||
addToRunTimeSelectionTable(thermalBaffleModel, thermalBaffle, dictionary);
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
tmp<volScalarField::Internal> thermalBaffle::calcDelta() const
|
||||
{
|
||||
if (intCoupledPatchIDs_.size() != 2)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Mesh \"" << regionMesh().name()
|
||||
<< "\" does not have exactly two coupled patches"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
// Initial faces from which to wave
|
||||
DynamicList<label> initialFaces;
|
||||
|
||||
// Initialise faces on the first coupled patch with their centres as data
|
||||
initialFaces.clear();
|
||||
DynamicList<DeltaInfoData<point>> initialFaceInfoPoints;
|
||||
{
|
||||
const polyPatch& pp =
|
||||
regionMesh().boundaryMesh()[intCoupledPatchIDs_[0]];
|
||||
|
||||
initialFaces.setCapacity(initialFaces.size() + pp.size());
|
||||
initialFaceInfoPoints.setCapacity(initialFaces.size() + pp.size());
|
||||
|
||||
forAll(pp, ppFacei)
|
||||
{
|
||||
const point& c = pp.faceCentres()[ppFacei];
|
||||
|
||||
initialFaces.append(pp.start() + ppFacei);
|
||||
initialFaceInfoPoints.append(DeltaInfoData<point>(-1, c));
|
||||
}
|
||||
}
|
||||
|
||||
// Wave across the mesh layers
|
||||
List<DeltaInfoData<point>> faceInfoPoints(regionMesh().nFaces());
|
||||
List<DeltaInfoData<point>> cellInfoPoints(regionMesh().nCells());
|
||||
FaceCellWave<DeltaInfoData<point>>
|
||||
(
|
||||
regionMesh(),
|
||||
initialFaces,
|
||||
initialFaceInfoPoints,
|
||||
faceInfoPoints,
|
||||
cellInfoPoints,
|
||||
regionMesh().globalData().nTotalCells() + 1
|
||||
);
|
||||
|
||||
// Calculate the distances between the opposite patch and load into data to
|
||||
// wave back in the opposite direction
|
||||
initialFaces.clear();
|
||||
DynamicList<DeltaInfoData<scalar>> initialFaceInfoDeltas;
|
||||
{
|
||||
const polyPatch& pp =
|
||||
regionMesh().boundaryMesh()[intCoupledPatchIDs_[1]];
|
||||
|
||||
forAll(pp, ppFacei)
|
||||
{
|
||||
const point& c = pp.faceCentres()[ppFacei];
|
||||
|
||||
static nil td;
|
||||
|
||||
if (faceInfoPoints[pp.start() + ppFacei].valid(td))
|
||||
{
|
||||
const scalar d =
|
||||
mag(c - faceInfoPoints[pp.start() + ppFacei].data());
|
||||
|
||||
initialFaces.append(pp.start() + ppFacei);
|
||||
initialFaceInfoDeltas.append(DeltaInfoData<scalar>(-1, d));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Wave back across the layers
|
||||
List<DeltaInfoData<scalar>> faceInfoDeltas(regionMesh().nFaces());
|
||||
List<DeltaInfoData<scalar>> cellInfoDeltas(regionMesh().nCells());
|
||||
FaceCellWave<DeltaInfoData<scalar>>
|
||||
(
|
||||
regionMesh(),
|
||||
initialFaces,
|
||||
initialFaceInfoDeltas,
|
||||
faceInfoDeltas,
|
||||
cellInfoDeltas,
|
||||
regionMesh().globalData().nTotalCells() + 1
|
||||
);
|
||||
|
||||
// Unpack distances into a dimensioned field and return
|
||||
tmp<volScalarField::Internal> tDelta
|
||||
(
|
||||
new volScalarField::Internal
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"thickness",
|
||||
regionMesh().pointsInstance(),
|
||||
regionMesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
regionMesh(),
|
||||
dimLength
|
||||
)
|
||||
);
|
||||
volScalarField::Internal& delta = tDelta.ref();
|
||||
|
||||
forAll(cellInfoDeltas, celli)
|
||||
{
|
||||
static nil td;
|
||||
|
||||
if (!cellInfoDeltas[celli].valid(td))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Mesh \"" << regionMesh().name()
|
||||
<< "\" is not layered between its coupled patches"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
delta[celli] = cellInfoDeltas[celli].data();
|
||||
}
|
||||
|
||||
return tDelta;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
bool thermalBaffle::read()
|
||||
{
|
||||
this->solution().lookup("nNonOrthCorr") >> nNonOrthCorr_;
|
||||
return regionModel1D::read();
|
||||
solution().lookup("nNonOrthCorr") >> nNonOrthCorr_;
|
||||
return regionModel::read();
|
||||
}
|
||||
|
||||
|
||||
bool thermalBaffle::read(const dictionary& dict)
|
||||
{
|
||||
this->solution().lookup("nNonOrthCorr") >> nNonOrthCorr_;
|
||||
return regionModel1D::read(dict);
|
||||
solution().lookup("nNonOrthCorr") >> nNonOrthCorr_;
|
||||
return regionModel::read(dict);
|
||||
}
|
||||
|
||||
|
||||
@ -68,62 +189,31 @@ void thermalBaffle::solveEnergy()
|
||||
{
|
||||
DebugInFunction << endl;
|
||||
|
||||
const polyBoundaryMesh& rbm = regionMesh().boundaryMesh();
|
||||
|
||||
tmp<volScalarField> tQ
|
||||
// Modify thermo density and diffusivity to take into account the thickness
|
||||
volScalarField dByT
|
||||
(
|
||||
volScalarField::New
|
||||
(
|
||||
"tQ",
|
||||
"dByT",
|
||||
regionMesh(),
|
||||
dimensionedScalar(dimEnergy/dimVolume/dimTime, 0)
|
||||
dimless,
|
||||
extrapolatedCalculatedFvPatchField<scalar>::typeName
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField& Q = tQ.ref();
|
||||
|
||||
volScalarField rho("rho", thermo_->rho());
|
||||
volScalarField alphahe(thermo_->alphahe());
|
||||
|
||||
|
||||
// If region is one-dimension variable thickness
|
||||
if (oneD_ && !constantThickness_)
|
||||
{
|
||||
// Scale K and rhoCp and fill Q in the internal baffle region.
|
||||
const label patchi = intCoupledPatchIDs_[0];
|
||||
const polyPatch& ppCoupled = rbm[patchi];
|
||||
|
||||
forAll(ppCoupled, localFacei)
|
||||
{
|
||||
const labelList& cells = boundaryFaceCells_[localFacei];
|
||||
forAll(cells, i)
|
||||
{
|
||||
const label cellId = cells[i];
|
||||
|
||||
Q[cellId] =
|
||||
Qs_.boundaryField()[patchi][localFacei]
|
||||
/thickness_[localFacei];
|
||||
|
||||
rho[cellId] *= delta_.value()/thickness_[localFacei];
|
||||
|
||||
alphahe[cellId] *= delta_.value()/thickness_[localFacei];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Q = Q_;
|
||||
}
|
||||
dByT.ref() = delta_/thickness_;
|
||||
dByT.correctBoundaryConditions();
|
||||
const volScalarField rho("rho", thermo_->rho()*dByT);
|
||||
const volScalarField alphahe("alphahe", thermo_->alphahe()*dByT);
|
||||
|
||||
fvScalarMatrix hEqn
|
||||
(
|
||||
fvm::ddt(rho, he_)
|
||||
- fvm::laplacian(alphahe, he_)
|
||||
==
|
||||
Q
|
||||
Q_ + Qs_/thickness_
|
||||
);
|
||||
|
||||
if (moveMesh_)
|
||||
if (regionMesh().moving())
|
||||
{
|
||||
surfaceScalarField phiMesh
|
||||
(
|
||||
@ -152,7 +242,20 @@ thermalBaffle::thermalBaffle
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
thermalBaffleModel(modelType, mesh, dict),
|
||||
regionModel(mesh, "thermalBaffle", modelType, dict, true),
|
||||
delta_(calcDelta()),
|
||||
thickness_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"thickness",
|
||||
regionMesh().pointsInstance(),
|
||||
regionMesh(),
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
delta_
|
||||
),
|
||||
nNonOrthCorr_(solution().lookup<label>("nNonOrthCorr")),
|
||||
thermo_(solidThermo::New(regionMesh())),
|
||||
he_(thermo_->he()),
|
||||
@ -191,56 +294,6 @@ thermalBaffle::thermalBaffle
|
||||
)
|
||||
)
|
||||
{
|
||||
init();
|
||||
thermo_->correct();
|
||||
}
|
||||
|
||||
|
||||
thermalBaffle::thermalBaffle
|
||||
(
|
||||
const word& modelType,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
thermalBaffleModel(modelType, mesh),
|
||||
nNonOrthCorr_(solution().lookup<label>("nNonOrthCorr")),
|
||||
thermo_(solidThermo::New(regionMesh())),
|
||||
he_(thermo_->he()),
|
||||
Qs_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Qs",
|
||||
regionMesh().time().timeName(),
|
||||
regionMesh(),
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
regionMesh(),
|
||||
dimensionedScalar(dimEnergy/dimArea/dimTime, Zero)
|
||||
),
|
||||
Q_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Q",
|
||||
regionMesh().time().timeName(),
|
||||
regionMesh(),
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
regionMesh(),
|
||||
dimensionedScalar(dimEnergy/dimVolume/dimTime, Zero)
|
||||
),
|
||||
radiation_
|
||||
(
|
||||
radiationModel::New
|
||||
(
|
||||
thermo_->T()
|
||||
)
|
||||
)
|
||||
{
|
||||
init();
|
||||
thermo_->correct();
|
||||
}
|
||||
|
||||
@ -253,25 +306,6 @@ thermalBaffle::~thermalBaffle()
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void thermalBaffle::init()
|
||||
{
|
||||
if (oneD_ && !constantThickness_)
|
||||
{
|
||||
label patchi = intCoupledPatchIDs_[0];
|
||||
const label Qsb = Qs_.boundaryField()[patchi].size();
|
||||
|
||||
if (Qsb!= thickness_.size())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "the boundary field of Qs is "
|
||||
<< Qsb << " and " << nl
|
||||
<< "the field 'thickness' is " << thickness_.size() << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void thermalBaffle::preEvolveRegion()
|
||||
{}
|
||||
|
||||
@ -330,20 +364,22 @@ void thermalBaffle::info()
|
||||
const label patchi = coupledPatches[i];
|
||||
const fvPatchScalarField& phe = he_.boundaryField()[patchi];
|
||||
const word patchName = regionMesh().boundary()[patchi].name();
|
||||
Info<< indent << "Q : " << patchName << indent <<
|
||||
|
||||
Info<< indent << "Q : " << patchName << indent
|
||||
<<
|
||||
gSum
|
||||
(
|
||||
mag(regionMesh().Sf().boundaryField()[patchi])
|
||||
*phe.snGrad()
|
||||
*thermo_->alphahe(patchi)
|
||||
) << endl;
|
||||
)
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // end namespace thermalBaffleModels
|
||||
} // end namespace regionModels
|
||||
} // end namespace Foam
|
||||
|
||||
@ -22,10 +22,10 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::regionModels::thermalBaffleModels::thermalBaffle
|
||||
Foam::regionModels::thermalBaffle
|
||||
|
||||
Description
|
||||
2D thermal baffle
|
||||
Thermal baffle region model
|
||||
|
||||
SourceFiles
|
||||
thermalBaffle.C
|
||||
@ -36,19 +36,17 @@ SourceFiles
|
||||
#ifndef thermalBaffle_H
|
||||
#define thermalBaffle_H
|
||||
|
||||
#include "thermalBaffleModel.H"
|
||||
#include "radiationModel.H"
|
||||
#include "regionModel.H"
|
||||
#include "solidThermo.H"
|
||||
#include "volFieldsFwd.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace regionModels
|
||||
{
|
||||
namespace thermalBaffleModels
|
||||
{
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class thermalBaffle Declaration
|
||||
@ -56,18 +54,27 @@ namespace thermalBaffleModels
|
||||
|
||||
class thermalBaffle
|
||||
:
|
||||
public thermalBaffleModel
|
||||
public regionModel
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Initialise thermalBaffle
|
||||
void init();
|
||||
//- Calculate the baffle mesh thickness
|
||||
tmp<volScalarField::Internal> calcDelta() const;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
// Geometric parameters
|
||||
|
||||
//- Baffle mesh thickness
|
||||
volScalarField::Internal delta_;
|
||||
|
||||
//- Baffle physical thickness
|
||||
volScalarField::Internal thickness_;
|
||||
|
||||
|
||||
// Solution parameters
|
||||
|
||||
//- Number of non orthogonal correctors
|
||||
@ -85,10 +92,10 @@ protected:
|
||||
|
||||
// Source term fields
|
||||
|
||||
//- Surface energy source / [J/m2/s]
|
||||
//- Surface energy source [J/m2/s]
|
||||
volScalarField Qs_;
|
||||
|
||||
//- Volumetric energy source / [J/m3/s]
|
||||
//- Volumetric energy source [J/m3/s]
|
||||
volScalarField Q_;
|
||||
|
||||
|
||||
@ -100,11 +107,13 @@ protected:
|
||||
|
||||
// Protected member functions
|
||||
|
||||
//- Read control parameters IO dictionary
|
||||
virtual bool read();
|
||||
// IO
|
||||
|
||||
//- Read control parameters from dictionary
|
||||
virtual bool read(const dictionary& dict);
|
||||
//- Read control parameters IO dictionary
|
||||
virtual bool read();
|
||||
|
||||
//- Read control parameters from dictionary
|
||||
virtual bool read(const dictionary& dict);
|
||||
|
||||
|
||||
// Equations
|
||||
@ -121,9 +130,6 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
thermalBaffle(const word& modelType, const fvMesh& mesh);
|
||||
|
||||
//- Construct from components and dict
|
||||
thermalBaffle
|
||||
(
|
||||
@ -145,41 +151,25 @@ public:
|
||||
// Thermo properties
|
||||
|
||||
//- Return const reference to the solidThermo
|
||||
virtual const solidThermo& thermo() const;
|
||||
const solidThermo& thermo() const;
|
||||
|
||||
|
||||
// Fields
|
||||
|
||||
//- Return the film specific heat capacity [J/kg/K]
|
||||
virtual const tmp<volScalarField> Cp() const;
|
||||
const tmp<volScalarField> Cp() const;
|
||||
|
||||
//- Return solid absorptivity [1/m]
|
||||
virtual const volScalarField& kappaRad() const;
|
||||
const volScalarField& kappaRad() const;
|
||||
|
||||
//- Return temperature [K]
|
||||
virtual const volScalarField& T() const;
|
||||
const volScalarField& T() const;
|
||||
|
||||
//- Return density [Kg/m^3]
|
||||
virtual const volScalarField& rho() const;
|
||||
const volScalarField& rho() const;
|
||||
|
||||
//- Return thermal conductivity [W/m/K]
|
||||
virtual const volScalarField& kappa() const;
|
||||
|
||||
|
||||
// Helper functions
|
||||
|
||||
//- Return sensible enthalpy/internal energy
|
||||
// as a function of temperature
|
||||
// for a patch
|
||||
inline tmp<scalarField> he
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
) const;
|
||||
|
||||
//- Return sensible enthalpy/internal energy
|
||||
inline tmp<volScalarField> he() const;
|
||||
const volScalarField& kappa() const;
|
||||
|
||||
|
||||
// Evolution
|
||||
@ -206,16 +196,11 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace thermalBaffleModels
|
||||
} // End namespace regionModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "thermalBaffleI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,9 +0,0 @@
|
||||
thermalBaffleModel/thermalBaffleModel.C
|
||||
thermalBaffleModel/thermalBaffleModelNew.C
|
||||
thermalBaffle/thermalBaffle.C
|
||||
noThermo/noThermo.C
|
||||
|
||||
derivedFvPatchFields/thermalBaffle/thermalBaffleFvPatchScalarField.C
|
||||
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libthermalBaffleModels
|
||||
@ -1,156 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "noThermo.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "volFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace regionModels
|
||||
{
|
||||
namespace thermalBaffleModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(noThermo, 0);
|
||||
|
||||
addToRunTimeSelectionTable(thermalBaffleModel, noThermo, mesh);
|
||||
addToRunTimeSelectionTable(thermalBaffleModel, noThermo, dictionary);
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
bool noThermo::read()
|
||||
{
|
||||
return regionModel1D::read();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
noThermo::noThermo(const word& modelType, const fvMesh& mesh)
|
||||
:
|
||||
thermalBaffleModel(mesh)
|
||||
{}
|
||||
|
||||
|
||||
noThermo::noThermo
|
||||
(
|
||||
const word& modelType,
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
thermalBaffleModel(modelType, mesh, dict)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
noThermo::~noThermo()
|
||||
{}
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void noThermo::preEvolveRegion()
|
||||
{}
|
||||
|
||||
|
||||
void noThermo::evolveRegion()
|
||||
{}
|
||||
|
||||
|
||||
const tmp<volScalarField> noThermo::Cp() const
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cp field not available for " << type()
|
||||
<< abort(FatalError);
|
||||
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
volScalarField::New
|
||||
(
|
||||
"noThermo::Cp",
|
||||
primaryMesh(),
|
||||
dimensionedScalar(dimEnergy/dimVolume/dimTime, 0)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
const volScalarField& noThermo::kappaRad() const
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "kappa field not available for " << type()
|
||||
<< abort(FatalError);
|
||||
return volScalarField::null();
|
||||
}
|
||||
|
||||
|
||||
const volScalarField& noThermo::rho() const
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "rho field not available for " << type()
|
||||
<< abort(FatalError);
|
||||
return volScalarField::null();
|
||||
}
|
||||
|
||||
|
||||
const volScalarField& noThermo::kappa() const
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "K field not available for " << type()
|
||||
<< abort(FatalError);
|
||||
return volScalarField::null();
|
||||
}
|
||||
|
||||
|
||||
const volScalarField& noThermo::T() const
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "T field not available for " << type()
|
||||
<< abort(FatalError);
|
||||
return volScalarField::null();
|
||||
}
|
||||
|
||||
|
||||
const solidThermo& noThermo::thermo() const
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "T field not available for " << type()
|
||||
<< abort(FatalError);
|
||||
return NullObjectRef<solidThermo>();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace thermalBaffleModels
|
||||
} // End namespace regionModels
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,147 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::regionModels::thermalBaffleModels::noThermo
|
||||
|
||||
Description
|
||||
Dummy surface model for 'none'
|
||||
|
||||
SourceFiles
|
||||
noThermo.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef noThermo_H
|
||||
#define noThermo_H
|
||||
|
||||
#include "thermalBaffleModel.H"
|
||||
#include "volFieldsFwd.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace regionModels
|
||||
{
|
||||
namespace thermalBaffleModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class noThermo Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class noThermo
|
||||
:
|
||||
public thermalBaffleModel
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected member functions
|
||||
|
||||
//- Read control parameters from dictionary
|
||||
virtual bool read();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("none");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from type name and mesh
|
||||
noThermo(const word& modelType, const fvMesh& mesh);
|
||||
|
||||
//- Construct from components and dict
|
||||
noThermo
|
||||
(
|
||||
const word& modelType,
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
//- Disallow default bitwise copy construction
|
||||
noThermo(const noThermo&) = delete;
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~noThermo();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
|
||||
// Thermo properties
|
||||
|
||||
//- Return const reference to the solidThermo
|
||||
virtual const solidThermo& thermo() const;
|
||||
|
||||
|
||||
// Fields
|
||||
|
||||
//- Return the film specific heat capacity [J/kg/K]
|
||||
virtual const tmp<volScalarField> Cp() const;
|
||||
|
||||
//- Return solid absorptivity [1/m]
|
||||
virtual const volScalarField& kappaRad() const;
|
||||
|
||||
//- Return the film mean temperature [K]
|
||||
virtual const volScalarField& T() const;
|
||||
|
||||
//- Return density [Kg/m^3]
|
||||
virtual const volScalarField& rho() const;
|
||||
|
||||
//- Return thermal conductivity [W/m/K]
|
||||
virtual const volScalarField& kappa() const;
|
||||
|
||||
|
||||
// Evolution
|
||||
|
||||
//- Pre-evolve film
|
||||
virtual void preEvolveRegion();
|
||||
|
||||
//- Evolve the film equations
|
||||
virtual void evolveRegion();
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const noThermo&) = delete;
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace thermalBaffleModels
|
||||
} // End namespace regionModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,63 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "thermalBaffle.H"
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace regionModels
|
||||
{
|
||||
namespace thermalBaffleModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
inline tmp<scalarField> thermalBaffle::he
|
||||
(
|
||||
const scalarField& p,
|
||||
const scalarField& T,
|
||||
const label patchi
|
||||
) const
|
||||
{
|
||||
return thermo_->he(T, patchi);
|
||||
}
|
||||
|
||||
|
||||
inline tmp<volScalarField> thermalBaffle::he() const
|
||||
{
|
||||
return thermo_->he();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace thermalBaffleModels
|
||||
} // End namespace regionModels
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,238 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "thermalBaffleModel.H"
|
||||
#include "fvMesh.H"
|
||||
#include "mappedVariableThicknessWallPolyPatch.H"
|
||||
#include "wedgePolyPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace regionModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(thermalBaffleModel, 0);
|
||||
defineRunTimeSelectionTable(thermalBaffleModel, mesh);
|
||||
defineRunTimeSelectionTable(thermalBaffleModel, dictionary);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
bool thermalBaffleModel::read()
|
||||
{
|
||||
regionModel1D::read();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool thermalBaffleModel::read(const dictionary& dict)
|
||||
{
|
||||
regionModel1D::read(dict);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void thermalBaffleModel::init()
|
||||
{
|
||||
const polyBoundaryMesh& rbm = regionMesh().boundaryMesh();
|
||||
|
||||
// Check if region mesh in 1-D
|
||||
label nTotalEdges = 0;
|
||||
const label patchi = intCoupledPatchIDs_[0];
|
||||
nTotalEdges = 2*nLayers_*rbm[patchi].nInternalEdges();
|
||||
nTotalEdges +=
|
||||
nLayers_*(rbm[patchi].nEdges() - rbm[patchi].nInternalEdges());
|
||||
|
||||
reduce(nTotalEdges, sumOp<label>());
|
||||
|
||||
label nFaces = 0;
|
||||
forAll(rbm, patchi)
|
||||
{
|
||||
if (
|
||||
rbm[patchi].size()
|
||||
&&
|
||||
(
|
||||
isA<wedgePolyPatch>(rbm[patchi])
|
||||
|| isA<emptyPolyPatch>(rbm[patchi])
|
||||
)
|
||||
)
|
||||
{
|
||||
nFaces += rbm[patchi].size();
|
||||
}
|
||||
}
|
||||
reduce(nFaces, sumOp<label>());
|
||||
|
||||
if (nTotalEdges == nFaces)
|
||||
{
|
||||
oneD_ = true;
|
||||
Info << "\nThe thermal baffle is 1D \n" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info << "\nThe thermal baffle is 3D \n" << endl;
|
||||
}
|
||||
|
||||
forAll(intCoupledPatchIDs_, i)
|
||||
{
|
||||
const label patchi = intCoupledPatchIDs_[i];
|
||||
const polyPatch& pp = rbm[patchi];
|
||||
|
||||
if
|
||||
(
|
||||
!isA<mappedVariableThicknessWallPolyPatch>(pp)
|
||||
&& oneD_
|
||||
&& !constantThickness_
|
||||
)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "' not type '"
|
||||
<< mappedVariableThicknessWallPolyPatch::typeName
|
||||
<< "'. This is necessary for 1D solution "
|
||||
<< " and variable thickness"
|
||||
<< "\n for patch. " << pp.name()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
else if (!isA<mappedWallPolyPatch>(pp))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "' not type '"
|
||||
<< mappedWallPolyPatch::typeName
|
||||
<< "'. This is necessary for 3D solution"
|
||||
<< "\n for patch. " << pp.name()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
if (oneD_ && !constantThickness_)
|
||||
{
|
||||
const label patchi = intCoupledPatchIDs_[0];
|
||||
const polyPatch& pp = rbm[patchi];
|
||||
const mappedVariableThicknessWallPolyPatch& ppCoupled =
|
||||
refCast
|
||||
<
|
||||
const mappedVariableThicknessWallPolyPatch
|
||||
>(pp);
|
||||
|
||||
thickness_ = ppCoupled.thickness();
|
||||
|
||||
// Check that thickness has the right size
|
||||
if (thickness_.size() != pp.size())
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< " coupled patches in thermalBaffle are " << nl
|
||||
<< " different sizes from list thickness" << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
// Calculate thickness of the baffle on the first face only.
|
||||
if (delta_.value() == 0.0)
|
||||
{
|
||||
forAll(ppCoupled, localFacei)
|
||||
{
|
||||
label facei = ppCoupled.start() + localFacei;
|
||||
|
||||
label faceO =
|
||||
boundaryFaceOppositeFace_[localFacei];
|
||||
|
||||
delta_.value() = mag
|
||||
(
|
||||
regionMesh().faceCentres()[facei]
|
||||
- regionMesh().faceCentres()[faceO]
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
thermalBaffleModel::thermalBaffleModel(const fvMesh& mesh)
|
||||
:
|
||||
regionModel1D(mesh, "thermalBaffle"),
|
||||
thickness_(),
|
||||
delta_("delta", dimLength, 0.0),
|
||||
oneD_(false),
|
||||
constantThickness_(true)
|
||||
{}
|
||||
|
||||
|
||||
thermalBaffleModel::thermalBaffleModel
|
||||
(
|
||||
const word& modelType,
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict
|
||||
|
||||
)
|
||||
:
|
||||
regionModel1D(mesh, "thermalBaffle", modelType, dict, true),
|
||||
thickness_(),
|
||||
delta_("delta", dimLength, 0.0),
|
||||
oneD_(false),
|
||||
constantThickness_(dict.lookupOrDefault<bool>("constantThickness", true))
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
thermalBaffleModel::thermalBaffleModel
|
||||
(
|
||||
const word& modelType,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
regionModel1D(mesh, "thermalBaffle", modelType),
|
||||
thickness_(),
|
||||
delta_("delta", dimLength, 0.0),
|
||||
oneD_(false),
|
||||
constantThickness_(lookupOrDefault<bool>("constantThickness", true))
|
||||
{
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
thermalBaffleModel::~thermalBaffleModel()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void thermalBaffleModel::preEvolveRegion()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace regionModels
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,238 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Namespace
|
||||
Foam::regionModels::thermalBaffleModels
|
||||
|
||||
Class
|
||||
Foam::regionModels::thermalBaffleModel
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
thermalBaffleModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef thermalBaffleModel_H
|
||||
#define thermalBaffleModel_H
|
||||
|
||||
#include "runTimeSelectionTables.H"
|
||||
#include "scalarIOField.H"
|
||||
#include "autoPtr.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "solidThermo.H"
|
||||
#include "regionModel1D.H"
|
||||
#include "radiationModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace regionModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class thermalBaffleModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class thermalBaffleModel
|
||||
:
|
||||
public regionModel1D
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Initialise thermal Baffle
|
||||
void init();
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Data
|
||||
|
||||
//- Baffle physical thickness
|
||||
scalarField thickness_;
|
||||
|
||||
//- Baffle mesh thickness
|
||||
dimensionedScalar delta_;
|
||||
|
||||
//- Is it one dimension
|
||||
bool oneD_;
|
||||
|
||||
//- Is thickness constant
|
||||
bool constantThickness_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Read control parameters from IO dictionary
|
||||
virtual bool read();
|
||||
|
||||
//- Read control parameters from dictionary
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("thermalBaffleModel");
|
||||
|
||||
|
||||
// Declare runtime constructor selection tables
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
thermalBaffleModel,
|
||||
mesh,
|
||||
(
|
||||
const word& modelType,
|
||||
const fvMesh& mesh
|
||||
),
|
||||
(modelType, mesh)
|
||||
);
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
thermalBaffleModel,
|
||||
dictionary,
|
||||
(
|
||||
const word& modelType,
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict
|
||||
),
|
||||
(modelType, mesh, dict)
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null from mesh
|
||||
thermalBaffleModel(const fvMesh& mesh);
|
||||
|
||||
//- Construct from type name and mesh
|
||||
thermalBaffleModel(const word& modelType, const fvMesh& mesh);
|
||||
|
||||
//- Construct from type name and mesh and dict
|
||||
thermalBaffleModel
|
||||
(
|
||||
const word& modelType,
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
//- Disallow default bitwise copy construction
|
||||
thermalBaffleModel(const thermalBaffleModel&) = delete;
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a reference to the selected model
|
||||
static autoPtr<thermalBaffleModel> New(const fvMesh& mesh);
|
||||
|
||||
//- Return a reference to the selected model using dictionary
|
||||
static autoPtr<thermalBaffleModel> New
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~thermalBaffleModel();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return solid thermo
|
||||
virtual const solidThermo& thermo() const = 0;
|
||||
|
||||
//- Return thickness
|
||||
const scalarField& thickness() const
|
||||
{
|
||||
return thickness_;
|
||||
}
|
||||
|
||||
//- Return geometrical thickness
|
||||
const dimensionedScalar& delta() const
|
||||
{
|
||||
return delta_;
|
||||
}
|
||||
|
||||
//- Return if region is one dimensional
|
||||
bool oneD() const
|
||||
{
|
||||
return oneD_;
|
||||
}
|
||||
|
||||
//- Return if region has constant thickness
|
||||
bool constantThickness() const
|
||||
{
|
||||
return constantThickness_;
|
||||
}
|
||||
|
||||
|
||||
// Fields
|
||||
|
||||
//- Return density [kg/m^3]
|
||||
virtual const volScalarField& rho() const = 0;
|
||||
|
||||
//- Return const temperature [K]
|
||||
virtual const volScalarField& T() const = 0;
|
||||
|
||||
//- Return specific heat capacity [J/kg/K]
|
||||
virtual const tmp<volScalarField> Cp() const = 0;
|
||||
|
||||
//- Return the region absorptivity [1/m]
|
||||
virtual const volScalarField& kappaRad() const = 0;
|
||||
|
||||
//- Return the region thermal conductivity [W/m/k]
|
||||
virtual const volScalarField& kappa() const = 0;
|
||||
|
||||
|
||||
// Evolution
|
||||
|
||||
//- Pre-evolve region
|
||||
virtual void preEvolveRegion();
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const thermalBaffleModel&) = delete;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace regionModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,112 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "thermalBaffleModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace regionModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||
|
||||
autoPtr<thermalBaffleModel> thermalBaffleModel::New(const fvMesh& mesh)
|
||||
{
|
||||
word modelType;
|
||||
{
|
||||
IOdictionary thermalBafflePropertiesDict
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"thermalBaffleProperties",
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
);
|
||||
|
||||
word modelType =
|
||||
thermalBafflePropertiesDict.lookupOrDefault<word>
|
||||
(
|
||||
"thermalBaffleModel",
|
||||
"thermalBaffle"
|
||||
);
|
||||
}
|
||||
|
||||
meshConstructorTable::iterator cstrIter =
|
||||
meshConstructorTablePtr_->find(modelType);
|
||||
|
||||
if (cstrIter == meshConstructorTablePtr_->end())
|
||||
{
|
||||
|
||||
FatalErrorInFunction
|
||||
<< "Unknown thermalBaffleModel type " << modelType
|
||||
<< nl << nl
|
||||
<< "Valid thermalBaffleModel types are:" << nl
|
||||
<< meshConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<thermalBaffleModel>(cstrIter()(modelType, mesh));
|
||||
}
|
||||
|
||||
|
||||
autoPtr<thermalBaffleModel> thermalBaffleModel::New
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
word modelType =
|
||||
dict.lookupOrDefault<word>("thermalBaffleModel", "thermalBaffle");
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(modelType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
{
|
||||
|
||||
FatalErrorInFunction
|
||||
<< "Unknown thermalBaffleModel type " << modelType
|
||||
<< nl << nl
|
||||
<< "Valid thermalBaffleModel types are:" << nl
|
||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<thermalBaffleModel>(cstrIter()(modelType, mesh, dict));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace regionModels
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -45,6 +45,6 @@ timePrecision 6;
|
||||
|
||||
runTimeModifiable true;
|
||||
|
||||
libs ("libthermalBaffleModels.so");
|
||||
libs ("libthermalBaffle.so");
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
Reference in New Issue
Block a user