Commit 2728a96b authored by Andrew Heather's avatar Andrew Heather
Browse files

ENH: finiteArea - faMesh now derived from faSolution, faSchemes and data classes

parent f385e3b9
......@@ -155,4 +155,4 @@
dimensionedScalar("one", dimless, 0.01)
);
aMesh.schemesDict().setFluxRequired("h");
aMesh.setFluxRequired("h");
......@@ -532,9 +532,9 @@ void Foam::faMatrix<Type>::relax(const scalar alpha)
template<class Type>
void Foam::faMatrix<Type>::relax()
{
if (psi_.mesh().solutionDict().relaxEquation(psi_.name()))
if (psi_.mesh().relaxEquation(psi_.name()))
{
relax(psi_.mesh().solutionDict().equationRelaxationFactor(psi_.name()));
relax(psi_.mesh().equationRelaxationFactor(psi_.name()));
}
else
{
......@@ -628,7 +628,7 @@ template<class Type>
Foam::tmp<Foam::GeometricField<Type, Foam::faePatchField, Foam::edgeMesh>>
Foam::faMatrix<Type>::flux() const
{
if (!psi_.mesh().schemesDict().fluxRequired(psi_.name()))
if (!psi_.mesh().fluxRequired(psi_.name()))
{
FatalErrorInFunction
<< "flux requested but " << psi_.name()
......
......@@ -143,6 +143,8 @@ Foam::SolverPerformance<Type> Foam::faMatrix<Type>::solve
psi.correctBoundaryConditions();
psi.mesh().setSolverPerformance(psi.name(), solverPerfVec);
return solverPerfVec;
}
......@@ -150,26 +152,14 @@ Foam::SolverPerformance<Type> Foam::faMatrix<Type>::solve
template<class Type>
Foam::SolverPerformance<Type> Foam::faMatrix<Type>::faSolver::solve()
{
return solvei
(
faMat_.psi().mesh().solutionDict().solverDict
(
faMat_.psi().name()
)
);
return solve(faMat_.psi().mesh().solverDict(faMat_.psi().name()));
}
template<class Type>
Foam::SolverPerformance<Type> Foam::faMatrix<Type>::solve()
{
return solve
(
this->psi().mesh().solutionDict().solverDict
(
this->psi().name()
)
);
return solve(this->psi().mesh().solverDict(this->psi().name()));
}
......
......@@ -89,6 +89,8 @@ Foam::solverPerformance Foam::faMatrix<Foam::scalar>::solve
psi.correctBoundaryConditions();
psi.mesh().setSolverPerformance(psi.name(), solverPerf);
return solverPerf;
}
......
......@@ -55,8 +55,7 @@ const int Foam::faMesh::quadricsFit_ = 0;
void Foam::faMesh::setPrimitiveMeshData()
{
DebugInFunction
<< "Setting primitive data" << endl;
DebugInFunction << "Setting primitive data" << endl;
const indirectPrimitivePatch& bp = patch();
......@@ -121,11 +120,7 @@ void Foam::faMesh::setPrimitiveMeshData()
void Foam::faMesh::clearGeomNotAreas() const
{
if (debug)
{
Info<< "void faMesh::clearGeomNotAreas() const : "
<< "Clearing geometry" << endl;
}
DebugInFunction << "Clearing geometry" << endl;
deleteDemandDrivenData(SPtr_);
deleteDemandDrivenData(patchPtr_);
......@@ -144,11 +139,7 @@ void Foam::faMesh::clearGeomNotAreas() const
void Foam::faMesh::clearGeom() const
{
if (debug)
{
Info<< "void faMesh::clearGeom() const : "
<< "Clearing geometry" << endl;
}
DebugInFunction << "Clearing geometry" << endl;
clearGeomNotAreas();
deleteDemandDrivenData(S0Ptr_);
......@@ -159,11 +150,7 @@ void Foam::faMesh::clearGeom() const
void Foam::faMesh::clearAddressing() const
{
if (debug)
{
Info<< "void faMesh::clearAddressing() const : "
<< "Clearing addressing" << endl;
}
DebugInFunction << "Clearing addressing" << endl;
deleteDemandDrivenData(lduPtr_);
}
......@@ -184,6 +171,9 @@ Foam::faMesh::faMesh(const polyMesh& pMesh)
GeoMesh<polyMesh>(pMesh),
MeshObject<polyMesh, Foam::UpdateableMeshObject, faMesh>(pMesh),
edgeInterpolation(*this),
faSchemes(mesh()),
faSolution(mesh()),
data(mesh()),
faceLabels_
(
IOobject
......@@ -229,11 +219,7 @@ Foam::faMesh::faMesh(const polyMesh& pMesh)
correctPatchPointNormalsPtr_(nullptr),
globalMeshDataPtr_(nullptr)
{
if (debug)
{
Info<< "faMesh::faMesh(...) : "
<< "Creating faMesh from IOobject" << endl;
}
DebugInFunction << "Creating faMesh from IOobject" << endl;
setPrimitiveMeshData();
......@@ -277,6 +263,9 @@ Foam::faMesh::faMesh
GeoMesh<polyMesh>(pMesh),
MeshObject<polyMesh, Foam::UpdateableMeshObject, faMesh>(pMesh),
edgeInterpolation(*this),
faSchemes(mesh()),
faSolution(mesh()),
data(mesh()),
faceLabels_
(
IOobject
......@@ -324,11 +313,7 @@ Foam::faMesh::faMesh
correctPatchPointNormalsPtr_(nullptr),
globalMeshDataPtr_(nullptr)
{
if (debug)
{
Info<< "faMesh::faMesh(...) : "
<< "Creating faMesh from components" << endl;
}
DebugInFunction << "Creating faMesh from components" << endl;
}
......@@ -341,6 +326,9 @@ Foam::faMesh::faMesh
GeoMesh<polyMesh>(pMesh),
MeshObject<polyMesh, Foam::UpdateableMeshObject, faMesh>(pMesh),
edgeInterpolation(*this),
faSchemes(mesh()),
faSolution(mesh()),
data(mesh()),
faceLabels_
(
IOobject
......@@ -388,8 +376,7 @@ Foam::faMesh::faMesh
correctPatchPointNormalsPtr_(nullptr),
globalMeshDataPtr_(nullptr)
{
DebugInFunction
<< "Creating faMesh from definition file" << endl;
DebugInFunction << "Creating faMesh from definition file" << endl;
// Reading faMeshDefinition dictionary
IOdictionary faMeshDefinition
......@@ -791,6 +778,9 @@ Foam::faMesh::faMesh
GeoMesh<polyMesh>(pMesh),
MeshObject<polyMesh, Foam::UpdateableMeshObject, faMesh>(pMesh),
edgeInterpolation(*this),
faSchemes(mesh()),
faSolution(mesh()),
data(mesh()),
faceLabels_
(
IOobject
......@@ -838,8 +828,7 @@ Foam::faMesh::faMesh
correctPatchPointNormalsPtr_(nullptr),
globalMeshDataPtr_(nullptr)
{
DebugInFunction
<< "Creating faMesh from polyPatch" << endl;
DebugInFunction << "Creating faMesh from polyPatch" << endl;
const polyBoundaryMesh& pbm = pMesh.boundaryMesh();
......@@ -977,8 +966,7 @@ const Foam::faceList& Foam::faMesh::faces() const
void Foam::faMesh::addFaPatches(const List<faPatch*>& p)
{
DebugInFunction
<< "Adding patches to faMesh" << endl;
DebugInFunction << "Adding patches to faMesh" << endl;
if (boundary().size() > 0)
{
......@@ -1304,7 +1292,7 @@ Foam::boolList& Foam::faMesh::correctPatchPointNormals() const
}
bool Foam::faMesh::write() const
bool Foam::faMesh::write(const bool valid) const
{
faceLabels_.write();
boundary_.write();
......
......@@ -58,6 +58,9 @@ Author
#include "labelIOList.H"
#include "FieldFields.H"
#include "faGlobalMeshData.H"
#include "faSchemes.H"
#include "faSolution.H"
#include "data.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -77,7 +80,10 @@ class faMesh
public GeoMesh<polyMesh>,
public MeshObject<polyMesh, Foam::UpdateableMeshObject, faMesh>,
public lduMesh,
public edgeInterpolation
public edgeInterpolation,
public faSchemes,
public faSolution,
public data
{
// Private data
......@@ -402,6 +408,13 @@ public:
//- Return reference to the mesh database
virtual const objectRegistry& thisDb() const;
//- Name function is needed to disambiguate those inherited
// from base classes
const word& name() const
{
return thisDb().name();
}
//- Return constant reference to boundary mesh
const faBoundaryMesh& boundary() const;
......@@ -531,7 +544,7 @@ public:
boolList& correctPatchPointNormals() const;
//- Write mesh
virtual bool write() const;
virtual bool write(const bool valid = true) const;
// Member Operators
......
......@@ -52,7 +52,7 @@ ddt
return fa::faDdtScheme<Type>::New
(
mesh,
mesh.schemesDict().ddtScheme("ddt(" + dt.name() + ')')
mesh.ddtScheme("ddt(" + dt.name() + ')')
).ref().facDdt(dt);
}
......@@ -67,7 +67,7 @@ ddt
return fa::faDdtScheme<Type>::New
(
vf.mesh(),
vf.mesh().schemesDict().ddtScheme("ddt(" + vf.name() + ')')
vf.mesh().ddtScheme("ddt(" + vf.name() + ')')
).ref().facDdt(vf);
}
......@@ -83,7 +83,7 @@ ddt
return fa::faDdtScheme<Type>::New
(
vf.mesh(),
vf.mesh().schemesDict().ddtScheme
vf.mesh().ddtScheme
(
"ddt(" + rho.name() + ',' + vf.name() + ')'
)
......@@ -102,7 +102,7 @@ ddt
return fa::faDdtScheme<Type>::New
(
vf.mesh(),
vf.mesh().schemesDict().ddtScheme
vf.mesh().ddtScheme
(
"ddt(" + rho.name() + ',' + vf.name() + ')'
)
......
......@@ -107,7 +107,7 @@ div
(
fa::divScheme<Type>::New
(
vf.mesh(), vf.mesh().schemesDict().divScheme(name)
vf.mesh(), vf.mesh().divScheme(name)
).ref().facDiv(vf)
);
GeometricField
......@@ -207,7 +207,7 @@ div
(
vf.mesh(),
flux,
vf.mesh().schemesDict().divScheme(name)
vf.mesh().divScheme(name)
).ref().facDiv(flux, vf)
);
GeometricField<Type, faPatchField, areaMesh>& Div = tDiv.ref();
......
......@@ -115,7 +115,7 @@ grad
fa::gradScheme<Type>::New
(
vf.mesh(),
vf.mesh().schemesDict().gradScheme(name)
vf.mesh().gradScheme(name)
).ref().grad(vf);
GeometricField<GradType, faPatchField, areaMesh>& gGrad = tgGrad.ref();
......
......@@ -52,7 +52,7 @@ laplacian
return fa::laplacianScheme<Type>::New
(
vf.mesh(),
vf.mesh().schemesDict().laplacianScheme(name)
vf.mesh().laplacianScheme(name)
).ref().facLaplacian(vf);
}
......@@ -172,7 +172,7 @@ laplacian
return fa::laplacianScheme<Type>::New
(
vf.mesh(),
vf.mesh().schemesDict().laplacianScheme(name)
vf.mesh().laplacianScheme(name)
).ref().facLaplacian(gamma, vf);
}
......@@ -306,7 +306,7 @@ laplacian
return fa::laplacianScheme<Type>::New
(
vf.mesh(),
vf.mesh().schemesDict().laplacianScheme(name)
vf.mesh().laplacianScheme(name)
).ref().facLaplacian(gamma, vf);
}
......
......@@ -52,7 +52,7 @@ lnGrad
return fa::lnGradScheme<Type>::New
(
vf.mesh(),
vf.mesh().schemesDict().lnGradScheme(name)
vf.mesh().lnGradScheme(name)
).ref().lnGrad(vf);
}
......
......@@ -98,7 +98,7 @@ ndiv
(
fa::divScheme<Type>::New
(
vf.mesh(), vf.mesh().schemesDict().divScheme(name)
vf.mesh(), vf.mesh().divScheme(name)
).ref().facDiv(vf)
);
GeometricField<Type, faPatchField, areaMesh>& Div = tDiv.ref();
......@@ -192,7 +192,7 @@ ndiv
(
vf.mesh(),
flux,
vf.mesh().schemesDict().divScheme(name)
vf.mesh().divScheme(name)
).ref().facDiv(flux, vf)
);
......
......@@ -118,7 +118,7 @@ ngrad
fa::gradScheme<Type>::New
(
vf.mesh(),
vf.mesh().schemesDict().gradScheme(name)
vf.mesh().gradScheme(name)
).ref().grad(vf);
GeometricField<GradType, faPatchField, areaMesh>& gGrad = tgGrad.ref();
......
......@@ -52,7 +52,7 @@ ddt
return fa::faDdtScheme<Type>::New
(
vf.mesh(),
vf.mesh().schemesDict().ddtScheme("ddt(" + vf.name() + ')')
vf.mesh().ddtScheme("ddt(" + vf.name() + ')')
).ref().famDdt(vf);
}
......@@ -68,7 +68,7 @@ ddt
return fa::faDdtScheme<Type>::New
(
vf.mesh(),
vf.mesh().schemesDict().ddtScheme
vf.mesh().ddtScheme
(
"ddt(" + rho.name() + ',' + vf.name() + ')'
)
......@@ -87,7 +87,7 @@ ddt
return fa::faDdtScheme<Type>::New
(
vf.mesh(),
vf.mesh().schemesDict().ddtScheme
vf.mesh().ddtScheme
(
"ddt(" + rho.name() + ',' + vf.name() + ')'
)
......
......@@ -59,7 +59,7 @@ div
(
vf.mesh(),
flux,
vf.mesh().schemesDict().divScheme(name)
vf.mesh().divScheme(name)
).ref().famDiv(flux, vf)
);
faMatrix<Type>& M = tM.ref();
......@@ -70,7 +70,7 @@ div
(
vf.mesh(),
flux,
vf.mesh().schemesDict().divScheme(name)
vf.mesh().divScheme(name)
).ref().facDiv(flux, vf)
);
......
......@@ -172,7 +172,7 @@ laplacian
return fa::laplacianScheme<Type>::New
(
vf.mesh(),
vf.mesh().schemesDict().laplacianScheme(name)
vf.mesh().laplacianScheme(name)
).ref().famLaplacian(gamma, vf);
}
......@@ -218,7 +218,7 @@ laplacian
return fa::laplacianScheme<Type>::New
(
vf.mesh(),
vf.mesh().schemesDict().laplacianScheme(name)
vf.mesh().laplacianScheme(name)
).ref().famLaplacian(gamma, vf);
}
......
......@@ -55,7 +55,7 @@ ndiv
(
vf.mesh(),
flux,
vf.mesh().schemesDict().divScheme(name)
vf.mesh().divScheme(name)
).ref().famDiv(flux, vf);//TODO calculate normal
}
......
......@@ -55,7 +55,7 @@ div
(
vf.mesh(),
flux,
vf.mesh().schemesDict().divScheme(name)
vf.mesh().divScheme(name)
).ref().famDiv(flux, vf);
}
......
......@@ -50,8 +50,6 @@ SourceFiles
namespace Foam
{
class mapPolyMesh;
/*---------------------------------------------------------------------------*\
Class leastSquaresFaVectors Declaration
\*---------------------------------------------------------------------------*/
......
......@@ -80,7 +80,7 @@ gaussLaplacianScheme<Type>::famLaplacian
if (this->tlnGradScheme_().corrected())
{
if (this->mesh().schemesDict().fluxRequired(vf.name()))
if (this->mesh().fluxRequired(vf.name()))
{
fam.faceFluxCorrectionPtr() = new
GeometricField<Type, faePatchField, edgeMesh>
......@@ -89,8 +89,8 @@ gaussLaplacianScheme<Type>::famLaplacian
);
fam.source() -=
this->mesh().S()*
fac::div
this->mesh().S()
*fac::div
(
*fam.faceFluxCorrectionPtr()
)().internalField();
......@@ -98,8 +98,8 @@ gaussLaplacianScheme<Type>::famLaplacian
else
{
fam.source() -=
this->mesh().S()*
fac::div
this->mesh().S()
*fac::div
(
gammaMagSf*this->tlnGradScheme_().correction(vf)
)().internalField();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment