Improvements and fvPatch virtual functions for immersed boundary support

This commit is contained in:
Hrvoje Jasak 2017-12-30 09:29:43 +00:00
parent e089353e71
commit ec3f650fdb
5 changed files with 93 additions and 39 deletions

View file

@ -48,6 +48,13 @@ defineTypeNameAndDebug(Foam::fvMesh, 0);
void Foam::fvMesh::clearGeomNotOldVol()
{
if (debug)
{
InfoIn("void Foam::fvMesh::clearGeomNotOldVol()")
<< "Clearing geometry but not old volumes"
<< endl;
}
deleteDemandDrivenData(VPtr_);
deleteDemandDrivenData(SfPtr_);
@ -59,6 +66,13 @@ void Foam::fvMesh::clearGeomNotOldVol()
void Foam::fvMesh::clearGeom()
{
if (debug)
{
InfoIn("void Foam::fvMesh::clearGeomNotOldVol()")
<< "Clearing geometry"
<< endl;
}
clearGeomNotOldVol();
deleteDemandDrivenData(V0Ptr_);
@ -75,6 +89,13 @@ void Foam::fvMesh::clearGeom()
void Foam::fvMesh::clearAddressing()
{
if (debug)
{
InfoIn("void Foam::fvMesh::clearAddressing()")
<< "Clearing addressing"
<< endl;
}
deleteDemandDrivenData(lduPtr_);
// Geometry dependent object updated through call-back
@ -569,11 +590,9 @@ void Foam::fvMesh::updateMesh(const mapPolyMesh& mpm)
void Foam::fvMesh::syncUpdateMesh()
{
// Update polyMesh. This needs to keep volume existent!
// Update polyMesh. This needs to keep cell volumes
polyMesh::syncUpdateMesh();
// Not sure how much clean-up is needed here. HJ, 27/Nov/2009
surfaceInterpolation::clearOut();
clearGeomNotOldVol();

View file

@ -353,7 +353,7 @@ public:
//- Return cell face motion fluxes
surfaceScalarField& setPhi();
//- Return old-time cell volumes
//- Set old-time cell volumes
DimensionedField<scalar, volMesh>& setV0();

View file

@ -249,9 +249,8 @@ void fvMesh::makePhi() const
{
if (debug)
{
Info<< "void fvMesh::makePhi() const : "
<< "reading old time flux field if present and creating "
<< "zero current time flux field"
InfoIn("void fvMesh::makePhi() const")
<< "Preparing mesh flux field"
<< endl;
}
@ -267,12 +266,12 @@ void fvMesh::makePhi() const
// Reading old time mesh motion flux if it exists and
// creating zero current time mesh motion flux
scalar t0 = this->time().value() - this->time().deltaT().value();
scalar t0 = time().value() - time().deltaT().value();
IOobject meshPhiHeader
(
"meshPhi",
this->time().timeName(t0),
time().timeName(t0),
*this,
IOobject::NO_READ
);
@ -290,7 +289,7 @@ void fvMesh::makePhi() const
IOobject
(
"meshPhi",
this->time().timeName(t0),
time().timeName(t0),
*this,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
@ -317,7 +316,7 @@ void fvMesh::makePhi() const
IOobject
(
"meshPhi",
this->time().timeName(),
time().timeName(),
*this,
IOobject::NO_READ,
IOobject::AUTO_WRITE
@ -338,20 +337,39 @@ void fvMesh::updatePhi(const scalarField& sweptVols) const
makePhi();
}
surfaceScalarField& phi = *phiPtr_;
scalar rDeltaT = 1.0/time().deltaT().value();
surfaceScalarField& phi = *phiPtr_;
phi.internalField() = scalarField::subField(sweptVols, nInternalFaces());
phi.internalField() *= rDeltaT;
const fvPatchList& patches = boundary();
// Calculate regular values first and then allow patches to update them
// HJ, 15/Dec/2017
forAll (patches, patchI)
{
phi.boundaryField()[patchI] = patches[patchI].patchSlice(sweptVols);
phi.boundaryField()[patchI] *= rDeltaT;
}
// Make sure V and V0 are constructed before the correction
// HJ, 22/Dec/2017
V0();
V();
// Boundary update. Used in complex geometries, eg. immersed boundary
// HJ, 29/Nov/2017
forAll (phi.boundaryField(), patchI)
{
boundary()[patchI].updatePhi
(
*VPtr_,
*V0Ptr_,
phi
);
}
}
@ -425,6 +443,9 @@ DimensionedField<scalar, volMesh>& fvMesh::setV0()
<< "Setting old cell volumes" << endl;
}
// Update time index
curTimeIndex_ = time().timeIndex();
V0Ptr_ = new DimensionedField<scalar, volMesh>
(
IOobject

View file

@ -43,6 +43,35 @@ defineRunTimeSelectionTable(fvPatch, polyPatch);
addToRunTimeSelectionTable(fvPatch, fvPatch, polyPatch);
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
void fvPatch::makeWeights(fvsPatchScalarField& w) const
{
w = 1.0;
}
void fvPatch::makeDeltaCoeffs(fvsPatchScalarField& dc) const
{
dc = 1.0/(nf() & delta());
}
void fvPatch::makeCorrVecs(fvsPatchVectorField& cv) const
{
cv = vector::zero;
}
void fvPatch::initMovePoints()
{}
void fvPatch::movePoints()
{}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
fvPatch::fvPatch(const polyPatch& p, const fvBoundaryMesh& bm)
@ -152,32 +181,6 @@ tmp<vectorField> fvPatch::delta() const
}
void fvPatch::makeWeights(fvsPatchScalarField& w) const
{
w = 1.0;
}
void fvPatch::makeDeltaCoeffs(fvsPatchScalarField& dc) const
{
dc = 1.0/(nf() & delta());
}
void fvPatch::makeCorrVecs(fvsPatchVectorField& cv) const
{
cv = vector::zero;
}
void fvPatch::initMovePoints()
{}
void fvPatch::movePoints()
{}
const scalarField& fvPatch::deltaCoeffs() const
{
return boundaryMesh().mesh().deltaCoeffs().boundaryField()[index()];

View file

@ -43,8 +43,10 @@ SourceFiles
#include "tmp.H"
#include "primitiveFields.H"
#include "SubField.H"
#include "DimensionedField.H"
#include "fvPatchFieldsFwd.H"
#include "fvsPatchFieldsFwd.H"
#include "surfaceFieldsFwd.H"
#include "slicedVolFieldsFwd.H"
#include "slicedSurfaceFieldsFwd.H"
#include "autoPtr.H"
@ -105,6 +107,15 @@ protected:
virtual void makeV(scalarField&) const
{}
//- Update mesh motion fluxes
virtual void updatePhi
(
DimensionedField<scalar, volMesh>& V,
DimensionedField<scalar, volMesh>& V0,
surfaceScalarField& phi
) const
{}
// Discretisation correction functions