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);
120 surfaceScalarField::Boundary& nMagSfBf = nMagSf.boundaryFieldRef();
122 localPyrolysisFacei = 0;
124 forAll(intCoupledPatchIDs_, i)
126 const label patchi = intCoupledPatchIDs_[i];
127 const polyPatch& ppCoupled = rbm[
patchi];
128 const vectorField& pNormals = ppCoupled.faceNormals();
129 nMagSfBf[
patchi] = regionMesh().Sf().boundaryField()[
patchi] & pNormals;
130 forAll(pNormals, localFacei)
132 const vector&
n = pNormals[localFacei];
133 const labelList& faces = boundaryFaceFaces_[localPyrolysisFacei++];
136 const label faceID = faces[facei];
137 nMagSf[faceID] = regionMesh().Sf()[faceID] &
n;
150 moveMesh_.readIfPresent(
"moveMesh", coeffs_);
165 moveMesh_.readIfPresent(
"moveMesh", coeffs_);
179 const scalar minDelta
195 label totalFaceId = 0;
196 forAll(intCoupledPatchIDs_, localPatchi)
198 label patchi = intCoupledPatchIDs_[localPatchi];
204 const labelList& faces = boundaryFaceFaces_[totalFaceId];
211 oldCf[0] = cf[patchFacei];
214 oldCf[i + 1] = regionMesh().faceCentres()[faces[i]];
218 point nbrCf = oldCf[0];
222 const label facei = faces[i];
223 const label celli = cells[i];
225 const face f = regionMesh().faces()[facei];
227 newDelta += (deltaV[celli]/
mag(sf))*n;
232 const label pointi = f[pti];
236 mag((nbrCf - (oldPoints[pointi] + newDelta)) & n)
240 newPoints[pointi] = oldPoints[pointi] + newDelta;
241 localDelta = newDelta;
242 cellMoveMap[celli] = 1;
245 nbrCf = oldCf[i + 1] + localDelta;
248 const label bFacei = boundaryFaceOppositeFace_[totalFaceId];
249 const face f = regionMesh().faces()[bFacei];
250 const label celli = cells[cells.
size() - 1];
251 newDelta += (deltaV[celli]/
mag(sf))*n;
254 const label pointi = f[pti];
257 mag((nbrCf - (oldPoints[pointi] + newDelta)) & n)
261 newPoints[pointi] = oldPoints[pointi] + newDelta;
262 cellMoveMap[celli] = 1;
269 regionMesh().movePoints(newPoints);
277 Foam::regionModels::regionModel1D::regionModel1D
280 const word& regionType
284 boundaryFaceFaces_(),
285 boundaryFaceCells_(),
286 boundaryFaceOppositeFace_(),
293 Foam::regionModels::regionModel1D::regionModel1D
296 const word& regionType,
297 const word& modelName,
302 boundaryFaceFaces_(regionMesh().nCells()),
303 boundaryFaceCells_(regionMesh().nCells()),
304 boundaryFaceOppositeFace_(regionMesh().nCells()),
309 constructMeshObjects();
319 Foam::regionModels::regionModel1D::regionModel1D
322 const word& regionType,
323 const word& modelName,
328 regionModel(mesh, regionType, modelName, dict, readFields),
329 boundaryFaceFaces_(regionMesh().nCells()),
330 boundaryFaceCells_(regionMesh().nCells()),
331 boundaryFaceOppositeFace_(regionMesh().nCells()),
336 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.
const dimensionSet dimArea
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.