Skip to content

Commit

Permalink
fvMeshMovers, fvMeshTopoChangers: General mesh motion and topology ch…
Browse files Browse the repository at this point in the history
…ange replacement for dynamicFvMesh

Mesh motion and topology change are now combinable run-time selectable options
within fvMesh, replacing the restrictive dynamicFvMesh which supported only
motion OR topology change.

All solvers which instantiated a dynamicFvMesh now instantiate an fvMesh which
reads the optional constant/dynamicFvMeshDict to construct an fvMeshMover and/or
an fvMeshTopoChanger.  These two are specified within the optional mover and
topoChanger sub-dictionaries of dynamicFvMeshDict.

When the fvMesh is updated the fvMeshTopoChanger is first executed which can
change the mesh topology in anyway, adding or removing points as required, for
example for automatic mesh refinement/unrefinement, and all registered fields
are mapped onto the updated mesh.  The fvMeshMover is then executed which moved
the points only and calculates the cell volume change and corresponding
mesh-fluxes for conservative moving mesh transport.  If multiple topological
changes or movements are required these would be combined into special
fvMeshMovers and fvMeshTopoChangers which handle the processing of a list of
changes, e.g. solidBodyMotionFunctions:multiMotion.

The tutorials/multiphase/interFoam/laminar/sloshingTank3D3DoF case has been
updated to demonstrate this new functionality by combining solid-body motion
with mesh refinement/unrefinement:

/*--------------------------------*- C++ -*----------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     | Website:  https://openfoam.org
    \\  /    A nd           | Version:  dev
     \\/     M anipulation  |
\*---------------------------------------------------------------------------*/
FoamFile
{
    format      ascii;
    class       dictionary;
    location    "constant";
    object      dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

mover
{
    type    motionSolver;

    libs    ("libfvMeshMovers.so" "libfvMotionSolvers.so");

    motionSolver    solidBody;

    solidBodyMotionFunction SDA;

    CofG            (0 0 0);
    lamda           50;
    rollAmax        0.2;
    rollAmin        0.1;
    heaveA          4;
    swayA           2.4;
    Q               2;
    Tp              14;
    Tpn             12;
    dTi             0.06;
    dTp             -0.001;
}

topoChanger
{
    type    refiner;

    libs    ("libfvMeshTopoChangers.so");

    // How often to refine
    refineInterval  1;

    // Field to be refinement on
    field           alpha.water;

    // Refine field in between lower..upper
    lowerRefineLevel 0.001;
    upperRefineLevel 0.999;

    // Have slower than 2:1 refinement
    nBufferLayers   1;

    // Refine cells only up to maxRefinement levels
    maxRefinement   1;

    // Stop refinement if maxCells reached
    maxCells        200000;

    // Flux field and corresponding velocity field. Fluxes on changed
    // faces get recalculated by interpolating the velocity. Use 'none'
    // on surfaceScalarFields that do not need to be reinterpolated.
    correctFluxes
    (
        (phi none)
        (nHatf none)
        (rhoPhi none)
        (alphaPhi.water none)
        (meshPhi none)
        (meshPhi_0 none)
        (ghf none)
    );

    // Write the refinement level as a volScalarField
    dumpLevel       true;
}

// ************************************************************************* //

Note that currently this is the only working combination of mesh-motion with
topology change within the new framework and further development is required to
update the set of topology changers so that topology changes with mapping are
separated from the mesh-motion so that they can be combined with any of the
other movements or topology changes in any manner.

All of the solvers and tutorials have been updated to use the new form of
dynamicMeshDict but backward-compatibility was not practical due to the complete
reorganisation of the mesh change structure.
  • Loading branch information
Henry Weller committed Oct 1, 2021
1 parent 167ad74 commit cf3d6cd
Show file tree
Hide file tree
Showing 175 changed files with 2,563 additions and 1,895 deletions.
3 changes: 0 additions & 3 deletions applications/solvers/combustion/PDRFoam/Make/options
Expand Up @@ -29,8 +29,6 @@ EXE_INC = \
-I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \
-I$(LIB_SRC)/ThermophysicalTransportModels/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude \

Expand All @@ -45,6 +43,5 @@ EXE_LIBS = \
-lthermophysicalTransportModels \
-llaminarFlameSpeedModels \
-lfiniteVolume \
-ldynamicFvMesh \
-lfvModels \
-lfvConstraints
57 changes: 30 additions & 27 deletions applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C
Expand Up @@ -56,32 +56,33 @@ Description
\*---------------------------------------------------------------------------*/

#include "fvCFD.H"
#include "dynamicFvMesh.H"
#include "psiuReactionThermo.H"
#include "compressibleMomentumTransportModels.H"
#include "fluidThermophysicalTransportModel.H"
#include "laminarFlameSpeed.H"
#include "XiModel.H"
#include "PDRDragModel.H"
#include "ignition.H"
#include "Switch.H"
#include "bound.H"
#include "dynamicRefineFvMesh.H"
#include "pimpleControl.H"
#include "fvModels.H"
#include "fvConstraints.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
{
#include "setRootCaseLists.H"
#include "postProcess.H"

#include "setRootCaseLists.H"
#include "createTime.H"
#include "createDynamicFvMesh.H"

pimpleControl pimple(mesh);

#include "createMesh.H"
#include "createControl.H"
#include "readCombustionProperties.H"
#include "readGravitationalAcceleration.H"
#include "createFields.H"
#include "createFieldRefs.H"
#include "initContinuityErrs.H"
#include "createTimeControls.H"
#include "compressibleCourantNo.H"
Expand Down Expand Up @@ -122,22 +123,22 @@ int main(int argc, char *argv[])
fvc::makeAbsolute(phi, rho, U);

// Test : disable refinement for some cells
PackedBoolList& protectedCell =
refCast<dynamicRefineFvMesh>(mesh).protectedCell();

if (protectedCell.empty())
{
protectedCell.setSize(mesh.nCells());
protectedCell = 0;
}

forAll(betav, celli)
{
if (betav[celli] < 0.99)
{
protectedCell[celli] = 1;
}
}
// PackedBoolList& protectedCell =
// refCast<dynamicRefineFvMesh>(mesh).protectedCell();

// if (protectedCell.empty())
// {
// protectedCell.setSize(mesh.nCells());
// protectedCell = 0;
// }

// forAll(betav, celli)
// {
// if (betav[celli] < 0.99)
// {
// protectedCell[celli] = 1;
// }
// }

// Flux estimate for introduced faces.
volVectorField rhoU("rhoU", rho*U);
Expand Down Expand Up @@ -171,20 +172,21 @@ int main(int argc, char *argv[])
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
#include "UEqn.H"
fvModels.correct();

#include "UEqn.H"

// --- Pressure corrector loop
while (pimple.correct())
{
#include "bEqn.H"
#include "ftEqn.H"
#include "huEqn.H"
#include "hEqn.H"
#include "EauEqn.H"
#include "EaEqn.H"

if (!ign.ignited())
{
hu == h;
thermo.heu() == thermo.he();
}

#include "pEqn.H"
Expand All @@ -193,6 +195,7 @@ int main(int argc, char *argv[])
if (pimple.turbCorr())
{
turbulence->correct();
thermophysicalTransport->correct();
}
}

Expand Down
3 changes: 0 additions & 3 deletions applications/solvers/combustion/reactingFoam/Make/options
Expand Up @@ -10,7 +10,6 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
-I$(LIB_SRC)/ODE/lnInclude \
-I$(LIB_SRC)/combustionModels/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/finiteVolume/cfdTools \
-I$(LIB_SRC)/meshTools/lnInclude \
Expand All @@ -27,8 +26,6 @@ EXE_LIBS = \
-lcompressibleMomentumTransportModels \
-lthermophysicalTransportModels \
-lfluidReactionThermophysicalTransportModels \
-ldynamicFvMesh \
-ltopoChangerFvMesh \
-lfiniteVolume \
-lfvModels \
-lfvConstraints \
Expand Down
Expand Up @@ -12,7 +12,6 @@ EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
-I$(LIB_SRC)/ODE/lnInclude \
-I$(LIB_SRC)/combustionModels/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/finiteVolume/cfdTools \
-I$(LIB_SRC)/meshTools/lnInclude \
Expand All @@ -29,8 +28,6 @@ EXE_LIBS = \
-lchemistryModel \
-lODE \
-lcombustionModels \
-ldynamicFvMesh \
-ltopoChangerFvMesh \
-lfiniteVolume \
-lfvModels \
-lfvConstraints \
Expand Down
Expand Up @@ -35,7 +35,6 @@ Description
\*---------------------------------------------------------------------------*/

#include "fvCFD.H"
#include "dynamicFvMesh.H"
#include "fluidReactionThermo.H"
#include "combustionModel.H"
#include "compressibleMomentumTransportModels.H"
Expand All @@ -58,7 +57,7 @@ int main(int argc, char *argv[])

#include "setRootCaseLists.H"
#include "createTime.H"
#include "createDynamicFvMesh.H"
#include "createMesh.H"
#include "createDyMControls.H"
#include "initContinuityErrs.H"
#include "createFields.H"
Expand Down
Expand Up @@ -5,7 +5,6 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/cfdTools \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \
-I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \
-I$(LIB_SRC)/ThermophysicalTransportModels/lnInclude \
Expand All @@ -26,7 +25,6 @@ EXE_LIBS = \
-lfvConstraints \
-lsampling \
-lmeshTools \
-ldynamicFvMesh \
-lmomentumTransportModels \
-lcompressibleMomentumTransportModels \
-lthermophysicalTransportModels \
Expand Down
3 changes: 1 addition & 2 deletions applications/solvers/combustion/reactingFoam/reactingFoam.C
Expand Up @@ -34,7 +34,6 @@ Description
\*---------------------------------------------------------------------------*/

#include "fvCFD.H"
#include "dynamicFvMesh.H"
#include "fluidReactionThermo.H"
#include "combustionModel.H"
#include "compressibleMomentumTransportModels.H"
Expand All @@ -56,7 +55,7 @@ int main(int argc, char *argv[])

#include "setRootCaseLists.H"
#include "createTime.H"
#include "createDynamicFvMesh.H"
#include "createMesh.H"
#include "createDyMControls.H"
#include "initContinuityErrs.H"
#include "createFields.H"
Expand Down
3 changes: 0 additions & 3 deletions applications/solvers/compressible/rhoCentralFoam/Make/options
Expand Up @@ -7,7 +7,6 @@ EXE_INC = \
-I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \
-I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \
-I$(LIB_SRC)/ThermophysicalTransportModels/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude

EXE_LIBS = \
Expand All @@ -20,6 +19,4 @@ EXE_LIBS = \
-lmomentumTransportModels \
-lcompressibleMomentumTransportModels \
-lthermophysicalTransportModels \
-ldynamicFvMesh \
-ltopoChangerFvMesh \
-lmeshTools
Expand Up @@ -31,7 +31,6 @@ Description
\*---------------------------------------------------------------------------*/

#include "fvCFD.H"
#include "dynamicFvMesh.H"
#include "psiThermo.H"
#include "compressibleMomentumTransportModels.H"
#include "fluidThermophysicalTransportModel.H"
Expand All @@ -49,7 +48,7 @@ int main(int argc, char *argv[])

#include "setRootCaseLists.H"
#include "createTime.H"
#include "createDynamicFvMesh.H"
#include "createMesh.H"
#include "createFields.H"
#include "createFieldRefs.H"
#include "createTimeControls.H"
Expand Down
5 changes: 1 addition & 4 deletions applications/solvers/compressible/rhoPimpleFoam/Make/options
Expand Up @@ -7,8 +7,7 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/cfdTools \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude
-I$(LIB_SRC)/sampling/lnInclude

EXE_LIBS = \
-lfluidThermophysicalModels \
Expand All @@ -17,8 +16,6 @@ EXE_LIBS = \
-lcompressibleMomentumTransportModels \
-lthermophysicalTransportModels \
-lfiniteVolume \
-ldynamicFvMesh \
-ltopoChangerFvMesh \
-lmeshTools \
-lsampling \
-lfvModels \
Expand Down
Expand Up @@ -34,7 +34,6 @@ Description
\*---------------------------------------------------------------------------*/

#include "fvCFD.H"
#include "dynamicFvMesh.H"
#include "fluidThermo.H"
#include "compressibleMomentumTransportModels.H"
#include "fluidThermophysicalTransportModel.H"
Expand All @@ -54,7 +53,7 @@ int main(int argc, char *argv[])

#include "setRootCaseLists.H"
#include "createTime.H"
#include "createDynamicFvMesh.H"
#include "createMesh.H"
#include "createDyMControls.H"
#include "initContinuityErrs.H"
#include "createFields.H"
Expand Down
Expand Up @@ -9,8 +9,7 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/cfdTools \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude
-I$(LIB_SRC)/sampling/lnInclude

EXE_LIBS = \
-lfluidThermophysicalModels \
Expand All @@ -19,8 +18,6 @@ EXE_LIBS = \
-lcompressibleMomentumTransportModels \
-lthermophysicalTransportModels \
-lfiniteVolume \
-ldynamicFvMesh \
-ltopoChangerFvMesh \
-lmeshTools \
-lsampling \
-lfvModels \
Expand Down
Expand Up @@ -35,7 +35,6 @@ Description
\*---------------------------------------------------------------------------*/

#include "fvCFD.H"
#include "dynamicFvMesh.H"
#include "fluidThermo.H"
#include "compressibleMomentumTransportModels.H"
#include "fluidThermophysicalTransportModel.H"
Expand All @@ -56,7 +55,7 @@ int main(int argc, char *argv[])

#include "setRootCaseLists.H"
#include "createTime.H"
#include "createDynamicFvMesh.H"
#include "createMesh.H"
#include "createDyMControls.H"
#include "initContinuityErrs.H"
#include "createFields.H"
Expand Down
5 changes: 0 additions & 5 deletions applications/solvers/incompressible/pimpleFoam/Make/options
Expand Up @@ -4,8 +4,6 @@ EXE_INC = \
-I$(LIB_SRC)/physicalProperties/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \

EXE_LIBS = \
Expand All @@ -16,7 +14,4 @@ EXE_LIBS = \
-lfvModels \
-lfvConstraints \
-lsampling \
-ldynamicFvMesh \
-ltopoChangerFvMesh \
-ldynamicMesh \
-lmeshTools
3 changes: 1 addition & 2 deletions applications/solvers/incompressible/pimpleFoam/pimpleFoam.C
Expand Up @@ -33,7 +33,6 @@ Description
\*---------------------------------------------------------------------------*/

#include "fvCFD.H"
#include "dynamicFvMesh.H"
#include "viscosityModel.H"
#include "incompressibleMomentumTransportModels.H"
#include "pimpleControl.H"
Expand All @@ -52,7 +51,7 @@ int main(int argc, char *argv[])

#include "setRootCaseLists.H"
#include "createTime.H"
#include "createDynamicFvMesh.H"
#include "createMesh.H"
#include "initContinuityErrs.H"
#include "createDyMControls.H"
#include "createFields.H"
Expand Down
Expand Up @@ -11,7 +11,6 @@ EXE_INC = \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude

EXE_LIBS = \
Expand All @@ -23,8 +22,6 @@ EXE_LIBS = \
-lincompressibleMomentumTransportModels \
-lphaseIncompressibleMomentumTransportModels \
-lfiniteVolume \
-ldynamicFvMesh \
-ltopoChangerFvMesh \
-lfvModels \
-lfvConstraints \
-lmeshTools
Expand Up @@ -76,7 +76,6 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#include "fvCFD.H"
#include "dynamicFvMesh.H"
#include "viscosityModel.H"
#include "phaseIncompressibleMomentumTransportModel.H"
#include "pimpleControl.H"
Expand All @@ -94,7 +93,7 @@ int main(int argc, char *argv[])

#include "setRootCaseLists.H"
#include "createTime.H"
#include "createDynamicFvMesh.H"
#include "createMesh.H"
#include "createDyMControls.H"
#include "createFields.H"
#include "createUcfIfPresent.H"
Expand Down

0 comments on commit cf3d6cd

Please sign in to comment.