43void Foam::regionModels::regionModel1D::constructMeshObjects()
65void Foam::regionModels::regionModel1D::initialise()
69 Pout<<
"regionModel1D::initialise()" <<
endl;
74 DynamicList<label> faceIDs;
75 DynamicList<label> cellIDs;
77 label localPyrolysisFacei = 0;
79 const polyBoundaryMesh& rbm = regionMesh().boundaryMesh();
81 forAll(intCoupledPatchIDs_, i)
83 const label patchi = intCoupledPatchIDs_[i];
84 const polyPatch& ppCoupled = rbm[patchi];
85 localPyrolysisFacei += ppCoupled.size();
88 boundaryFaceOppositeFace_.setSize(localPyrolysisFacei);
89 boundaryFaceFaces_.setSize(localPyrolysisFacei);
90 boundaryFaceCells_.setSize(localPyrolysisFacei);
92 localPyrolysisFacei = 0;
94 forAll(intCoupledPatchIDs_, i)
96 const label patchi = intCoupledPatchIDs_[i];
97 const polyPatch& ppCoupled = rbm[patchi];
98 forAll(ppCoupled, localFacei)
100 label facei = ppCoupled.start() + localFacei;
105 label ownCelli = regionMesh().faceOwner()[facei];
106 if (ownCelli != celli)
112 celli = regionMesh().faceNeighbour()[facei];
115 cellIDs.append(celli);
116 const cell& cFaces = regionMesh().cells()[celli];
117 faceIDs.append(facei);
119 cFaces.opposingFaceLabel(facei, regionMesh().faces());
121 }
while (regionMesh().isInternalFace(facei));
123 boundaryFaceOppositeFace_[localPyrolysisFacei] = facei;
126 boundaryFaceFaces_[localPyrolysisFacei].transfer(faceIDs);
127 boundaryFaceCells_[localPyrolysisFacei].transfer(cellIDs);
129 localPyrolysisFacei++;
140 localPyrolysisFacei = 0;
142 forAll(intCoupledPatchIDs_, i)
144 const label patchi = intCoupledPatchIDs_[i];
145 const polyPatch& ppCoupled = rbm[patchi];
146 const vectorField& pNormals = ppCoupled.faceNormals();
148 nMagSfBf[patchi] = regionMesh().Sf().boundaryField()[patchi] & pNormals;
150 forAll(pNormals, localFacei)
152 const vector n = pNormals[localFacei];
153 const labelList& faces = boundaryFaceFaces_[localPyrolysisFacei++];
159 const label faceID = faces[facei];
160 nMagSf[faceID] = regionMesh().Sf()[faceID] &
n;
185 moveMesh_.readIfPresent(
"moveMesh", coeffs_);
197 const scalar minDelta
201 auto& cellMoveMap = tcellMoveMap.ref();
211 const polyBoundaryMesh& bm = regionMesh().boundaryMesh();
213 label totalFacei = 0;
214 forAll(intCoupledPatchIDs_, localPatchi)
216 label patchi = intCoupledPatchIDs_[localPatchi];
217 const polyPatch&
pp = bm[patchi];
221 const labelList& faces = boundaryFaceFaces_[totalFacei];
223 const label oFace = boundaryFaceOppositeFace_[totalFacei];
225 const vector n =
pp.faceNormals()[patchFacei];
226 const vector sf =
pp.faceAreas()[patchFacei];
228 List<point> oldCf(faces.size() + 1,
Zero);
229 List<bool> frozen(faces.size(),
false);
233 oldCf[i] = regionMesh().faceCentres()[faces[i]];
236 oldCf[faces.size()] = regionMesh().faceCentres()[oFace];
240 const label celli =
cells[i];
242 if (
mag(oldCf[i + 1] - oldCf[i]) < minDelta)
245 cellMoveMap[celli] = 1;
254 const label celli =
cells[i];
255 newDelta[j+1] = (deltaV[celli]/
mag(sf))*
n + newDelta[j];
260 const face of = regionMesh().faces()[oFace];
262 scalar omagV =
mag(newDelta[newDelta.size()-1]);
264 if (!frozen[
cells.size()-1] && (omagV > ROOTVSMALL))
268 const label pointi = of[pti];
270 oldPoints[pointi] - newDelta[newDelta.size()-1];
275 for (label i=0; i < faces.size(); i++)
277 const label facei = faces[i];
278 const face
f = regionMesh().faces()[facei];
280 scalar magV =
mag(newDelta[i]);
281 if (!frozen[i] && magV > 0)
285 const label pointi =
f[pti];
286 newPoints[pointi] = oldPoints[pointi] - newDelta[i];
296 regionMesh().movePoints(newPoints);
304Foam::regionModels::regionModel1D::regionModel1D
307 const word& regionType
311 boundaryFaceFaces_(),
312 boundaryFaceCells_(),
320Foam::regionModels::regionModel1D::regionModel1D
323 const word& regionType,
324 const word& modelName,
329 boundaryFaceFaces_(regionMesh().nCells()),
330 boundaryFaceCells_(regionMesh().nCells()),
331 boundaryFaceOppositeFace_(regionMesh().nCells()),
338 constructMeshObjects();
348Foam::regionModels::regionModel1D::regionModel1D
351 const word& regionType,
352 const word& modelName,
358 boundaryFaceFaces_(regionMesh().nCells()),
359 boundaryFaceCells_(regionMesh().nCells()),
360 boundaryFaceOppositeFace_(regionMesh().nCells()),
367 constructMeshObjects();
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
GeometricBoundaryField< scalar, fvsPatchField, surfaceMesh > Boundary
@ NO_REGISTER
Do not request registration (bool: false).
@ NO_READ
Nothing to be read.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void size(const label n)
Older name for setAddressableSize.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A face is a list of labels corresponding to mesh vertices.
Mesh data needed to do the Finite Volume discretisation.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
A patch is a list of labels that address the faces in the global face list.
Base class for 1-D region models.
tmp< labelField > moveMesh(const scalarList &deltaV, const scalar minDelta=0.0)
Move mesh points according to change in cell volumes.
labelListList boundaryFaceFaces_
Global face IDs.
labelList boundaryFaceOppositeFace_
Global boundary face IDs oppositte coupled patch.
autoPtr< surfaceScalarField > nMagSfPtr_
Face area magnitude normal to patch.
virtual ~regionModel1D()
Destructor.
Switch moveMesh_
Flag to allow mesh movement.
label nLayers_
Number of layers in the region.
labelListList boundaryFaceCells_
Global cell IDs.
virtual bool read()
Read control parameters from dictionary.
Base class for region models.
Switch active_
Active flag.
const Time & time() const noexcept
Return the reference to the time database.
dictionary coeffs_
Model coefficients dictionary.
const fvMesh & regionMesh() const
Return the region mesh database.
labelList intCoupledPatchIDs_
List of patch IDs internally coupled with the primary region.
const word & modelName() const noexcept
Return the model name.
virtual bool read()
Read control parameters from dictionary.
A class for managing temporary objects.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const NameMatchPredicate &selectedFields, DynamicList< regIOobject * > &storedObjects)
Read the selected GeometricFields of the templated type and store on the objectRegistry.
List< label > labelList
A List of labels.
const dimensionSet dimArea(sqr(dimLength))
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Field< vector > vectorField
Specialisation of Field<T> for vector.
static constexpr const zero Zero
Global zero (0).
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
vectorField pointField
pointField is a vectorField.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
List< scalar > scalarList
List of scalar.
#define forAll(list, i)
Loop across all elements in list.