solvers: Split moveMesh from motionCorrector

This is so that stitching is complete across all regions before any FV
operations are attempted.
This commit is contained in:
Will Bainbridge
2024-01-30 08:26:43 +00:00
parent 5d008bf093
commit f1ab9882c7
21 changed files with 95 additions and 1 deletions

View File

@ -241,6 +241,9 @@ public:
//- Called at the start of the PIMPLE loop to move the mesh //- Called at the start of the PIMPLE loop to move the mesh
virtual void moveMesh(); virtual void moveMesh();
//- Corrections that follow mesh motion
virtual void motionCorrector();
//- Called at the start of the PIMPLE loop //- Called at the start of the PIMPLE loop
virtual void prePredictor() = 0; virtual void prePredictor() = 0;

View File

@ -51,7 +51,14 @@ void Foam::solvers::VoFSolver::moveMesh()
// Move the mesh // Move the mesh
mesh_.move(); mesh_.move();
}
}
void Foam::solvers::VoFSolver::motionCorrector()
{
if (pimple.firstIter() || pimple.moveMeshOuterCorrectors())
{
if (mesh.changing()) if (mesh.changing())
{ {
buoyancy.moveMesh(); buoyancy.moveMesh();

View File

@ -225,6 +225,9 @@ public:
//- Called at the start of the PIMPLE loop to move the mesh //- Called at the start of the PIMPLE loop to move the mesh
virtual void moveMesh(); virtual void moveMesh();
//- Corrections that follow mesh motion
virtual void motionCorrector();
//- Called at the start of the PIMPLE loop //- Called at the start of the PIMPLE loop
virtual void prePredictor(); virtual void prePredictor();

View File

@ -36,7 +36,14 @@ void Foam::solvers::incompressibleDenseParticleFluid::moveMesh()
{ {
// Move the mesh // Move the mesh
mesh_.move(); mesh_.move();
}
}
void Foam::solvers::incompressibleDenseParticleFluid::motionCorrector()
{
if (pimple.firstIter() || pimple.moveMeshOuterCorrectors())
{
if (mesh.changing()) if (mesh.changing())
{ {
if (correctPhi || mesh.topoChanged()) if (correctPhi || mesh.topoChanged())

View File

@ -180,6 +180,9 @@ public:
//- Called at the start of the PIMPLE loop to move the mesh //- Called at the start of the PIMPLE loop to move the mesh
virtual void moveMesh(); virtual void moveMesh();
//- Corrections that follow mesh motion
virtual void motionCorrector();
//- Called at the start of the PIMPLE loop //- Called at the start of the PIMPLE loop
virtual void prePredictor(); virtual void prePredictor();

View File

@ -35,7 +35,14 @@ void Foam::solvers::incompressibleFluid::moveMesh()
{ {
// Move the mesh // Move the mesh
mesh_.move(); mesh_.move();
}
}
void Foam::solvers::incompressibleFluid::motionCorrector()
{
if (pimple.firstIter() || pimple.moveMeshOuterCorrectors())
{
if (mesh.changing()) if (mesh.changing())
{ {
MRF.update(); MRF.update();

View File

@ -466,6 +466,10 @@ void Foam::solvers::isothermalFilm::moveMesh()
{} {}
void Foam::solvers::isothermalFilm::motionCorrector()
{}
void Foam::solvers::isothermalFilm::thermophysicalPredictor() void Foam::solvers::isothermalFilm::thermophysicalPredictor()
{ {
thermo_.correct(); thermo_.correct();

View File

@ -338,6 +338,9 @@ public:
//- Called at the start of the PIMPLE loop to move the mesh //- Called at the start of the PIMPLE loop to move the mesh
virtual void moveMesh(); virtual void moveMesh();
//- Corrections that follow mesh motion
virtual void motionCorrector();
//- Called at the start of the PIMPLE loop //- Called at the start of the PIMPLE loop
virtual void prePredictor(); virtual void prePredictor();

View File

@ -255,6 +255,9 @@ public:
//- Called at the start of the PIMPLE loop to move the mesh //- Called at the start of the PIMPLE loop to move the mesh
virtual void moveMesh(); virtual void moveMesh();
//- Corrections that follow mesh motion
virtual void motionCorrector();
//- Called at the start of the PIMPLE loop //- Called at the start of the PIMPLE loop
virtual void prePredictor(); virtual void prePredictor();

View File

@ -35,9 +35,15 @@ void Foam::solvers::isothermalFluid::moveMesh()
{ {
// Move the mesh // Move the mesh
mesh_.move(); mesh_.move();
}
}
void Foam::solvers::isothermalFluid::motionCorrector()
{
if (pimple.firstIter() || pimple.moveMeshOuterCorrectors())
{
// The rhoU field can be cleared following mesh-motion // The rhoU field can be cleared following mesh-motion
// now the mesh has been re-stitched as necessary
rhoU.clear(); rhoU.clear();
if (mesh.changing()) if (mesh.changing())

View File

@ -85,6 +85,10 @@ void Foam::solvers::movingMesh::moveMesh()
} }
void Foam::solvers::movingMesh::motionCorrector()
{}
void Foam::solvers::movingMesh::prePredictor() void Foam::solvers::movingMesh::prePredictor()
{} {}

View File

@ -91,6 +91,9 @@ public:
//- Called at the start of the PIMPLE loop to move the mesh //- Called at the start of the PIMPLE loop to move the mesh
virtual void moveMesh(); virtual void moveMesh();
//- Corrections that follow mesh motion
virtual void motionCorrector();
//- Called at the beginning of the PIMPLE loop //- Called at the beginning of the PIMPLE loop
virtual void prePredictor(); virtual void prePredictor();

View File

@ -57,7 +57,18 @@ void Foam::solvers::multiphaseEuler::moveMesh()
// Move the mesh // Move the mesh
mesh_.move(); mesh_.move();
}
}
void Foam::solvers::multiphaseEuler::motionCorrector()
{
if
(
pimple.flow()
&& (pimple.firstIter() || pimple.moveMeshOuterCorrectors())
)
{
if (mesh.changing()) if (mesh.changing())
{ {
buoyancy.moveMesh(); buoyancy.moveMesh();

View File

@ -239,6 +239,9 @@ public:
//- Called at the start of the PIMPLE loop to move the mesh //- Called at the start of the PIMPLE loop to move the mesh
virtual void moveMesh(); virtual void moveMesh();
//- Corrections that follow mesh motion
virtual void motionCorrector();
//- Called at the start of the PIMPLE loop //- Called at the start of the PIMPLE loop
virtual void prePredictor(); virtual void prePredictor();

View File

@ -33,11 +33,19 @@ void Foam::solvers::shockFluid::moveMesh()
{ {
// Move the mesh // Move the mesh
mesh_.move(); mesh_.move();
}
}
void Foam::solvers::shockFluid::motionCorrector()
{
if (pimple.firstIter() || pimple.moveMeshOuterCorrectors())
{
if (mesh.changing()) if (mesh.changing())
{ {
if (mesh.topoChanged()) if (mesh.topoChanged())
{ {
// ...
} }
meshCourantNo(); meshCourantNo();

View File

@ -244,6 +244,9 @@ public:
//- Called at the start of the PIMPLE loop to move the mesh //- Called at the start of the PIMPLE loop to move the mesh
virtual void moveMesh(); virtual void moveMesh();
//- Corrections that follow mesh motion
virtual void motionCorrector();
//- Called at the start of the PIMPLE loop //- Called at the start of the PIMPLE loop
virtual void prePredictor(); virtual void prePredictor();

View File

@ -201,6 +201,10 @@ void Foam::solvers::solid::moveMesh()
} }
void Foam::solvers::solid::motionCorrector()
{}
void Foam::solvers::solid::prePredictor() void Foam::solvers::solid::prePredictor()
{ {
if (pimple.predictTransport()) if (pimple.predictTransport())

View File

@ -144,6 +144,9 @@ public:
//- Called at the start of the PIMPLE loop to move the mesh //- Called at the start of the PIMPLE loop to move the mesh
virtual void moveMesh(); virtual void moveMesh();
//- Corrections that follow mesh motion
virtual void motionCorrector();
//- Called at the beginning of the PIMPLE loop //- Called at the beginning of the PIMPLE loop
virtual void prePredictor(); virtual void prePredictor();

View File

@ -134,6 +134,11 @@ int main(int argc, char *argv[])
solvers[i].moveMesh(); solvers[i].moveMesh();
} }
forAll(solvers, i)
{
solvers[i].motionCorrector();
}
forAll(solvers, i) forAll(solvers, i)
{ {
solvers[i].fvModels().correct(); solvers[i].fvModels().correct();

View File

@ -139,6 +139,7 @@ int main(int argc, char *argv[])
while (pimple.loop()) while (pimple.loop())
{ {
solver.moveMesh(); solver.moveMesh();
solver.motionCorrector();
solver.fvModels().correct(); solver.fvModels().correct();
solver.prePredictor(); solver.prePredictor();
solver.momentumPredictor(); solver.momentumPredictor();

View File

@ -175,6 +175,9 @@ public:
//- Called at the start of the PIMPLE loop to move the mesh //- Called at the start of the PIMPLE loop to move the mesh
virtual void moveMesh() = 0; virtual void moveMesh() = 0;
//- Corrections that follow mesh motion
virtual void motionCorrector() = 0;
//- Called at the start of the PIMPLE loop //- Called at the start of the PIMPLE loop
virtual void prePredictor() = 0; virtual void prePredictor() = 0;