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 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 nMagSf.boundaryField()[patchI] =
132 regionMesh().Sf().boundaryField()[patchI] & pNormals;
133 forAll(pNormals, localFaceI)
135 const vector&
n = pNormals[localFaceI];
136 const labelList& faces = boundaryFaceFaces_[localPyrolysisFaceI++];
139 const label faceID = faces[faceI];
140 nMagSf[faceID] = regionMesh().Sf()[faceID] &
n;
153 moveMesh_.readIfPresent(
"moveMesh", coeffs_);
168 moveMesh_.readIfPresent(
"moveMesh", coeffs_);
182 const scalar minDelta
198 label totalFaceId = 0;
199 forAll(intCoupledPatchIDs_, localPatchI)
201 label patchI = intCoupledPatchIDs_[localPatchI];
203 const vectorField& cf = regionMesh().Cf().boundaryField()[patchI];
207 const labelList& faces = boundaryFaceFaces_[totalFaceId];
214 oldCf[0] = cf[patchFaceI];
217 oldCf[i + 1] = regionMesh().faceCentres()[faces[i]];
221 point nbrCf = oldCf[0];
225 const label faceI = faces[i];
226 const label cellI = cells[i];
228 const face f = regionMesh().faces()[faceI];
230 newDelta += (deltaV[cellI]/
mag(sf))*n;
235 const label pointI = f[pti];
239 mag((nbrCf - (oldPoints[pointI] + newDelta)) & n)
243 newPoints[pointI] = oldPoints[pointI] + newDelta;
244 localDelta = newDelta;
245 cellMoveMap[cellI] = 1;
248 nbrCf = oldCf[i + 1] + localDelta;
251 const label bFaceI = boundaryFaceOppositeFace_[totalFaceId];
252 const face f = regionMesh().faces()[bFaceI];
253 const label cellI = cells[cells.
size() - 1];
254 newDelta += (deltaV[cellI]/
mag(sf))*n;
257 const label pointI = f[pti];
260 mag((nbrCf - (oldPoints[pointI] + newDelta)) & n)
264 newPoints[pointI] = oldPoints[pointI] + newDelta;
265 cellMoveMap[cellI] = 1;
272 regionMesh().movePoints(newPoints);
280 Foam::regionModels::regionModel1D::regionModel1D
283 const word& regionType
287 boundaryFaceFaces_(),
288 boundaryFaceCells_(),
289 boundaryFaceOppositeFace_(),
296 Foam::regionModels::regionModel1D::regionModel1D
299 const word& regionType,
300 const word& modelName,
305 boundaryFaceFaces_(regionMesh().nCells()),
306 boundaryFaceCells_(regionMesh().nCells()),
307 boundaryFaceOppositeFace_(regionMesh().nCells()),
314 constructMeshObjects();
325 Foam::regionModels::regionModel1D::regionModel1D
328 const word& regionType,
329 const word& modelName,
334 regionModel(mesh, regionType, modelName, dict, readFields),
335 boundaryFaceFaces_(regionMesh().nCells()),
336 boundaryFaceCells_(regionMesh().nCells()),
337 boundaryFaceOppositeFace_(regionMesh().nCells()),
344 constructMeshObjects();
tmp< labelField > moveMesh(const scalarList &deltaV, const scalar minDelta=0.0)
Move mesh points according to change in cell volumes.
Mesh data needed to do the Finite Volume discretisation.
const vectorField::subField faceAreas() const
Return face normals.
dimensioned< scalar > mag(const dimensioned< Type > &)
virtual ~regionModel1D()
Destructor.
virtual bool read()
Read control parameters from dictionary.
Field< label > labelField
Specialisation of Field<T> for label.
const dimensionSet dimArea(sqr(dimLength))
A class for handling words, derived from string.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void size(const label)
Override size to be inconsistent with allocated storage.
defineTypeNameAndDebug(regionModel, 0)
A list of keyword definitions, which are a keyword followed by any number of values (e...
volScalarField sf(fieldObject, mesh)
A patch is a list of labels that address the faces in the global face list.
A face is a list of labels corresponding to mesh vertices.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Field< vector > vectorField
Specialisation of Field<T> for vector.
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
const Field< PointType > & faceNormals() const
Return face normals for patch.
const cellShapeList & cells
List< label > labelList
A List of labels.
Vector< scalar > vector
A scalar version of the templated Vector.
bool read(const char *, int32_t &)
virtual bool read()
Read control parameters from dictionary.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
A class for managing temporary objects.
prefixOSstream Pout(cout,"Pout")