Merge branch 'feature-fa-various' into 'develop'

Misc. changes in the finite-area module

See merge request Development/openfoam!661
This commit is contained in:
Andrew Heather
2024-03-05 18:14:12 +00:00
113 changed files with 1152 additions and 1445 deletions

View File

@ -272,10 +272,7 @@ while (pimple.correct())
).ptr() ).ptr()
); );
deleteDemandDrivenData pEqnComps[phasei].faceFluxCorrectionPtr(nullptr);
(
pEqnComps[phasei].faceFluxCorrectionPtr()
);
pEqnComps[phasei].relax(); pEqnComps[phasei].relax();
} }

View File

@ -50,6 +50,7 @@ License
#include "demandDrivenData.H" #include "demandDrivenData.H"
#include "unitConversion.H" #include "unitConversion.H"
#include "foamVtkIndPatchWriter.H" #include "foamVtkIndPatchWriter.H"
#include "calculatedFaPatchFields.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

View File

@ -69,22 +69,13 @@ public:
// Member Functions // Member Functions
//- Return size. Number of faces //- Return size. Number of faces
static label size(const Mesh& mesh) static label size(const Mesh& mesh) { return mesh.nFaces(); }
{
return mesh.nFaces();
}
//- Return size. Number of faces //- Return size. Number of faces
label size() const label size() const { return size(mesh_); }
{
return size(mesh_);
}
//- Field of face centres //- Field of face centres
const areaVectorField& C() const const areaVectorField& C() const { return mesh_.areaCentres(); }
{
return mesh_.areaCentres();
}
}; };

View File

@ -84,10 +84,10 @@ void Foam::faMeshDistributor::createInternalEdgeMap() const
const auto& faEdgeMap = distMap_.faceMap(); const auto& faEdgeMap = distMap_.faceMap();
// Copy full map // Copy full map
internalEdgeMap_.reset(new mapDistributeBase(faEdgeMap)); internalEdgeMapPtr_ = std::make_unique<mapDistributeBase>(faEdgeMap);
// Retain internal edges // Retain internal edges
internalEdgeMap_->compactRemoteData internalEdgeMapPtr_->compactRemoteData
( (
bitSet(tgtMesh_.nInternalEdges(), true), bitSet(tgtMesh_.nInternalEdges(), true),
UPstream::msgType(), UPstream::msgType(),
@ -200,8 +200,6 @@ Foam::faMeshDistributor::faMeshDistributor
srcMesh_(srcMesh), srcMesh_(srcMesh),
tgtMesh_(tgtMesh), tgtMesh_(tgtMesh),
distMap_(distMap), distMap_(distMap),
internalEdgeMap_(),
patchEdgeMaps_(),
dummyHandler_(fileOperation::null()), dummyHandler_(fileOperation::null()),
writeHandler_(dummyHandler_), writeHandler_(dummyHandler_),
isWriteProc_(isWriteProc) isWriteProc_(isWriteProc)
@ -221,8 +219,6 @@ Foam::faMeshDistributor::faMeshDistributor
srcMesh_(srcMesh), srcMesh_(srcMesh),
tgtMesh_(tgtMesh), tgtMesh_(tgtMesh),
distMap_(distMap), distMap_(distMap),
internalEdgeMap_(),
patchEdgeMaps_(),
dummyHandler_(nullptr), dummyHandler_(nullptr),
writeHandler_(writeHandler), writeHandler_(writeHandler),
isWriteProc_(Switch::INVALID) isWriteProc_(Switch::INVALID)

View File

@ -73,7 +73,7 @@ class faMeshDistributor
const mapDistributePolyMesh& distMap_; const mapDistributePolyMesh& distMap_;
//- Internal edge mapper //- Internal edge mapper
mutable std::unique_ptr<mapDistributeBase> internalEdgeMap_; mutable std::unique_ptr<mapDistributeBase> internalEdgeMapPtr_;
//- Patch edge mappers //- Patch edge mappers
mutable PtrList<mapDistributeBase> patchEdgeMaps_; mutable PtrList<mapDistributeBase> patchEdgeMaps_;
@ -99,6 +99,7 @@ class faMeshDistributor
//- Debug: check addressing //- Debug: check addressing
void checkAddressing() const; void checkAddressing() const;
//- Construct reconstruct mapping
static mapDistributePolyMesh createReconstructMap static mapDistributePolyMesh createReconstructMap
( (
const faMesh& mesh, const faMesh& mesh,

View File

@ -154,7 +154,7 @@ Foam::faMeshDistributor::distributeField
const GeometricField<Type, faePatchField, edgeMesh>& fld const GeometricField<Type, faePatchField, edgeMesh>& fld
) const ) const
{ {
if (!internalEdgeMap_) if (!internalEdgeMapPtr_)
{ {
createInternalEdgeMap(); createInternalEdgeMap();
} }
@ -165,7 +165,7 @@ Foam::faMeshDistributor::distributeField
const distributedFieldMapper mapper const distributedFieldMapper mapper
( (
labelUList::null(), labelUList::null(),
*(internalEdgeMap_) *(internalEdgeMapPtr_)
); );
DimensionedField<Type, edgeMesh> internalField DimensionedField<Type, edgeMesh> internalField

View File

@ -65,25 +65,17 @@ public:
GeoMesh<faMesh>(mesh) GeoMesh<faMesh>(mesh)
{} {}
// Member Functions // Member Functions
//- Return size. Number of internal edges //- Return size. Number of internal edges
static label size(const Mesh& mesh) static label size(const Mesh& mesh) { return mesh.nInternalEdges(); }
{
return mesh.nInternalEdges();
}
//- Return size. Number of internal edges //- Return size. Number of internal edges
label size() const label size() const { return size(mesh_); }
{
return size(mesh_);
}
//- Field of edge centres //- Field of edge centres
const edgeVectorField& C() const const edgeVectorField& C() const { return mesh_.edgeCentres(); }
{
return mesh_.edgeCentres();
}
}; };

View File

@ -28,12 +28,9 @@ License
#include "areaFields.H" #include "areaFields.H"
#include "edgeFields.H" #include "edgeFields.H"
#include "calculatedFaPatchFields.H"
#include "extrapolatedCalculatedFaPatchFields.H" #include "extrapolatedCalculatedFaPatchFields.H"
#include "zeroGradientFaPatchFields.H"
#include "IndirectList.H" #include "IndirectList.H"
#include "UniformList.H" #include "UniformList.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -50,7 +47,7 @@ void Foam::faMatrix<Type>::addToInternalField
{ {
FatalErrorInFunction FatalErrorInFunction
<< "addressing (" << addr.size() << "addressing (" << addr.size()
<< ") and field (" << pf.size() << ") are different sizes" << endl << ") and field (" << pf.size() << ") are different sizes"
<< abort(FatalError); << abort(FatalError);
} }
@ -88,7 +85,7 @@ void Foam::faMatrix<Type>::subtractFromInternalField
{ {
FatalErrorInFunction FatalErrorInFunction
<< "addressing (" << addr.size() << "addressing (" << addr.size()
<< ") and field (" << pf.size() << ") are different sizes" << endl << ") and field (" << pf.size() << ") are different sizes"
<< abort(FatalError); << abort(FatalError);
} }
@ -193,8 +190,7 @@ Foam::faMatrix<Type>::faMatrix
dimensions_(ds), dimensions_(ds),
source_(psi.size(), Zero), source_(psi.size(), Zero),
internalCoeffs_(psi.mesh().boundary().size()), internalCoeffs_(psi.mesh().boundary().size()),
boundaryCoeffs_(psi.mesh().boundary().size()), boundaryCoeffs_(psi.mesh().boundary().size())
faceFluxCorrectionPtr_(nullptr)
{ {
DebugInFunction DebugInFunction
<< "constructing faMatrix<Type> for field " << psi_.name() << "constructing faMatrix<Type> for field " << psi_.name()
@ -234,19 +230,17 @@ Foam::faMatrix<Type>::faMatrix(const faMatrix<Type>& fam)
dimensions_(fam.dimensions_), dimensions_(fam.dimensions_),
source_(fam.source_), source_(fam.source_),
internalCoeffs_(fam.internalCoeffs_), internalCoeffs_(fam.internalCoeffs_),
boundaryCoeffs_(fam.boundaryCoeffs_), boundaryCoeffs_(fam.boundaryCoeffs_)
faceFluxCorrectionPtr_(nullptr)
{ {
DebugInFunction DebugInFunction
<< "Copying faMatrix<Type> for field " << psi_.name() << endl; << "Copying faMatrix<Type> for field " << psi_.name() << endl;
if (fam.faceFluxCorrectionPtr_) if (fam.faceFluxCorrectionPtr_)
{ {
faceFluxCorrectionPtr_ = faceFluxCorrectionPtr_ = std::make_unique<faceFluxFieldType>
new GeometricField<Type, faePatchField, edgeMesh> (
( *(fam.faceFluxCorrectionPtr_)
*(fam.faceFluxCorrectionPtr_) );
);
} }
} }
@ -259,8 +253,7 @@ Foam::faMatrix<Type>::faMatrix(const tmp<faMatrix<Type>>& tmat)
dimensions_(tmat().dimensions_), dimensions_(tmat().dimensions_),
source_(tmat.constCast().source_, tmat.movable()), source_(tmat.constCast().source_, tmat.movable()),
internalCoeffs_(tmat.constCast().internalCoeffs_, tmat.movable()), internalCoeffs_(tmat.constCast().internalCoeffs_, tmat.movable()),
boundaryCoeffs_(tmat.constCast().boundaryCoeffs_, tmat.movable()), boundaryCoeffs_(tmat.constCast().boundaryCoeffs_, tmat.movable())
faceFluxCorrectionPtr_(nullptr)
{ {
DebugInFunction DebugInFunction
<< "Copy/Move faMatrix<Type> for field " << psi_.name() << endl; << "Copy/Move faMatrix<Type> for field " << psi_.name() << endl;
@ -268,17 +261,16 @@ Foam::faMatrix<Type>::faMatrix(const tmp<faMatrix<Type>>& tmat)
if (tmat().faceFluxCorrectionPtr_) if (tmat().faceFluxCorrectionPtr_)
{ {
if (tmat.movable()) if (tmat.movable())
{
faceFluxCorrectionPtr_ = tmat().faceFluxCorrectionPtr_;
tmat().faceFluxCorrectionPtr_ = nullptr;
}
else
{ {
faceFluxCorrectionPtr_ = faceFluxCorrectionPtr_ =
new GeometricField<Type, faePatchField, edgeMesh> std::move(tmat.constCast().faceFluxCorrectionPtr_);
( }
*(tmat().faceFluxCorrectionPtr_) else if (tmat().faceFluxCorrectionPtr_)
); {
faceFluxCorrectionPtr_ = std::make_unique<faceFluxFieldType>
(
*(tmat().faceFluxCorrectionPtr_)
);
} }
} }
@ -293,8 +285,6 @@ Foam::faMatrix<Type>::~faMatrix()
{ {
DebugInFunction DebugInFunction
<< "Destroying faMatrix<Type> for field " << psi_.name() << endl; << "Destroying faMatrix<Type> for field " << psi_.name() << endl;
deleteDemandDrivenData(faceFluxCorrectionPtr_);
} }
@ -791,9 +781,10 @@ void Foam::faMatrix<Type>::operator=(const faMatrix<Type>& famv)
} }
else if (famv.faceFluxCorrectionPtr_) else if (famv.faceFluxCorrectionPtr_)
{ {
faceFluxCorrectionPtr_ = faceFluxCorrectionPtr_ = std::make_unique<faceFluxFieldType>
new GeometricField<Type, faePatchField, edgeMesh> (
(*famv.faceFluxCorrectionPtr_); *famv.faceFluxCorrectionPtr_
);
} }
} }
@ -838,8 +829,7 @@ void Foam::faMatrix<Type>::operator+=(const faMatrix<Type>& famv)
} }
else if (famv.faceFluxCorrectionPtr_) else if (famv.faceFluxCorrectionPtr_)
{ {
faceFluxCorrectionPtr_ = new faceFluxCorrectionPtr_ = std::make_unique<faceFluxFieldType>
GeometricField<Type, faePatchField, edgeMesh>
( (
*famv.faceFluxCorrectionPtr_ *famv.faceFluxCorrectionPtr_
); );
@ -872,9 +862,10 @@ void Foam::faMatrix<Type>::operator-=(const faMatrix<Type>& famv)
} }
else if (famv.faceFluxCorrectionPtr_) else if (famv.faceFluxCorrectionPtr_)
{ {
faceFluxCorrectionPtr_ = faceFluxCorrectionPtr_ = std::make_unique<faceFluxFieldType>
new GeometricField<Type, faePatchField, edgeMesh> (
(-*famv.faceFluxCorrectionPtr_); -*famv.faceFluxCorrectionPtr_
);
} }
} }

View File

