Dynamic mesh support, first version

This commit is contained in:
Hrvoje Jasak 2017-12-12 16:19:02 +00:00
parent 30566d80c9
commit 1b36d98057
8 changed files with 98 additions and 55 deletions

View file

@ -147,6 +147,13 @@ void Foam::immersedBoundaryFvPatch::makeCorrVecs(fvsPatchVectorField& cv) const
}
void Foam::immersedBoundaryFvPatch::movePoints()
{
Info<< "immersedBoundaryFvPatch::movePoints()" << endl;
ibPolyPatch_.clearOut();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::immersedBoundaryFvPatch::immersedBoundaryFvPatch
@ -158,7 +165,9 @@ Foam::immersedBoundaryFvPatch::immersedBoundaryFvPatch
fvPatch(patch, bm),
ibPolyPatch_(refCast<const immersedBoundaryPolyPatch>(patch)),
mesh_(bm.mesh())
{}
{
ibPolyPatch_.clearOut();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -178,16 +187,16 @@ Foam::immersedBoundaryFvPatch::faceCells() const
}
Foam::tmp<Foam::vectorField> Foam::immersedBoundaryFvPatch::nf() const
{
return ibPolyPatch_.ibPatch().faceNormals();
}
// Foam::tmp<Foam::vectorField> Foam::immersedBoundaryFvPatch::nf() const
// {
// return ibPolyPatch_.ibPatch().faceNormals();
// }
Foam::tmp<Foam::vectorField> Foam::immersedBoundaryFvPatch::delta() const
{
return ibPolyPatch_.ibPatch().faceCentres() - ibPolyPatch_.ibCellCentres();
}
// Foam::tmp<Foam::vectorField> Foam::immersedBoundaryFvPatch::delta() const
// {
// return ibPolyPatch_.ibPatch().faceCentres() - ibPolyPatch_.ibCellCentres();
// }
// ************************************************************************* //

View file

@ -112,6 +112,9 @@ protected:
//- Make patch face non-orthogonality correction vectors
virtual void makeCorrVecs(fvsPatchVectorField&) const;
//- Correct patches after moving points
virtual void movePoints();
public:
@ -147,13 +150,13 @@ public:
// Access functions for geometrical data
//- Return face normals
// Reconsider. HJ, 11/Dec/2017
tmp<vectorField> nf() const;
// //- Return face normals
// // Reconsider. HJ, 11/Dec/2017
// tmp<vectorField> nf() const;
//- Return cell-centre to face-centre vector
// Reconsider. HJ, 11/Dec/2017
virtual tmp<vectorField> delta() const;
// //- Return cell-centre to face-centre vector
// // Reconsider. HJ, 11/Dec/2017
// virtual tmp<vectorField> delta() const;
// Access to immersed boundary components

View file

@ -32,9 +32,6 @@ License
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>

View file

@ -147,16 +147,14 @@ public:
virtual void autoMap
(
const fvPatchFieldMapper&
)
{}
);
//- Reverse map the given fvsPatchField onto this fvsPatchField
virtual void rmap
(
const fvPatchField<Type>&,
const labelList&
)
{}
);
// Member functions

View file

