80 const bool haveV = (VPtr_ !=
nullptr);
81 const bool haveSf = (SfPtr_ !=
nullptr);
82 const bool haveMagSf = (magSfPtr_ !=
nullptr);
83 const bool haveCP = (CPtr_ !=
nullptr);
84 const bool haveCf = (CfPtr_ !=
nullptr);
118 clearGeomNotOldVol();
157 meshObject::clear<fvMesh, TopologicalMeshObject>(*this);
158 meshObject::clear<lduMesh, TopologicalMeshObject>(*this);
169 <<
" Storing old time volumes since from time " << curTimeIndex_
170 <<
" and time now " << time().timeIndex()
171 <<
" V:" << V.size() <<
endl;
173 if (V00Ptr_ && V0Ptr_)
181 V0Ptr_ =
new DimensionedField<scalar, volMesh>
197 V0Ptr_->scalarField::resize_nocopy(V.size());
201 V0Ptr_->scalarField::operator=(V);
203 curTimeIndex_ = time().timeIndex();
208 <<
" Stored old time volumes V0:" << V0Ptr_->size()
214 <<
" Stored oldold time volumes V00:" << V00Ptr_->size()
227 clearAddressing(isMeshUpdate);
230 phiPtr_.reset(
nullptr);
236 clearOutLocal(isMeshUpdate);
245 phiPtr_.reset(
nullptr);
307 rio.resetHeader(
"V0");
311 <<
"Detected V0: " << rio.objectRelPath() <<
nl;
313 V0Ptr_ =
new DimensionedField<scalar, volMesh>
329 rio.resetHeader(
"meshPhi");
333 <<
"Detected meshPhi: " << rio.objectRelPath() <<
nl;
336 phiPtr_.reset(
nullptr);
338 phiPtr_ = std::make_unique<surfaceScalarField>
354 V0Ptr_ =
new DimensionedField<scalar, volMesh>
391 std::move(allNeighbour),
493 std::move(allNeighbour),
500 static_cast<const
dictionary*>(baseMesh.hasSchemes())
507 static_cast<const
dictionary*>(baseMesh.hasSolution())
550 static_cast<const
dictionary*>(baseMesh.hasSchemes())
557 static_cast<const
dictionary*>(baseMesh.hasSolution())
590 return static_cast<const fvSchemes*
>(
this);
602 return static_cast<const fvSchemes&
>(*this);
682 const bool validBoundary
688 <<
" boundary already exists" 692 addPatches(plist, validBoundary);
700 const bool validBoundary
706 addFvPatches(plist, validBoundary);
764 <<
"Calculating fvMeshLduAddressing from nFaces:" 767 lduPtr_ =
new fvMeshLduAddressing(*
this);
786 <<
" nCells:" << nCells()
788 <<
" nFaces:" << nFaces()
799 <<
"mapPolyMesh does not correspond to the old mesh." 800 <<
" nCells:" << nCells()
803 <<
" nFaces:" << nFaces()
810 const fvMeshMapper mapper(*
this, meshMap);
813 MapGeometricFields<scalar, fvPatchField, fvMeshMapper, volMesh>
815 MapGeometricFields<vector, fvPatchField, fvMeshMapper, volMesh>
817 MapGeometricFields<sphericalTensor, fvPatchField, fvMeshMapper, volMesh>
819 MapGeometricFields<symmTensor, fvPatchField, fvMeshMapper, volMesh>
821 MapGeometricFields<tensor, fvPatchField, fvMeshMapper, volMesh>
825 MapGeometricFields<scalar, fvsPatchField, fvMeshMapper, surfaceMesh>
827 MapGeometricFields<vector, fvsPatchField, fvMeshMapper, surfaceMesh>
834 MapGeometricFields<symmTensor, fvsPatchField, fvMeshMapper, surfaceMesh>
836 MapGeometricFields<tensor, fvsPatchField, fvMeshMapper, surfaceMesh>
840 MapDimensionedFields<scalar, fvMeshMapper, volMesh>(mapper);
841 MapDimensionedFields<vector, fvMeshMapper, volMesh>(mapper);
842 MapDimensionedFields<sphericalTensor, fvMeshMapper, volMesh>(mapper);
843 MapDimensionedFields<symmTensor, fvMeshMapper, volMesh>(mapper);
844 MapDimensionedFields<tensor, fvMeshMapper, volMesh>(mapper);
858 V0.resize_nocopy(nCells());
864 V0[i] = savedV0[cellMap[i]];
880 label celli = -index-2;
882 V0[celli] += savedV0[oldCelli];
889 <<
"Mapping old time volume V0. Merged " 890 << nMerged <<
" out of " << nCells() <<
" cells" <<
endl;
900 V00.resize_nocopy(nCells());
906 V00[i] = savedV00[cellMap[i]];
922 label celli = -index-2;
924 V00[celli] += savedV00[oldCelli];
930 <<
"Mapping old time volume V00. Merged " 931 << nMerged <<
" out of " << nCells() <<
" cells" <<
endl;
956 phiPtr_ = std::make_unique<surfaceScalarField>
974 if (phiPtr_->timeIndex() != time().timeIndex())
989 updateGeomNotOldVol();
992 boundary_.movePoints();
997 meshObject::movePoints<fvMesh>(*this);
998 meshObject::movePoints<lduMesh>(*this);
1029 if (VPtr_ && (VPtr_->size() != mpm.
nOldCells()))
1032 <<
"V:" << VPtr_->size()
1033 <<
" not equal to the number of old cells " 1037 if (V0Ptr_ && (V0Ptr_->size() != mpm.
nOldCells()))
1040 <<
"V0:" << V0Ptr_->size()
1041 <<
" not equal to the number of old cells " 1045 if (V00Ptr_ && (V00Ptr_->size() != mpm.
nOldCells()))
1048 <<
"V0:" << V00Ptr_->size()
1049 <<
" not equal to the number of old cells " 1060 phiPtr_.reset(
nullptr);
1063 phiPtr_ = std::make_unique<surfaceScalarField>
1080 clearGeomNotOldVol();
1089 clearAddressing(
true);
1091 meshObject::updateMesh<fvMesh>(*
this, mpm);
1092 meshObject::updateMesh<lduMesh>(*
this, mpm);
1099 const bool writeOnProc
1105 ok = phiPtr_->write(writeOnProc);
1113 ok = V0Ptr_->write(writeOnProc);
1128 Foam::fvMesh::validComponents<Foam::sphericalTensor>()
const 1138 return &rhs !=
this;
1144 return &rhs ==
this;
void size(const label n)
Older name for setAddressableSize.
slicedVolVectorField * CPtr_
Cell centres.
void clearAddressing()
Clear topological data.
void removeFvBoundary()
Remove boundary patches. Warning: fvPatchFields hold ref to these fvPatches.
void clearMeshPhi()
Clear cell face motion fluxes.
virtual bool init(const bool doInit)
Initialise all non-demand-driven data.
const fvSchemes & schemes() const
Read-access to the fvSchemes controls.
errorManipArg< error, int > exit(error &err, const int errNo=1)
virtual void movePoints(const pointField &)
Move points.
virtual bool writeObject(IOstreamOption streamOpt, const bool writeOnProc) const
Write the underlying polyMesh and other data.
static void clearUpto(objectRegistry &obr)
Clear all meshObject derived from FromType up to (but not including) ToType.
void mapClouds(const objectRegistry &db, const mapPolyMesh &mapper)
Generic Geometric field mapper.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void clearOutLocal(const bool isMeshUpdate=false)
Clear local-only storage (geometry, addressing etc)
constexpr char nl
The newline '\n' character (0x0a)
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface...
Ostream & endl(Ostream &os)
Add newline and flush stream.
A traits class, which is primarily used for primitives and vector-space.
Abstract base class for meshes which provide LDU addressing for the construction of lduMatrix and LDU...
virtual bool movePoints()
Do what is necessary if the mesh has moved.
void storeOldVol(const scalarField &)
Preserve old volume(s)
virtual const meshState & data() const noexcept
Const reference to the mesh and solver state data.
const dimensionSet dimVol(dimVolume)
Older spelling for dimVolume.
const fvSolution & solution() const
Read-access to the fvSolution controls.
A simple container for options an IOstream can normally have.
Cell to surface interpolation scheme. Included in fvMesh.
Ignore writing from objectRegistry::writeObject()
SolverPerformance< Type > solveSegregatedOrCoupled(const dictionary &)
Solve segregated or coupled returning the solution statistics.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
void MapGeometricFields(const MeshMapper &mapper)
Generic Geometric field mapper.
#define forAll(list, i)
Loop across all elements in list.
void clearGeomNotOldVol()
Clear geometry but not the old-time cell volumes.
virtual ~fvMesh()
Destructor.
const dimensionSet dimVolume(pow3(dimLength))
vectorField pointField
pointField is a vectorField.
virtual void updateMesh(const mapPolyMesh &mpm)
Update mesh corresponding to the given map.
virtual void updateGeom()
Update all geometric data.
virtual readUpdateState readUpdate()
Update the mesh based on the mesh files saved in time.
const labelList & cellMap() const noexcept
Old cell map.
virtual void updateMesh(const mapPolyMesh &mpm)
Update the mesh corresponding to given map.
void clearOut()
Clear all geometry and addressing unnecessary for CFD.
virtual void updateMesh(const mapPolyMesh &mpm)
Update mesh for topology changes.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
bool operator!=(const fvMesh &rhs) const
Compares addresses.
#define DebugInFunction
Report an information message using Foam::Info.
virtual const lduAddressing & lduAddr() const
Return ldu addressing.
const labelList & reverseCellMap() const noexcept
Reverse cell map.
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
void clearGeom()
Clear local geometry.
void reset(const meshState &ms)
Reset the dictionary.
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
virtual SolverPerformance< scalar > solve(fvMatrix< scalar > &, const dictionary &) const
Solve returning the solution statistics given convergence tolerance. Use the given solver controls...
errorManip< error > abort(error &err)
fvMesh(const fvMesh &)=delete
No copy construct.
virtual bool write(const bool writeOnProc=true) const
Write mesh using IO settings from time.
#define DebugInfo
Report an information message using Foam::Info.
void removeBoundary()
Remove boundary patches.
bool operator==(const fvMesh &rhs) const
Compares addresses.
int debug
Static debugging option.
defineTypeNameAndDebug(combustionModel, 0)
void addFvPatches(polyPatchList &plist, const bool validBoundary=true)
Add boundary patches. Constructor helper.
label nOldCells() const noexcept
Number of old cells.
Generic Geometric field mapper. For "real" mapping, add template specialisations for mapping of inter...
surfaceScalarField * magSfPtr_
Mag face area vectors.
Template functions to aid in the implementation of demand driven data.
const fvSchemes * hasSchemes() const
Non-null if fvSchemes exists (can test as bool).
const scalarField & oldCellVolumes() const
virtual lduInterfacePtrsList interfaces() const
Return a list of pointers for each patch.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Selector class for finite volume solution solution. fvMesh is derived from fvSolution so that all fie...
void clearOut()
Clear all geometry and addressing.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Selector class for finite volume differencing schemes. fvMesh is derived from fvSchemes so that all f...
Mesh data needed to do the Finite Volume discretisation.
const fvSolution * hasSolution() const
Non-null if fvSolution exists (can test as bool).
virtual bool init(const bool doInit)
Initialise all non-demand-driven data.
Automatically write from objectRegistry::writeObject()
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
slicedSurfaceVectorField * SfPtr_
Face area vectors.
void updateGeomNotOldVol()
Clear geometry like clearGeomNotOldVol but recreate any.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Reading is optional [identical to READ_IF_PRESENT].
label nOldFaces() const noexcept
Number of old faces.
virtual void updateGeom()
Update all geometric data. This gets redirected up from primitiveMesh level.
The class contains the addressing required by the lduMatrix: upper, lower and losort.
SlicedDimensionedField< scalar, volMesh > * VPtr_
Cell volumes.
Mesh consisting of general polyhedral cells.
const labelList & faceMap() const noexcept
Old face map.
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars, i.e. SphericalTensor<scalar>.
readUpdateState
Enumeration defining the state of the mesh after a read update.
List< label > labelList
A List of labels.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
virtual readUpdateState readUpdate()
Update the mesh based on the mesh files saved in.
Registry of regIOobjects.
bool returnReduceOr(const bool value, const label comm=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
void deleteDemandDrivenData(DataPtr &dataPtr)
Defines the attributes of an object for which implicit objectRegistry management is supported...
slicedSurfaceVectorField * CfPtr_
Face centres.
Do not request registration (bool: false)
virtual void mapFields(const mapPolyMesh &mpm)
Map all fields in time using given map.
#define InfoInFunction
Report an information message using Foam::Info.
virtual bool writeObject(IOstreamOption streamOpt, const bool writeOnProc=true) const
Write items held in the objectRegistry. Normally includes mesh components (points, faces, etc) and any registered fields.