@ -46,10 +46,6 @@ Author
#include "areaFields.H" #include "areaFields.H"
#include "edgeFields.H" #include "edgeFields.H"
#include "lduMatrix.H" #include "lduMatrix.H"
#include "tmp.H"
#include "autoPtr.H"
#include "dimensionedTypes.H"
#include "className.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -155,7 +151,7 @@ private:
FieldField<Field, Type> boundaryCoeffs_; FieldField<Field, Type> boundaryCoeffs_;
//- Face flux field for non-orthogonal correction //- Face flux field for non-orthogonal correction
mutable faceFluxFieldType* faceFluxCorrectionPtr_; mutable std::unique_ptr<faceFluxFieldType> faceFluxCorrectionPtr_;
protected: protected:
@ -357,8 +353,7 @@ public:
} }
//- Declare return type of the faceFluxCorrectionPtr() function //- Declare return type of the faceFluxCorrectionPtr() function
typedef GeometricField<Type, faePatchField, edgeMesh> typedef std::unique_ptr<faceFluxFieldType> faceFluxFieldPtrType;
*faceFluxFieldPtrType;
//- Return pointer to face-flux non-orthogonal correction field //- Return pointer to face-flux non-orthogonal correction field
faceFluxFieldPtrType& faceFluxCorrectionPtr() faceFluxFieldPtrType& faceFluxCorrectionPtr()
@ -366,6 +361,12 @@ public:
return faceFluxCorrectionPtr_; return faceFluxCorrectionPtr_;
} }
//- Set pointer to face-flux non-orthogonal correction field
void faceFluxCorrectionPtr(faceFluxFieldType* flux)
{
faceFluxCorrectionPtr_.reset(flux);
}
//- True if face-flux non-orthogonal correction field exists //- True if face-flux non-orthogonal correction field exists
bool hasFaceFluxCorrection() const noexcept bool hasFaceFluxCorrection() const noexcept
{ {

View File

@ -29,7 +29,6 @@ License
#include "faBoundaryMesh.H" #include "faBoundaryMesh.H"
#include "faMesh.H" #include "faMesh.H"
#include "globalIndex.H" #include "globalIndex.H"
#include "primitiveMesh.H"
#include "processorFaPatch.H" #include "processorFaPatch.H"
#include "wordRes.H" #include "wordRes.H"
#include "PtrListOps.H" #include "PtrListOps.H"

View File

@ -46,8 +46,6 @@ Author
#include "faPatch.H" #include "faPatch.H"
#include "labelPair.H" #include "labelPair.H"
#include "lduInterfacePtrsList.H" #include "lduInterfacePtrsList.H"
#include "wordList.H"
#include "pointField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -77,7 +77,13 @@ class faGlobalMeshData
labelList sharedPointAddr_; labelList sharedPointAddr_;
// Private Member Functions public:
//- Runtime type information
ClassName("faGlobalMeshData");
// Generated Methods
//- No copy construct //- No copy construct
faGlobalMeshData(const faGlobalMeshData&) = delete; faGlobalMeshData(const faGlobalMeshData&) = delete;
@ -86,12 +92,6 @@ class faGlobalMeshData
void operator=(const faGlobalMeshData&) = delete; void operator=(const faGlobalMeshData&) = delete;
public:
//- Runtime type information
ClassName("faGlobalMeshData");
// Constructors // Constructors
//- Construct from mesh //- Construct from mesh

View File

@ -169,14 +169,12 @@ void Foam::faMesh::checkBoundaryEdgeLabelRange
void Foam::faMesh::initPatch() const void Foam::faMesh::initPatch() const
{ {
patchPtr_.reset patchPtr_ = std::make_unique<uindirectPrimitivePatch>
( (
new uindirectPrimitivePatch UIndirectList<face>(mesh().faces(), faceLabels_),
( mesh().points()
UIndirectList<face>(mesh().faces(), faceLabels_),
mesh().points()
)
); );
// Could set some basic primitive data here... // Could set some basic primitive data here...
// nEdges_ = patchPtr_->nEdges(); // nEdges_ = patchPtr_->nEdges();
// nInternalEdges_ = patchPtr_->nInternalEdges(); // nInternalEdges_ = patchPtr_->nInternalEdges();
@ -253,17 +251,17 @@ void Foam::faMesh::clearGeomNotAreas() const
polyPatchFacesPtr_.reset(nullptr); polyPatchFacesPtr_.reset(nullptr);
polyPatchIdsPtr_.reset(nullptr); polyPatchIdsPtr_.reset(nullptr);
bndConnectPtr_.reset(nullptr); bndConnectPtr_.reset(nullptr);
deleteDemandDrivenData(SPtr_); SPtr_.reset(nullptr);
deleteDemandDrivenData(patchStartsPtr_); patchStartsPtr_.reset(nullptr);
deleteDemandDrivenData(LePtr_); LePtr_.reset(nullptr);
deleteDemandDrivenData(magLePtr_); magLePtr_.reset(nullptr);
deleteDemandDrivenData(faceCentresPtr_); faceCentresPtr_.reset(nullptr);
deleteDemandDrivenData(edgeCentresPtr_); edgeCentresPtr_.reset(nullptr);
deleteDemandDrivenData(faceAreaNormalsPtr_); faceAreaNormalsPtr_.reset(nullptr);
deleteDemandDrivenData(edgeAreaNormalsPtr_); edgeAreaNormalsPtr_.reset(nullptr);
pointAreaNormalsPtr_.reset(nullptr); pointAreaNormalsPtr_.reset(nullptr);
deleteDemandDrivenData(faceCurvaturesPtr_); faceCurvaturesPtr_.reset(nullptr);
deleteDemandDrivenData(edgeTransformTensorsPtr_); edgeTransformTensorsPtr_.reset(nullptr);
} }
@ -272,9 +270,9 @@ void Foam::faMesh::clearGeom() const
DebugInFunction << "Clearing geometry" << endl; DebugInFunction << "Clearing geometry" << endl;
clearGeomNotAreas(); clearGeomNotAreas();
deleteDemandDrivenData(S0Ptr_); S0Ptr_.reset(nullptr);
deleteDemandDrivenData(S00Ptr_); S00Ptr_.reset(nullptr);
deleteDemandDrivenData(correctPatchPointNormalsPtr_); correctPatchPointNormalsPtr_.reset(nullptr);
} }
@ -282,7 +280,7 @@ void Foam::faMesh::clearAddressing() const
{ {
DebugInFunction << "Clearing addressing" << endl; DebugInFunction << "Clearing addressing" << endl;
deleteDemandDrivenData(lduPtr_); lduPtr_.reset(nullptr);
} }
@ -402,33 +400,7 @@ Foam::faMesh::faMesh
*this *this
), ),
comm_(UPstream::worldComm), comm_(UPstream::worldComm),
curTimeIndex_(time().timeIndex()), curTimeIndex_(time().timeIndex())
patchPtr_(nullptr),
polyPatchFacesPtr_(nullptr),
polyPatchIdsPtr_(nullptr),
bndConnectPtr_(nullptr),
lduPtr_(nullptr),
SPtr_(nullptr),
S0Ptr_(nullptr),
S00Ptr_(nullptr),
patchStartsPtr_(nullptr),
LePtr_(nullptr),
magLePtr_(nullptr),
faceCentresPtr_(nullptr),
edgeCentresPtr_(nullptr),
faceAreaNormalsPtr_(nullptr),
edgeAreaNormalsPtr_(nullptr),
pointAreaNormalsPtr_(nullptr),
faceCurvaturesPtr_(nullptr),
edgeTransformTensorsPtr_(nullptr),
correctPatchPointNormalsPtr_(nullptr),
globalMeshDataPtr_(nullptr),
haloMapPtr_(nullptr),
haloFaceCentresPtr_(nullptr),
haloFaceNormalsPtr_(nullptr)
{ {
DebugInFunction << "Creating from IOobject" << endl; DebugInFunction << "Creating from IOobject" << endl;
@ -459,7 +431,7 @@ Foam::faMesh::faMesh
rio.resetHeader("S0"); rio.resetHeader("S0");
if (returnReduceOr(rio.typeHeaderOk<regIOobject>(false))) if (returnReduceOr(rio.typeHeaderOk<regIOobject>(false)))
{ {
S0Ptr_ = new DimensionedField<scalar, areaMesh> S0Ptr_ = std::make_unique<DimensionedField<scalar, areaMesh>>
( (
rio, rio,
*this, *this,
@ -524,33 +496,7 @@ Foam::faMesh::faMesh
label(0) label(0)
), ),
comm_(UPstream::worldComm), comm_(UPstream::worldComm),
curTimeIndex_(time().timeIndex()), curTimeIndex_(time().timeIndex())
patchPtr_(nullptr),
polyPatchFacesPtr_(nullptr),
polyPatchIdsPtr_(nullptr),
bndConnectPtr_(nullptr),
lduPtr_(nullptr),
SPtr_(nullptr),
S0Ptr_(nullptr),
S00Ptr_(nullptr),
patchStartsPtr_(nullptr),
LePtr_(nullptr),
magLePtr_(nullptr),
faceCentresPtr_(nullptr),
edgeCentresPtr_(nullptr),
faceAreaNormalsPtr_(nullptr),
edgeAreaNormalsPtr_(nullptr),
pointAreaNormalsPtr_(nullptr),
faceCurvaturesPtr_(nullptr),
edgeTransformTensorsPtr_(nullptr),
correctPatchPointNormalsPtr_(nullptr),
globalMeshDataPtr_(nullptr),
haloMapPtr_(nullptr),
haloFaceCentresPtr_(nullptr),
haloFaceNormalsPtr_(nullptr)
{ {
// Not yet much for primitive mesh data possible... // Not yet much for primitive mesh data possible...
nPoints_ = 0; nPoints_ = 0;
@ -609,33 +555,7 @@ Foam::faMesh::faMesh
label(0) label(0)
), ),
comm_(UPstream::worldComm), comm_(UPstream::worldComm),
curTimeIndex_(time().timeIndex()), curTimeIndex_(time().timeIndex())
patchPtr_(nullptr),
polyPatchFacesPtr_(nullptr),
polyPatchIdsPtr_(nullptr),
bndConnectPtr_(nullptr),
lduPtr_(nullptr),
SPtr_(nullptr),
S0Ptr_(nullptr),
S00Ptr_(nullptr),
patchStartsPtr_(nullptr),
LePtr_(nullptr),
magLePtr_(nullptr),
faceCentresPtr_(nullptr),
edgeCentresPtr_(nullptr),
faceAreaNormalsPtr_(nullptr),
edgeAreaNormalsPtr_(nullptr),
pointAreaNormalsPtr_(nullptr),
faceCurvaturesPtr_(nullptr),
edgeTransformTensorsPtr_(nullptr),
correctPatchPointNormalsPtr_(nullptr),
globalMeshDataPtr_(nullptr),
haloMapPtr_(nullptr),
haloFaceCentresPtr_(nullptr),
haloFaceNormalsPtr_(nullptr)
{ {
// Not yet much for primitive mesh data possible... // Not yet much for primitive mesh data possible...
nPoints_ = 0; nPoints_ = 0;
@ -732,7 +652,7 @@ Foam::faMesh::faMesh
rio.resetHeader("S0"); rio.resetHeader("S0");
if (returnReduceOr(rio.typeHeaderOk<regIOobject>(false))) if (returnReduceOr(rio.typeHeaderOk<regIOobject>(false)))
{ {
S0Ptr_ = new DimensionedField<scalar, areaMesh> S0Ptr_ = std::make_unique<DimensionedField<scalar, areaMesh>>
( (
rio, rio,
*this, *this,
@ -948,7 +868,7 @@ Foam::faMesh::S00() const
{ {
if (!S00Ptr_) if (!S00Ptr_)
{ {
S00Ptr_ = new DimensionedField<scalar, areaMesh> S00Ptr_ = std::make_unique<DimensionedField<scalar, areaMesh>>
( (
IOobject IOobject
( (
@ -994,7 +914,7 @@ const Foam::vectorField& Foam::faMesh::pointAreaNormals() const
{ {
if (!pointAreaNormalsPtr_) if (!pointAreaNormalsPtr_)
{ {
pointAreaNormalsPtr_.reset(new vectorField(nPoints())); pointAreaNormalsPtr_ = std::make_unique<vectorField>(nPoints());
calcPointAreaNormals(*pointAreaNormalsPtr_); calcPointAreaNormals(*pointAreaNormalsPtr_);
@ -1082,7 +1002,7 @@ bool Foam::faMesh::movePoints()
{ {
DebugInfo<< "Creating old cell volumes." << endl; DebugInfo<< "Creating old cell volumes." << endl;
S0Ptr_ = new DimensionedField<scalar, areaMesh> S0Ptr_ = std::make_unique<DimensionedField<scalar, areaMesh>>
( (
IOobject IOobject
( (
@ -1140,7 +1060,8 @@ Foam::boolList& Foam::faMesh::correctPatchPointNormals() const
{ {
if (!correctPatchPointNormalsPtr_) if (!correctPatchPointNormalsPtr_)
{ {
correctPatchPointNormalsPtr_ = new boolList(boundary().size(), false); correctPatchPointNormalsPtr_ =
std::make_unique<boolList>(boundary().size(), false);
} }
return *correctPatchPointNormalsPtr_; return *correctPatchPointNormalsPtr_;

View File

@ -261,52 +261,53 @@ class faMesh
mutable std::unique_ptr<List<labelPair>> bndConnectPtr_; mutable std::unique_ptr<List<labelPair>> bndConnectPtr_;
//- Ldu addressing data //- Ldu addressing data
mutable faMeshLduAddressing* lduPtr_; mutable std::unique_ptr<faMeshLduAddressing> lduPtr_;
// Geometric Data // Geometric Data
//- Face areas //- Face areas
mutable DimensionedField<scalar, areaMesh>* SPtr_; mutable std::unique_ptr<DimensionedField<scalar, areaMesh>> SPtr_;
//- Face areas old time level //- Face areas old time level
mutable DimensionedField<scalar, areaMesh>* S0Ptr_; mutable std::unique_ptr<DimensionedField<scalar, areaMesh>> S0Ptr_;
//- Face areas old-old time level //- Face areas old-old time level
mutable DimensionedField<scalar, areaMesh>* S00Ptr_; mutable std::unique_ptr<DimensionedField<scalar, areaMesh>> S00Ptr_;
//- Patch starts in the edge list //- Patch starts in the edge list
mutable labelList* patchStartsPtr_; mutable std::unique_ptr<labelList> patchStartsPtr_;
//- Edge length vectors //- Edge length vectors
mutable edgeVectorField* LePtr_; mutable std::unique_ptr<edgeVectorField> LePtr_;
//- Mag edge length vectors //- Mag edge length vectors
mutable edgeScalarField* magLePtr_; mutable std::unique_ptr<edgeScalarField> magLePtr_;
//- Face centres //- Face centres
mutable areaVectorField* faceCentresPtr_; mutable std::unique_ptr<areaVectorField> faceCentresPtr_;
//- Edge centres //- Edge centres
mutable edgeVectorField* edgeCentresPtr_; mutable std::unique_ptr<edgeVectorField> edgeCentresPtr_;
//- Face area normals //- Face area normals
mutable areaVectorField* faceAreaNormalsPtr_; mutable std::unique_ptr<areaVectorField> faceAreaNormalsPtr_;
//- Edge area normals //- Edge area normals
mutable edgeVectorField* edgeAreaNormalsPtr_; mutable std::unique_ptr<edgeVectorField> edgeAreaNormalsPtr_;
//- Point area normals //- Point area normals
mutable std::unique_ptr<vectorField> pointAreaNormalsPtr_; mutable std::unique_ptr<vectorField> pointAreaNormalsPtr_;
//- Face curvatures //- Face curvatures
mutable areaScalarField* faceCurvaturesPtr_; mutable std::unique_ptr<areaScalarField> faceCurvaturesPtr_;
//- Edge transformation tensors //- Edge transformation tensors
mutable FieldField<Field, tensor>* edgeTransformTensorsPtr_; mutable std::unique_ptr<FieldField<Field, tensor>>
edgeTransformTensorsPtr_;
//- Whether point normals must be corrected for a patch //- Whether point normals must be corrected for a patch
mutable boolList* correctPatchPointNormalsPtr_; mutable std::unique_ptr<boolList> correctPatchPointNormalsPtr_;
// Other mesh-related data // Other mesh-related data
@ -332,12 +333,6 @@ class faMesh
// Private Member Functions // Private Member Functions
//- No copy construct
faMesh(const faMesh&) = delete;
//- No copy assignment
void operator=(const faMesh&) = delete;
//- Set indirect patch, removing any old one. //- Set indirect patch, removing any old one.
// No communication // No communication
void initPatch() const; void initPatch() const;
@ -524,6 +519,15 @@ public:
static word meshSubDir; static word meshSubDir;
// Generated Methods
//- No copy construct
faMesh(const faMesh&) = delete;
//- No copy assignment
void operator=(const faMesh&) = delete;
// Constructors // Constructors
//- Read construct from polyMesh, using its IOobject properties //- Read construct from polyMesh, using its IOobject properties

View File

@ -222,7 +222,7 @@ void Foam::faMesh::calcLduAddressing() const
<< abort(FatalError); << abort(FatalError);
} }
lduPtr_ = new faMeshLduAddressing(*this); lduPtr_ = std::make_unique<faMeshLduAddressing>(*this);
} }
@ -238,7 +238,7 @@ void Foam::faMesh::calcPatchStarts() const
<< abort(FatalError); << abort(FatalError);
} }
patchStartsPtr_ = new labelList(boundary().patchStarts()); patchStartsPtr_ = std::make_unique<labelList>(boundary().patchStarts());
} }
@ -254,9 +254,9 @@ void Foam::faMesh::calcWhichPatchFaces() const
const polyBoundaryMesh& pbm = mesh().boundaryMesh(); const polyBoundaryMesh& pbm = mesh().boundaryMesh();
polyPatchFacesPtr_.reset polyPatchFacesPtr_ = std::make_unique<List<labelPair>>
( (
new List<labelPair>(pbm.whichPatchFace(faceLabels_)) pbm.whichPatchFace(faceLabels_)
); );
labelHashSet ids; labelHashSet ids;
@ -278,7 +278,7 @@ void Foam::faMesh::calcWhichPatchFaces() const
this->comm() this->comm()
); );
polyPatchIdsPtr_.reset(new labelList(ids.sortedToc())); polyPatchIdsPtr_ = std::make_unique<labelList>(ids.sortedToc());
} }
@ -675,23 +675,22 @@ void Foam::faMesh::calcLe() const
<< abort(FatalError); << abort(FatalError);
} }
LePtr_ = LePtr_ = std::make_unique<edgeVectorField>
new edgeVectorField (
IOobject
( (
IOobject "Le",
( mesh().pointsInstance(),
"Le", faMesh::meshSubDir,
mesh().pointsInstance(), faMesh::thisDb(),
faMesh::meshSubDir, IOobject::NO_READ,
faMesh::thisDb(), IOobject::NO_WRITE,
IOobject::NO_READ, IOobject::NO_REGISTER
IOobject::NO_WRITE, ),
IOobject::NO_REGISTER *this,
), dimLength
*this, // -> calculatedType()
dimLength );
// -> calculatedType()
);
edgeVectorField& Le = *LePtr_; edgeVectorField& Le = *LePtr_;
// Need face centres // Need face centres
@ -773,23 +772,21 @@ void Foam::faMesh::calcMagLe() const
<< abort(FatalError); << abort(FatalError);
} }
magLePtr_ = magLePtr_ = std::make_unique<edgeScalarField>
new edgeScalarField (
IOobject
( (
IOobject "magLe",
( mesh().pointsInstance(),
"magLe", faMesh::meshSubDir,
mesh().pointsInstance(), faMesh::thisDb(),
faMesh::meshSubDir, IOobject::NO_READ,
faMesh::thisDb(), IOobject::NO_WRITE,
IOobject::NO_READ, IOobject::NO_REGISTER
IOobject::NO_WRITE, ),
IOobject::NO_REGISTER *this,
), dimLength
*this, );
dimLength
);
edgeScalarField& magLe = *magLePtr_; edgeScalarField& magLe = *magLePtr_;
const pointField& localPoints = points(); const pointField& localPoints = points();
@ -849,24 +846,22 @@ void Foam::faMesh::calcFaceCentres() const
<< abort(FatalError); << abort(FatalError);
} }
faceCentresPtr_ = faceCentresPtr_ = std::make_unique<areaVectorField>
new areaVectorField (
IOobject
( (
IOobject "centres",
( mesh().pointsInstance(),
"centres", faMesh::meshSubDir,
mesh().pointsInstance(), faMesh::thisDb(),
faMesh::meshSubDir, IOobject::NO_READ,
faMesh::thisDb(), IOobject::NO_WRITE,
IOobject::NO_READ, IOobject::NO_REGISTER
IOobject::NO_WRITE, ),
IOobject::NO_REGISTER *this,
), dimLength
*this, // -> calculatedType()
dimLength );
// -> calculatedType()
);
areaVectorField& centres = *faceCentresPtr_; areaVectorField& centres = *faceCentresPtr_;
// Need local points // Need local points
@ -931,24 +926,22 @@ void Foam::faMesh::calcEdgeCentres() const
<< abort(FatalError); << abort(FatalError);
} }
edgeCentresPtr_ = edgeCentresPtr_ = std::make_unique<edgeVectorField>
new edgeVectorField (
IOobject
( (
IOobject "edgeCentres",
( mesh().pointsInstance(),
"edgeCentres", faMesh::meshSubDir,
mesh().pointsInstance(), faMesh::thisDb(),
faMesh::meshSubDir, IOobject::NO_READ,
faMesh::thisDb(), IOobject::NO_WRITE,
IOobject::NO_READ, IOobject::NO_REGISTER
IOobject::NO_WRITE, ),
IOobject::NO_REGISTER *this,
), dimLength
*this, // -> calculatedType()
dimLength );
// -> calculatedType()
);
edgeVectorField& centres = *edgeCentresPtr_; edgeVectorField& centres = *edgeCentresPtr_;
// Need local points // Need local points
@ -996,7 +989,7 @@ void Foam::faMesh::calcS() const
<< abort(FatalError); << abort(FatalError);
} }
SPtr_ = new DimensionedField<scalar, areaMesh> SPtr_ = std::make_unique<DimensionedField<scalar, areaMesh>>
( (
IOobject IOobject
( (
@ -1068,23 +1061,21 @@ void Foam::faMesh::calcFaceAreaNormals() const
<< abort(FatalError); << abort(FatalError);
} }
faceAreaNormalsPtr_ = faceAreaNormalsPtr_ = std::make_unique<areaVectorField>
new areaVectorField (
IOobject
( (
IOobject "faceAreaNormals",
( mesh().pointsInstance(),
"faceAreaNormals", faMesh::meshSubDir,
mesh().pointsInstance(), faMesh::thisDb(),
faMesh::meshSubDir, IOobject::NO_READ,
faMesh::thisDb(), IOobject::NO_WRITE,
IOobject::NO_READ, IOobject::NO_REGISTER
IOobject::NO_WRITE, ),
IOobject::NO_REGISTER *this,
), dimless
*this, );
dimless
);
areaVectorField& faceNormals = *faceAreaNormalsPtr_; areaVectorField& faceNormals = *faceAreaNormalsPtr_;
const pointField& localPoints = points(); const pointField& localPoints = points();
@ -1149,23 +1140,22 @@ void Foam::faMesh::calcEdgeAreaNormals() const
<< abort(FatalError); << abort(FatalError);
} }
edgeAreaNormalsPtr_ = edgeAreaNormalsPtr_ = std::make_unique<edgeVectorField>
new edgeVectorField (
IOobject
( (
IOobject "edgeAreaNormals",
( mesh().pointsInstance(),
"edgeAreaNormals", faMesh::meshSubDir,
mesh().pointsInstance(), faMesh::thisDb(),
faMesh::meshSubDir, IOobject::NO_READ,
faMesh::thisDb(), IOobject::NO_WRITE,
IOobject::NO_READ, IOobject::NO_REGISTER
IOobject::NO_WRITE, ),
IOobject::NO_REGISTER *this,
), dimless
*this, // -> calculatedType()
dimless );
// -> calculatedType()
);
edgeVectorField& edgeAreaNormals = *edgeAreaNormalsPtr_; edgeVectorField& edgeAreaNormals = *edgeAreaNormalsPtr_;
@ -1279,23 +1269,21 @@ void Foam::faMesh::calcFaceCurvatures() const
<< abort(FatalError); << abort(FatalError);
} }
faceCurvaturesPtr_ = faceCurvaturesPtr_ = std::make_unique<areaScalarField>
new areaScalarField (
IOobject
( (
IOobject "faceCurvatures",
( mesh().pointsInstance(),
"faceCurvatures", faMesh::meshSubDir,
mesh().pointsInstance(), faMesh::thisDb(),
faMesh::meshSubDir, IOobject::NO_READ,
faMesh::thisDb(), IOobject::NO_WRITE,
IOobject::NO_READ, IOobject::NO_REGISTER
IOobject::NO_WRITE, ),
IOobject::NO_REGISTER *this,
), dimless/dimLength
*this, );
dimless/dimLength
);
areaScalarField& faceCurvatures = *faceCurvaturesPtr_; areaScalarField& faceCurvatures = *faceCurvaturesPtr_;
@ -1321,7 +1309,8 @@ void Foam::faMesh::calcEdgeTransformTensors() const
<< abort(FatalError); << abort(FatalError);
} }
edgeTransformTensorsPtr_ = new FieldField<Field, tensor>(nEdges_); edgeTransformTensorsPtr_ =
std::make_unique<FieldField<Field, tensor>>(nEdges_);
auto& edgeTransformTensors = *edgeTransformTensorsPtr_; auto& edgeTransformTensors = *edgeTransformTensorsPtr_;
// Initialize all transformation tensors // Initialize all transformation tensors

View File

@ -73,7 +73,9 @@ class faMeshLduAddressing
const lduSchedule& patchSchedule_; const lduSchedule& patchSchedule_;
// Private Member Functions public:
// Generated Methods
//- No copy construct //- No copy construct
faMeshLduAddressing(const faMeshLduAddressing&) = delete; faMeshLduAddressing(const faMeshLduAddressing&) = delete;
@ -82,8 +84,6 @@ class faMeshLduAddressing
void operator=(const faMeshLduAddressing&) = delete; void operator=(const faMeshLduAddressing&) = delete;
public:
// Constructors // Constructors
//- Construct from components //- Construct from components

View File

@ -61,10 +61,18 @@ void Foam::faAreaMapper::calcAddressing() const
// Prepare a list of new face labels and (preliminary) addressing // Prepare a list of new face labels and (preliminary) addressing
// Note: dimensioned to number of boundary faces of polyMesh // Note: dimensioned to number of boundary faces of polyMesh
newFaceLabelsPtr_ = new labelList(mesh_.mesh().nBoundaryFaces(), -1); newFaceLabelsPtr_ = std::make_unique<labelList>
labelList& newFaceLabels = *newFaceLabelsPtr_; (
mesh_.mesh().nBoundaryFaces(),
-1
);
auto& newFaceLabels = *newFaceLabelsPtr_;
newFaceLabelsMapPtr_ = new labelList(mesh_.mesh().nBoundaryFaces(), -1); newFaceLabelsMapPtr_ = std::make_unique<labelList>
(
mesh_.mesh().nBoundaryFaces(),
-1
);
labelList& newFaceLabelsMap = *newFaceLabelsMapPtr_; labelList& newFaceLabelsMap = *newFaceLabelsMapPtr_;
label nNewFaces = 0; label nNewFaces = 0;
@ -94,7 +102,7 @@ void Foam::faAreaMapper::calcAddressing() const
// Direct mapping: no further faces to add. Resize list // Direct mapping: no further faces to add. Resize list
newFaceLabels.setSize(nNewFaces); newFaceLabels.setSize(nNewFaces);
directAddrPtr_ = new labelList(newFaceLabels.size()); directAddrPtr_ = std::make_unique<labelList>(newFaceLabels.size());
labelList& addr = *directAddrPtr_; labelList& addr = *directAddrPtr_;
// Adjust for creation of a boundary face from an internal face // Adjust for creation of a boundary face from an internal face
@ -114,10 +122,13 @@ void Foam::faAreaMapper::calcAddressing() const
{ {
// There are further faces to add. Prepare interpolation addressing // There are further faces to add. Prepare interpolation addressing
// and weights to full size // and weights to full size
interpolationAddrPtr_ = new labelListList(newFaceLabels.size()); interpolationAddrPtr_ = std::make_unique<labelListList>
(
newFaceLabels.size()
);
labelListList& addr = *interpolationAddrPtr_; labelListList& addr = *interpolationAddrPtr_;
weightsPtr_ = new scalarListList(newFaceLabels.size()); weightsPtr_ = std::make_unique<scalarListList>(newFaceLabels.size());
scalarListList& w = *weightsPtr_; scalarListList& w = *weightsPtr_;
// Insert single addressing and weights // Insert single addressing and weights
@ -256,20 +267,20 @@ void Foam::faAreaMapper::calcAddressing() const
// Inserted objects cannot appear in the new faMesh as they have no master // Inserted objects cannot appear in the new faMesh as they have no master
// HJ, 10/Aug/2011 // HJ, 10/Aug/2011
insertedObjectLabelsPtr_ = new labelList(0); insertedObjectLabelsPtr_ = std::make_unique<labelList>();
} }
void Foam::faAreaMapper::clearOut() void Foam::faAreaMapper::clearOut()
{ {
deleteDemandDrivenData(newFaceLabelsPtr_); newFaceLabelsPtr_.reset(nullptr);
deleteDemandDrivenData(newFaceLabelsMapPtr_); newFaceLabelsMapPtr_.reset(nullptr);
deleteDemandDrivenData(directAddrPtr_); directAddrPtr_.reset(nullptr);
deleteDemandDrivenData(interpolationAddrPtr_); interpolationAddrPtr_.reset(nullptr);
deleteDemandDrivenData(weightsPtr_); weightsPtr_.reset(nullptr);
deleteDemandDrivenData(insertedObjectLabelsPtr_); insertedObjectLabelsPtr_.reset(nullptr);
hasUnmapped_ = false; hasUnmapped_ = false;
} }
@ -286,13 +297,7 @@ Foam::faAreaMapper::faAreaMapper
mpm_(mpm), mpm_(mpm),
direct_(false), direct_(false),
hasUnmapped_(false), hasUnmapped_(false),
sizeBeforeMapping_(mesh.nFaces()), sizeBeforeMapping_(mesh.nFaces())
newFaceLabelsPtr_(nullptr),
newFaceLabelsMapPtr_(nullptr),
directAddrPtr_(nullptr),
interpolationAddrPtr_(nullptr),
weightsPtr_(nullptr),
insertedObjectLabelsPtr_(nullptr)
{ {
// Check for possibility of direct mapping // Check for possibility of direct mapping
if if

View File

@ -43,9 +43,6 @@ SourceFiles
#include "morphFieldMapper.H" #include "morphFieldMapper.H"
#include "faMesh.H" #include "faMesh.H"
#include "faceMapper.H"
#include "HashSet.H"
#include "mapPolyMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -60,7 +57,7 @@ class faAreaMapper
: :
public morphFieldMapper public morphFieldMapper
{ {
// Private data // Private Data
//- Reference to mesh mapper //- Reference to mesh mapper
const faMesh& mesh_; const faMesh& mesh_;
@ -80,33 +77,27 @@ class faAreaMapper
label sizeBeforeMapping_; label sizeBeforeMapping_;
//- New face labels after mapping //- New face labels after mapping
mutable labelList* newFaceLabelsPtr_; mutable std::unique_ptr<labelList> newFaceLabelsPtr_;
//- New face labels after mapping //- New face labels after mapping
mutable labelList* newFaceLabelsMapPtr_; mutable std::unique_ptr<labelList> newFaceLabelsMapPtr_;
//- Direct addressing (only one form of addressing is used) //- Direct addressing (only one form of addressing is used)
mutable labelList* directAddrPtr_; mutable std::unique_ptr<labelList> directAddrPtr_;
//- Interpolated addressing (only one form of addressing is used) //- Interpolated addressing (only one form of addressing is used)
mutable labelListList* interpolationAddrPtr_; mutable std::unique_ptr<labelListList> interpolationAddrPtr_;
//- Interpolation weights //- Interpolation weights
mutable scalarListList* weightsPtr_; mutable std::unique_ptr<scalarListList> weightsPtr_;
//- Inserted faces //- Inserted faces
mutable labelList* insertedObjectLabelsPtr_; mutable std::unique_ptr<labelList> insertedObjectLabelsPtr_;
// Private Member Functions // Private Member Functions
//- No copy construct
faAreaMapper(const faAreaMapper&) = delete;
//- No copy assignment
void operator=(const faAreaMapper&) = delete;
//- Calculate addressing //- Calculate addressing
void calcAddressing() const; void calcAddressing() const;
@ -116,6 +107,15 @@ class faAreaMapper
public: public:
// Generated Methods
//- No copy construct
faAreaMapper(const faAreaMapper&) = delete;
//- No copy assignment
void operator=(const faAreaMapper&) = delete;
//- Construct from components //- Construct from components
faAreaMapper faAreaMapper
( (
@ -127,7 +127,6 @@ public:
//- Destructor //- Destructor
virtual ~faAreaMapper(); virtual ~faAreaMapper();
// Member Functions // Member Functions
//- Return new face labels //- Return new face labels

View File

@ -34,7 +34,6 @@ Description
#ifndef faBoundaryMeshMapper_H #ifndef faBoundaryMeshMapper_H
#define faBoundaryMeshMapper_H #define faBoundaryMeshMapper_H
#include "PtrList.H"
#include "faPatchMapper.H" #include "faPatchMapper.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -43,13 +43,13 @@ void Foam::faEdgeMapper::calcAddressing() const
hasUnmapped_ = false; hasUnmapped_ = false;
// Dummy mapping: take value from edge 0 // Dummy mapping: take value from edge 0
directAddrPtr_ = new labelList(size(), Zero); directAddrPtr_ = std::make_unique<labelList>(size(), Foam::zero{});
} }
void Foam::faEdgeMapper::clearOut() void Foam::faEdgeMapper::clearOut()
{ {
deleteDemandDrivenData(directAddrPtr_); directAddrPtr_.reset(nullptr);
hasUnmapped_ = false; hasUnmapped_ = false;
} }
@ -63,10 +63,8 @@ Foam::faEdgeMapper::faEdgeMapper
) )
: :
mesh_(mesh), mesh_(mesh),
// mpm_(mpm),
sizeBeforeMapping_(mesh.nInternalEdges()), sizeBeforeMapping_(mesh.nInternalEdges()),
hasUnmapped_(false), hasUnmapped_(false)
directAddrPtr_(nullptr)
{} {}

View File

@ -45,7 +45,6 @@ SourceFiles
#include "morphFieldMapper.H" #include "morphFieldMapper.H"
#include "faMesh.H" #include "faMesh.H"
#include "faceMapper.H" #include "faceMapper.H"
#include "HashSet.H"
#include "mapPolyMesh.H" #include "mapPolyMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -61,14 +60,11 @@ class faEdgeMapper
: :
public morphFieldMapper public morphFieldMapper
{ {
// Private data // Private Data
//- Reference to mesh //- Reference to mesh
const faMesh& mesh_; const faMesh& mesh_;
//- Reference to mapPolyMesh
//const mapPolyMesh& mpm_;
//- Old mesh size //- Old mesh size
label sizeBeforeMapping_; label sizeBeforeMapping_;
@ -78,17 +74,11 @@ class faEdgeMapper
mutable bool hasUnmapped_; mutable bool hasUnmapped_;
//- Direct addressing //- Direct addressing
mutable labelList* directAddrPtr_; mutable std::unique_ptr<labelList> directAddrPtr_;
// Private Member Functions // Private Member Functions
//- No copy construct
faEdgeMapper(const faEdgeMapper&) = delete;
//- No copy assignment
void operator=(const faEdgeMapper&) = delete;
//- Calculate addressing //- Calculate addressing
void calcAddressing() const; void calcAddressing() const;
@ -98,6 +88,15 @@ class faEdgeMapper
public: public:
// Generated Methods
//- No copy construct
faEdgeMapper(const faEdgeMapper&) = delete;
//- No copy assignment
void operator=(const faEdgeMapper&) = delete;
//- Construct from components //- Construct from components
faEdgeMapper faEdgeMapper
( (

View File

@ -68,7 +68,7 @@ class mapPolyMesh;
class faMeshMapper class faMeshMapper
{ {
// Private data // Private Data
//- Reference to mesh //- Reference to mesh
const faMesh& mesh_; const faMesh& mesh_;
@ -110,7 +110,9 @@ class faMeshMapper
faBoundaryMeshMapper boundaryMap_; faBoundaryMeshMapper boundaryMap_;
// Private Member Functions public:
// Generated Methods
//- No copy construct //- No copy construct
faMeshMapper(const faMeshMapper&) = delete; faMeshMapper(const faMeshMapper&) = delete;
@ -119,8 +121,6 @@ class faMeshMapper
void operator=(const faMeshMapper&) = delete; void operator=(const faMeshMapper&) = delete;
public:
// Constructors // Constructors
//- Construct from components //- Construct from components

View File

@ -26,11 +26,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "faPatchMapper.H" #include "faPatchMapper.H"
#include "faPatch.H"
#include "faBoundaryMesh.H"
#include "faMesh.H"
#include "mapPolyMesh.H" #include "mapPolyMesh.H"
#include "faceMapper.H"
#include "demandDrivenData.H" #include "demandDrivenData.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -47,7 +43,7 @@ void Foam::faPatchMapper::calcAddressing() const
// Compatibility change HJ, 12/Aug/2017 // Compatibility change HJ, 12/Aug/2017
hasUnmapped_ = false; hasUnmapped_ = false;
directAddrPtr_ = new labelList(patch_.size(), Zero); directAddrPtr_ = std::make_unique<labelList>(patch_.size(), Foam::zero{});
labelList& addr = *directAddrPtr_; labelList& addr = *directAddrPtr_;
// Make a map of old edgeFaces, giving edge index in patch given the new // Make a map of old edgeFaces, giving edge index in patch given the new
@ -90,7 +86,7 @@ void Foam::faPatchMapper::calcAddressing() const
void Foam::faPatchMapper::clearOut() void Foam::faPatchMapper::clearOut()
{ {
deleteDemandDrivenData(directAddrPtr_); directAddrPtr_.reset(nullptr);
hasUnmapped_ = false; hasUnmapped_ = false;
} }
@ -107,8 +103,7 @@ Foam::faPatchMapper::faPatchMapper
mpm_(mpm), mpm_(mpm),
sizeBeforeMapping_(patch.size()), sizeBeforeMapping_(patch.size()),
oldEdgeFaces_(patch.edgeFaces()), oldEdgeFaces_(patch.edgeFaces()),
hasUnmapped_(false), hasUnmapped_(false)
directAddrPtr_(nullptr)
{} {}

View File

@ -45,7 +45,6 @@ SourceFiles
#include "faPatchFieldMapper.H" #include "faPatchFieldMapper.H"
#include "faceMapper.H" #include "faceMapper.H"
#include "faPatch.H" #include "faPatch.H"
#include "primitiveFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -64,7 +63,7 @@ class faPatchMapper
: :
public faPatchFieldMapper public faPatchFieldMapper
{ {
// Private data // Private Data
//- Reference to patch //- Reference to patch
const faPatch& patch_; const faPatch& patch_;
@ -84,18 +83,11 @@ class faPatchMapper
mutable bool hasUnmapped_; mutable bool hasUnmapped_;
//- Direct addressing //- Direct addressing
mutable labelList* directAddrPtr_; mutable std::unique_ptr<labelList> directAddrPtr_;
// Private Member Functions // Private Member Functions
//- No copy construct
faPatchMapper(const faPatchMapper&) = delete;
//- No copy assignment
void operator=(const faPatchMapper&) = delete;
//- Calculate addressing for mapping with inserted cells //- Calculate addressing for mapping with inserted cells
void calcAddressing() const; void calcAddressing() const;
@ -105,6 +97,15 @@ class faPatchMapper
public: public:
// Generated Methods
//- No copy construct
faPatchMapper(const faPatchMapper&) = delete;
//- No copy assignment
void operator=(const faPatchMapper&) = delete;
//- Construct from mappers //- Construct from mappers
faPatchMapper faPatchMapper
( (

View File

@ -102,12 +102,6 @@ protected:
//- FatalError if subset has not been performed //- FatalError if subset has not been performed
bool checkHasSubMesh() const; bool checkHasSubMesh() const;
//- No copy construct
faMeshSubset(const faMeshSubset&) = delete;
//- No copy assignment
void operator=(const faMeshSubset&) = delete;
public: public:
@ -116,6 +110,14 @@ public:
//- Name for exposed internal edges (default: oldInternalEdges) //- Name for exposed internal edges (default: oldInternalEdges)
static word exposedPatchName; static word exposedPatchName;
// Generated Methods
//- No copy construct
faMeshSubset(const faMeshSubset&) = delete;
//- No copy assignment
void operator=(const faMeshSubset&) = delete;
// Constructors // Constructors

View File

@ -144,7 +144,7 @@ Foam::faMeshTools::newMesh
IOobject cmptIO(meshIO, "faceLabels", meshSubDir); IOobject cmptIO(meshIO, "faceLabels", meshSubDir);
cmptIO.readOpt(IOobject::MUST_READ); cmptIO.readOpt(IOobject::MUST_READ);
cmptIO.writeOpt(IOobject::NO_WRITE); cmptIO.writeOpt(IOobject::NO_WRITE);
cmptIO.registerObject(false); cmptIO.registerObject(IOobject::NO_REGISTER);
// Check who has a mesh // Check who has a mesh

View File

@ -849,9 +849,10 @@ void Foam::faMesh::setBoundaryConnections
<< abort(FatalError); << abort(FatalError);
} }
bndConnectPtr_.reset bndConnectPtr_ = std::make_unique<List<labelPair>>
( (
new List<labelPair>(nBoundaryEdges, labelPair(-1,-1)) nBoundaryEdges,
labelPair(-1,-1)
); );
auto& bndConnect = *bndConnectPtr_; auto& bndConnect = *bndConnectPtr_;
@ -989,7 +990,7 @@ const Foam::faMeshBoundaryHalo& Foam::faMesh::boundaryHaloMap() const
{ {
if (!haloMapPtr_) if (!haloMapPtr_)
{ {
haloMapPtr_.reset(new faMeshBoundaryHalo(*this)); haloMapPtr_ = std::make_unique<faMeshBoundaryHalo>(*this);
} }
return *haloMapPtr_; return *haloMapPtr_;
@ -1022,8 +1023,8 @@ void Foam::faMesh::calcHaloFaceGeometry() const
const labelList& inputFaceIds = halo.inputMeshFaces(); const labelList& inputFaceIds = halo.inputMeshFaces();
haloFaceCentresPtr_.reset(new pointField); haloFaceCentresPtr_ = std::make_unique<pointField>();
haloFaceNormalsPtr_.reset(new vectorField); haloFaceNormalsPtr_ = std::make_unique<vectorField>();
auto& centres = *haloFaceCentresPtr_; auto& centres = *haloFaceCentresPtr_;
auto& normals = *haloFaceNormalsPtr_; auto& normals = *haloFaceNormalsPtr_;

View File

@ -27,10 +27,8 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "cyclicFaPatch.H" #include "cyclicFaPatch.H"
#include "coupledPolyPatch.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "transform.H" #include "transform.H"
#include "faMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -30,7 +30,6 @@ License
#include "processorPolyPatch.H" // For newName() #include "processorPolyPatch.H" // For newName()
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "transformField.H" #include "transformField.H"
#include "faBoundaryMesh.H"
#include "faMesh.H" #include "faMesh.H"
#include "globalMeshData.H" #include "globalMeshData.H"

View File

@ -28,9 +28,6 @@ License
#include "wedgeFaPatch.H" #include "wedgeFaPatch.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "faBoundaryMesh.H"
#include "wedgePolyPatch.H"
#include "polyMesh.H"
#include "faMesh.H" #include "faMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -105,10 +105,7 @@ Foam::faPatch::faPatch
patchIdentifier(name, index), patchIdentifier(name, index),
labelList(edgeLabels), labelList(edgeLabels),
nbrPolyPatchId_(nbrPolyPatchi), nbrPolyPatchId_(nbrPolyPatchi),
boundaryMesh_(bm), boundaryMesh_(bm)
edgeFacesPtr_(nullptr),
pointLabelsPtr_(nullptr),
pointEdgesPtr_(nullptr)
{ {
if (constraintType(patchType)) if (constraintType(patchType))
{ {
@ -129,10 +126,7 @@ Foam::faPatch::faPatch
patchIdentifier(name, dict, index), patchIdentifier(name, dict, index),
labelList(dict.get<labelList>("edgeLabels")), labelList(dict.get<labelList>("edgeLabels")),
nbrPolyPatchId_(dict.get<label>("ngbPolyPatchIndex")), nbrPolyPatchId_(dict.get<label>("ngbPolyPatchIndex")),
boundaryMesh_(bm), boundaryMesh_(bm)
edgeFacesPtr_(nullptr),
pointLabelsPtr_(nullptr),
pointEdgesPtr_(nullptr)
{ {
if (constraintType(patchType)) if (constraintType(patchType))
{ {
@ -153,10 +147,7 @@ Foam::faPatch::faPatch
patchIdentifier(p, index), patchIdentifier(p, index),
labelList(edgeLabels), labelList(edgeLabels),
nbrPolyPatchId_(p.nbrPolyPatchId_), nbrPolyPatchId_(p.nbrPolyPatchId_),
boundaryMesh_(bm), boundaryMesh_(bm)
edgeFacesPtr_(nullptr),
pointLabelsPtr_(nullptr),
pointEdgesPtr_(nullptr)
{} {}
@ -331,7 +322,7 @@ void Foam::faPatch::calcPointLabels() const
} }
// Transfer to plain list (reuse storage) // Transfer to plain list (reuse storage)
pointLabelsPtr_.reset(new labelList(std::move(dynEdgePoints))); pointLabelsPtr_ = std::make_unique<labelList>(std::move(dynEdgePoints));
/// const auto& edgePoints = *pointLabelsPtr_; /// const auto& edgePoints = *pointLabelsPtr_;
/// ///
@ -381,7 +372,7 @@ void Foam::faPatch::calcPointEdges() const
} }
// Flatten to regular list // Flatten to regular list
pointEdgesPtr_.reset(new labelListList(edgePoints.size())); pointEdgesPtr_ = std::make_unique<labelListList>(edgePoints.size());
auto& pEdges = *pointEdgesPtr_; auto& pEdges = *pointEdgesPtr_;
forAll(pEdges, pointi) forAll(pEdges, pointi)
@ -441,12 +432,9 @@ const Foam::labelUList& Foam::faPatch::edgeFaces() const
{ {
if (!edgeFacesPtr_) if (!edgeFacesPtr_)
{ {
edgeFacesPtr_.reset edgeFacesPtr_ = std::make_unique<labelList::subList>
( (
new labelList::subList patchSlice(boundaryMesh().mesh().edgeOwner())
(
patchSlice(boundaryMesh().mesh().edgeOwner())
)
); );
} }
@ -520,11 +508,9 @@ void Foam::faPatch::makeDeltaCoeffs(scalarField& dc) const
void Foam::faPatch::makeCorrectionVectors(vectorField& k) const void Foam::faPatch::makeCorrectionVectors(vectorField& k) const
{ {
vectorField unitDelta(delta()/mag(delta())); const vectorField unitDelta(delta()/mag(delta()));
vectorField edgeNormMag(edgeNormals()/mag(edgeNormals()));
scalarField dn(edgeNormals() & delta());
k = edgeNormMag - (scalar(1)/(unitDelta & edgeNormMag))*unitDelta; k = edgeNormals() - (scalar(1)/(unitDelta & edgeNormals()))*unitDelta;
} }

View File

@ -61,11 +61,13 @@ class faSolution
{ {
public: public:
//- No copy construct // Generated Methods
faSolution(const faSolution&) = delete;
//- No copy assignment //- No copy construct
void operator=(const faSolution&) = delete; faSolution(const faSolution&) = delete;
//- No copy assignment
void operator=(const faSolution&) = delete;
// Constructors // Constructors

View File

@ -47,7 +47,6 @@ SourceFiles
#include "faMesh.H" #include "faMesh.H"
#include "faPatchFields.H" #include "faPatchFields.H"
#include "areaFieldsFwd.H" #include "areaFieldsFwd.H"
#include "calculatedFaPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -48,7 +48,6 @@ SourceFiles
#include "faMesh.H" #include "faMesh.H"
#include "faePatchFields.H" #include "faePatchFields.H"
#include "edgeFieldsFwd.H" #include "edgeFieldsFwd.H"
#include "calculatedFaePatchFields.H"
#endif #endif

View File

@ -68,7 +68,7 @@ class cyclicFaPatchField
const cyclicFaPatch& cyclicPatch_; const cyclicFaPatch& cyclicPatch_;
// Private member functions // Private Member Functions
//- Return neighbour side field given internal fields //- Return neighbour side field given internal fields
template<class Type2> template<class Type2>

View File

@ -48,7 +48,7 @@ class faPatchFieldMapperPatchRef
: :
public faPatchFieldMapper public faPatchFieldMapper
{ {
// Private data // Private Data
const faPatch& sourcePatch_; const faPatch& sourcePatch_;
const faPatch& targetPatch_; const faPatch& targetPatch_;

View File

@ -59,7 +59,7 @@ class cyclicFaePatchField
: :
public coupledFaePatchField<Type> public coupledFaePatchField<Type>
{ {
// Private data // Private Data
//- Local reference cast into the cyclic patch //- Local reference cast into the cyclic patch
const cyclicFaPatch& cyclicPatch_; const cyclicFaPatch& cyclicPatch_;

View File

@ -37,10 +37,8 @@ SourceFiles
#ifndef faConvectionScheme_H #ifndef faConvectionScheme_H
#define faConvectionScheme_H #define faConvectionScheme_H
#include "tmp.H"
#include "areaFieldsFwd.H" #include "areaFieldsFwd.H"
#include "edgeFieldsFwd.H" #include "edgeFieldsFwd.H"
#include "typeInfo.H"
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -48,6 +46,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward Declarations
template<class Type> template<class Type>
class faMatrix; class faMatrix;
@ -67,20 +66,12 @@ class convectionScheme
: :
public refCount public refCount
{ {
// Private data // Private Data
//- Reference to mesh
const faMesh& mesh_; const faMesh& mesh_;
// Private Member Functions
//- No copy construct
convectionScheme(const convectionScheme&) = delete;
//- No copy assignment
void operator=(const convectionScheme&) = delete;
public: public:
// Declare run-time constructor selection tables // Declare run-time constructor selection tables
@ -99,6 +90,15 @@ public:
); );
// Generated Methods
//- No copy construct
convectionScheme(const convectionScheme&) = delete;
//- No copy assignment
void operator=(const convectionScheme&) = delete;
// Constructors // Constructors
//- Construct from mesh, flux and Istream //- Construct from mesh, flux and Istream
@ -130,10 +130,7 @@ public:
// Member Functions // Member Functions
//- Return mesh reference //- Return mesh reference
const faMesh& mesh() const const faMesh& mesh() const noexcept { return mesh_; }
{
return mesh_;
}
virtual tmp<GeometricField<Type, faePatchField, edgeMesh>> flux virtual tmp<GeometricField<Type, faePatchField, edgeMesh>> flux
( (

View File

@ -60,26 +60,27 @@ class gaussConvectionScheme
: :
public fa::convectionScheme<Type> public fa::convectionScheme<Type>
{ {
// Private data // Private Data
//- Edge-interpolation scheme
tmp<edgeInterpolationScheme<Type>> tinterpScheme_; tmp<edgeInterpolationScheme<Type>> tinterpScheme_;
// Private Member Functions
//- No copy construct
gaussConvectionScheme(const gaussConvectionScheme&) = delete;
//- No copy assignment
void operator=(const gaussConvectionScheme&) = delete;
public: public:
//- Runtime type information //- Runtime type information
TypeName("Gauss"); TypeName("Gauss");
// Generated Methods
//- No copy construct
gaussConvectionScheme(const gaussConvectionScheme&) = delete;
//- No copy assignment
void operator=(const gaussConvectionScheme&) = delete;
// Constructors // Constructors
//- Construct from flux and interpolation scheme //- Construct from flux and interpolation scheme

View File

@ -26,7 +26,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "EulerFaD2dt2Scheme.H" #include "EulerFaD2dt2Scheme.H"
#include "facDiv.H"
#include "faMatrices.H" #include "faMatrices.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -72,21 +71,21 @@ EulerFaD2dt2Scheme<Type>::facD2dt2
scalar coefft = (deltaT + deltaT0)/(2*deltaT); scalar coefft = (deltaT + deltaT0)/(2*deltaT);
scalar coefft00 = (deltaT + deltaT0)/(2*deltaT0); scalar coefft00 = (deltaT + deltaT0)/(2*deltaT0);
IOobject d2dt2IOobject const IOobject d2dt2IOobject
( (
"d2dt2("+dt.name()+')', mesh().thisDb().newIOobject
mesh().time().timeName(), (
mesh().thisDb(), "d2dt2("+dt.name()+')',
IOobject::NO_READ, { IOobject::REGISTER }
IOobject::NO_WRITE )
); );
if (mesh().moving()) if (mesh().moving())
{ {
scalar halfRdeltaT2 = rDeltaT2.value()/2.0; scalar halfRdeltaT2 = 0.5*rDeltaT2.value();
scalarField SS0 = mesh().S() + mesh().S0(); scalarField SS0(mesh().S() + mesh().S0());
scalarField S0S00 = mesh().S0() + mesh().S00(); scalarField S0S00(mesh().S0() + mesh().S00());
tmp<GeometricField<Type, faPatchField, areaMesh>> tdt2dt2 tmp<GeometricField<Type, faPatchField, areaMesh>> tdt2dt2
( (
@ -131,13 +130,13 @@ EulerFaD2dt2Scheme<Type>::facD2dt2
dimensionedScalar rDeltaT2 = dimensionedScalar rDeltaT2 =
4.0/sqr(mesh().time().deltaT() + mesh().time().deltaT0()); 4.0/sqr(mesh().time().deltaT() + mesh().time().deltaT0());
IOobject d2dt2IOobject const IOobject d2dt2IOobject
( (
"d2dt2("+vf.name()+')', mesh().thisDb().newIOobject
mesh().time().timeName(), (
mesh().thisDb(), "d2dt2("+vf.name()+')',
IOobject::NO_READ, { IOobject::REGISTER }
IOobject::NO_WRITE )
); );
scalar deltaT = deltaT_(); scalar deltaT = deltaT_();
@ -149,10 +148,10 @@ EulerFaD2dt2Scheme<Type>::facD2dt2
if (mesh().moving()) if (mesh().moving())
{ {
scalar halfRdeltaT2 = rDeltaT2.value()/2.0; scalar halfRdeltaT2 = 0.5*rDeltaT2.value();
scalarField SS0 = mesh().S() + mesh().S0(); scalarField SS0(mesh().S() + mesh().S0());
scalarField S0S00 = mesh().S0() + mesh().S00(); scalarField S0S00(mesh().S0() + mesh().S00());
return tmp<GeometricField<Type, faPatchField, areaMesh>> return tmp<GeometricField<Type, faPatchField, areaMesh>>
( (
@ -209,13 +208,13 @@ EulerFaD2dt2Scheme<Type>::facD2dt2
dimensionedScalar rDeltaT2 = dimensionedScalar rDeltaT2 =
4.0/sqr(mesh().time().deltaT() + mesh().time().deltaT0()); 4.0/sqr(mesh().time().deltaT() + mesh().time().deltaT0());
IOobject d2dt2IOobject const IOobject d2dt2IOobject
( (
"d2dt2("+rho.name()+','+vf.name()+')', mesh().thisDb().newIOobject
mesh().time().timeName(), (
mesh().thisDb(), "d2dt2("+rho.name()+','+vf.name()+')',
IOobject::NO_READ, { IOobject::REGISTER }
IOobject::NO_WRITE )
); );
scalar deltaT = deltaT_(); scalar deltaT = deltaT_();
@ -229,13 +228,15 @@ EulerFaD2dt2Scheme<Type>::facD2dt2
{ {
scalar halfRdeltaT2 = 0.5*rDeltaT2.value(); scalar halfRdeltaT2 = 0.5*rDeltaT2.value();
scalarField SS0rhoRho0 = scalarField SS0rhoRho0
(mesh().S() + mesh().S0()) (
*rho.value(); (mesh().S() + mesh().S0())*rho.value()
);
scalarField S0S00rho0Rho00 = scalarField S0S00rho0Rho00
(mesh().S0() + mesh().S00()) (
*rho.value(); (mesh().S0() + mesh().S00())*rho.value()
);
return tmp<GeometricField<Type, faPatchField, areaMesh>> return tmp<GeometricField<Type, faPatchField, areaMesh>>
( (
@ -294,13 +295,13 @@ EulerFaD2dt2Scheme<Type>::facD2dt2
dimensionedScalar rDeltaT2 = dimensionedScalar rDeltaT2 =
4.0/sqr(mesh().time().deltaT() + mesh().time().deltaT0()); 4.0/sqr(mesh().time().deltaT() + mesh().time().deltaT0());
IOobject d2dt2IOobject const IOobject d2dt2IOobject
( (
"d2dt2("+rho.name()+','+vf.name()+')', mesh().thisDb().newIOobject
mesh().time().timeName(), (
mesh().thisDb(), "d2dt2("+rho.name()+','+vf.name()+')',
IOobject::NO_READ, { IOobject::REGISTER }
IOobject::NO_WRITE )
); );
scalar deltaT = deltaT_(); scalar deltaT = deltaT_();
@ -490,7 +491,6 @@ EulerFaD2dt2Scheme<Type>::famD2dt2
scalar halfRdeltaT2 = 0.5*rDeltaT2; scalar halfRdeltaT2 = 0.5*rDeltaT2;
scalarField SS0(mesh().S() + mesh().S0()); scalarField SS0(mesh().S() + mesh().S0());
scalarField S0S00(mesh().S0() + mesh().S00()); scalarField S0S00(mesh().S0() + mesh().S00());
fam.diag() = rho.value()*(coefft*halfRdeltaT2)*SS0; fam.diag() = rho.value()*(coefft*halfRdeltaT2)*SS0;

View File

@ -67,12 +67,6 @@ class EulerFaD2dt2Scheme
//- Return the previous time-step //- Return the previous time-step
scalar deltaT0_() const; scalar deltaT0_() const;
//- No copy construct
EulerFaD2dt2Scheme(const EulerFaD2dt2Scheme&) = delete;
//- No copy assignment
void operator=(const EulerFaD2dt2Scheme&) = delete;
public: public:
@ -80,6 +74,15 @@ public:
TypeName("Euler"); TypeName("Euler");
// Generated Methods
//- No copy construct
EulerFaD2dt2Scheme(const EulerFaD2dt2Scheme&) = delete;
//- No copy assignment
void operator=(const EulerFaD2dt2Scheme&) = delete;
// Constructors // Constructors
//- Construct from mesh //- Construct from mesh

View File

@ -24,13 +24,9 @@ License
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Description
Abstract base class for finite area d2dt2 schemes.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fa.H" #include "fa.H"
#include "HashTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -37,11 +37,9 @@ SourceFiles
#ifndef faD2dt2Scheme_H #ifndef faD2dt2Scheme_H
#define faD2dt2Scheme_H #define faD2dt2Scheme_H
#include "tmp.H"
#include "dimensionedType.H" #include "dimensionedType.H"
#include "areaFieldsFwd.H" #include "areaFieldsFwd.H"
#include "edgeFieldsFwd.H" #include "edgeFieldsFwd.H"
#include "typeInfo.H"
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -49,6 +47,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward Declarations
template<class Type> template<class Type>
class faMatrix; class faMatrix;
@ -68,23 +67,14 @@ class faD2dt2Scheme
: :
public refCount public refCount
{ {
protected: protected:
// Protected data // Protected Data
//- Reference to mesh
const faMesh& mesh_; const faMesh& mesh_;
// Private Member Functions
//- No copy construct
faD2dt2Scheme(const faD2dt2Scheme&) = delete;
//- No copy assignment
void operator=(const faD2dt2Scheme&) = delete;
public: public:
//- Runtime type information //- Runtime type information
@ -103,6 +93,15 @@ public:
); );
// Generated Methods
//- No copy construct
faD2dt2Scheme(const faD2dt2Scheme&) = delete;
//- No copy assignment
void operator=(const faD2dt2Scheme&) = delete;
// Constructors // Constructors
//- Construct from mesh //- Construct from mesh
@ -135,10 +134,7 @@ public:
// Member Functions // Member Functions
//- Return mesh reference //- Return mesh reference
const faMesh& mesh() const const faMesh& mesh() const noexcept { return mesh_; }
{
return mesh_;
}
virtual tmp<GeometricField<Type, faPatchField, areaMesh>> facD2dt2 virtual tmp<GeometricField<Type, faPatchField, areaMesh>> facD2dt2
( (

View File

@ -26,7 +26,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "EulerFaDdtScheme.H" #include "EulerFaDdtScheme.H"
#include "facDiv.H"
#include "faMatrices.H" #include "faMatrices.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -50,13 +49,13 @@ EulerFaDdtScheme<Type>::facDdt
{ {
dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT(); dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT();
IOobject ddtIOobject const IOobject ddtIOobject
( (
"ddt("+dt.name()+')', mesh().thisDb().newIOobject
mesh().time().timeName(), (
mesh().thisDb(), "ddt("+dt.name()+')',
IOobject::NO_READ, { IOobject::REGISTER }
IOobject::NO_WRITE )
); );
if (mesh().moving()) if (mesh().moving())
@ -97,13 +96,13 @@ EulerFaDdtScheme<Type>::facDdt0
{ {
dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT(); dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT();
IOobject ddtIOobject const IOobject ddtIOobject
( (
"ddt("+dt.name()+')', mesh().thisDb().newIOobject
mesh().time().timeName(), (
mesh().thisDb(), "ddt("+dt.name()+')',
IOobject::NO_READ, { IOobject::REGISTER }
IOobject::NO_WRITE )
); );
tmp<GeometricField<Type, faPatchField, areaMesh>> tdtdt0 tmp<GeometricField<Type, faPatchField, areaMesh>> tdtdt0
@ -135,13 +134,13 @@ EulerFaDdtScheme<Type>::facDdt
{ {
dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT(); dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT();
IOobject ddtIOobject const IOobject ddtIOobject
( (
"ddt("+vf.name()+')', mesh().thisDb().newIOobject
mesh().time().timeName(), (
mesh().thisDb(), "ddt("+vf.name()+')',
IOobject::NO_READ, { IOobject::REGISTER }
IOobject::NO_WRITE )
); );
if (mesh().moving()) if (mesh().moving())
@ -188,13 +187,13 @@ EulerFaDdtScheme<Type>::facDdt0
{ {
dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT(); dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT();
IOobject ddtIOobject const IOobject ddtIOobject
( (
"ddt0("+vf.name()+')', mesh().thisDb().newIOobject
mesh().time().timeName(), (
mesh().thisDb(), "ddt0("+vf.name()+')',
IOobject::NO_READ, { IOobject::REGISTER }
IOobject::NO_WRITE )
); );
if (mesh().moving()) if (mesh().moving())
@ -235,13 +234,13 @@ EulerFaDdtScheme<Type>::facDdt
{ {
dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT(); dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT();
IOobject ddtIOobject const IOobject ddtIOobject
( (
"ddt("+rho.name()+','+vf.name()+')', mesh().thisDb().newIOobject
mesh().time().timeName(), (
mesh().thisDb(), "ddt("+rho.name()+','+vf.name()+')',
IOobject::NO_READ, { IOobject::REGISTER }
IOobject::NO_WRITE )
); );
if (mesh().moving()) if (mesh().moving())
@ -288,13 +287,13 @@ EulerFaDdtScheme<Type>::facDdt0
{ {
dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT(); dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT();
IOobject ddtIOobject const IOobject ddtIOobject
( (
"ddt0("+rho.name()+','+vf.name()+')', mesh().thisDb().newIOobject
mesh().time().timeName(), (
mesh().thisDb(), "ddt0("+rho.name()+','+vf.name()+')',
IOobject::NO_READ, { IOobject::REGISTER }
IOobject::NO_WRITE )
); );
if (mesh().moving()) if (mesh().moving())
@ -337,13 +336,13 @@ EulerFaDdtScheme<Type>::facDdt
{ {
dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT(); dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT();
IOobject ddtIOobject const IOobject ddtIOobject
( (
"ddt("+rho.name()+','+vf.name()+')', mesh().thisDb().newIOobject
mesh().time().timeName(), (
mesh().thisDb(), "ddt("+rho.name()+','+vf.name()+')',
IOobject::NO_READ, { IOobject::REGISTER }
IOobject::NO_WRITE )
); );
if (mesh().moving()) if (mesh().moving())
@ -394,13 +393,13 @@ EulerFaDdtScheme<Type>::facDdt0
{ {
dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT(); dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT();
IOobject ddtIOobject const IOobject ddtIOobject
( (
"ddt0("+rho.name()+','+vf.name()+')', mesh().thisDb().newIOobject
mesh().time().timeName(), (
mesh().thisDb(), "ddt0("+rho.name()+','+vf.name()+')',
IOobject::NO_READ, { IOobject::REGISTER }
IOobject::NO_WRITE )
); );
if (mesh().moving()) if (mesh().moving())

View File

@ -59,7 +59,13 @@ class EulerFaDdtScheme
: :
public fa::faDdtScheme<Type> public fa::faDdtScheme<Type>
{ {
// Private Member Functions public:
//- Runtime type information
TypeName("Euler");
// Generated Methods
//- No copy construct //- No copy construct
EulerFaDdtScheme(const EulerFaDdtScheme&) = delete; EulerFaDdtScheme(const EulerFaDdtScheme&) = delete;
@ -68,12 +74,6 @@ class EulerFaDdtScheme
void operator=(const EulerFaDdtScheme&) = delete; void operator=(const EulerFaDdtScheme&) = delete;
public:
//- Runtime type information
TypeName("Euler");
// Constructors // Constructors
//- Construct from mesh //- Construct from mesh

View File

@ -26,7 +26,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "backwardFaDdtScheme.H" #include "backwardFaDdtScheme.H"
#include "facDiv.H"
#include "faMatrices.H" #include "faMatrices.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -81,13 +80,13 @@ backwardFaDdtScheme<Type>::facDdt
{ {
dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT(); dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT();
IOobject ddtIOobject const IOobject ddtIOobject
( (
"ddt("+dt.name()+')', mesh().thisDb().newIOobject
mesh().time().timeName(), (
mesh().thisDb(), "ddt("+dt.name()+')',
IOobject::NO_READ, { IOobject::REGISTER }
IOobject::NO_WRITE )
); );
scalar deltaT = deltaT_(); scalar deltaT = deltaT_();
@ -136,13 +135,13 @@ backwardFaDdtScheme<Type>::facDdt0
{ {
dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT(); dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT();
IOobject ddtIOobject const IOobject ddtIOobject
( (
"ddt("+dt.name()+')', mesh().thisDb().newIOobject
mesh().time().timeName(), (
mesh().thisDb(), "ddt("+dt.name()+')',
IOobject::NO_READ, { IOobject::REGISTER }
IOobject::NO_WRITE )
); );
scalar deltaT = deltaT_(); scalar deltaT = deltaT_();
@ -183,13 +182,13 @@ backwardFaDdtScheme<Type>::facDdt
{ {
dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT(); dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT();
IOobject ddtIOobject const IOobject ddtIOobject
( (
"ddt("+vf.name()+')', mesh().thisDb().newIOobject
mesh().time().timeName(), (
mesh().thisDb(), "ddt("+vf.name()+')',
IOobject::NO_READ, { IOobject::REGISTER }
IOobject::NO_WRITE )
); );
scalar deltaT = deltaT_(); scalar deltaT = deltaT_();
@ -256,13 +255,13 @@ backwardFaDdtScheme<Type>::facDdt0
{ {
dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT(); dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT();
IOobject ddtIOobject const IOobject ddtIOobject
( (
"ddt0("+vf.name()+')', mesh().thisDb().newIOobject
mesh().time().timeName(), (
mesh().thisDb(), "ddt0("+vf.name()+')',
IOobject::NO_READ, { IOobject::REGISTER }
IOobject::NO_WRITE )
); );
scalar deltaT = deltaT_(); scalar deltaT = deltaT_();
@ -327,13 +326,13 @@ backwardFaDdtScheme<Type>::facDdt
{ {
dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT(); dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT();
IOobject ddtIOobject const IOobject ddtIOobject
( (
"ddt("+rho.name()+','+vf.name()+')', mesh().thisDb().newIOobject
mesh().time().timeName(), (
mesh().thisDb(), "ddt("+rho.name()+','+vf.name()+')',
IOobject::NO_READ, { IOobject::REGISTER }
IOobject::NO_WRITE )
); );
scalar deltaT = deltaT_(); scalar deltaT = deltaT_();
@ -400,13 +399,13 @@ backwardFaDdtScheme<Type>::facDdt0
{ {
dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT(); dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT();
IOobject ddtIOobject const IOobject ddtIOobject
( (
"ddt0("+rho.name()+','+vf.name()+')', mesh().thisDb().newIOobject
mesh().time().timeName(), (
mesh().thisDb(), "ddt0("+rho.name()+','+vf.name()+')',
IOobject::NO_READ, { IOobject::REGISTER }
IOobject::NO_WRITE )
); );
scalar deltaT = deltaT_(); scalar deltaT = deltaT_();
@ -471,13 +470,13 @@ backwardFaDdtScheme<Type>::facDdt
{ {
dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT(); dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT();
IOobject ddtIOobject const IOobject ddtIOobject
( (
"ddt("+rho.name()+','+vf.name()+')', mesh().thisDb().newIOobject
mesh().time().timeName(), (
mesh().thisDb(), "ddt("+rho.name()+','+vf.name()+')',
IOobject::NO_READ, { IOobject::REGISTER }
IOobject::NO_WRITE )
); );
scalar deltaT = deltaT_(); scalar deltaT = deltaT_();
@ -548,13 +547,13 @@ backwardFaDdtScheme<Type>::facDdt0
{ {
dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT(); dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT();
IOobject ddtIOobject const IOobject ddtIOobject
( (
"ddt0("+rho.name()+','+vf.name()+')', mesh().thisDb().newIOobject
mesh().time().timeName(), (
mesh().thisDb(), "ddt0("+rho.name()+','+vf.name()+')',
IOobject::NO_READ, { IOobject::REGISTER }
IOobject::NO_WRITE )
); );
scalar deltaT = deltaT_(); scalar deltaT = deltaT_();

View File

@ -72,12 +72,6 @@ class backwardFaDdtScheme
template<class GeoField> template<class GeoField>
scalar deltaT0_(const GeoField&) const; scalar deltaT0_(const GeoField&) const;
//- No copy construct
backwardFaDdtScheme(const backwardFaDdtScheme&) = delete;
//- No copy assignment
void operator=(const backwardFaDdtScheme&) = delete;
public: public:
@ -85,6 +79,15 @@ public:
TypeName("backward"); TypeName("backward");
// Generated Methods
//- No copy construct
backwardFaDdtScheme(const backwardFaDdtScheme&) = delete;
//- No copy assignment
void operator=(const backwardFaDdtScheme&) = delete;
// Constructors // Constructors
//- Construct from mesh //- Construct from mesh

View File

@ -26,7 +26,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "boundedBackwardFaDdtScheme.H" #include "boundedBackwardFaDdtScheme.H"
#include "facDiv.H"
#include "faMatrices.H" #include "faMatrices.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -64,13 +63,13 @@ tmp<areaScalarField> boundedBackwardFaDdtScheme::facDdt
dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT(); dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT();
IOobject ddtIOobject const IOobject ddtIOobject
( (
"ddt("+dt.name()+')', mesh().thisDb().newIOobject
mesh().time().timeName(), (
mesh().thisDb(), "ddt("+dt.name()+')',
IOobject::NO_READ, { IOobject::REGISTER }
IOobject::NO_WRITE )
); );
scalar deltaT = deltaT_(); scalar deltaT = deltaT_();
@ -119,13 +118,13 @@ tmp<areaScalarField> boundedBackwardFaDdtScheme::facDdt0
dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT(); dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT();
IOobject ddtIOobject const IOobject ddtIOobject
( (
"ddt("+dt.name()+')', mesh().thisDb().newIOobject
mesh().time().timeName(), (
mesh().thisDb(), "ddt("+dt.name()+')',
IOobject::NO_READ, { IOobject::REGISTER }
IOobject::NO_WRITE )
); );
scalar deltaT = deltaT_(); scalar deltaT = deltaT_();
@ -164,13 +163,13 @@ tmp<areaScalarField> boundedBackwardFaDdtScheme::facDdt
{ {
dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT(); dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT();
IOobject ddtIOobject const IOobject ddtIOobject
( (
"ddt("+vf.name()+')', mesh().thisDb().newIOobject
mesh().time().timeName(), (
mesh().thisDb(), "ddt("+vf.name()+')',
IOobject::NO_READ, { IOobject::REGISTER }
IOobject::NO_WRITE )
); );
scalar deltaT = deltaT_(); scalar deltaT = deltaT_();
@ -261,13 +260,13 @@ tmp<areaScalarField> boundedBackwardFaDdtScheme::facDdt0
{ {
dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT(); dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT();
IOobject ddtIOobject const IOobject ddtIOobject
( (
"ddt0("+vf.name()+')', mesh().thisDb().newIOobject
mesh().time().timeName(), (
mesh().thisDb(), "ddt0("+vf.name()+')',
IOobject::NO_READ, { IOobject::REGISTER }
IOobject::NO_WRITE )
); );
scalar deltaT = deltaT_(); scalar deltaT = deltaT_();
@ -356,13 +355,13 @@ tmp<areaScalarField> boundedBackwardFaDdtScheme::facDdt
{ {
dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT(); dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT();
IOobject ddtIOobject const IOobject ddtIOobject
( (
"ddt("+rho.name()+','+vf.name()+')', mesh().thisDb().newIOobject
mesh().time().timeName(), (
mesh().thisDb(), "ddt("+rho.name()+','+vf.name()+')',
IOobject::NO_READ, { IOobject::REGISTER }
IOobject::NO_WRITE )
); );
scalar deltaT = deltaT_(); scalar deltaT = deltaT_();
@ -453,13 +452,13 @@ tmp<areaScalarField> boundedBackwardFaDdtScheme::facDdt0
{ {
dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT(); dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT();
IOobject ddtIOobject const IOobject ddtIOobject
( (
"ddt0("+rho.name()+','+vf.name()+')', mesh().thisDb().newIOobject
mesh().time().timeName(), (
mesh().thisDb(), "ddt0("+rho.name()+','+vf.name()+')',
IOobject::NO_READ, { IOobject::REGISTER }
IOobject::NO_WRITE )
); );
scalar deltaT = deltaT_(); scalar deltaT = deltaT_();
@ -548,13 +547,13 @@ tmp<areaScalarField> boundedBackwardFaDdtScheme::facDdt
{ {
dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT(); dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT();
IOobject ddtIOobject const IOobject ddtIOobject
( (
"ddt("+rho.name()+','+vf.name()+')', mesh().thisDb().newIOobject
mesh().time().timeName(), (
mesh().thisDb(), "ddt("+rho.name()+','+vf.name()+')',
IOobject::NO_READ, { IOobject::REGISTER }
IOobject::NO_WRITE )
); );
scalar deltaT = deltaT_(); scalar deltaT = deltaT_();
@ -649,13 +648,13 @@ tmp<areaScalarField> boundedBackwardFaDdtScheme::facDdt0
{ {
dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT(); dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT();
IOobject ddtIOobject const IOobject ddtIOobject
( (
"ddt0("+rho.name()+','+vf.name()+')', mesh().thisDb().newIOobject
mesh().time().timeName(), (
mesh().thisDb(), "ddt0("+rho.name()+','+vf.name()+')',
IOobject::NO_READ, { IOobject::REGISTER }
IOobject::NO_WRITE )
); );
scalar deltaT = deltaT_(); scalar deltaT = deltaT_();

View File

@ -76,26 +76,26 @@ class boundedBackwardFaDdtScheme
{ {
return GREAT; return GREAT;
} }
else
{ return deltaT0_();
return deltaT0_();
}
} }
//- No copy construct
boundedBackwardFaDdtScheme(const boundedBackwardFaDdtScheme&) = delete;
//- No copy assignment
void operator=(const boundedBackwardFaDdtScheme&) = delete;
public: public:
//- Runtime type information //- Runtime type information
TypeName("boundedBackward"); TypeName("boundedBackward");
// Generated Methods
//- No copy construct
boundedBackwardFaDdtScheme(const boundedBackwardFaDdtScheme&) = delete;
//- No copy assignment
void operator=(const boundedBackwardFaDdtScheme&) = delete;
// Constructors // Constructors
//- Construct from mesh //- Construct from mesh

View File

@ -27,7 +27,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fa.H" #include "fa.H"
#include "HashTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -37,11 +37,9 @@ SourceFiles
#ifndef faDdtScheme_H #ifndef faDdtScheme_H
#define faDdtScheme_H #define faDdtScheme_H
#include "tmp.H"
#include "dimensionedType.H" #include "dimensionedType.H"
#include "areaFieldsFwd.H" #include "areaFieldsFwd.H"
#include "edgeFieldsFwd.H" #include "edgeFieldsFwd.H"
#include "typeInfo.H"
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -49,6 +47,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward Declarations
template<class Type> template<class Type>
class faMatrix; class faMatrix;
@ -68,23 +67,14 @@ class faDdtScheme
: :
public refCount public refCount
{ {
protected: protected:
// Protected data // Protected Data
//- Reference to mesh
const faMesh& mesh_; const faMesh& mesh_;
// Private Member Functions
//- No copy construct
faDdtScheme(const faDdtScheme&) = delete;
//- No copy assignment
void operator=(const faDdtScheme&) = delete;
public: public:
//- Runtime type information //- Runtime type information
@ -103,6 +93,15 @@ public:
); );
// Generated Methods
//- No copy construct
faDdtScheme(const faDdtScheme&) = delete;
//- No copy assignment
void operator=(const faDdtScheme&) = delete;
// Constructors // Constructors
//- Construct from mesh //- Construct from mesh
@ -135,10 +134,7 @@ public:
// Member Functions // Member Functions
//- Return mesh reference //- Return mesh reference
const faMesh& mesh() const const faMesh& mesh() const noexcept { return mesh_; }
{
return mesh_;
}
virtual tmp<GeometricField<Type, faPatchField, areaMesh>> facDdt virtual tmp<GeometricField<Type, faPatchField, areaMesh>> facDdt
( (

View File

@ -48,16 +48,13 @@ steadyStateFaDdtScheme<Type>::facDdt
const dimensioned<Type> dt const dimensioned<Type> dt
) )
{ {
return tmp<GeometricField<Type, faPatchField, areaMesh>>::New return GeometricField<Type, faPatchField, areaMesh>::New
( (
IOobject "ddt("+dt.name()+')',
( IOobject::REGISTER,
"ddt("+dt.name()+')',
mesh().time().timeName(),
mesh().thisDb()
),
mesh(), mesh(),
dimensioned<Type>(dt.dimensions()/dimTime, Zero) Foam::zero{},
dt.dimensions()/dimTime
); );
} }
@ -69,16 +66,13 @@ steadyStateFaDdtScheme<Type>::facDdt0
const dimensioned<Type> dt const dimensioned<Type> dt
) )
{ {
return tmp<GeometricField<Type, faPatchField, areaMesh>>::New return GeometricField<Type, faPatchField, areaMesh>::New
( (
IOobject "ddt("+dt.name()+')',
( IOobject::REGISTER,
"ddt("+dt.name()+')',
mesh().time().timeName(),
mesh().thisDb()
),
mesh(), mesh(),
dimensioned<Type>(dt.dimensions()/dimTime, Zero) Foam::zero{},
dt.dimensions()/dimTime
); );
} }
@ -90,16 +84,13 @@ steadyStateFaDdtScheme<Type>::facDdt
const GeometricField<Type, faPatchField, areaMesh>& vf const GeometricField<Type, faPatchField, areaMesh>& vf
) )
{ {
return tmp<GeometricField<Type, faPatchField, areaMesh>>::New return GeometricField<Type, faPatchField, areaMesh>::New
( (
IOobject "ddt("+vf.name()+')',
( IOobject::REGISTER,
"ddt("+vf.name()+')',
mesh().time().timeName(),
mesh().thisDb()
),
mesh(), mesh(),
dimensioned<Type>(vf.dimensions()/dimTime, Zero) Foam::zero{},
vf.dimensions()/dimTime
); );
} }
@ -111,16 +102,13 @@ steadyStateFaDdtScheme<Type>::facDdt0
const GeometricField<Type, faPatchField, areaMesh>& vf const GeometricField<Type, faPatchField, areaMesh>& vf
) )
{ {
return tmp<GeometricField<Type, faPatchField, areaMesh>>::New return GeometricField<Type, faPatchField, areaMesh>::New
( (
IOobject "ddt0("+vf.name()+')',
( IOobject::REGISTER,
"ddt0("+vf.name()+')',
mesh().time().timeName(),
mesh().thisDb()
),
mesh(), mesh(),
dimensioned<Type>(vf.dimensions()/dimTime, Zero) Foam::zero{},
vf.dimensions()/dimTime
); );
} }
@ -133,16 +121,13 @@ steadyStateFaDdtScheme<Type>::facDdt
const GeometricField<Type, faPatchField, areaMesh>& vf const GeometricField<Type, faPatchField, areaMesh>& vf
) )
{ {
return tmp<GeometricField<Type, faPatchField, areaMesh>>::New return GeometricField<Type, faPatchField, areaMesh>::New
( (
IOobject "ddt("+rho.name()+','+vf.name()+')',
( IOobject::REGISTER,
"ddt("+rho.name()+','+vf.name()+')',
mesh().time().timeName(),
mesh().thisDb()
),
mesh(), mesh(),
dimensioned<Type>(rho.dimensions()*vf.dimensions()/dimTime, Zero) Foam::zero{},
rho.dimensions()*vf.dimensions()/dimTime
); );
} }
@ -154,16 +139,13 @@ steadyStateFaDdtScheme<Type>::facDdt0
const GeometricField<Type, faPatchField, areaMesh>& vf const GeometricField<Type, faPatchField, areaMesh>& vf
) )
{ {
return tmp<GeometricField<Type, faPatchField, areaMesh>>::New return GeometricField<Type, faPatchField, areaMesh>::New
( (
IOobject "ddt0("+rho.name()+','+vf.name()+')',
( IOobject::REGISTER,
"ddt0("+rho.name()+','+vf.name()+')',
mesh().time().timeName(),
mesh().thisDb()
),
mesh(), mesh(),
dimensioned<Type>(rho.dimensions()*vf.dimensions()/dimTime, Zero) Foam::zero{},
rho.dimensions()*vf.dimensions()/dimTime
); );
} }
@ -176,16 +158,13 @@ steadyStateFaDdtScheme<Type>::facDdt
const GeometricField<Type, faPatchField, areaMesh>& vf const GeometricField<Type, faPatchField, areaMesh>& vf
) )
{ {
return tmp<GeometricField<Type, faPatchField, areaMesh>>::New return GeometricField<Type, faPatchField, areaMesh>::New
( (
IOobject "ddt("+rho.name()+','+vf.name()+')',
( IOobject::REGISTER,
"ddt("+rho.name()+','+vf.name()+')',
mesh().time().timeName(),
mesh().thisDb()
),
mesh(), mesh(),
dimensioned<Type>(rho.dimensions()*vf.dimensions()/dimTime, Zero) Foam::zero{},
rho.dimensions()*vf.dimensions()/dimTime
); );
} }
@ -198,16 +177,13 @@ steadyStateFaDdtScheme<Type>::facDdt0
const GeometricField<Type, faPatchField, areaMesh>& vf const GeometricField<Type, faPatchField, areaMesh>& vf
) )
{ {
return tmp<GeometricField<Type, faPatchField, areaMesh>>::New return GeometricField<Type, faPatchField, areaMesh>::New
( (
IOobject "ddt0("+rho.name()+','+vf.name()+')',
( IOobject::REGISTER,
"ddt0("+rho.name()+','+vf.name()+')',
mesh().time().timeName(),
mesh().thisDb()
),
mesh(), mesh(),
dimensioned<Type>(rho.dimensions()*vf.dimensions()/dimTime, Zero) Foam::zero{},
rho.dimensions()*vf.dimensions()/dimTime
); );
} }

View File

@ -58,7 +58,13 @@ class steadyStateFaDdtScheme
: :
public fa::faDdtScheme<Type> public fa::faDdtScheme<Type>
{ {
// Private Member Functions public:
//- Runtime type information
TypeName("steadyState");
// Generated Methods
//- No copy construct //- No copy construct
steadyStateFaDdtScheme(const steadyStateFaDdtScheme&) = delete; steadyStateFaDdtScheme(const steadyStateFaDdtScheme&) = delete;
@ -67,12 +73,6 @@ class steadyStateFaDdtScheme
void operator=(const steadyStateFaDdtScheme&) = delete; void operator=(const steadyStateFaDdtScheme&) = delete;
public:
//- Runtime type information
TypeName("steadyState");
// Constructors // Constructors
//- Construct from mesh //- Construct from mesh

View File

@ -27,8 +27,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fa.H" #include "fa.H"
#include "HashTable.H"
#include "linearEdgeInterpolation.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -38,11 +38,9 @@ SourceFiles
#ifndef Foam_faDivScheme_H #ifndef Foam_faDivScheme_H
#define Foam_faDivScheme_H #define Foam_faDivScheme_H
#include "tmp.H"
#include "areaFieldsFwd.H" #include "areaFieldsFwd.H"
#include "edgeFieldsFwd.H" #include "edgeFieldsFwd.H"
#include "linearEdgeInterpolation.H" #include "linearEdgeInterpolation.H"
#include "typeInfo.H"
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -72,20 +70,13 @@ protected:
// Protected Data // Protected Data
//- Reference to mesh
const faMesh& mesh_; const faMesh& mesh_;
//- Edge interpolation scheme
tmp<edgeInterpolationScheme<Type>> tinterpScheme_; tmp<edgeInterpolationScheme<Type>> tinterpScheme_;
// Private Member Functions
//- No copy construct
divScheme(const divScheme&) = delete;
//- No copy assignment
void operator=(const divScheme&) = delete;
public: public:
// Declare run-time constructor selection tables // Declare run-time constructor selection tables
@ -100,6 +91,15 @@ public:
); );
// Generated Methods
//- No copy construct
divScheme(const divScheme&) = delete;
//- No copy assignment
void operator=(const divScheme&) = delete;
// Constructors // Constructors
//- Construct from mesh //- Construct from mesh
@ -148,10 +148,7 @@ public:
// Member Functions // Member Functions
//- Return mesh reference //- Return mesh reference
const faMesh& mesh() const const faMesh& mesh() const noexcept { return mesh_; }
{
return mesh_;
}
virtual tmp virtual tmp
< <

View File

@ -59,7 +59,13 @@ class gaussDivScheme
: :
public fa::divScheme<Type> public fa::divScheme<Type>
{ {
// Private Member Functions public:
//- Runtime type information
TypeName("Gauss");
// Generated Methods
//- No copy construct //- No copy construct
gaussDivScheme(const gaussDivScheme&) = delete; gaussDivScheme(const gaussDivScheme&) = delete;
@ -68,12 +74,6 @@ class gaussDivScheme
void operator=(const gaussDivScheme&) = delete; void operator=(const gaussDivScheme&) = delete;
public:
//- Runtime type information
TypeName("Gauss");
// Constructors // Constructors
//- Construct from mesh //- Construct from mesh

View File

@ -61,11 +61,13 @@ class faSchemes
{ {
public: public:
//- No copy construct // Generated Methods
faSchemes(const faSchemes&) = delete;
//- No copy assignment //- No copy construct
void operator=(const faSchemes&) = delete; faSchemes(const faSchemes&) = delete;
//- No copy assignment
void operator=(const faSchemes&) = delete;
// Constructors // Constructors

View File

@ -34,7 +34,6 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef facAverage_H #ifndef facAverage_H
#define facAverage_H #define facAverage_H

View File

@ -37,7 +37,6 @@ Author
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef facDdt_H #ifndef facDdt_H
#define facDdt_H #define facDdt_H

View File

@ -34,7 +34,6 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef facDiv_H #ifndef facDiv_H
#define facDiv_H #define facDiv_H

View File

@ -35,7 +35,6 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef facEdgeIntegrate_H #ifndef facEdgeIntegrate_H
#define facEdgeIntegrate_H #define facEdgeIntegrate_H

View File

@ -34,7 +34,6 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef facGrad_H #ifndef facGrad_H
#define facGrad_H #define facGrad_H

View File

@ -34,7 +34,6 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef facLaplacian_H #ifndef facLaplacian_H
#define facLaplacian_H #define facLaplacian_H

View File

@ -34,7 +34,6 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef facLnGrad_H #ifndef facLnGrad_H
#define facLnGrad_H #define facLnGrad_H

View File

@ -27,7 +27,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fa.H" #include "fa.H"
#include "HashTable.H"
#include "objectRegistry.H" #include "objectRegistry.H"
#include "solution.H" #include "solution.H"

View File

@ -39,17 +39,15 @@ SourceFiles
#ifndef faGradScheme_H #ifndef faGradScheme_H
#define faGradScheme_H #define faGradScheme_H
#include "tmp.H"
#include "areaFieldsFwd.H" #include "areaFieldsFwd.H"
#include "edgeFieldsFwd.H" #include "edgeFieldsFwd.H"
#include "typeInfo.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
// Forward Declarations
class faMesh; class faMesh;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -66,20 +64,12 @@ class gradScheme
: :
public refCount public refCount
{ {
// Private data // Private Data
//- Reference to mesh
const faMesh& mesh_; const faMesh& mesh_;
// Private Member Functions
//- No copy construct
gradScheme(const gradScheme&) = delete;
//- No copy assignment
void operator=(const gradScheme&) = delete;
public: public:
// Declare run-time constructor selection tables // Declare run-time constructor selection tables
@ -94,6 +84,15 @@ public:
); );
// Generated Methods
//- No copy construct
gradScheme(const gradScheme&) = delete;
//- No copy assignment
void operator=(const gradScheme&) = delete;
// Constructors // Constructors
//- Construct from mesh //- Construct from mesh
@ -120,7 +119,7 @@ public:
// Member Functions // Member Functions
//- Return mesh reference //- Return mesh reference
const faMesh& mesh() const { return mesh_; } const faMesh& mesh() const noexcept { return mesh_; }
//- Calculate and return the grad of the given field. //- Calculate and return the grad of the given field.
// Used by grad either to recalculate the cached gradient when it is // Used by grad either to recalculate the cached gradient when it is

View File

@ -28,8 +28,6 @@ License
#include "gaussFaGrad.H" #include "gaussFaGrad.H"
#include "facGrad.H" #include "facGrad.H"
#include "areaFields.H"
#include "edgeFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -69,7 +69,13 @@ class gaussGrad
tmp<edgeInterpolationScheme<Type>> tinterpScheme_; tmp<edgeInterpolationScheme<Type>> tinterpScheme_;
// Private Member Functions public:
//- Runtime type information
TypeName("Gauss");
// Generated Methods
//- No copy construct //- No copy construct
gaussGrad(const gaussGrad&) = delete; gaussGrad(const gaussGrad&) = delete;
@ -78,12 +84,6 @@ class gaussGrad
void operator=(const gaussGrad&) = delete; void operator=(const gaussGrad&) = delete;
public:
//- Runtime type information
TypeName("Gauss");
// Constructors // Constructors
//- Construct from mesh //- Construct from mesh

View File

@ -26,7 +26,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "gaussFaGrad.H" #include "gaussFaGrad.H"
#include "faMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -29,11 +29,6 @@ License
#include "leastSquaresFaGrad.H" #include "leastSquaresFaGrad.H"
#include "leastSquaresFaVectors.H" #include "leastSquaresFaVectors.H"
#include "gaussFaGrad.H" #include "gaussFaGrad.H"
#include "faMesh.H"
#include "areaFaMesh.H"
#include "edgeFaMesh.H"
#include "GeometricField.H"
#include "zeroGradientFaPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -96,10 +91,10 @@ leastSquaresFaGrad<Type>::calcGrad
forAll(own, edgei) forAll(own, edgei)
{ {
label ownEdgeI = own[edgei]; const label ownEdgeI = own[edgei];
label neiEdgeI = nei[edgei]; const label neiEdgeI = nei[edgei];
Type deltaVsf = vsf[neiEdgeI] - vsf[ownEdgeI]; const Type deltaVsf(vsf[neiEdgeI] - vsf[ownEdgeI]);
lsGrad[ownEdgeI] += ownLs[edgei]*deltaVsf; lsGrad[ownEdgeI] += ownLs[edgei]*deltaVsf;
lsGrad[neiEdgeI] -= neiLs[edgei]*deltaVsf; lsGrad[neiEdgeI] -= neiLs[edgei]*deltaVsf;
@ -108,35 +103,23 @@ leastSquaresFaGrad<Type>::calcGrad
// Boundary edges // Boundary edges
forAll(vsf.boundaryField(), patchi) forAll(vsf.boundaryField(), patchi)
{ {
const faePatchVectorField& patchOwnLs = ownLs.boundaryField()[patchi]; const faPatchField<Type>& bf = vsf.boundaryField()[patchi];
const Field<Type>& vsfp =
(
bf.coupled()
? bf.patchNeighbourField().cref()
: const_cast<faPatchField<Type>&>(bf)
);
const faePatchVectorField& ownLsp = ownLs.boundaryField()[patchi];
const labelUList& edgeFaces = const labelUList& edgeFaces =
lsGrad.boundaryField()[patchi].patch().edgeFaces(); lsGrad.boundaryField()[patchi].patch().edgeFaces();
if (vsf.boundaryField()[patchi].coupled()) forAll(vsfp, pEdgei)
{ {
Field<Type> neiVsf lsGrad[edgeFaces[pEdgei]] +=
( ownLsp[pEdgei]*(vsfp[pEdgei] - vsf[edgeFaces[pEdgei]]);
vsf.boundaryField()[patchi].patchNeighbourField()
);
forAll(neiVsf, patchEdgeI)
{
lsGrad[edgeFaces[patchEdgeI]] +=
patchOwnLs[patchEdgeI]
*(neiVsf[patchEdgeI] - vsf[edgeFaces[patchEdgeI]]);
}
}
else
{
const faPatchField<Type>& patchVsf = vsf.boundaryField()[patchi];
forAll(patchVsf, patchEdgeI)
{
lsGrad[edgeFaces[patchEdgeI]] +=
patchOwnLs[patchEdgeI]
*(patchVsf[patchEdgeI] - vsf[edgeFaces[patchEdgeI]]);
}
} }
} }

View File

@ -62,7 +62,13 @@ class leastSquaresFaGrad
: :
public fa::gradScheme<Type> public fa::gradScheme<Type>
{ {
// Private Member Functions public:
//- Runtime type information
TypeName("leastSquares");
// Generated Methods
//- No copy construct //- No copy construct
leastSquaresFaGrad(const leastSquaresFaGrad&) = delete; leastSquaresFaGrad(const leastSquaresFaGrad&) = delete;
@ -71,12 +77,6 @@ class leastSquaresFaGrad
void operator=(const leastSquaresFaGrad&) = delete; void operator=(const leastSquaresFaGrad&) = delete;
public:
//- Runtime type information
TypeName("leastSquares");
// Constructors // Constructors
//- Construct from mesh //- Construct from mesh

View File

@ -25,7 +25,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "faMesh.H"
#include "leastSquaresFaGrad.H" #include "leastSquaresFaGrad.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -29,7 +29,6 @@ License
#include "leastSquaresFaVectors.H" #include "leastSquaresFaVectors.H"
#include "edgeFields.H" #include "edgeFields.H"
#include "areaFields.H" #include "areaFields.H"
#include "mapPolyMesh.H"
#include "demandDrivenData.H" #include "demandDrivenData.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -44,21 +43,10 @@ namespace Foam
Foam::leastSquaresFaVectors::leastSquaresFaVectors(const faMesh& mesh) Foam::leastSquaresFaVectors::leastSquaresFaVectors(const faMesh& mesh)
: :
MeshObject<faMesh, Foam::MoveableMeshObject, leastSquaresFaVectors>(mesh), MeshObject<faMesh, Foam::MoveableMeshObject, leastSquaresFaVectors>(mesh)
pVectorsPtr_(nullptr),
nVectorsPtr_(nullptr)
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::leastSquaresFaVectors::~leastSquaresFaVectors()
{
deleteDemandDrivenData(pVectorsPtr_);
deleteDemandDrivenData(nVectorsPtr_);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::leastSquaresFaVectors::makeLeastSquaresVectors() const void Foam::leastSquaresFaVectors::makeLeastSquaresVectors() const
@ -67,7 +55,7 @@ void Foam::leastSquaresFaVectors::makeLeastSquaresVectors() const
<< "Constructing finite area (invDist) least square gradient vectors" << "Constructing finite area (invDist) least square gradient vectors"
<< nl; << nl;
pVectorsPtr_ = new edgeVectorField pVectorsPtr_ = std::make_unique<edgeVectorField>
( (
IOobject IOobject
( (
@ -83,7 +71,7 @@ void Foam::leastSquaresFaVectors::makeLeastSquaresVectors() const
); );
auto& lsP = *pVectorsPtr_; auto& lsP = *pVectorsPtr_;
nVectorsPtr_ = new edgeVectorField nVectorsPtr_ = std::make_unique<edgeVectorField>
( (
IOobject IOobject
( (
@ -237,8 +225,8 @@ bool Foam::leastSquaresFaVectors::movePoints()
DebugInFunction DebugInFunction
<< "Clearing least square data" << nl; << "Clearing least square data" << nl;
deleteDemandDrivenData(pVectorsPtr_); pVectorsPtr_.reset(nullptr);
deleteDemandDrivenData(nVectorsPtr_); nVectorsPtr_.reset(nullptr);
return true; return true;
} }

View File

@ -43,7 +43,6 @@ SourceFiles
#include "MeshObject.H" #include "MeshObject.H"
#include "faMesh.H" #include "faMesh.H"
#include "edgeFieldsFwd.H" #include "edgeFieldsFwd.H"
#include "labelPair.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -58,14 +57,14 @@ class leastSquaresFaVectors
: :
public MeshObject<faMesh, Foam::MoveableMeshObject, leastSquaresFaVectors> public MeshObject<faMesh, Foam::MoveableMeshObject, leastSquaresFaVectors>
{ {
// Private data // Private Data
//- Least-squares gradient vectors //- Least-squares gradient vectors
mutable edgeVectorField* pVectorsPtr_; mutable std::unique_ptr<edgeVectorField> pVectorsPtr_;
mutable edgeVectorField* nVectorsPtr_; mutable std::unique_ptr<edgeVectorField> nVectorsPtr_;
// Private member functions // Private Member Functions
//- Construct Least-squares gradient vectors //- Construct Least-squares gradient vectors
void makeLeastSquaresVectors() const; void makeLeastSquaresVectors() const;
@ -84,7 +83,7 @@ public:
//- Destructor //- Destructor
virtual ~leastSquaresFaVectors(); virtual ~leastSquaresFaVectors() = default;
// Member functions // Member functions

View File

@ -66,6 +66,7 @@ class edgeLimitedGrad
{ {
// Private Data // Private Data
//- Basic gradient scheme
tmp<fa::gradScheme<Type>> basicGradScheme_; tmp<fa::gradScheme<Type>> basicGradScheme_;
//- Limiter coefficient //- Limiter coefficient
@ -83,6 +84,14 @@ class edgeLimitedGrad
) const; ) const;
public:
//- RunTime type information
TypeName("edgeLimited");
// Generated Methods
//- No copy construct //- No copy construct
edgeLimitedGrad(const edgeLimitedGrad&) = delete; edgeLimitedGrad(const edgeLimitedGrad&) = delete;
@ -90,12 +99,6 @@ class edgeLimitedGrad
void operator=(const edgeLimitedGrad&) = delete; void operator=(const edgeLimitedGrad&) = delete;
public:
//- RunTime type information
TypeName("edgeLimited");
// Constructors // Constructors
//- Construct from mesh and schemeData //- Construct from mesh and schemeData

View File

@ -28,11 +28,6 @@ License
#include "edgeLimitedFaGrad.H" #include "edgeLimitedFaGrad.H"
#include "gaussFaGrad.H" #include "gaussFaGrad.H"
#include "faMesh.H"
#include "areaFaMesh.H"
#include "edgeFaMesh.H"
#include "areaFields.H"
#include "fixedValueFaPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -96,22 +91,22 @@ tmp<areaVectorField> edgeLimitedGrad<scalar>::calcGrad
const areaVectorField& C = mesh.areaCentres(); const areaVectorField& C = mesh.areaCentres();
const edgeVectorField& Cf = mesh.edgeCentres(); const edgeVectorField& Cf = mesh.edgeCentres();
// create limiter // Create limiter field
scalarField limiter(vsf.internalField().size(), 1.0); scalarField limiter(vsf.internalField().size(), 1.0);
scalar rk = (1.0/k_ - 1.0); const scalar rk = (1.0/k_ - 1.0);
forAll(owner, edgei) forAll(owner, edgei)
{ {
label own = owner[edgei]; const label own = owner[edgei];
label nei = neighbour[edgei]; const label nei = neighbour[edgei];
scalar vsfOwn = vsf[own]; const scalar vsfOwn = vsf[own];
scalar vsfNei = vsf[nei]; const scalar vsfNei = vsf[nei];
scalar maxEdge = max(vsfOwn, vsfNei); scalar maxEdge = max(vsfOwn, vsfNei);
scalar minEdge = min(vsfOwn, vsfNei); scalar minEdge = min(vsfOwn, vsfNei);
scalar maxMinEdge = rk*(maxEdge - minEdge); const scalar maxMinEdge = rk*(maxEdge - minEdge);
maxEdge += maxMinEdge; maxEdge += maxMinEdge;
minEdge -= maxMinEdge; minEdge -= maxMinEdge;
@ -119,7 +114,8 @@ tmp<areaVectorField> edgeLimitedGrad<scalar>::calcGrad
limitEdge limitEdge
( (
limiter[own], limiter[own],
maxEdge - vsfOwn, minEdge - vsfOwn, maxEdge - vsfOwn,
minEdge - vsfOwn,
(Cf[edgei] - C[own]) & g[own] (Cf[edgei] - C[own]) & g[own]
); );
@ -127,67 +123,53 @@ tmp<areaVectorField> edgeLimitedGrad<scalar>::calcGrad
limitEdge limitEdge
( (
limiter[nei], limiter[nei],
maxEdge - vsfNei, minEdge - vsfNei, maxEdge - vsfNei,
minEdge - vsfNei,
(Cf[edgei] - C[nei]) & g[nei] (Cf[edgei] - C[nei]) & g[nei]
); );
} }
const areaScalarField::Boundary& bsf = vsf.boundaryField(); // Lambda expression to update limiter for boundary edges
auto updateLimiter = [&](const label patchi, const scalarField& fld) -> void
{
const labelUList& pOwner = mesh.boundary()[patchi].edgeFaces();
const vectorField& pCf = Cf.boundaryField()[patchi];
forAll(pOwner, edgei)
{
const label own = pOwner[edgei];
const scalar vsfOwn = vsf[own];
const scalar vsfNei = fld[edgei];
scalar maxEdge = max(vsfOwn, vsfNei);
scalar minEdge = min(vsfOwn, vsfNei);
const scalar maxMinEdge = rk*(maxEdge - minEdge);
maxEdge += maxMinEdge;
minEdge -= maxMinEdge;
limitEdge
(
limiter[own],
maxEdge - vsfOwn,
minEdge - vsfOwn,
(pCf[edgei] - C[own]) & g[own]
);
}
};
const areaScalarField::Boundary& bsf = vsf.boundaryField();
forAll(bsf, patchi) forAll(bsf, patchi)
{ {
const faPatchScalarField& psf = bsf[patchi]; const faPatchScalarField& psf = bsf[patchi];
const labelUList& pOwner = mesh.boundary()[patchi].edgeFaces();
const vectorField& pCf = Cf.boundaryField()[patchi];
if (psf.coupled()) if (psf.coupled())
{ {
const scalarField psfNei(psf.patchNeighbourField()); updateLimiter(patchi, psf.patchNeighbourField());
forAll(pOwner, pEdgei)
{
label own = pOwner[pEdgei];
scalar vsfOwn = vsf[own];
scalar vsfNei = psfNei[pEdgei];
scalar maxEdge = max(vsfOwn, vsfNei);
scalar minEdge = min(vsfOwn, vsfNei);
scalar maxMinEdge = rk*(maxEdge - minEdge);
maxEdge += maxMinEdge;
minEdge -= maxMinEdge;
limitEdge
(
limiter[own],
maxEdge - vsfOwn, minEdge - vsfOwn,
(pCf[pEdgei] - C[own]) & g[own]
);
}
} }
else if (psf.fixesValue()) else if (psf.fixesValue())
{ {
forAll(pOwner, pEdgei) updateLimiter(patchi, psf);
{
label own = pOwner[pEdgei];
scalar vsfOwn = vsf[own];
scalar vsfNei = psf[pEdgei];
scalar maxEdge = max(vsfOwn, vsfNei);
scalar minEdge = min(vsfOwn, vsfNei);
scalar maxMinEdge = rk*(maxEdge - minEdge);
maxEdge += maxMinEdge;
minEdge -= maxMinEdge;
limitEdge
(
limiter[own],
maxEdge - vsfOwn, minEdge - vsfOwn,
(pCf[pEdgei] - C[own]) & g[own]
);
}
} }
} }
@ -231,35 +213,33 @@ tmp<areaTensorField> edgeLimitedGrad<vector>::calcGrad
const areaVectorField& C = mesh.areaCentres(); const areaVectorField& C = mesh.areaCentres();
const edgeVectorField& Cf = mesh.edgeCentres(); const edgeVectorField& Cf = mesh.edgeCentres();
// create limiter // Create limiter
scalarField limiter(vvf.internalField().size(), 1.0); scalarField limiter(vvf.internalField().size(), 1.0);
scalar rk = (1.0/k_ - 1.0); const scalar rk = (1.0/k_ - 1.0);
forAll(owner, edgei) forAll(owner, edgei)
{ {
label own = owner[edgei]; const label own = owner[edgei];
label nei = neighbour[edgei]; const label nei = neighbour[edgei];
vector vvfOwn = vvf[own];
vector vvfNei = vvf[nei];
// owner side // owner side
vector gradf = (Cf[edgei] - C[own]) & g[own]; vector gradf((Cf[edgei] - C[own]) & g[own]);
scalar vsfOwn = gradf & vvfOwn; scalar vsfOwn = gradf & vvf[own];
scalar vsfNei = gradf & vvfNei; scalar vsfNei = gradf & vvf[nei];
scalar maxEdge = max(vsfOwn, vsfNei); scalar maxEdge = max(vsfOwn, vsfNei);
scalar minEdge = min(vsfOwn, vsfNei); scalar minEdge = min(vsfOwn, vsfNei);
scalar maxMinEdge = rk*(maxEdge - minEdge); const scalar maxMinEdge = rk*(maxEdge - minEdge);
maxEdge += maxMinEdge; maxEdge += maxMinEdge;
minEdge -= maxMinEdge; minEdge -= maxMinEdge;
limitEdge limitEdge
( (
limiter[own], limiter[own],
maxEdge - vsfOwn, minEdge - vsfOwn, maxEdge - vsfOwn,
minEdge - vsfOwn,
magSqr(gradf) magSqr(gradf)
); );
@ -267,8 +247,8 @@ tmp<areaTensorField> edgeLimitedGrad<vector>::calcGrad
// neighbour side // neighbour side
gradf = (Cf[edgei] - C[nei]) & g[nei]; gradf = (Cf[edgei] - C[nei]) & g[nei];
vsfOwn = gradf & vvfOwn; vsfOwn = gradf & vvf[own];
vsfNei = gradf & vvfNei; vsfNei = gradf & vvf[nei];
maxEdge = max(vsfOwn, vsfNei); maxEdge = max(vsfOwn, vsfNei);
minEdge = min(vsfOwn, vsfNei); minEdge = min(vsfOwn, vsfNei);
@ -276,78 +256,57 @@ tmp<areaTensorField> edgeLimitedGrad<vector>::calcGrad
limitEdge limitEdge
( (
limiter[nei], limiter[nei],
maxEdge - vsfNei, minEdge - vsfNei, maxEdge - vsfNei,
minEdge - vsfNei,
magSqr(gradf) magSqr(gradf)
); );
} }
const areaVectorField::Boundary& bvf = vvf.boundaryField(); // Lambda expression to update limiter for boundary edges
auto updateLimiter = [&](const label patchi, const vectorField& fld) -> void
{
const labelUList& pOwner = mesh.boundary()[patchi].edgeFaces();
const vectorField& pCf = Cf.boundaryField()[patchi];
forAll(pOwner, edgei)
{
const label own = pOwner[edgei];
const vector gradf((pCf[edgei] - C[own]) & g[own]);
const scalar vsfOwn = gradf & vvf[own];
const scalar vsfNei = gradf & fld[edgei];
scalar maxEdge = max(vsfOwn, vsfNei);
scalar minEdge = min(vsfOwn, vsfNei);
const scalar maxMinEdge = rk*(maxEdge - minEdge);
maxEdge += maxMinEdge;
minEdge -= maxMinEdge;
limitEdge
(
limiter[own],
maxEdge - vsfOwn,
minEdge - vsfOwn,
magSqr(gradf)
);
}
};
const areaVectorField::Boundary& bvf = vvf.boundaryField();
forAll(bvf, patchi) forAll(bvf, patchi)
{ {
const faPatchVectorField& psf = bvf[patchi]; const faPatchVectorField& psf = bvf[patchi];
const labelUList& pOwner = mesh.boundary()[patchi].edgeFaces();
const vectorField& pCf = Cf.boundaryField()[patchi];
if (psf.coupled()) if (psf.coupled())
{ {
const vectorField psfNei(psf.patchNeighbourField()); updateLimiter(patchi, psf.patchNeighbourField());
forAll(pOwner, pEdgei)
{
label own = pOwner[pEdgei];
vector vvfOwn = vvf[own];
vector vvfNei = psfNei[pEdgei];
vector gradf = (pCf[pEdgei] - C[own]) & g[own];
scalar vsfOwn = gradf & vvfOwn;
scalar vsfNei = gradf & vvfNei;
scalar maxEdge = max(vsfOwn, vsfNei);
scalar minEdge = min(vsfOwn, vsfNei);
scalar maxMinEdge = rk*(maxEdge - minEdge);
maxEdge += maxMinEdge;
minEdge -= maxMinEdge;
limitEdge
(
limiter[own],
maxEdge - vsfOwn, minEdge - vsfOwn,
magSqr(gradf)
);
}
} }
else if (psf.fixesValue()) else if (psf.fixesValue())
{ {
forAll(pOwner, pEdgei) updateLimiter(patchi, psf);
{
label own = pOwner[pEdgei];
vector vvfOwn = vvf[own];
vector vvfNei = psf[pEdgei];
vector gradf = (pCf[pEdgei] - C[own]) & g[own];
scalar vsfOwn = gradf & vvfOwn;
scalar vsfNei = gradf & vvfNei;
scalar maxEdge = max(vsfOwn, vsfNei);
scalar minEdge = min(vsfOwn, vsfNei);
scalar maxMinEdge = rk*(maxEdge - minEdge);
maxEdge += maxMinEdge;
minEdge -= maxMinEdge;
limitEdge
(
limiter[own],
maxEdge - vsfOwn, minEdge - vsfOwn,
magSqr(gradf)
);
}
} }
} }

View File

@ -69,13 +69,20 @@ class faceLimitedGrad
{ {
// Private Data // Private Data
//- Basic gradient scheme
tmp<fa::gradScheme<Type>> basicGradScheme_; tmp<fa::gradScheme<Type>> basicGradScheme_;
//- Limiter coefficient //- Limiter coefficient
scalar k_; scalar k_;
// Private Member Functions public:
//- RunTime type information
TypeName("faceLimited");
// Generated Methods
//- No copy construct //- No copy construct
faceLimitedGrad(const faceLimitedGrad&) = delete; faceLimitedGrad(const faceLimitedGrad&) = delete;
@ -84,12 +91,6 @@ class faceLimitedGrad
void operator=(const faceLimitedGrad&) = delete; void operator=(const faceLimitedGrad&) = delete;
public:
//- RunTime type information
TypeName("faceLimited");
// Constructors // Constructors
//- Construct from mesh and schemeData //- Construct from mesh and schemeData

View File

@ -28,11 +28,6 @@ License
#include "faceLimitedFaGrad.H" #include "faceLimitedFaGrad.H"
#include "gaussFaGrad.H" #include "gaussFaGrad.H"
#include "faMesh.H"
#include "areaFaMesh.H"
#include "edgeFaMesh.H"
#include "areaFields.H"
#include "fixedValueFaPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -123,11 +118,11 @@ tmp<areaVectorField> faceLimitedGrad<scalar>::calcGrad
forAll(owner, facei) forAll(owner, facei)
{ {
label own = owner[facei]; const label own = owner[facei];
label nei = neighbour[facei]; const label nei = neighbour[facei];
scalar vsfOwn = vsf[own]; const scalar vsfOwn = vsf[own];
scalar vsfNei = vsf[nei]; const scalar vsfNei = vsf[nei];
maxVsf[own] = max(maxVsf[own], vsfNei); maxVsf[own] = max(maxVsf[own], vsfNei);
minVsf[own] = min(minVsf[own], vsfNei); minVsf[own] = min(minVsf[own], vsfNei);
@ -137,37 +132,33 @@ tmp<areaVectorField> faceLimitedGrad<scalar>::calcGrad
} }
const areaScalarField::Boundary& bsf = vsf.boundaryField(); // Lambda expression to update limiter for boundary edges
auto updateLimiter = [&](const label patchi, const scalarField& fld) -> void
{
const labelUList& pOwner = mesh.boundary()[patchi].edgeFaces();
forAll(pOwner, facei)
{
const label own = pOwner[facei];
const scalar vsf = fld[facei];
maxVsf[own] = max(maxVsf[own], vsf);
minVsf[own] = min(minVsf[own], vsf);
}
};
const areaScalarField::Boundary& bsf = vsf.boundaryField();
forAll(bsf, patchi) forAll(bsf, patchi)
{ {
const faPatchScalarField& psf = bsf[patchi]; const faPatchScalarField& psf = bsf[patchi];
const labelUList& pOwner = mesh.boundary()[patchi].edgeFaces();
if (psf.coupled()) if (psf.coupled())
{ {
scalarField psfNei(psf.patchNeighbourField()); updateLimiter(patchi, psf.patchNeighbourField());
forAll(pOwner, pFacei)
{
label own = pOwner[pFacei];
scalar vsfNei = psfNei[pFacei];
maxVsf[own] = max(maxVsf[own], vsfNei);
minVsf[own] = min(minVsf[own], vsfNei);
}
} }
else else
{ {
forAll(pOwner, pFacei) updateLimiter(patchi, psf);
{
label own = pOwner[pFacei];
scalar vsfNei = psf[pFacei];
maxVsf[own] = max(maxVsf[own], vsfNei);
minVsf[own] = min(minVsf[own], vsfNei);
}
} }
} }
@ -176,19 +167,19 @@ tmp<areaVectorField> faceLimitedGrad<scalar>::calcGrad
if (k_ < 1.0) if (k_ < 1.0)
{ {
scalarField maxMinVsf((1.0/k_ - 1.0)*(maxVsf - minVsf)); const scalarField maxMinVsf((1.0/k_ - 1.0)*(maxVsf - minVsf));
maxVsf += maxMinVsf; maxVsf += maxMinVsf;
minVsf -= maxMinVsf; minVsf -= maxMinVsf;
} }
// create limiter // Create limiter
scalarField limiter(vsf.internalField().size(), 1.0); scalarField limiter(vsf.internalField().size(), 1.0);
forAll(owner, facei) forAll(owner, facei)
{ {
label own = owner[facei]; const label own = owner[facei];
label nei = neighbour[facei]; const label nei = neighbour[facei];
// owner side // owner side
limitEdge limitEdge
@ -216,7 +207,7 @@ tmp<areaVectorField> faceLimitedGrad<scalar>::calcGrad
forAll(pOwner, pFacei) forAll(pOwner, pFacei)
{ {
label own = pOwner[pFacei]; const label own = pOwner[pFacei];
limitEdge limitEdge
( (
@ -273,8 +264,8 @@ tmp<areaTensorField> faceLimitedGrad<vector>::calcGrad
forAll(owner, facei) forAll(owner, facei)
{ {
label own = owner[facei]; const label own = owner[facei];
label nei = neighbour[facei]; const label nei = neighbour[facei];
const vector& vsfOwn = vsf[own]; const vector& vsfOwn = vsf[own];
const vector& vsfNei = vsf[nei]; const vector& vsfNei = vsf[nei];
@ -287,36 +278,33 @@ tmp<areaTensorField> faceLimitedGrad<vector>::calcGrad
} }
const areaVectorField::Boundary& bsf = vsf.boundaryField(); // Lambda expression to update limiter for boundary edges
auto updateLimiter = [&](const label patchi, const vectorField& fld) -> void
{
const labelUList& pOwner = mesh.boundary()[patchi].edgeFaces();
forAll(pOwner, facei)
{
const label own = pOwner[facei];
const vector& vsf = fld[facei];
maxVsf[own] = max(maxVsf[own], vsf);
minVsf[own] = min(minVsf[own], vsf);
}
};
const areaVectorField::Boundary& bsf = vsf.boundaryField();
forAll(bsf, patchi) forAll(bsf, patchi)
{ {
const faPatchVectorField& psf = bsf[patchi]; const faPatchVectorField& psf = bsf[patchi];
const labelUList& pOwner = mesh.boundary()[patchi].edgeFaces();
if (psf.coupled()) if (psf.coupled())
{ {
vectorField psfNei(psf.patchNeighbourField()); updateLimiter(patchi, psf.patchNeighbourField());
forAll(pOwner, pFacei)
{
label own = pOwner[pFacei];
const vector& vsfNei = psfNei[pFacei];
maxVsf[own] = max(maxVsf[own], vsfNei);
minVsf[own] = min(minVsf[own], vsfNei);
}
} }
else else
{ {
forAll(pOwner, pFacei) updateLimiter(patchi, psf);
{
label own = pOwner[pFacei];
const vector& vsfNei = psf[pFacei];
maxVsf[own] = max(maxVsf[own], vsfNei);
minVsf[own] = min(minVsf[own], vsfNei);
}
} }
} }
@ -325,7 +313,7 @@ tmp<areaTensorField> faceLimitedGrad<vector>::calcGrad
if (k_ < 1.0) if (k_ < 1.0)
{ {
vectorField maxMinVsf((1.0/k_ - 1.0)*(maxVsf - minVsf)); const vectorField maxMinVsf((1.0/k_ - 1.0)*(maxVsf - minVsf));
maxVsf += maxMinVsf; maxVsf += maxMinVsf;
minVsf -= maxMinVsf; minVsf -= maxMinVsf;
@ -334,13 +322,13 @@ tmp<areaTensorField> faceLimitedGrad<vector>::calcGrad
} }
// create limiter // Create limiter
vectorField limiter(vsf.internalField().size(), vector::one); vectorField limiter(vsf.internalField().size(), vector::one);
forAll(owner, facei) forAll(owner, facei)
{ {
label own = owner[facei]; const label own = owner[facei];
label nei = neighbour[facei]; const label nei = neighbour[facei];
// owner side // owner side
limitEdge limitEdge
@ -368,7 +356,7 @@ tmp<areaTensorField> faceLimitedGrad<vector>::calcGrad
forAll(pOwner, pFacei) forAll(pOwner, pFacei)
{ {
label own = pOwner[pFacei]; const label own = pOwner[pFacei];
limitEdge limitEdge
( (

View File

@ -27,8 +27,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fa.H" #include "fa.H"
#include "HashTable.H"
#include "linearEdgeInterpolation.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -38,12 +38,9 @@ SourceFiles
#ifndef Foam_faLaplacianScheme_H #ifndef Foam_faLaplacianScheme_H
#define Foam_faLaplacianScheme_H #define Foam_faLaplacianScheme_H
#include "tmp.H"
#include "areaFieldsFwd.H" #include "areaFieldsFwd.H"
#include "edgeFieldsFwd.H" #include "edgeFieldsFwd.H"
#include "linearEdgeInterpolation.H"
#include "correctedLnGrad.H" #include "correctedLnGrad.H"
#include "typeInfo.H"
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -79,15 +76,6 @@ protected:
tmp<lnGradScheme<Type>> tlnGradScheme_; tmp<lnGradScheme<Type>> tlnGradScheme_;
// Private Member Functions
//- No copy construct
laplacianScheme(const laplacianScheme&) = delete;
//- No copy assignment
void operator=(const laplacianScheme&) = delete;
public: public:
// Declare run-time constructor selection tables // Declare run-time constructor selection tables
@ -102,6 +90,15 @@ public:
); );
// Generated Methods
//- No copy construct
laplacianScheme(const laplacianScheme&) = delete;
//- No copy assignment
void operator=(const laplacianScheme&) = delete;
// Constructors // Constructors
//- Construct from mesh //- Construct from mesh

View File

@ -82,8 +82,10 @@ gaussLaplacianScheme<Type>::famLaplacian
{ {
if (this->mesh().fluxRequired(vf.name())) if (this->mesh().fluxRequired(vf.name()))
{ {
fam.faceFluxCorrectionPtr() = new fam.faceFluxCorrectionPtr() = std::make_unique
GeometricField<Type, faePatchField, edgeMesh> <
GeometricField<Type, faePatchField, edgeMesh>
>
( (
gammaMagSf*this->tlnGradScheme_().correction(vf) gammaMagSf*this->tlnGradScheme_().correction(vf)
); );

View File

@ -59,7 +59,13 @@ class gaussLaplacianScheme
: :
public fa::laplacianScheme<Type> public fa::laplacianScheme<Type>
{ {
// Private Member Functions public:
//- Runtime type information
TypeName("Gauss");
// Generated Methods
//- No copy construct //- No copy construct
gaussLaplacianScheme(const gaussLaplacianScheme&) = delete; gaussLaplacianScheme(const gaussLaplacianScheme&) = delete;
@ -68,12 +74,6 @@ class gaussLaplacianScheme
void operator=(const gaussLaplacianScheme&) = delete; void operator=(const gaussLaplacianScheme&) = delete;
public:
//- Runtime type information
TypeName("Gauss");
// Constructors // Constructors
//- Construct from mesh //- Construct from mesh

View File

@ -25,10 +25,8 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "correctedLnGrad.H"
#include "areaFields.H" #include "areaFields.H"
#include "edgeFields.H" #include "edgeFields.H"
#include "linearEdgeInterpolation.H"
#include "gaussFaGrad.H" #include "gaussFaGrad.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -58,18 +58,21 @@ class correctedLnGrad
: :
public lnGradScheme<Type> public lnGradScheme<Type>
{ {
// Private Member Functions
//- No copy assignment
void operator=(const correctedLnGrad&) = delete;
public: public:
//- Runtime type information //- Runtime type information
TypeName("corrected"); TypeName("corrected");
// Generated Methods
//- No copy construct
correctedLnGrad(const correctedLnGrad&) = delete;
//- No copy assignment
void operator=(const correctedLnGrad&) = delete;
// Constructors // Constructors
//- Construct from mesh //- Construct from mesh

View File

@ -29,7 +29,6 @@ License
#include "areaFields.H" #include "areaFields.H"
#include "edgeFields.H" #include "edgeFields.H"
#include "correctedLnGrad.H" #include "correctedLnGrad.H"
#include "linearEdgeInterpolation.H"
#include "gaussFaGrad.H" #include "gaussFaGrad.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -58,18 +58,21 @@ class fourthLnGrad
: :
public lnGradScheme<Type> public lnGradScheme<Type>
{ {
// Private Member Functions
//- No copy assignment
void operator=(const fourthLnGrad&) = delete;
public: public:
//- Runtime type information //- Runtime type information
TypeName("fourth"); TypeName("fourth");
// Generated Methods
//- No copy construct
fourthLnGrad(const fourthLnGrad&) = delete;
//- No copy assignment
void operator=(const fourthLnGrad&) = delete;
// Constructors // Constructors
//- Construct from mesh //- Construct from mesh
@ -102,10 +105,7 @@ public:
} }
//- Return true if this scheme uses an explicit correction //- Return true if this scheme uses an explicit correction
virtual bool corrected() const virtual bool corrected() const { return true; }
{
return true;
}
//- Return the explicit correction to the fourthLnGrad //- Return the explicit correction to the fourthLnGrad
// for the given field // for the given field

View File

@ -72,7 +72,7 @@ limitedLnGrad<Type>::correction
(1 - limitCoeff_)*mag(corr) (1 - limitCoeff_)*mag(corr)
+ dimensionedScalar("small", corr.dimensions(), SMALL) + dimensionedScalar("small", corr.dimensions(), SMALL)
), ),
dimensionedScalar("one", dimless, 1.0) dimensionedScalar(dimless, Foam::one{})
) )
); );

View File

@ -68,24 +68,27 @@ class limitedLnGrad
: :
public lnGradScheme<Type> public lnGradScheme<Type>
{ {
// Private data // Private Data
//- Limiter. 0 = no limiting, 1 = full limiting //- Limiter. 0 = no limiting, 1 = full limiting
scalar limitCoeff_; scalar limitCoeff_;
// Private Member Functions
//- No copy assignment
void operator=(const limitedLnGrad&) = delete;
public: public:
//- Runtime type information //- Runtime type information
TypeName("limited"); TypeName("limited");
// Generated Methods
//- No copy construct
limitedLnGrad(const limitedLnGrad&) = delete;
//- No copy assignment
void operator=(const limitedLnGrad&) = delete;
// Constructors // Constructors
//- Construct from mesh //- Construct from mesh

View File

@ -30,7 +30,6 @@ License
#include "lnGradScheme.H" #include "lnGradScheme.H"
#include "areaFields.H" #include "areaFields.H"
#include "edgeFields.H" #include "edgeFields.H"
#include "HashTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -37,10 +37,8 @@ SourceFiles
#ifndef lnGradScheme_H #ifndef lnGradScheme_H
#define lnGradScheme_H #define lnGradScheme_H
#include "tmp.H"
#include "areaFieldsFwd.H" #include "areaFieldsFwd.H"
#include "edgeFieldsFwd.H" #include "edgeFieldsFwd.H"
#include "typeInfo.H"
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -48,6 +46,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward Declarations
class faMesh; class faMesh;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -64,18 +63,12 @@ class lnGradScheme
: :
public refCount public refCount
{ {
// Private data // Private Data
//- Hold reference to mesh //- Hold reference to mesh
const faMesh& mesh_; const faMesh& mesh_;
// Private Member Functions
//- No copy assignment
void operator=(const lnGradScheme&) = delete;
public: public:
// Declare run-time constructor selection tables // Declare run-time constructor selection tables
@ -90,6 +83,15 @@ public:
); );
// Generated Methods
//- No copy construct
lnGradScheme(const lnGradScheme&) = delete;
//- No copy assignment
void operator=(const lnGradScheme&) = delete;
// Constructors // Constructors
//- Construct from mesh //- Construct from mesh
@ -116,10 +118,7 @@ public:
// Member Functions // Member Functions
//- Return mesh reference //- Return mesh reference
const faMesh& mesh() const const faMesh& mesh() const noexcept { return mesh_; }
{
return mesh_;
}
//- Return the lnGrad of the given cell field //- Return the lnGrad of the given cell field
// with the given weighting factors // with the given weighting factors
@ -138,10 +137,7 @@ public:
) const = 0; ) const = 0;
//- Return true if this scheme uses an explicit correction //- Return true if this scheme uses an explicit correction
virtual bool corrected() const virtual bool corrected() const { return false; }
{
return false;
}
//- Return the explicit correction to the lnGrad //- Return the explicit correction to the lnGrad
// for the given field // for the given field

View File

@ -26,7 +26,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "lnGradScheme.H" #include "lnGradScheme.H"
#include "HashTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -58,18 +58,21 @@ class uncorrectedLnGrad
: :
public lnGradScheme<Type> public lnGradScheme<Type>
{ {
// Private Member Functions
//- No copy assignment
void operator=(const uncorrectedLnGrad&) = delete;
public: public:
//- Runtime type information //- Runtime type information
TypeName("uncorrected"); TypeName("uncorrected");
// Generated Methods
//- No copy construct
uncorrectedLnGrad(const uncorrectedLnGrad&) = delete;
//- No copy assignment
void operator=(const uncorrectedLnGrad&) = delete;
// Constructors // Constructors
//- Construct from mesh //- Construct from mesh
@ -101,10 +104,7 @@ public:
} }
//- Return true if this scheme uses an explicit correction //- Return true if this scheme uses an explicit correction
virtual bool corrected() const virtual bool corrected() const { return false; }
{
return false;
}
//- Return the explicit correction to the uncorrectedLnGrad //- Return the explicit correction to the uncorrectedLnGrad
//- for the given field //- for the given field

View File

@ -100,14 +100,14 @@ Foam::fac::interpolate
Istream& schemeData Istream& schemeData
) )
{ {
# ifdef DEBUGInterpolations #ifdef DEBUGInterpolations
if (edgeInterpolation::debug) if (edgeInterpolation::debug)
{ {
InfoInFunction InfoInFunction
<< "interpolating GeometricField<Type, faPatchField, areaMesh> " << "interpolating GeometricField<Type, faPatchField, areaMesh> "
<< endl; << endl;
} }
# endif #endif
return scheme<Type>(faceFlux, schemeData)().interpolate(vf); return scheme<Type>(faceFlux, schemeData)().interpolate(vf);
} }
@ -122,7 +122,7 @@ Foam::fac::interpolate
const word& name const word& name
) )
{ {
# ifdef DEBUGInterpolations #ifdef DEBUGInterpolations
if (edgeInterpolation::debug) if (edgeInterpolation::debug)
{ {
InfoInFunction InfoInFunction
@ -130,7 +130,7 @@ Foam::fac::interpolate
<< "using " << name << "using " << name
<< endl; << endl;
} }
# endif #endif
return scheme<Type>(faceFlux, name)().interpolate(vf); return scheme<Type>(faceFlux, name)().interpolate(vf);
} }
@ -199,14 +199,14 @@ Foam::fac::interpolate
Istream& schemeData Istream& schemeData
) )
{ {
# ifdef DEBUGInterpolations #ifdef DEBUGInterpolations
if (edgeInterpolation::debug) if (edgeInterpolation::debug)
{ {
InfoInFunction InfoInFunction
<< "interpolating GeometricField<Type, faPatchField, areaMesh> " << "interpolating GeometricField<Type, faPatchField, areaMesh> "
<< endl; << endl;
} }
# endif #endif
return scheme<Type>(vf.mesh(), schemeData)().interpolate(vf); return scheme<Type>(vf.mesh(), schemeData)().interpolate(vf);
} }
@ -220,7 +220,7 @@ Foam::fac::interpolate
const word& name const word& name
) )
{ {
# ifdef DEBUGInterpolations #ifdef DEBUGInterpolations
if (edgeInterpolation::debug) if (edgeInterpolation::debug)
{ {
InfoInFunction InfoInFunction
@ -228,7 +228,7 @@ Foam::fac::interpolate
<< "using " << name << "using " << name
<< endl; << endl;
} }
# endif #endif
return scheme<Type>(vf.mesh(), name)().interpolate(vf); return scheme<Type>(vf.mesh(), name)().interpolate(vf);
} }
@ -257,7 +257,7 @@ Foam::fac::interpolate
const GeometricField<Type, faPatchField, areaMesh>& vf const GeometricField<Type, faPatchField, areaMesh>& vf
) )
{ {
# ifdef DEBUGInterpolations #ifdef DEBUGInterpolations
if (edgeInterpolation::debug) if (edgeInterpolation::debug)
{ {
InfoInFunction InfoInFunction
@ -265,7 +265,7 @@ Foam::fac::interpolate
<< "using run-time selected scheme" << "using run-time selected scheme"
<< endl; << endl;
} }
# endif #endif
return interpolate(vf, "interpolate(" + vf.name() + ')'); return interpolate(vf, "interpolate(" + vf.name() + ')');
} }

View File

@ -36,7 +36,6 @@ SourceFiles
#ifndef edgeInterpolate_H #ifndef edgeInterpolate_H
#define edgeInterpolate_H #define edgeInterpolate_H
#include "tmp.H"
#include "areaFieldsFwd.H" #include "areaFieldsFwd.H"
#include "edgeFieldsFwd.H" #include "edgeFieldsFwd.H"
#include "edgeInterpolationScheme.H" #include "edgeInterpolationScheme.H"

View File

@ -29,8 +29,6 @@ License
#include "faMesh.H" #include "faMesh.H"
#include "areaFields.H" #include "areaFields.H"
#include "edgeFields.H" #include "edgeFields.H"
#include "demandDrivenData.H"
#include "faPatchFields.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -39,79 +37,55 @@ namespace Foam
defineTypeNameAndDebug(edgeInterpolation, 0); defineTypeNameAndDebug(edgeInterpolation, 0);
} }
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
void Foam::edgeInterpolation::clearOut()
{
deleteDemandDrivenData(lPN_);
deleteDemandDrivenData(weightingFactors_);
deleteDemandDrivenData(differenceFactors_);
deleteDemandDrivenData(correctionVectors_);
deleteDemandDrivenData(skewCorrectionVectors_);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::edgeInterpolation::edgeInterpolation(const faMesh& fam) Foam::edgeInterpolation::edgeInterpolation(const faMesh& fam)
: :
faMesh_(fam), faMesh_(fam),
lPN_(nullptr),
weightingFactors_(nullptr),
differenceFactors_(nullptr),
correctionVectors_(nullptr),
skewCorrectionVectors_(nullptr),
orthogonal_(false), orthogonal_(false),
skew_(true) skew_(true)
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::edgeInterpolation::~edgeInterpolation()
{
clearOut();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::edgeScalarField& Foam::edgeInterpolation::lPN() const const Foam::edgeScalarField& Foam::edgeInterpolation::lPN() const
{ {
if (!lPN_) if (!lPNptr_)
{ {
makeLPN(); makeLPN();
} }
return (*lPN_); return (*lPNptr_);
} }
const Foam::edgeScalarField& Foam::edgeInterpolation::weights() const const Foam::edgeScalarField& Foam::edgeInterpolation::weights() const
{ {
if (!weightingFactors_) if (!weightingFactorsPtr_)
{ {
makeWeights(); makeWeights();
} }
return (*weightingFactors_); return (*weightingFactorsPtr_);
} }
const Foam::edgeScalarField& Foam::edgeInterpolation::deltaCoeffs() const const Foam::edgeScalarField& Foam::edgeInterpolation::deltaCoeffs() const
{ {
if (!differenceFactors_) if (!differenceFactorsPtr_)
{ {
makeDeltaCoeffs(); makeDeltaCoeffs();
} }
return (*differenceFactors_); return (*differenceFactorsPtr_);
} }
bool Foam::edgeInterpolation::orthogonal() const bool Foam::edgeInterpolation::orthogonal() const
{ {
if (orthogonal_ == false && !correctionVectors_) if (orthogonal_ == false && !correctionVectorsPtr_)
{ {
makeCorrectionVectors(); makeCorrectionVectors();
} }
@ -129,13 +103,13 @@ const Foam::edgeVectorField& Foam::edgeInterpolation::correctionVectors() const
<< abort(FatalError); << abort(FatalError);
} }
return (*correctionVectors_); return (*correctionVectorsPtr_);
} }
bool Foam::edgeInterpolation::skew() const bool Foam::edgeInterpolation::skew() const
{ {
if (skew_ == true && !skewCorrectionVectors_) if (skew_ == true && !skewCorrectionVectorsPtr_)
{ {
makeSkewCorrectionVectors(); makeSkewCorrectionVectors();
} }
@ -154,21 +128,21 @@ Foam::edgeInterpolation::skewCorrectionVectors() const
<< abort(FatalError); << abort(FatalError);
} }
return (*skewCorrectionVectors_); return (*skewCorrectionVectorsPtr_);
} }
bool Foam::edgeInterpolation::movePoints() const bool Foam::edgeInterpolation::movePoints() const
{ {
deleteDemandDrivenData(lPN_); lPNptr_.reset(nullptr);
deleteDemandDrivenData(weightingFactors_); weightingFactorsPtr_.reset(nullptr);
deleteDemandDrivenData(differenceFactors_); differenceFactorsPtr_.reset(nullptr);
orthogonal_ = false; orthogonal_ = false;
deleteDemandDrivenData(correctionVectors_); correctionVectorsPtr_.reset(nullptr);
skew_ = true; skew_ = true;
deleteDemandDrivenData(skewCorrectionVectors_); skewCorrectionVectorsPtr_.reset(nullptr);
return true; return true;
} }
@ -180,14 +154,14 @@ const Foam::vector& Foam::edgeInterpolation::skewCorr(const label edgeI) const
return return
( (
skewCorrectionVectors_ skewCorrectionVectorsPtr_
? (*skewCorrectionVectors_)[edgeI] ? (*skewCorrectionVectorsPtr_)[edgeI]
: pTraits<vector>::zero : pTraits<vector>::zero
); );
#else #else
return (*skewCorrectionVectors_)[edgeI]; return (*skewCorrectionVectorsPtr_)[edgeI];
#endif #endif
} }
@ -200,7 +174,7 @@ void Foam::edgeInterpolation::makeLPN() const
<< endl; << endl;
lPN_ = new edgeScalarField lPNptr_ = std::make_unique<edgeScalarField>
( (
IOobject IOobject
( (
@ -214,7 +188,7 @@ void Foam::edgeInterpolation::makeLPN() const
mesh(), mesh(),
dimLength dimLength
); );
edgeScalarField& lPN = *lPN_; edgeScalarField& lPN = *lPNptr_;
// Set local references to mesh data // Set local references to mesh data
const edgeVectorField& edgeCentres = mesh().edgeCentres(); const edgeVectorField& edgeCentres = mesh().edgeCentres();
@ -281,7 +255,7 @@ void Foam::edgeInterpolation::makeWeights() const
<< endl; << endl;
weightingFactors_ = new edgeScalarField weightingFactorsPtr_ = std::make_unique<edgeScalarField>
( (
IOobject IOobject
( (
@ -295,7 +269,7 @@ void Foam::edgeInterpolation::makeWeights() const
mesh(), mesh(),
dimensionedScalar(dimless, 1) dimensionedScalar(dimless, 1)
); );
edgeScalarField& weightingFactors = *weightingFactors_; edgeScalarField& weightingFactors = *weightingFactorsPtr_;
// Set local references to mesh data // Set local references to mesh data
@ -361,11 +335,11 @@ void Foam::edgeInterpolation::makeDeltaCoeffs() const
// needed to make sure deltaCoeffs are calculated for parallel runs. // needed to make sure deltaCoeffs are calculated for parallel runs.
weights(); weights();
differenceFactors_ = new edgeScalarField differenceFactorsPtr_ = std::make_unique<edgeScalarField>
( (
IOobject IOobject
( (
"differenceFactors_", "differenceFactors",
mesh().pointsInstance(), mesh().pointsInstance(),
mesh().thisDb(), mesh().thisDb(),
IOobject::NO_READ, IOobject::NO_READ,
@ -375,7 +349,7 @@ void Foam::edgeInterpolation::makeDeltaCoeffs() const
mesh(), mesh(),
dimensionedScalar(dimless/dimLength, SMALL) dimensionedScalar(dimless/dimLength, SMALL)
); );
edgeScalarField& DeltaCoeffs = *differenceFactors_; edgeScalarField& DeltaCoeffs = *differenceFactorsPtr_;
scalarField& dc = DeltaCoeffs.primitiveFieldRef(); scalarField& dc = DeltaCoeffs.primitiveFieldRef();
// Set local references to mesh data // Set local references to mesh data
@ -455,7 +429,7 @@ void Foam::edgeInterpolation::makeCorrectionVectors() const
<< "Constructing non-orthogonal correction vectors" << "Constructing non-orthogonal correction vectors"
<< endl; << endl;
correctionVectors_ = new edgeVectorField correctionVectorsPtr_ = std::make_unique<edgeVectorField>
( (
IOobject IOobject
( (
@ -469,7 +443,7 @@ void Foam::edgeInterpolation::makeCorrectionVectors() const
mesh(), mesh(),
dimless dimless
); );
edgeVectorField& CorrVecs = *correctionVectors_; edgeVectorField& CorrVecs = *correctionVectorsPtr_;
// Set local references to mesh data // Set local references to mesh data
const areaVectorField& faceCentres = mesh().areaCentres(); const areaVectorField& faceCentres = mesh().areaCentres();
@ -543,7 +517,7 @@ void Foam::edgeInterpolation::makeCorrectionVectors() const
if (NonOrthogCoeff < 0.1) if (NonOrthogCoeff < 0.1)
{ {
orthogonal_ = true; orthogonal_ = true;
deleteDemandDrivenData(correctionVectors_); correctionVectorsPtr_.reset(nullptr);
} }
else else
{ {
@ -562,7 +536,7 @@ void Foam::edgeInterpolation::makeSkewCorrectionVectors() const
<< "Constructing skew correction vectors" << "Constructing skew correction vectors"
<< endl; << endl;
skewCorrectionVectors_ = new edgeVectorField skewCorrectionVectorsPtr_ = std::make_unique<edgeVectorField>
( (
IOobject IOobject
( (
@ -576,7 +550,7 @@ void Foam::edgeInterpolation::makeSkewCorrectionVectors() const
mesh(), mesh(),
dimensionedVector(dimless, Zero) dimensionedVector(dimless, Zero)
); );
edgeVectorField& SkewCorrVecs = *skewCorrectionVectors_; edgeVectorField& SkewCorrVecs = *skewCorrectionVectorsPtr_;
// Set local references to mesh data // Set local references to mesh data
const areaVectorField& C = mesh().areaCentres(); const areaVectorField& C = mesh().areaCentres();
@ -700,12 +674,12 @@ void Foam::edgeInterpolation::makeSkewCorrectionVectors() const
if (skewCoeff < maxSkewRatio) if (skewCoeff < maxSkewRatio)
{ {
deleteDemandDrivenData(skewCorrectionVectors_); skewCorrectionVectorsPtr_.reset(nullptr);
} }
#endif #endif
skew_ = bool(skewCorrectionVectors_); skew_ = bool(skewCorrectionVectorsPtr_);
DebugInFunction DebugInFunction

View File

@ -42,11 +42,8 @@ SourceFiles
#ifndef Foam_edgeInterpolation_H #ifndef Foam_edgeInterpolation_H
#define Foam_edgeInterpolation_H #define Foam_edgeInterpolation_H
#include "tmp.H"
#include "scalar.H"
#include "areaFieldsFwd.H" #include "areaFieldsFwd.H"
#include "edgeFieldsFwd.H" #include "edgeFieldsFwd.H"
#include "className.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -71,19 +68,19 @@ class edgeInterpolation
// Demand-driven data // Demand-driven data
//- Geodesic distance between centroids of neighbour finite areas //- Geodesic distance between centroids of neighbour finite areas
mutable edgeScalarField* lPN_; mutable std::unique_ptr<edgeScalarField> lPNptr_;
//- Central-differencing weighting factors //- Central-differencing weighting factors
mutable edgeScalarField* weightingFactors_; mutable std::unique_ptr<edgeScalarField> weightingFactorsPtr_;
//- Face-gradient difference factors //- Face-gradient difference factors
mutable edgeScalarField* differenceFactors_; mutable std::unique_ptr<edgeScalarField> differenceFactorsPtr_;
//- Non-orthogonality correction vectors //- Non-orthogonality correction vectors
mutable edgeVectorField* correctionVectors_; mutable std::unique_ptr<edgeVectorField> correctionVectorsPtr_;
//- Skew correction vectors //- Skew correction vectors
mutable edgeVectorField* skewCorrectionVectors_; mutable std::unique_ptr<edgeVectorField> skewCorrectionVectorsPtr_;
//- Is mesh orthogonal //- Is mesh orthogonal
mutable bool orthogonal_; mutable bool orthogonal_;
@ -113,22 +110,21 @@ class edgeInterpolation
void makeSkewCorrectionVectors() const; void makeSkewCorrectionVectors() const;
protected:
// Protected Member Functions
// Storage Management
//- Clear all geometry and addressing
void clearOut();
public: public:
// Declare name of the class and it's debug switch // Declare name of the class and it's debug switch
ClassName("edgeInterpolation"); ClassName("edgeInterpolation");
// Generated Methods
//- No copy construct
edgeInterpolation(const edgeInterpolation&) = delete;
//- No copy assignment
void operator=(const edgeInterpolation&) = delete;
// Constructors // Constructors
//- Construct given an faMesh //- Construct given an faMesh
@ -136,16 +132,13 @@ public:
//- Destructor //- Destructor
~edgeInterpolation(); ~edgeInterpolation() = default;
// Member Functions // Member Functions
//- Return mesh reference //- Return mesh reference
const faMesh& mesh() const noexcept const faMesh& mesh() const noexcept { return faMesh_; }
{
return faMesh_;
}
//- Return reference to PN geodesic distance //- Return reference to PN geodesic distance
const edgeScalarField& lPN() const; const edgeScalarField& lPN() const;
@ -178,7 +171,7 @@ public:
// Storage Management // Storage Management
//- True if weights exist //- True if weights exist
bool hasWeights() const noexcept { return bool(weightingFactors_); } bool hasWeights() const noexcept { return bool(weightingFactorsPtr_); }
}; };

View File

@ -29,9 +29,7 @@ License
#include "edgeInterpolationScheme.H" #include "edgeInterpolationScheme.H"
#include "areaFields.H" #include "areaFields.H"
#include "edgeFields.H" #include "edgeFields.H"
#include "faPatchFields.H"
#include "coupledFaPatchField.H" #include "coupledFaPatchField.H"
#include "transform.H"
// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * //

View File

@ -37,10 +37,8 @@ SourceFiles
#ifndef edgeInterpolationScheme_H #ifndef edgeInterpolationScheme_H
#define edgeInterpolationScheme_H #define edgeInterpolationScheme_H
#include "tmp.H"
#include "areaFieldsFwd.H" #include "areaFieldsFwd.H"
#include "edgeFieldsFwd.H" #include "edgeFieldsFwd.H"
#include "typeInfo.H"
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -59,18 +57,12 @@ class edgeInterpolationScheme
: :
public refCount public refCount
{ {
// Private data // Private Data
//- Hold reference to mesh //- Reference to mesh
const faMesh& mesh_; const faMesh& mesh_;
// Private Member Functions
//- No copy assignment
void operator=(const edgeInterpolationScheme&) = delete;
public: public:
// Declare run-time constructor selection tables // Declare run-time constructor selection tables
@ -101,6 +93,15 @@ public:
); );
// Private Member Functions
//- No copy construct
edgeInterpolationScheme(const edgeInterpolationScheme&) = delete;
//- No copy assignment
void operator=(const edgeInterpolationScheme&) = delete;
// Constructors // Constructors
//- Construct from mesh //- Construct from mesh
@ -179,10 +180,7 @@ public:
) const = 0; ) const = 0;
//- Return true if this scheme uses an explicit correction //- Return true if this scheme uses an explicit correction
virtual bool corrected() const virtual bool corrected() const { return false; }
{
return false;
}
//- Return the explicit correction to the face-interpolate //- Return the explicit correction to the face-interpolate
// for the given field // for the given field

View File

@ -54,7 +54,11 @@ namespace Foam
class GammaWeight class GammaWeight
{ {
scalar k_; // Private Data
//- Model coefficient [0,1]
scalar k_;
public: public:
@ -72,7 +76,7 @@ public:
// Rescale k_ to be >= 0 and <= 0.5 (TVD conformant) // Rescale k_ to be >= 0 and <= 0.5 (TVD conformant)
// and avoid the /0 when k_ = 0 // and avoid the /0 when k_ = 0
k_ = max(k_/2.0, SMALL); k_ = max(0.5*k_, SMALL);
} }
@ -87,30 +91,19 @@ public:
const vector& d const vector& d
) const ) const
{ {
scalar magd = mag(d); const vector dHat(normalised(d));
vector dHat = d/mag(d);
scalar gradf = (phiN - phiP)/magd; // Choose gradc based on faceFlux
const vector& gradcPN = (faceFlux > 0) ? gradcP : gradcN;
scalar gradcf; const scalar udWeight = (faceFlux > 0) ? 1 : 0;
scalar udWeight;
if (faceFlux > 0)
{
gradcf = dHat & gradcP;
udWeight = 1;
}
else
{
gradcf = dHat & gradcN;
udWeight = 0;
}
// Stabilise for division // Stabilise for division
gradcf = stabilise(gradcf, SMALL); const scalar gradcf = stabilise(dHat & gradcPN, SMALL);
scalar phict = 1 - 0.5*gradf/gradcf; const scalar gradf = (phiN - phiP)/mag(d);
scalar limiter = clamp(phict/k_, zero_one{});
const scalar phict = 1 - 0.5*gradf/gradcf;
const scalar limiter = clamp(phict/k_, zero_one{});
return lerp(udWeight, cdWeight, limiter); return lerp(udWeight, cdWeight, limiter);
} }

View File

@ -72,14 +72,6 @@ protected:
const edgeScalarField& edgeFlux_; const edgeScalarField& edgeFlux_;
// Protected Member Functions
//- No copy construct
faNVDscheme(const faNVDscheme&) = delete;
//- No copy assignment
void operator=(const faNVDscheme&) = delete;
public: public:
@ -91,6 +83,15 @@ public:
TypeName("faNVDscheme"); TypeName("faNVDscheme");
// Generated Methods
//- No copy construct
faNVDscheme(const faNVDscheme&) = delete;
//- No copy assignment
void operator=(const faNVDscheme&) = delete;
// Constructors // Constructors
//- Construct from mesh and edgeFlux and blendingFactor //- Construct from mesh and edgeFlux and blendingFactor

Some files were not shown because too many files have changed in this diff Show More