32 namespace regionModels
40 void Foam::regionModels::regionModel1D::constructMeshObjects()
61 void Foam::regionModels::regionModel1D::initialise()
67 DynamicList<label> faceIDs;
68 DynamicList<label> cellIDs;
70 label localPyrolysisFacei = 0;
72 const polyBoundaryMesh& rbm = regionMesh().boundaryMesh();
74 forAll(intCoupledPatchIDs_, i)
76 const label patchi = intCoupledPatchIDs_[i];
77 const polyPatch& ppCoupled = rbm[
patchi];
78 forAll(ppCoupled, localFacei)
80 label facei = ppCoupled.start() + localFacei;
86 label ownCelli = regionMesh().faceOwner()[facei];
87 if (ownCelli != celli)
93 celli = regionMesh().faceNeighbour()[facei];
96 cellIDs.append(celli);
97 const cell& cFaces = regionMesh().cells()[celli];
98 facei = cFaces.opposingFaceLabel(facei, regionMesh().faces());
99 faceIDs.append(facei);
101 }
while (regionMesh().isInternalFace(facei));
103 boundaryFaceOppositeFace_[localPyrolysisFacei] = facei;
107 boundaryFaceFaces_[localPyrolysisFacei].transfer(faceIDs);
108 boundaryFaceCells_[localPyrolysisFacei].transfer(cellIDs);
110 localPyrolysisFacei++;
115 boundaryFaceOppositeFace_.setSize(localPyrolysisFacei);
116 boundaryFaceFaces_.setSize(localPyrolysisFacei);
117 boundaryFaceCells_.setSize(localPyrolysisFacei);
121 surfaceScalarField::Boundary nMagSfBf =
122 nMagSf.boundaryFieldRef();
124 localPyrolysisFacei = 0;
126 forAll(intCoupledPatchIDs_, i)
128 const label patchi = intCoupledPatchIDs_[i];
129 const polyPatch& ppCoupled = rbm[
patchi];
130 const vectorField& pNormals = ppCoupled.faceNormals();
131 nMagSfBf[
patchi] = regionMesh().Sf().boundaryField()[
patchi] & pNormals;
132 forAll(pNormals, localFacei)
134 const vector&
n = pNormals[localFacei];
135 const labelList& faces = boundaryFaceFaces_[localPyrolysisFacei++];
138 const label faceID = faces[facei];
139 nMagSf[faceID] = regionMesh().Sf()[faceID] &
n;
152 moveMesh_.readIfPresent(
"moveMesh", coeffs_);
167 moveMesh_.readIfPresent(
"moveMesh", coeffs_);
181 const scalar minDelta
197 label totalFaceId = 0;
198 forAll(intCoupledPatchIDs_, localPatchi)
200 label patchi = intCoupledPatchIDs_[localPatchi];
206 const labelList& faces = boundaryFaceFaces_[totalFaceId];
213 oldCf[0] = cf[patchFacei];
216 oldCf[i + 1] = regionMesh().faceCentres()[faces[i]];
220 point nbrCf = oldCf[0];
224 const label facei = faces[i];
225 const label celli = cells[i];
227 const face f = regionMesh().faces()[facei];
229 newDelta += (deltaV[celli]/
mag(sf))*n;
234 const label pointi = f[pti];
238 mag((nbrCf - (oldPoints[pointi] + newDelta)) & n)
242 newPoints[pointi] = oldPoints[pointi] + newDelta;
243 localDelta = newDelta;
244 cellMoveMap[celli] = 1;
247 nbrCf = oldCf[i + 1] + localDelta;
250 const label bFacei = boundaryFaceOppositeFace_[totalFaceId];
251 const face f = regionMesh().faces()[bFacei];
252 const label celli = cells[cells.
size() - 1];
253 newDelta += (deltaV[celli]/
mag(sf))*n;
256 const label pointi = f[pti];
259 mag((nbrCf - (oldPoints[pointi] + newDelta)) & n)
263 newPoints[pointi] = oldPoints[pointi] + newDelta;
264 cellMoveMap[celli] = 1;
271 regionMesh().movePoints(newPoints);
279 Foam::regionModels::regionModel1D::regionModel1D
282 const word& regionType
286 boundaryFaceFaces_(),
287 boundaryFaceCells_(),
288 boundaryFaceOppositeFace_(),
295 Foam::regionModels::regionModel1D::regionModel1D
298 const word& regionType,
299 const word& modelName,
304 boundaryFaceFaces_(regionMesh().nCells()),
305 boundaryFaceCells_(regionMesh().nCells()),
306 boundaryFaceOppositeFace_(regionMesh().nCells()),
313 constructMeshObjects();
324 Foam::regionModels::regionModel1D::regionModel1D
327 const word& regionType,
328 const word& modelName,
333 regionModel(mesh, regionType, modelName, dict, readFields),
334 boundaryFaceFaces_(regionMesh().nCells()),
335 boundaryFaceCells_(regionMesh().nCells()),
336 boundaryFaceOppositeFace_(regionMesh().nCells()),
343 constructMeshObjects();
Field< label > labelField
Specialisation of Field<T> for label.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
A face is a list of labels corresponding to mesh vertices.
A list of keyword definitions, which are a keyword followed by any number of values (e...
T & ref() const
Return non-const reference or generate a fatal error.
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
tmp< labelField > moveMesh(const scalarList &deltaV, const scalar minDelta=0.0)
Move mesh points according to change in cell volumes.
Vector< scalar > vector
A scalar version of the templated Vector.
defineTypeNameAndDebug(regionModel, 0)
bool read(const char *, int32_t &)
virtual ~regionModel1D()
Destructor.
A class for handling words, derived from string.
virtual bool read()
Read control parameters from dictionary.
#define DebugInFunction
Report an information message using Foam::Info.
List< label > labelList
A List of labels.
const Field< PointType > & faceNormals() const
Return face normals for patch.
const vectorField::subField faceAreas() const
Return face areas.
volScalarField sf(fieldObject, mesh)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
virtual bool read()
Read control parameters from dictionary.
Mesh data needed to do the Finite Volume discretisation.
dimensioned< scalar > mag(const dimensioned< Type > &)
Base class for region models.
Field< vector > vectorField
Specialisation of Field<T> for vector.
A class for managing temporary objects.
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
A patch is a list of labels that address the faces in the global face list.
const dimensionSet dimArea(sqr(dimLength))