@ -56,7 +56,7 @@ const Foam::debug::tolerancesSwitch
Foam::immersedBoundaryPolyPatch::liveFactor_
(
"immersedBoundaryLiveFactor",
1e-7
1e-4
);
@ -338,13 +338,11 @@ void Foam::immersedBoundaryPolyPatch::calcImmersedBoundary() const
if (cellFactor < liveFactor_())
{
// Thin cut: cell is dry
Info<< "Dry cell from intersection" << cellI << endl;
intersectedCell[cellI] = immersedPoly::DRY;
}
else if (cellFactor > (1 - liveFactor_()))
{
// Thick cut: cell is wet
Info<< "Wet cell from intersection" << cellI << endl;
intersectedCell[cellI] = immersedPoly::WET;
}
else
@ -845,28 +843,6 @@ void Foam::immersedBoundaryPolyPatch::calcImmersedBoundary() const
}
void Foam::immersedBoundaryPolyPatch::clearOut()
{
deleteDemandDrivenData(triSurfSearchPtr_);
deleteDemandDrivenData(ibPatchPtr_);
deleteDemandDrivenData(ibCellsPtr_);
deleteDemandDrivenData(ibCellCentresPtr_);
deleteDemandDrivenData(ibFacesPtr_);
deleteDemandDrivenData(ibFaceCentresPtr_);
deleteDemandDrivenData(nearestTriPtr_);
deleteDemandDrivenData(deadCellsPtr_);
deleteDemandDrivenData(deadFacesPtr_);
deleteDemandDrivenData(correctedCellCentresPtr_);
deleteDemandDrivenData(correctedFaceCentresPtr_);
deleteDemandDrivenData(correctedCellVolumesPtr_);
deleteDemandDrivenData(correctedFaceAreasPtr_);
deleteDemandDrivenData(correctedIbPatchFaceAreasPtr_);
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::immersedBoundaryPolyPatch::calcCorrectedGeometry() const
{
if (debug)
@ -1005,8 +981,20 @@ void Foam::immersedBoundaryPolyPatch::calcCorrectedGeometry() const
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::immersedBoundaryPolyPatch::movePoints(const pointField& p)
{
if (debug)
{
InfoIn
(
"void immersedBoundaryPolyPatch::"
"movePoints(const pointField&) const"
) << "creating triSurface search algorithm"
<< endl;
}
// Handle motion of immersed boundary
clearOut();
@ -1453,6 +1441,48 @@ void Foam::immersedBoundaryPolyPatch::moveTriSurfacePoints
}
void Foam::immersedBoundaryPolyPatch::clearGeom()
{
clearOut();
}
void Foam::immersedBoundaryPolyPatch::clearAddressing()
{
clearOut();
}
void Foam::immersedBoundaryPolyPatch::clearOut() const
{
if (debug)
{
InfoIn("void immersedBoundaryPolyPatch::clearOut() const")
<< "Clear immersed boundary polyPatch"
<< endl;
}
deleteDemandDrivenData(triSurfSearchPtr_);
deleteDemandDrivenData(ibPatchPtr_);
deleteDemandDrivenData(ibCellsPtr_);
deleteDemandDrivenData(ibCellCentresPtr_);
deleteDemandDrivenData(ibCellVolumesPtr_);
deleteDemandDrivenData(ibFacesPtr_);
deleteDemandDrivenData(ibFaceCentresPtr_);
deleteDemandDrivenData(ibFaceAreasPtr_);
deleteDemandDrivenData(nearestTriPtr_);
deleteDemandDrivenData(deadCellsPtr_);
deleteDemandDrivenData(deadFacesPtr_);
deleteDemandDrivenData(correctedCellCentresPtr_);
deleteDemandDrivenData(correctedFaceCentresPtr_);
deleteDemandDrivenData(correctedCellVolumesPtr_);
deleteDemandDrivenData(correctedFaceAreasPtr_);
deleteDemandDrivenData(correctedIbPatchFaceAreasPtr_);
}
void Foam::immersedBoundaryPolyPatch::write(Ostream& os) const
{
polyPatch::write(os);

View file

@ -152,13 +152,8 @@ class immersedBoundaryPolyPatch
// Private Member Functions
// Storage management
//- Clear all demand-driven data
void clearOut();
//- Check cell intersection
vector cellSpan(const label cellID) const;
//- Check cell intersection
vector cellSpan(const label cellID) const;
// Make demand-driven data
@ -360,6 +355,15 @@ public:
//- Correct patches after moving points
void moveTriSurfacePoints(const pointField& p);
//- Clear geometry
virtual void clearGeom();
//- Clear addressing
virtual void clearAddressing();
//- Clear all demand-driven data
void clearOut() const;
//- Write
virtual void write(Ostream&) const;

View file

@ -40,7 +40,7 @@ const Foam::debug::tolerancesSwitch
Foam::immersedPoly::tolerance_
(
"immersedPolyTolerance",
1e-10
1e-7
);

View file

@ -282,6 +282,8 @@ void mixedIbFvPatchField<Type>::evaluate
const Pstream::commsTypes
)
{
this->updateIbValues();
// Set dead value
this->setDeadValues();