solvers::solid: Support mesh motion

Mesh motion is now supported in solid regions, but with the restriction
that it must be a solid-body-type motion. The mesh must not deform; all
cell volumes and face area magnitudes must remain constant. An error
will be generated if a motion strategy is selected that does not obey
this constraint.
This commit is contained in:
Will Bainbridge
2023-02-02 11:25:07 +00:00
parent 05d67b6166
commit df0f7f16be
8 changed files with 71 additions and 8 deletions

View File

@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "solid.H"
#include "fvMeshMover.H"
#include "localEulerDdtScheme.H"
#include "addToRunTimeSelectionTable.H"
@ -161,7 +162,25 @@ void Foam::solvers::solid::preSolve()
bool Foam::solvers::solid::moveMesh()
{
return true;
if (pimple.firstIter() || pimple.moveMeshOuterCorrectors())
{
if (!mesh.mover().solidBody())
{
FatalErrorInFunction
<< "Region " << name() << " of type " << type()
<< " does not support non-solid body mesh motion"
<< exit(FatalError);
}
mesh.move();
if (mesh.changing())
{
return mesh.moving();
}
}
return false;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -93,6 +93,12 @@ public:
//- Return point location obtained from the current motion field
virtual tmp<pointField> curPoints() const;
//- This is a solid body motion
virtual bool solidBody() const
{
return true;
}
//- Solve for motion
virtual void solve()
{}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2016-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -96,6 +96,12 @@ public:
//- Return point location obtained from the current motion field
virtual tmp<pointField> curPoints() const;
//- This is a solid body motion
virtual bool solidBody() const
{
return true;
}
//- Solve for motion
virtual void solve()
{}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -152,8 +152,17 @@ public:
//- Provide current points for motion. Uses current motion field
virtual tmp<pointField> curPoints() const = 0;
//- Correct point field for reduced-dimensionality cases
virtual void twoDCorrectPoints(pointField&) const;
//- Is the motion solid body? I.e., are the volumes and area magnitudes
// unchanged? Defaults to false. Set to true by
// motionSolvers::solidBody.
virtual bool solidBody() const
{
return false;
}
//- Solve for motion
virtual void solve() = 0;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2021-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -154,6 +154,14 @@ public:
return true;
}
//- Is the motion solid body? I.e., are the volumes and area magnitudes
// unchanged? Defaults to false. Set to true by fvMeshMovers::none and
// delegated to the motion solver by fvMeshMovers::motionSolver.
virtual bool solidBody() const
{
return false;
}
//- Update the mesh for both mesh motion and topology change
virtual bool update() = 0;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2021-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -79,6 +79,12 @@ public:
return false;
}
//- The mesh is static, which meets the criteria of a solid body motion
virtual bool solidBody() const
{
return true;
}
//- Dummy update function which does not change the mesh
virtual bool update();

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2021-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -63,6 +63,12 @@ const Foam::motionSolver& Foam::fvMeshMovers::motionSolver::motion() const
}
bool Foam::fvMeshMovers::motionSolver::solidBody() const
{
return motion().solidBody();
}
bool Foam::fvMeshMovers::motionSolver::update()
{
mesh().movePoints(motionPtr_->newPoints());

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2021-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -88,6 +88,9 @@ public:
//- Return the motionSolver
const Foam::motionSolver& motion() const;
//- Is this motion solid body? Delegate to the motion solver.
virtual bool solidBody() const;
//- Update the mesh for both mesh motion and topology change
virtual bool update();