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);
160 lduPtr_.reset(
nullptr);
169 <<
" Storing old time volumes since from time " << curTimeIndex_
170 <<
" and time now " << time().timeIndex()
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()
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),
385 fvSchemes(static_cast<const objectRegistry&>(*this)),
386 surfaceInterpolation(*this),
387 fvSolution(static_cast<const objectRegistry&>(*this)),
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);
654 const List<polyPatch*>&
p,
655 const bool 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);
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();
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();
1054 const bool writeOnProc
1060 ok = phiPtr_->write(writeOnProc);
1082typename Foam::pTraits<Foam::sphericalTensor>::labelType
1083Foam::fvMesh::validComponents<Foam::sphericalTensor>()
const
1093 return &
rhs !=
this;
1099 return &
rhs ==
this;
static const Foam::dimensionedScalar C("", Foam::dimTemperature, 234.5)
auto size() const noexcept
label size() const noexcept
@ NO_REGISTER
Do not request registration (bool: false).
readOption readOpt() const noexcept
Get the read option.
@ NO_READ
Nothing to be read.
@ LAZY_READ
Reading is optional [identical to READ_IF_PRESENT].
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
@ AUTO_WRITE
Automatically write from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
bool typeHeaderOk(const bool checkType=true, const bool search=true, const bool verbose=true)
Read header (respects is_globalIOobject trait) and check its info. A void type suppresses trait and t...
void resetHeader(const word &newName=word::null)
Clear various bits (headerClassName, note, sizeof...) that would be obtained when reading from a file...
fileName objectRelPath() const
The object path relative to the case.
A simple container for options an IOstream can normally have.
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.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A special matrix type and solver, designed for finite volume solutions of scalar equations....
SolverPerformance< Type > solveSegregatedOrCoupled(const dictionary &)
Solve segregated or coupled returning the solution statistics.
Class holds all the necessary information for mapping fields associated with fvMesh.
Mesh data needed to do the Finite Volume discretisation.
std::unique_ptr< slicedSurfaceVectorField > SfPtr_
Face area vectors.
virtual bool movePoints()
Avoid masking surfaceInterpolation method.
pTraits< Type >::labelType validComponents() const
Return a labelType of valid component indicators.
virtual bool writeObject(IOstreamOption streamOpt, const bool writeOnProc) const
Write the underlying polyMesh and other data.
const DimensionedField< scalar, volMesh > & V() const
Return cell volumes.
std::unique_ptr< surfaceScalarField > magSfPtr_
Mag face area vectors.
virtual SolverPerformance< scalar > solve(fvMatrix< scalar > &, const dictionary &) const
Solve returning the solution statistics given convergence tolerance. Use the given solver controls.
virtual lduInterfacePtrsList interfaces() const
Return a list of pointers for each patch.
const DimensionedField< scalar, volMesh > & V00() const
Return old-old-time cell volumes.
void addFvPatches(polyPatchList &plist, const bool validBoundary=true)
Add boundary patches. Constructor helper.
const Time & time() const
Return the top-level database.
virtual const lduAddressing & lduAddr() const
Return ldu addressing.
std::unique_ptr< fvMeshLduAddressing > lduPtr_
std::unique_ptr< DimensionedField< scalar, volMesh > > V00Ptr_
Cell volumes old-old time level.
void clearMeshPhi()
Clear cell face motion fluxes.
const fvSchemes & schemes() const
Read-access to the fvSchemes controls.
std::unique_ptr< DimensionedField< scalar, volMesh > > V0Ptr_
Cell volumes old time level.
virtual bool init(const bool doInit)
Initialise all non-demand-driven data.
fvBoundaryMesh boundary_
Boundary mesh.
const fvSolution * hasSolution() const
Non-null if fvSolution exists (can test as bool).
void clearGeom()
Clear local geometry.
void clearOutLocal(const bool isMeshUpdate=false)
Clear local-only storage (geometry, addressing etc).
fvMesh(const fvMesh &)=delete
No copy construct.
virtual ~fvMesh()
Destructor.
void updateGeomNotOldVol()
Clear geometry like clearGeomNotOldVol but recreate any.
void clearGeomNotOldVol()
Clear geometry but not the old-time cell volumes.
const fvSolution & solution() const
Read-access to the fvSolution controls.
void storeOldVol(const scalarField &)
Preserve old volume(s).
const surfaceVectorField & Cf() const
Return face centres as surfaceVectorField.
void clearAddressing(const bool isMeshUpdate=false)
Clear local addressing.
bool operator!=(const fvMesh &rhs) const
Compares addresses.
const DimensionedField< scalar, volMesh > & V0() const
Return old-time cell volumes.
virtual void updateMesh(const mapPolyMesh &mpm)
Update mesh corresponding to the given map.
virtual readUpdateState readUpdate()
Update the mesh based on the mesh files saved in time.
const surfaceVectorField & Sf() const
Return cell face area vectors.
std::unique_ptr< slicedVolVectorField > CPtr_
Cell centres.
const surfaceScalarField & magSf() const
Return cell face area magnitudes.
bool operator==(const fvMesh &rhs) const
Compares addresses.
virtual bool write(const bool writeOnProc=true) const
Write mesh using IO settings from time.
void removeFvBoundary()
Remove boundary patches. Warning: fvPatchFields hold ref to these fvPatches.
virtual void mapFields(const mapPolyMesh &mpm)
Map all fields in time using given map.
std::unique_ptr< slicedSurfaceVectorField > CfPtr_
Face centres.
label curTimeIndex_
Current time index for cell volumes.
const fvSchemes * hasSchemes() const
Non-null if fvSchemes exists (can test as bool).
void clearOut(const bool isMeshUpdate=false)
Clear all geometry and addressing.
std::unique_ptr< surfaceScalarField > phiPtr_
Face motion fluxes.
virtual void updateGeom()
Update all geometric data. This gets redirected up from primitiveMesh level.
std::unique_ptr< SlicedDimensionedField< scalar, volMesh > > VPtr_
Cell volumes.
Selector class for finite volume differencing schemes. fvMesh is derived from fvSchemes so that all f...
fvSchemes(const fvSchemes &)=delete
No copy construct.
Selector class for finite volume solution solution. fvMesh is derived from fvSolution so that all fie...
fvSolution(const fvSolution &)=delete
No copy construct.
An abstract base class with a fat-interface to all derived classes covering all possible ways in whic...
The class contains the addressing required by the lduMatrix: upper, lower and losort.
Abstract base class for meshes which provide LDU addressing for the construction of lduMatrix and LDU...
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const labelList & reverseCellMap() const noexcept
Reverse cell map.
label nOldCells() const noexcept
Number of old cells.
const labelList & faceMap() const noexcept
Old face map.
label nOldFaces() const noexcept
Number of old faces.
const labelList & cellMap() const noexcept
Old cell map.
const scalarField & oldCellVolumes() const
static void clearUpto(objectRegistry &obr)
Clear all meshObject derived from FromType up to (but not including) ToType.
static void clear(objectRegistry &obr)
Clear/remove all meshObject of MeshObjectType via objectRegistry::checkOut().
static void updateMesh(objectRegistry &obr, const mapPolyMesh &mpm)
Update topology using the given map.
static void movePoints(objectRegistry &obr)
Update for mesh motion.
void reset(const meshState &ms)
Reset the dictionary.
Registry of regIOobjects.
A traits class, which is primarily used for primitives and vector-space.
Mesh consisting of general polyhedral cells.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
void addPatches(polyPatchList &plist, const bool validBoundary=true)
Add boundary patches.
virtual bool writeObject(IOstreamOption streamOpt, const bool writeOnProc=true) const
Write items held in the objectRegistry. Normally includes mesh components (points,...
virtual const faceList & faces() const
Return raw faces.
bool moving() const noexcept
Is mesh moving.
virtual bool init(const bool doInit)
Initialise all non-demand-driven data.
readUpdateState
Enumeration defining the state of the mesh after a read update.
virtual const meshState & data() const noexcept
Const reference to the mesh and solver state data.
virtual void updateMesh(const mapPolyMesh &mpm)
Update the mesh corresponding to given map.
virtual readUpdateState readUpdate()
Update the mesh based on the mesh files saved in.
virtual void movePoints(const pointField &)
Move points.
virtual const pointField & points() const
Return raw points.
void removeBoundary()
Remove boundary patches.
label nCells() const noexcept
Number of mesh cells.
void clearAddressing()
Clear topological data.
label nFaces() const noexcept
Number of mesh faces.
const cellList & cells() const
void clearOut()
Clear all geometry and addressing unnecessary for CFD.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
Cell to surface interpolation scheme. Included in fvMesh.
virtual const fvGeometryScheme & geometry() const
Return reference to geometry calculation scheme.
virtual void updateMesh(const mapPolyMesh &mpm)
Update mesh for topology changes.
surfaceInterpolation(const fvMesh &)
Construct given an fvMesh.
void clearOut()
Clear all geometry and addressing.
virtual void updateGeom()
Update all geometric data.
Mesh data needed to do the Finite Volume discretisation.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Generic Geometric field mapper. For "real" mapping, add template specialisations for mapping of inter...
#define DebugInfo
Report an information message using Foam::Info.
#define DebugInFunction
Report an information message using Foam::Info.
#define InfoInFunction
Report an information message using Foam::Info.
const expr V(m.psi().mesh().V())
Namespace for handling debugging switches.
PtrList< polyPatch > polyPatchList
Store lists of polyPatch as a PtrList.
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
void mapClouds(const objectRegistry &db, const mapPolyMesh &mapper)
Generic Geometric field mapper.
List< label > labelList
A List of labels.
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
UPtrList< const lduInterface > lduInterfacePtrsList
Store lists of lduInterface as a UPtrList.
List< face > faceList
List of faces.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
List< cell > cellList
List of cell.
errorManip< error > abort(error &err)
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
void MapGeometricFields(const MeshMapper &mapper)
Generic Geometric field mapper.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
const dimensionSet dimVolume(pow3(dimLength))
vectorField pointField
pointField is a vectorField.
void MapDimensionedFields(const MeshMapper &mapper)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
errorManipArg< error, int > exit(error &err, const int errNo=1)
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars, i.e. SphericalTensor<scalar>.
const dimensionSet dimVol(dimVolume)
Older spelling for dimVolume.
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.