32 namespace regionModels
40 void Foam::regionModels::regionModel1D::constructMeshObjects()
62 void Foam::regionModels::regionModel1D::initialise()
66 Pout<<
"regionModel1D::initialise()" <<
endl;
71 DynamicList<label> faceIDs;
72 DynamicList<label> cellIDs;
74 label localPyrolysisFacei = 0;
76 const polyBoundaryMesh& rbm = regionMesh().boundaryMesh();
78 forAll(intCoupledPatchIDs_, i)
80 const label patchi = intCoupledPatchIDs_[i];
81 const polyPatch& ppCoupled = rbm[
patchi];
82 forAll(ppCoupled, localFacei)
84 label facei = ppCoupled.start() + localFacei;
90 label ownCelli = regionMesh().faceOwner()[facei];
91 if (ownCelli != celli)
97 celli = regionMesh().faceNeighbour()[facei];
100 cellIDs.append(celli);
101 const cell& cFaces = regionMesh().cells()[celli];
102 facei = cFaces.opposingFaceLabel(facei, regionMesh().faces());
103 faceIDs.append(facei);
105 }
while (regionMesh().isInternalFace(facei));
107 boundaryFaceOppositeFace_[localPyrolysisFacei] = facei;
111 boundaryFaceFaces_[localPyrolysisFacei].transfer(faceIDs);
112 boundaryFaceCells_[localPyrolysisFacei].transfer(cellIDs);
114 localPyrolysisFacei++;
119 boundaryFaceOppositeFace_.setSize(localPyrolysisFacei);
120 boundaryFaceFaces_.setSize(localPyrolysisFacei);
121 boundaryFaceCells_.setSize(localPyrolysisFacei);
125 surfaceScalarField::Boundary nMagSfBf =
126 nMagSf.boundaryFieldRef();
128 localPyrolysisFacei = 0;
130 forAll(intCoupledPatchIDs_, i)
132 const label patchi = intCoupledPatchIDs_[i];
133 const polyPatch& ppCoupled = rbm[
patchi];
134 const vectorField& pNormals = ppCoupled.faceNormals();
135 nMagSfBf[
patchi] = regionMesh().Sf().boundaryField()[
patchi] & pNormals;
136 forAll(pNormals, localFacei)
138 const vector&
n = pNormals[localFacei];
139 const labelList& faces = boundaryFaceFaces_[localPyrolysisFacei++];
142 const label faceID = faces[facei];
143 nMagSf[faceID] = regionMesh().Sf()[faceID] &
n;
156 moveMesh_.readIfPresent(
"moveMesh", coeffs_);
171 moveMesh_.readIfPresent(
"moveMesh", coeffs_);
185 const scalar minDelta
201 label totalFaceId = 0;
202 forAll(intCoupledPatchIDs_, localPatchi)
204 label patchi = intCoupledPatchIDs_[localPatchi];
210 const labelList& faces = boundaryFaceFaces_[totalFaceId];
217 oldCf[0] = cf[patchFacei];
220 oldCf[i + 1] = regionMesh().faceCentres()[faces[i]];
224 point nbrCf = oldCf[0];
228 const label facei = faces[i];
229 const label celli = cells[i];
231 const face f = regionMesh().faces()[facei];
233 newDelta += (deltaV[celli]/
mag(sf))*n;
238 const label pointi = f[pti];
242 mag((nbrCf - (oldPoints[pointi] + newDelta)) & n)
246 newPoints[pointi] = oldPoints[pointi] + newDelta;
247 localDelta = newDelta;
248 cellMoveMap[celli] = 1;
251 nbrCf = oldCf[i + 1] + localDelta;
254 const label bFacei = boundaryFaceOppositeFace_[totalFaceId];
255 const face f = regionMesh().faces()[bFacei];
256 const label celli = cells[cells.
size() - 1];
257 newDelta += (deltaV[celli]/
mag(sf))*n;
260 const label pointi = f[pti];
263 mag((nbrCf - (oldPoints[pointi] + newDelta)) & n)
267 newPoints[pointi] = oldPoints[pointi] + newDelta;
268 cellMoveMap[celli] = 1;
275 regionMesh().movePoints(newPoints);
283 Foam::regionModels::regionModel1D::regionModel1D
286 const word& regionType
290 boundaryFaceFaces_(),
291 boundaryFaceCells_(),
292 boundaryFaceOppositeFace_(),
299 Foam::regionModels::regionModel1D::regionModel1D
302 const word& regionType,
303 const word& modelName,
308 boundaryFaceFaces_(regionMesh().nCells()),
309 boundaryFaceCells_(regionMesh().nCells()),
310 boundaryFaceOppositeFace_(regionMesh().nCells()),
317 constructMeshObjects();
328 Foam::regionModels::regionModel1D::regionModel1D
331 const word& regionType,
332 const word& modelName,
337 regionModel(mesh, regionType, modelName, dict, readFields),
338 boundaryFaceFaces_(regionMesh().nCells()),
339 boundaryFaceCells_(regionMesh().nCells()),
340 boundaryFaceOppositeFace_(regionMesh().nCells()),
347 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.
const Field< PointType > & faceNormals() const
Return face normals for patch.
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.
List< label > labelList
A List of labels.
const vectorField::subField faceAreas() const
Return face normals.
volScalarField sf(fieldObject, mesh)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
virtual bool read()
Read control parameters from dictionary.
prefixOSstream Pout(cout, "Pout")
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))