35 namespace regionModels
43 void Foam::regionModels::regionModel1D::constructMeshObjects()
65 void Foam::regionModels::regionModel1D::initialise()
69 Pout<<
"regionModel1D::initialise()" <<
endl;
74 DynamicList<label> faceIDs;
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];
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
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);
304 Foam::regionModels::regionModel1D::regionModel1D
307 const word& regionType
311 boundaryFaceFaces_(),
312 boundaryFaceCells_(),
313 boundaryFaceOppositeFace_(),
320 Foam::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();
348 Foam::regionModels::regionModel1D::regionModel1D
351 const word& regionType,
352 const word& modelName,
353 const dictionary&
dict,
358 boundaryFaceFaces_(regionMesh().nCells()),
359 boundaryFaceCells_(regionMesh().nCells()),
360 boundaryFaceOppositeFace_(regionMesh().nCells()),
367 constructMeshObjects();
Field< label > labelField
Specialisation of Field<T> for label.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
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.
GeometricBoundaryField< scalar, fvsPatchField, surfaceMesh > Boundary
Type of boundary fields.
Ignore writing from objectRegistry::writeObject()
#define forAll(list, i)
Loop across all elements in list.
Switch moveMesh_
Flag to allow mesh movement.
vectorField pointField
pointField is a vectorField.
virtual ~regionModel1D()
Destructor.
A class for handling words, derived from Foam::string.
virtual bool read()
Read control parameters from dictionary.
autoPtr< surfaceScalarField > nMagSfPtr_
Face area magnitude normal to patch.
const fvMesh & regionMesh() const
Return the region mesh database.
Switch active_
Active flag.
int debug
Static debugging option.
dictionary coeffs_
Model coefficients dictionary.
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.
Base class for region models.
Field< vector > vectorField
Specialisation of Field<T> for vector.
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const wordHashSet &selectedFields, LIFOStack< regIOobject *> &storedObjects)
Read the selected GeometricFields of the templated type.
List< label > labelList
A List of labels.
A class for managing temporary objects.
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
defineTypeNameAndDebug(KirchhoffShell, 0)
bool readIfPresent(const word &key, const dictionary &dict)
Update the value of the Switch if it is found in the dictionary.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
const Time & time() const noexcept
Return the reference to the time database.
const dimensionSet dimArea(sqr(dimLength))
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
static constexpr const zero Zero
Global zero (0)