79 const bool haveV = (VPtr_ !=
nullptr);
80 const bool haveSf = (SfPtr_ !=
nullptr);
81 const bool haveMagSf = (magSfPtr_ !=
nullptr);
82 const bool haveCP = (CPtr_ !=
nullptr);
83 const bool haveCf = (CfPtr_ !=
nullptr);
117 clearGeomNotOldVol();
119 V0Ptr_.reset(
nullptr);
120 V00Ptr_.reset(
nullptr);
156 meshObject::clear<fvMesh, TopologicalMeshObject>(*this);
157 meshObject::clear<lduMesh, TopologicalMeshObject>(*this);
160 lduPtr_.reset(
nullptr);
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_ = std::make_unique<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);
298 rio.resetHeader(
"V0");
302 <<
"Detected V0: " << rio.objectRelPath() <<
nl;
304 V0Ptr_ = std::make_unique<DimensionedField<scalar, volMesh>>
320 rio.resetHeader(
"meshPhi");
324 <<
"Detected meshPhi: " << rio.objectRelPath() <<
nl;
327 phiPtr_.reset(
nullptr);
329 phiPtr_ = std::make_unique<surfaceScalarField>
345 V0Ptr_ = std::make_unique<DimensionedField<scalar, volMesh>>
382 std::move(allNeighbour),
466 std::move(allNeighbour),
473 static_cast<const
dictionary*>(baseMesh.hasSchemes())
480 static_cast<const
dictionary*>(baseMesh.hasSolution())
514 static_cast<const
dictionary*>(baseMesh.hasSchemes())
521 static_cast<const
dictionary*>(baseMesh.hasSolution())
545 return static_cast<const fvSchemes*
>(
this);
557 return static_cast<const fvSchemes&
>(*this);
637 const bool validBoundary
643 <<
" boundary already exists" 647 addPatches(plist, validBoundary);
655 const bool validBoundary
661 addFvPatches(plist, validBoundary);
719 <<
"Calculating fvMeshLduAddressing from nFaces:" 722 lduPtr_ = std::make_unique<fvMeshLduAddressing>(*this);
741 <<
" nCells:" << nCells()
743 <<
" nFaces:" << nFaces()
754 <<
"mapPolyMesh does not correspond to the old mesh." 755 <<
" nCells:" << nCells()
758 <<
" nFaces:" << nFaces()
765 const fvMeshMapper mapper(*
this, meshMap);
768 MapGeometricFields<scalar, fvPatchField, fvMeshMapper, volMesh>
770 MapGeometricFields<vector, fvPatchField, fvMeshMapper, volMesh>
772 MapGeometricFields<sphericalTensor, fvPatchField, fvMeshMapper, volMesh>
774 MapGeometricFields<symmTensor, fvPatchField, fvMeshMapper, volMesh>
776 MapGeometricFields<tensor, fvPatchField, fvMeshMapper, volMesh>
780 MapGeometricFields<scalar, fvsPatchField, fvMeshMapper, surfaceMesh>
782 MapGeometricFields<vector, fvsPatchField, fvMeshMapper, surfaceMesh>
789 MapGeometricFields<symmTensor, fvsPatchField, fvMeshMapper, surfaceMesh>
791 MapGeometricFields<tensor, fvsPatchField, fvMeshMapper, surfaceMesh>
795 MapDimensionedFields<scalar, fvMeshMapper, volMesh>(mapper);
796 MapDimensionedFields<vector, fvMeshMapper, volMesh>(mapper);
797 MapDimensionedFields<sphericalTensor, fvMeshMapper, volMesh>(mapper);
798 MapDimensionedFields<symmTensor, fvMeshMapper, volMesh>(mapper);
799 MapDimensionedFields<tensor, fvMeshMapper, volMesh>(mapper);
813 V0.resize_nocopy(nCells());
819 V0[i] = savedV0[cellMap[i]];
835 label celli = -index-2;
837 V0[celli] += savedV0[oldCelli];
844 <<
"Mapping old time volume V0. Merged " 845 << nMerged <<
" out of " << nCells() <<
" cells" <<
endl;
855 V00.resize_nocopy(nCells());
861 V00[i] = savedV00[cellMap[i]];
877 label celli = -index-2;
879 V00[celli] += savedV00[oldCelli];
885 <<
"Mapping old time volume V00. Merged " 886 << nMerged <<
" out of " << nCells() <<
" cells" <<
endl;
911 phiPtr_ = std::make_unique<surfaceScalarField>
929 if (phiPtr_->timeIndex() != time().timeIndex())
944 updateGeomNotOldVol();
947 boundary_.movePoints();
952 meshObject::movePoints<fvMesh>(*this);
953 meshObject::movePoints<lduMesh>(*this);
975 lduPtr_.reset(
nullptr);
984 if (VPtr_ && (VPtr_->size() != mpm.
nOldCells()))
987 <<
"V:" << VPtr_->size()
988 <<
" not equal to the number of old cells " 992 if (V0Ptr_ && (V0Ptr_->size() != mpm.
nOldCells()))
995 <<
"V0:" << V0Ptr_->size()
996 <<
" not equal to the number of old cells " 1000 if (V00Ptr_ && (V00Ptr_->size() != mpm.
nOldCells()))
1003 <<
"V0:" << V00Ptr_->size()
1004 <<
" not equal to the number of old cells " 1015 phiPtr_.reset(
nullptr);
1018 phiPtr_ = std::make_unique<surfaceScalarField>
1035 clearGeomNotOldVol();
1044 clearAddressing(
true);
1046 meshObject::updateMesh<fvMesh>(*
this, mpm);
1047 meshObject::updateMesh<lduMesh>(*
this, mpm);
1054 const bool writeOnProc
1060 ok = phiPtr_->write(writeOnProc);
1068 ok = V0Ptr_->write(writeOnProc);
1083 Foam::fvMesh::validComponents<Foam::sphericalTensor>()
const 1093 return &rhs !=
this;
1099 return &rhs ==
this;
void size(const label n)
Older name for setAddressableSize.
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.
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)
std::unique_ptr< slicedVolVectorField > CPtr_
Cell centres.
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.
std::unique_ptr< slicedSurfaceVectorField > CfPtr_
Face centres.
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...
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
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.
std::unique_ptr< slicedSurfaceVectorField > SfPtr_
Face area vectors.
defineTypeNameAndDebug(combustionModel, 0)
void addFvPatches(polyPatchList &plist, const bool validBoundary=true)
Add boundary patches. Constructor helper.
label nOldCells() const noexcept
Number of old cells.
std::unique_ptr< SlicedDimensionedField< scalar, volMesh > > VPtr_
Cell volumes.
Generic Geometric field mapper. For "real" mapping, add template specialisations for mapping of inter...
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)
static void clearUpto(objectRegistry &obr)
Clear all meshObject derived from FromType up to (but not including) ToType.
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.
std::unique_ptr< surfaceScalarField > magSfPtr_
Mag face area vectors.
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.
Defines the attributes of an object for which implicit objectRegistry management is supported...
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.