32 namespace regionModels
40 void Foam::regionModels::regionModel1D::constructMeshObjects()
61 void Foam::regionModels::regionModel1D::initialise()
65 Pout<<
"regionModel1D::initialise()" <<
endl;
70 DynamicList<label> faceIDs;
71 DynamicList<label> cellIDs;
73 label localPyrolysisFacei = 0;
75 const polyBoundaryMesh& rbm = regionMesh().boundaryMesh();
77 forAll(intCoupledPatchIDs_, i)
79 const label patchi = intCoupledPatchIDs_[i];
80 const polyPatch& ppCoupled = rbm[
patchi];
81 forAll(ppCoupled, localFacei)
83 label facei = ppCoupled.start() + localFacei;
89 label ownCelli = regionMesh().faceOwner()[facei];
90 if (ownCelli != celli)
96 celli = regionMesh().faceNeighbour()[facei];
99 cellIDs.append(celli);
100 const cell& cFaces = regionMesh().cells()[celli];
101 facei = cFaces.opposingFaceLabel(facei, regionMesh().faces());
102 faceIDs.append(facei);
104 }
while (regionMesh().isInternalFace(facei));
106 boundaryFaceOppositeFace_[localPyrolysisFacei] = facei;
110 boundaryFaceFaces_[localPyrolysisFacei].transfer(faceIDs);
111 boundaryFaceCells_[localPyrolysisFacei].transfer(cellIDs);
113 localPyrolysisFacei++;
118 boundaryFaceOppositeFace_.setSize(localPyrolysisFacei);
119 boundaryFaceFaces_.setSize(localPyrolysisFacei);
120 boundaryFaceCells_.setSize(localPyrolysisFacei);
124 surfaceScalarField::Boundary nMagSfBf =
125 nMagSf.boundaryFieldRef();
127 localPyrolysisFacei = 0;
129 forAll(intCoupledPatchIDs_, i)
131 const label patchi = intCoupledPatchIDs_[i];
132 const polyPatch& ppCoupled = rbm[
patchi];
133 const vectorField& pNormals = ppCoupled.faceNormals();
134 nMagSfBf[
patchi] = regionMesh().Sf().boundaryField()[
patchi] & pNormals;
135 forAll(pNormals, localFacei)
137 const vector&
n = pNormals[localFacei];
138 const labelList& faces = boundaryFaceFaces_[localPyrolysisFacei++];
141 const label faceID = faces[facei];
142 nMagSf[faceID] = regionMesh().Sf()[faceID] &
n;
155 moveMesh_.readIfPresent(
"moveMesh", coeffs_);
170 moveMesh_.readIfPresent(
"moveMesh", coeffs_);
184 const scalar minDelta
200 label totalFaceId = 0;
201 forAll(intCoupledPatchIDs_, localPatchi)
203 label patchi = intCoupledPatchIDs_[localPatchi];
209 const labelList& faces = boundaryFaceFaces_[totalFaceId];
216 oldCf[0] = cf[patchFacei];
219 oldCf[i + 1] = regionMesh().faceCentres()[faces[i]];
223 point nbrCf = oldCf[0];
227 const label facei = faces[i];
228 const label celli = cells[i];
230 const face f = regionMesh().faces()[facei];
232 newDelta += (deltaV[celli]/
mag(sf))*n;
237 const label pointi = f[pti];
241 mag((nbrCf - (oldPoints[pointi] + newDelta)) & n)
245 newPoints[pointi] = oldPoints[pointi] + newDelta;
246 localDelta = newDelta;
247 cellMoveMap[celli] = 1;
250 nbrCf = oldCf[i + 1] + localDelta;
253 const label bFacei = boundaryFaceOppositeFace_[totalFaceId];
254 const face f = regionMesh().faces()[bFacei];
255 const label celli = cells[cells.
size() - 1];
256 newDelta += (deltaV[celli]/
mag(sf))*n;
259 const label pointi = f[pti];
262 mag((nbrCf - (oldPoints[pointi] + newDelta)) & n)
266 newPoints[pointi] = oldPoints[pointi] + newDelta;
267 cellMoveMap[celli] = 1;
274 regionMesh().movePoints(newPoints);
282 Foam::regionModels::regionModel1D::regionModel1D
285 const word& regionType
289 boundaryFaceFaces_(),
290 boundaryFaceCells_(),
291 boundaryFaceOppositeFace_(),
298 Foam::regionModels::regionModel1D::regionModel1D
301 const word& regionType,
302 const word& modelName,
307 boundaryFaceFaces_(regionMesh().nCells()),
308 boundaryFaceCells_(regionMesh().nCells()),
309 boundaryFaceOppositeFace_(regionMesh().nCells()),
316 constructMeshObjects();
327 Foam::regionModels::regionModel1D::regionModel1D
330 const word& regionType,
331 const word& modelName,
336 regionModel(mesh, regionType, modelName, dict, readFields),
337 boundaryFaceFaces_(regionMesh().nCells()),
338 boundaryFaceCells_(regionMesh().nCells()),
339 boundaryFaceOppositeFace_(regionMesh().nCells()),
346 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.
List< label > labelList
A List of labels.
const Field< PointType > & faceNormals() const
Return face normals for patch.
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))