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()
);
deleteDemandDrivenData
(
pEqnComps[phasei].faceFluxCorrectionPtr()
);
pEqnComps[phasei].faceFluxCorrectionPtr(nullptr);
pEqnComps[phasei].relax();
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -46,10 +46,6 @@ Author
#include "areaFields.H"
#include "edgeFields.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_;
//- Face flux field for non-orthogonal correction
mutable faceFluxFieldType* faceFluxCorrectionPtr_;
mutable std::unique_ptr<faceFluxFieldType> faceFluxCorrectionPtr_;
protected:
@ -357,8 +353,7 @@ public:
}
//- Declare return type of the faceFluxCorrectionPtr() function
typedef GeometricField<Type, faePatchField, edgeMesh>
*faceFluxFieldPtrType;
typedef std::unique_ptr<faceFluxFieldType> faceFluxFieldPtrType;
//- Return pointer to face-flux non-orthogonal correction field
faceFluxFieldPtrType& faceFluxCorrectionPtr()
@ -366,6 +361,12 @@ public:
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
bool hasFaceFluxCorrection() const noexcept
{

View File

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

View File

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

View File

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

View File

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

View File

@ -261,52 +261,53 @@ class faMesh
mutable std::unique_ptr<List<labelPair>> bndConnectPtr_;
//- Ldu addressing data
mutable faMeshLduAddressing* lduPtr_;
mutable std::unique_ptr<faMeshLduAddressing> lduPtr_;
// Geometric Data
//- Face areas
mutable DimensionedField<scalar, areaMesh>* SPtr_;
mutable std::unique_ptr<DimensionedField<scalar, areaMesh>> SPtr_;
//- Face areas old time level
mutable DimensionedField<scalar, areaMesh>* S0Ptr_;
mutable std::unique_ptr<DimensionedField<scalar, areaMesh>> S0Ptr_;
//- 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
mutable labelList* patchStartsPtr_;
mutable std::unique_ptr<labelList> patchStartsPtr_;
//- Edge length vectors
mutable edgeVectorField* LePtr_;
mutable std::unique_ptr<edgeVectorField> LePtr_;
//- Mag edge length vectors
mutable edgeScalarField* magLePtr_;
mutable std::unique_ptr<edgeScalarField> magLePtr_;
//- Face centres
mutable areaVectorField* faceCentresPtr_;
mutable std::unique_ptr<areaVectorField> faceCentresPtr_;
//- Edge centres
mutable edgeVectorField* edgeCentresPtr_;
mutable std::unique_ptr<edgeVectorField> edgeCentresPtr_;
//- Face area normals
mutable areaVectorField* faceAreaNormalsPtr_;
mutable std::unique_ptr<areaVectorField> faceAreaNormalsPtr_;
//- Edge area normals
mutable edgeVectorField* edgeAreaNormalsPtr_;
mutable std::unique_ptr<edgeVectorField> edgeAreaNormalsPtr_;
//- Point area normals
mutable std::unique_ptr<vectorField> pointAreaNormalsPtr_;
//- Face curvatures
mutable areaScalarField* faceCurvaturesPtr_;
mutable std::unique_ptr<areaScalarField> faceCurvaturesPtr_;
//- 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
mutable boolList* correctPatchPointNormalsPtr_;
mutable std::unique_ptr<boolList> correctPatchPointNormalsPtr_;
// Other mesh-related data
@ -332,12 +333,6 @@ class faMesh
// 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.
// No communication
void initPatch() const;
@ -524,6 +519,15 @@ public:
static word meshSubDir;
// Generated Methods
//- No copy construct
faMesh(const faMesh&) = delete;
//- No copy assignment
void operator=(const faMesh&) = delete;
// Constructors
//- Read construct from polyMesh, using its IOobject properties

View File

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

View File

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

View File

@ -61,10 +61,18 @@ void Foam::faAreaMapper::calcAddressing() const
// Prepare a list of new face labels and (preliminary) addressing
// Note: dimensioned to number of boundary faces of polyMesh
newFaceLabelsPtr_ = new labelList(mesh_.mesh().nBoundaryFaces(), -1);
labelList& newFaceLabels = *newFaceLabelsPtr_;
newFaceLabelsPtr_ = std::make_unique<labelList>
(
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_;
label nNewFaces = 0;
@ -94,7 +102,7 @@ void Foam::faAreaMapper::calcAddressing() const
// Direct mapping: no further faces to add. Resize list
newFaceLabels.setSize(nNewFaces);
directAddrPtr_ = new labelList(newFaceLabels.size());
directAddrPtr_ = std::make_unique<labelList>(newFaceLabels.size());
labelList& addr = *directAddrPtr_;
// 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
// and weights to full size
interpolationAddrPtr_ = new labelListList(newFaceLabels.size());
interpolationAddrPtr_ = std::make_unique<labelListList>
(
newFaceLabels.size()
);
labelListList& addr = *interpolationAddrPtr_;
weightsPtr_ = new scalarListList(newFaceLabels.size());
weightsPtr_ = std::make_unique<scalarListList>(newFaceLabels.size());
scalarListList& w = *weightsPtr_;
// 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
// HJ, 10/Aug/2011
insertedObjectLabelsPtr_ = new labelList(0);
insertedObjectLabelsPtr_ = std::make_unique<labelList>();
}
void Foam::faAreaMapper::clearOut()
{
deleteDemandDrivenData(newFaceLabelsPtr_);
deleteDemandDrivenData(newFaceLabelsMapPtr_);
newFaceLabelsPtr_.reset(nullptr);
newFaceLabelsMapPtr_.reset(nullptr);
deleteDemandDrivenData(directAddrPtr_);
deleteDemandDrivenData(interpolationAddrPtr_);
deleteDemandDrivenData(weightsPtr_);
directAddrPtr_.reset(nullptr);
interpolationAddrPtr_.reset(nullptr);
weightsPtr_.reset(nullptr);
deleteDemandDrivenData(insertedObjectLabelsPtr_);
insertedObjectLabelsPtr_.reset(nullptr);
hasUnmapped_ = false;
}
@ -286,13 +297,7 @@ Foam::faAreaMapper::faAreaMapper
mpm_(mpm),
direct_(false),
hasUnmapped_(false),
sizeBeforeMapping_(mesh.nFaces()),
newFaceLabelsPtr_(nullptr),
newFaceLabelsMapPtr_(nullptr),
directAddrPtr_(nullptr),
interpolationAddrPtr_(nullptr),
weightsPtr_(nullptr),
insertedObjectLabelsPtr_(nullptr)
sizeBeforeMapping_(mesh.nFaces())
{
// Check for possibility of direct mapping
if

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -105,10 +105,7 @@ Foam::faPatch::faPatch
patchIdentifier(name, index),
labelList(edgeLabels),
nbrPolyPatchId_(nbrPolyPatchi),
boundaryMesh_(bm),
edgeFacesPtr_(nullptr),
pointLabelsPtr_(nullptr),
pointEdgesPtr_(nullptr)
boundaryMesh_(bm)
{
if (constraintType(patchType))
{
@ -129,10 +126,7 @@ Foam::faPatch::faPatch
patchIdentifier(name, dict, index),
labelList(dict.get<labelList>("edgeLabels")),
nbrPolyPatchId_(dict.get<label>("ngbPolyPatchIndex")),
boundaryMesh_(bm),
edgeFacesPtr_(nullptr),
pointLabelsPtr_(nullptr),
pointEdgesPtr_(nullptr)
boundaryMesh_(bm)
{
if (constraintType(patchType))
{
@ -153,10 +147,7 @@ Foam::faPatch::faPatch
patchIdentifier(p, index),
labelList(edgeLabels),
nbrPolyPatchId_(p.nbrPolyPatchId_),
boundaryMesh_(bm),
edgeFacesPtr_(nullptr),
pointLabelsPtr_(nullptr),
pointEdgesPtr_(nullptr)
boundaryMesh_(bm)
{}
@ -331,7 +322,7 @@ void Foam::faPatch::calcPointLabels() const
}
// 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_;
///
@ -381,7 +372,7 @@ void Foam::faPatch::calcPointEdges() const
}
// Flatten to regular list
pointEdgesPtr_.reset(new labelListList(edgePoints.size()));
pointEdgesPtr_ = std::make_unique<labelListList>(edgePoints.size());
auto& pEdges = *pointEdgesPtr_;
forAll(pEdges, pointi)
@ -441,12 +432,9 @@ const Foam::labelUList& Foam::faPatch::edgeFaces() const
{
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
{
vectorField unitDelta(delta()/mag(delta()));
vectorField edgeNormMag(edgeNormals()/mag(edgeNormals()));
scalarField dn(edgeNormals() & delta());
const vectorField unitDelta(delta()/mag(delta()));
k = edgeNormMag - (scalar(1)/(unitDelta & edgeNormMag))*unitDelta;
k = edgeNormals() - (scalar(1)/(unitDelta & edgeNormals()))*unitDelta;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -48,16 +48,13 @@ steadyStateFaDdtScheme<Type>::facDdt
const dimensioned<Type> dt
)
{
return tmp<GeometricField<Type, faPatchField, areaMesh>>::New
return GeometricField<Type, faPatchField, areaMesh>::New
(
IOobject
(
"ddt("+dt.name()+')',
mesh().time().timeName(),
mesh().thisDb()
),
"ddt("+dt.name()+')',
IOobject::REGISTER,
mesh(),
dimensioned<Type>(dt.dimensions()/dimTime, Zero)
Foam::zero{},
dt.dimensions()/dimTime
);
}
@ -69,16 +66,13 @@ steadyStateFaDdtScheme<Type>::facDdt0
const dimensioned<Type> dt
)
{
return tmp<GeometricField<Type, faPatchField, areaMesh>>::New
return GeometricField<Type, faPatchField, areaMesh>::New
(
IOobject
(
"ddt("+dt.name()+')',
mesh().time().timeName(),
mesh().thisDb()
),
"ddt("+dt.name()+')',
IOobject::REGISTER,
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
)
{
return tmp<GeometricField<Type, faPatchField, areaMesh>>::New
return GeometricField<Type, faPatchField, areaMesh>::New
(
IOobject
(
"ddt("+vf.name()+')',
mesh().time().timeName(),
mesh().thisDb()
),
"ddt("+vf.name()+')',
IOobject::REGISTER,
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
)
{
return tmp<GeometricField<Type, faPatchField, areaMesh>>::New
return GeometricField<Type, faPatchField, areaMesh>::New
(
IOobject
(
"ddt0("+vf.name()+')',
mesh().time().timeName(),
mesh().thisDb()
),
"ddt0("+vf.name()+')',
IOobject::REGISTER,
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
)
{
return tmp<GeometricField<Type, faPatchField, areaMesh>>::New
return GeometricField<Type, faPatchField, areaMesh>::New
(
IOobject
(
"ddt("+rho.name()+','+vf.name()+')',
mesh().time().timeName(),
mesh().thisDb()
),
"ddt("+rho.name()+','+vf.name()+')',
IOobject::REGISTER,
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
)
{
return tmp<GeometricField<Type, faPatchField, areaMesh>>::New
return GeometricField<Type, faPatchField, areaMesh>::New
(
IOobject
(
"ddt0("+rho.name()+','+vf.name()+')',
mesh().time().timeName(),
mesh().thisDb()
),
"ddt0("+rho.name()+','+vf.name()+')',
IOobject::REGISTER,
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
)
{
return tmp<GeometricField<Type, faPatchField, areaMesh>>::New
return GeometricField<Type, faPatchField, areaMesh>::New
(
IOobject
(
"ddt("+rho.name()+','+vf.name()+')',
mesh().time().timeName(),
mesh().thisDb()
),
"ddt("+rho.name()+','+vf.name()+')',
IOobject::REGISTER,
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
)
{
return tmp<GeometricField<Type, faPatchField, areaMesh>>::New
return GeometricField<Type, faPatchField, areaMesh>::New
(
IOobject
(
"ddt0("+rho.name()+','+vf.name()+')',
mesh().time().timeName(),
mesh().thisDb()
),
"ddt0("+rho.name()+','+vf.name()+')',
IOobject::REGISTER,
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>
{
// Private Member Functions
public:
//- Runtime type information
TypeName("steadyState");
// Generated Methods
//- No copy construct
steadyStateFaDdtScheme(const steadyStateFaDdtScheme&) = delete;
@ -67,12 +73,6 @@ class steadyStateFaDdtScheme
void operator=(const steadyStateFaDdtScheme&) = delete;
public:
//- Runtime type information
TypeName("steadyState");
// Constructors
//- Construct from mesh

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -39,17 +39,15 @@ SourceFiles
#ifndef faGradScheme_H
#define faGradScheme_H
#include "tmp.H"
#include "areaFieldsFwd.H"
#include "edgeFieldsFwd.H"
#include "typeInfo.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward Declarations
class faMesh;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -66,20 +64,12 @@ class gradScheme
:
public refCount
{
// Private data
// Private Data
//- Reference to mesh
const faMesh& mesh_;
// Private Member Functions
//- No copy construct
gradScheme(const gradScheme&) = delete;
//- No copy assignment
void operator=(const gradScheme&) = delete;
public:
// 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
//- Construct from mesh
@ -120,7 +119,7 @@ public:
// Member Functions
//- 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.
// Used by grad either to recalculate the cached gradient when it is

View File

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

View File

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

View File

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

View File

@ -29,11 +29,6 @@ License
#include "leastSquaresFaGrad.H"
#include "leastSquaresFaVectors.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)
{
label ownEdgeI = own[edgei];
label neiEdgeI = nei[edgei];
const label ownEdgeI = own[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[neiEdgeI] -= neiLs[edgei]*deltaVsf;
@ -108,35 +103,23 @@ leastSquaresFaGrad<Type>::calcGrad
// Boundary edges
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 =
lsGrad.boundaryField()[patchi].patch().edgeFaces();
if (vsf.boundaryField()[patchi].coupled())
forAll(vsfp, pEdgei)
{
Field<Type> neiVsf
(
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]]);
}
lsGrad[edgeFaces[pEdgei]] +=
ownLsp[pEdgei]*(vsfp[pEdgei] - vsf[edgeFaces[pEdgei]]);
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -28,11 +28,6 @@ License
#include "edgeLimitedFaGrad.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 edgeVectorField& Cf = mesh.edgeCentres();
// create limiter
// Create limiter field
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)
{
label own = owner[edgei];
label nei = neighbour[edgei];
const label own = owner[edgei];
const label nei = neighbour[edgei];
scalar vsfOwn = vsf[own];
scalar vsfNei = vsf[nei];
const scalar vsfOwn = vsf[own];
const scalar vsfNei = vsf[nei];
scalar maxEdge = max(vsfOwn, vsfNei);
scalar minEdge = min(vsfOwn, vsfNei);
scalar maxMinEdge = rk*(maxEdge - minEdge);
const scalar maxMinEdge = rk*(maxEdge - minEdge);
maxEdge += maxMinEdge;
minEdge -= maxMinEdge;
@ -119,7 +114,8 @@ tmp<areaVectorField> edgeLimitedGrad<scalar>::calcGrad
limitEdge
(
limiter[own],
maxEdge - vsfOwn, minEdge - vsfOwn,
maxEdge - vsfOwn,
minEdge - vsfOwn,
(Cf[edgei] - C[own]) & g[own]
);
@ -127,67 +123,53 @@ tmp<areaVectorField> edgeLimitedGrad<scalar>::calcGrad
limitEdge
(
limiter[nei],
maxEdge - vsfNei, minEdge - vsfNei,
maxEdge - vsfNei,
minEdge - vsfNei,
(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)
{
const faPatchScalarField& psf = bsf[patchi];
const labelUList& pOwner = mesh.boundary()[patchi].edgeFaces();
const vectorField& pCf = Cf.boundaryField()[patchi];
if (psf.coupled())
{
const scalarField psfNei(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]
);
}
updateLimiter(patchi, psf.patchNeighbourField());
}
else if (psf.fixesValue())
{
forAll(pOwner, pEdgei)
{
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]
);
}
updateLimiter(patchi, psf);
}
}
@ -231,35 +213,33 @@ tmp<areaTensorField> edgeLimitedGrad<vector>::calcGrad
const areaVectorField& C = mesh.areaCentres();
const edgeVectorField& Cf = mesh.edgeCentres();
// create limiter
// Create limiter
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)
{
label own = owner[edgei];
label nei = neighbour[edgei];
vector vvfOwn = vvf[own];
vector vvfNei = vvf[nei];
const label own = owner[edgei];
const label nei = neighbour[edgei];
// owner side
vector gradf = (Cf[edgei] - C[own]) & g[own];
vector gradf((Cf[edgei] - C[own]) & g[own]);
scalar vsfOwn = gradf & vvfOwn;
scalar vsfNei = gradf & vvfNei;
scalar vsfOwn = gradf & vvf[own];
scalar vsfNei = gradf & vvf[nei];
scalar maxEdge = max(vsfOwn, vsfNei);
scalar minEdge = min(vsfOwn, vsfNei);
scalar maxMinEdge = rk*(maxEdge - minEdge);
const scalar maxMinEdge = rk*(maxEdge - minEdge);
maxEdge += maxMinEdge;
minEdge -= maxMinEdge;
limitEdge
(
limiter[own],
maxEdge - vsfOwn, minEdge - vsfOwn,
maxEdge - vsfOwn,
minEdge - vsfOwn,
magSqr(gradf)
);
@ -267,8 +247,8 @@ tmp<areaTensorField> edgeLimitedGrad<vector>::calcGrad
// neighbour side
gradf = (Cf[edgei] - C[nei]) & g[nei];
vsfOwn = gradf & vvfOwn;
vsfNei = gradf & vvfNei;
vsfOwn = gradf & vvf[own];
vsfNei = gradf & vvf[nei];
maxEdge = max(vsfOwn, vsfNei);
minEdge = min(vsfOwn, vsfNei);
@ -276,78 +256,57 @@ tmp<areaTensorField> edgeLimitedGrad<vector>::calcGrad
limitEdge
(
limiter[nei],
maxEdge - vsfNei, minEdge - vsfNei,
maxEdge - vsfNei,
minEdge - vsfNei,
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)
{
const faPatchVectorField& psf = bvf[patchi];
const labelUList& pOwner = mesh.boundary()[patchi].edgeFaces();
const vectorField& pCf = Cf.boundaryField()[patchi];
if (psf.coupled())
{
const vectorField psfNei(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)
);
}
updateLimiter(patchi, psf.patchNeighbourField());
}
else if (psf.fixesValue())
{
forAll(pOwner, pEdgei)
{
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)
);
}
updateLimiter(patchi, psf);
}
}

View File

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

View File

@ -28,11 +28,6 @@ License
#include "faceLimitedFaGrad.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)
{
label own = owner[facei];
label nei = neighbour[facei];
const label own = owner[facei];
const label nei = neighbour[facei];
scalar vsfOwn = vsf[own];
scalar vsfNei = vsf[nei];
const scalar vsfOwn = vsf[own];
const scalar vsfNei = vsf[nei];
maxVsf[own] = max(maxVsf[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)
{
const faPatchScalarField& psf = bsf[patchi];
const labelUList& pOwner = mesh.boundary()[patchi].edgeFaces();
if (psf.coupled())
{
scalarField psfNei(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);
}
updateLimiter(patchi, psf.patchNeighbourField());
}
else
{
forAll(pOwner, pFacei)
{
label own = pOwner[pFacei];
scalar vsfNei = psf[pFacei];
maxVsf[own] = max(maxVsf[own], vsfNei);
minVsf[own] = min(minVsf[own], vsfNei);
}
updateLimiter(patchi, psf);
}
}
@ -176,19 +167,19 @@ tmp<areaVectorField> faceLimitedGrad<scalar>::calcGrad
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;
minVsf -= maxMinVsf;
}
// create limiter
// Create limiter
scalarField limiter(vsf.internalField().size(), 1.0);
forAll(owner, facei)
{
label own = owner[facei];
label nei = neighbour[facei];
const label own = owner[facei];
const label nei = neighbour[facei];
// owner side
limitEdge
@ -216,7 +207,7 @@ tmp<areaVectorField> faceLimitedGrad<scalar>::calcGrad
forAll(pOwner, pFacei)
{
label own = pOwner[pFacei];
const label own = pOwner[pFacei];
limitEdge
(
@ -273,8 +264,8 @@ tmp<areaTensorField> faceLimitedGrad<vector>::calcGrad
forAll(owner, facei)
{
label own = owner[facei];
label nei = neighbour[facei];
const label own = owner[facei];
const label nei = neighbour[facei];
const vector& vsfOwn = vsf[own];
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)
{
const faPatchVectorField& psf = bsf[patchi];
const labelUList& pOwner = mesh.boundary()[patchi].edgeFaces();
if (psf.coupled())
{
vectorField psfNei(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);
}
updateLimiter(patchi, psf.patchNeighbourField());
}
else
{
forAll(pOwner, pFacei)
{
label own = pOwner[pFacei];
const vector& vsfNei = psf[pFacei];
maxVsf[own] = max(maxVsf[own], vsfNei);
minVsf[own] = min(minVsf[own], vsfNei);
}
updateLimiter(patchi, psf);
}
}
@ -325,7 +313,7 @@ tmp<areaTensorField> faceLimitedGrad<vector>::calcGrad
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;
minVsf -= maxMinVsf;
@ -334,13 +322,13 @@ tmp<areaTensorField> faceLimitedGrad<vector>::calcGrad
}
// create limiter
// Create limiter
vectorField limiter(vsf.internalField().size(), vector::one);
forAll(owner, facei)
{
label own = owner[facei];
label nei = neighbour[facei];
const label own = owner[facei];
const label nei = neighbour[facei];
// owner side
limitEdge
@ -368,7 +356,7 @@ tmp<areaTensorField> faceLimitedGrad<vector>::calcGrad
forAll(pOwner, pFacei)
{
label own = pOwner[pFacei];
const label own = pOwner[pFacei];
limitEdge
(

View File

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

View File

@ -38,12 +38,9 @@ SourceFiles
#ifndef Foam_faLaplacianScheme_H
#define Foam_faLaplacianScheme_H
#include "tmp.H"
#include "areaFieldsFwd.H"
#include "edgeFieldsFwd.H"
#include "linearEdgeInterpolation.H"
#include "correctedLnGrad.H"
#include "typeInfo.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -79,15 +76,6 @@ protected:
tmp<lnGradScheme<Type>> tlnGradScheme_;
// Private Member Functions
//- No copy construct
laplacianScheme(const laplacianScheme&) = delete;
//- No copy assignment
void operator=(const laplacianScheme&) = delete;
public:
// 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
//- Construct from mesh

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -72,7 +72,7 @@ limitedLnGrad<Type>::correction
(1 - limitCoeff_)*mag(corr)
+ 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>
{
// Private data
// Private Data
//- Limiter. 0 = no limiting, 1 = full limiting
scalar limitCoeff_;
// Private Member Functions
//- No copy assignment
void operator=(const limitedLnGrad&) = delete;
public:
//- Runtime type information
TypeName("limited");
// Generated Methods
//- No copy construct
limitedLnGrad(const limitedLnGrad&) = delete;
//- No copy assignment
void operator=(const limitedLnGrad&) = delete;
// Constructors
//- Construct from mesh

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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