From cf3d6cd1e95569545fb429e927c8b2f2393a7025 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Fri, 1 Oct 2021 15:50:06 +0100 Subject: [PATCH] fvMeshMovers, fvMeshTopoChangers: General mesh motion and topology change 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. --- .../solvers/combustion/PDRFoam/Make/options | 3 - .../combustion/PDRFoam/PDRFoamAutoRefine.C | 53 +- .../combustion/reactingFoam/Make/options | 3 - .../buoyantReactingFoam/Make/options | 3 - .../buoyantReactingFoam/buoyantReactingFoam.C | 3 +- .../reactingFoam/engineFoam/Make/options | 2 - .../combustion/reactingFoam/reactingFoam.C | 3 +- .../compressible/rhoCentralFoam/Make/options | 3 - .../rhoCentralFoam/rhoCentralFoam.C | 3 +- .../compressible/rhoPimpleFoam/Make/options | 5 +- .../rhoPimpleFoam/rhoPimpleFoam.C | 3 +- .../buoyantPimpleFoam/Make/options | 5 +- .../buoyantPimpleFoam/buoyantPimpleFoam.C | 3 +- .../incompressible/pimpleFoam/Make/options | 5 - .../incompressible/pimpleFoam/pimpleFoam.C | 3 +- .../lagrangian/denseParticleFoam/Make/options | 3 - .../denseParticleFoam/denseParticleFoam.C | 3 +- .../lagrangian/particleFoam/Make/options | 3 - .../lagrangian/particleFoam/particleFoam.C | 3 +- .../lagrangian/rhoParticleFoam/Make/options | 6 +- .../rhoParticleFoam/rhoParticleFoam.C | 3 +- .../multiphase/cavitatingFoam/Make/options | 2 - .../cavitatingFoam/cavitatingFoam.C | 3 +- .../compressibleInterFoam/Make/options | 6 +- .../compressibleInterFoam.C | 3 +- .../solvers/multiphase/interFoam/Make/options | 3 - .../solvers/multiphase/interFoam/interFoam.C | 3 +- .../interFoam/interMixingFoam/Make/options | 2 - .../interMixingFoam/interMixingFoam.C | 3 +- .../multiphaseEulerFoam/Make/options | 6 +- .../multiphaseEulerFoam/multiphaseEulerFoam.C | 3 +- .../multiphaseInterFoam/Make/options | 2 - .../multiphaseInterFoam/multiphaseInterFoam.C | 3 +- .../potentialFreeSurfaceFoam/Make/options | 3 - .../potentialFreeSurfaceFoam.C | 3 +- .../utilities/mesh/advanced/PDRMesh/PDRMesh.C | 2 +- .../advanced/collapseEdges/collapseEdges.C | 2 +- .../mesh/advanced/removeFaces/removeFaces.C | 4 +- .../foamMeshToFluent/fluentFvMesh.C | 4 +- .../extrude/extrudeMesh/extrudeMesh.C | 2 +- .../backgroundMeshDecomposition.C | 3 +- .../cellShapeControlMesh.C | 3 +- .../conformalVoronoiMeshIO.C | 3 +- .../foamyHexMeshBackgroundMesh.C | 2 +- .../generation/snappyHexMesh/snappyHexMesh.C | 3 +- .../manipulation/deformedGeom/deformedGeom.C | 2 +- .../manipulation/mirrorMesh/mirrorFvMesh.C | 2 +- .../manipulation/moveDynamicMesh/Make/options | 5 +- .../moveDynamicMesh/moveDynamicMesh.C | 32 +- .../mesh/manipulation/moveMesh/moveMesh.C | 4 +- .../manipulation/polyDualMesh/polyDualMesh.C | 2 +- .../mesh/manipulation/rotateMesh/rotateMesh.C | 4 +- .../decomposePar/decomposePar.C | 3 +- .../decomposePar/domainDecomposition.C | 2 +- .../reconstructPar/reconstructPar.C | 5 +- .../reconstructParMesh/reconstructParMesh.C | 3 +- .../redistributePar/loadOrCreateMesh.C | 4 +- .../foamDataToFluent/foamDataToFluent.C | 4 +- .../dataConversion/foamToGMV/foamToGMV.C | 4 +- .../foamToTetDualMesh/foamToTetDualMesh.C | 5 +- .../dataConversion/smapToFoam/smapToFoam.C | 4 +- .../graphics/PVReaders/vtkPVFoam/vtkPVFoam.C | 3 +- .../ensightFoamReader/USERD_set_filenames.H | 3 +- .../miscellaneous/postChannel/postChannel.C | 2 +- .../applyBoundaryLayer/applyBoundaryLayer.C | 2 +- .../utilities/preProcessing/boxTurb/boxTurb.C | 4 +- .../dsmcInitialise/dsmcInitialise.C | 4 +- .../preProcessing/engineSwirl/engineSwirl.C | 4 +- .../preProcessing/mapFields/mapFields.C | 26 +- .../preProcessing/mapFieldsPar/mapFieldsPar.C | 6 +- .../preProcessing/mdInitialise/mdInitialise.C | 4 +- .../constant/dynamicMeshDict | 4 +- .../constant/dynamicMeshDict | 4 +- src/Allwmake | 4 +- .../RAS/RASModel/RASModel.C | 3 + .../RAS/kEpsilon/kEpsilon.C | 4 + src/OpenFOAM/include/createMeshNoChangers.H | 15 + src/OpenFOAM/include/createNamedMesh.H | 3 +- src/dynamicFvMesh/Make/files | 9 - .../dynamicFvMesh/dynamicFvMeshNew.C | 79 --- .../include/createDynamicFvMesh.H | 18 - .../include/createNamedDynamicFvMesh.H | 32 - .../displacementLinearMotionMotionSolver.H | 6 +- .../points0/points0MotionSolver.C | 66 +- .../solidBodyMotionFunction.H | 3 +- .../solidBodyMotionSolver.C | 69 +- .../solidBodyMotionSolver.H | 8 +- src/finiteVolume/Make/files | 12 + .../general}/include/createDyMControls.H | 0 .../cfdTools/general}/include/meshCourantNo.H | 2 +- .../general}/include/readDyMControls.H | 0 src/finiteVolume/fvMesh/fvMesh.C | 66 +- src/finiteVolume/fvMesh/fvMesh.H | 23 +- .../fvMeshMovers/fvMeshMover/fvMeshMover.C} | 99 +-- .../fvMeshMovers/fvMeshMover/fvMeshMover.H} | 107 ++-- .../fvMeshMovers/fvMeshMover/fvMeshMoverNew.C | 93 +++ .../fvMeshMovers/none/fvMeshMoversNone.C | 63 ++ .../fvMeshMovers/none/fvMeshMoversNone.H | 106 ++++ .../fvMeshTopoChanger/fvMeshTopoChanger.C | 95 +++ .../fvMeshTopoChanger/fvMeshTopoChanger.H | 182 ++++++ .../fvMeshTopoChanger/fvMeshTopoChangerNew.C | 100 +++ .../none/fvMeshTopoChangersNone.C} | 21 +- .../none/fvMeshTopoChangersNone.H} | 37 +- src/fvMeshMovers/Make/files | 5 + src/fvMeshMovers/Make/options | 7 + .../inkJet/fvMeshMoversInkJet.C} | 51 +- .../inkJet/fvMeshMoversInkJet.H} | 38 +- .../interpolator/fvMeshMoversInterpolator.C} | 44 +- .../interpolator/fvMeshMoversInterpolator.H} | 40 +- .../motionSolver/fvMeshMoversMotionSolver.C} | 58 +- .../motionSolver/fvMeshMoversMotionSolver.H} | 52 +- src/fvMeshTopoChangers/Make/files | 9 + .../Make/options | 0 .../linearValveFvMesh/linearValveFvMesh.C | 2 +- .../linearValveFvMesh/linearValveFvMesh.H | 2 +- .../linearValveLayersFvMesh.C | 4 +- .../linearValveLayersFvMesh.H | 2 +- .../mixerFvMesh/mixerFvMesh.C | 4 +- .../mixerFvMesh/mixerFvMesh.H | 2 +- .../fvMeshTopoChangersMovingCone.C} | 96 +-- .../fvMeshTopoChangersMovingCone.H} | 43 +- .../raw/fvMeshTopoChangersRaw.C} | 60 +- .../raw/fvMeshTopoChangersRaw.H} | 46 +- .../raw/fvMeshTopoChangersRawTemplates.C} | 19 +- .../refiner}/dynamicMeshDict | 5 +- .../refiner/fvMeshTopoChangersRefiner.C} | 599 ++++++++---------- .../refiner/fvMeshTopoChangersRefiner.H} | 75 +-- .../topoChangerFvMesh/topoChangerFvMesh.C | 2 +- .../topoChangerFvMesh/topoChangerFvMesh.H | 2 +- src/fvMotionSolver/Make/options | 4 +- ...surfaceDisplacementPointPatchVectorField.C | 9 +- ...aceSlipDisplacementPointPatchVectorField.C | 9 +- src/lagrangian/parcel/Make/options | 2 - src/lagrangian/parcelTurbulence/Make/options | 2 - .../cellSources/regionToCell/regionToCell.H | 4 +- src/rigidBodyState/Make/options | 6 +- src/rigidBodyState/rigidBodyState.C | 8 +- src/sixDoFRigidBodyState/Make/options | 6 +- .../sixDoFRigidBodyState.C | 12 +- src/topoChangerFvMesh/Make/options | 2 - .../constant/dynamicMeshDict | 54 +- .../movingCone/constant/dynamicMeshDict | 13 +- .../constant/dynamicMeshDict | 20 +- .../pimpleFoam/LES/channel395/Allclean | 9 + .../RAS/impeller/constant/dynamicMeshDict | 19 +- .../constant/dynamicMeshDict | 17 +- .../RAS/propeller/constant/dynamicMeshDict | 20 +- .../constant/dynamicMeshDict | 115 ++-- .../mixerVesselAMI2D/constant/dynamicMeshDict | 20 +- .../movingCone/constant/dynamicMeshDict | 13 +- .../mixerVesselAMI2D/constant/dynamicMeshDict | 47 +- .../SnakeRiverCanyon/constant/dynamicMeshDict | 22 +- .../sloshingTank2D/constant/dynamicMeshDict | 33 +- .../DTCHullMoving/constant/dynamicMeshDict | 107 ++-- .../constant/dynamicMeshDict.sixDoF | 91 +-- .../RAS/DTCHullWave/constant/dynamicMeshDict | 107 ++-- .../floatingObject/constant/dynamicMeshDict | 95 +-- .../constant/dynamicMeshDict.sixDoF | 119 ++-- .../mixerVesselAMI/constant/dynamicMeshDict | 19 +- .../planingHullW3/constant/dynamicMeshDict | 85 +-- .../RAS/propeller/constant/dynamicMeshDict | 33 +- .../constant/dynamicMeshDict | 62 +- .../damBreakWithObstacle/system/fvSolution | 3 +- .../sloshingCylinder/constant/dynamicMeshDict | 43 +- .../sloshingTank2D/constant/dynamicMeshDict | 33 +- .../constant/dynamicMeshDict | 33 +- .../sloshingTank3D/constant/dynamicMeshDict | 34 +- .../constant/dynamicMeshDict | 77 ++- .../sloshingTank3D3DoF/system/controlDict | 2 +- .../sloshingTank3D3DoF/system/fvSchemes | 2 +- .../sloshingTank3D3DoF/system/fvSolution | 26 +- .../constant/dynamicMeshDict | 19 +- .../testTubeMixer/constant/dynamicMeshDict | 71 ++- .../mixerVesselAMI2D/constant/dynamicMeshDict | 20 +- .../constant/dynamicMeshDict | 20 +- 175 files changed, 2586 insertions(+), 1918 deletions(-) create mode 100644 src/OpenFOAM/include/createMeshNoChangers.H delete mode 100644 src/dynamicFvMesh/Make/files delete mode 100644 src/dynamicFvMesh/dynamicFvMesh/dynamicFvMeshNew.C delete mode 100644 src/dynamicFvMesh/include/createDynamicFvMesh.H delete mode 100644 src/dynamicFvMesh/include/createNamedDynamicFvMesh.H rename src/{dynamicFvMesh => finiteVolume/cfdTools/general}/include/createDyMControls.H (100%) rename src/{dynamicFvMesh => finiteVolume/cfdTools/general}/include/meshCourantNo.H (96%) rename src/{dynamicFvMesh => finiteVolume/cfdTools/general}/include/readDyMControls.H (100%) rename src/{dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.C => finiteVolume/fvMesh/fvMeshMovers/fvMeshMover/fvMeshMover.C} (51%) rename src/{dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.H => finiteVolume/fvMesh/fvMeshMovers/fvMeshMover/fvMeshMover.H} (59%) create mode 100644 src/finiteVolume/fvMesh/fvMeshMovers/fvMeshMover/fvMeshMoverNew.C create mode 100644 src/finiteVolume/fvMesh/fvMeshMovers/none/fvMeshMoversNone.C create mode 100644 src/finiteVolume/fvMesh/fvMeshMovers/none/fvMeshMoversNone.H create mode 100644 src/finiteVolume/fvMesh/fvMeshTopoChangers/fvMeshTopoChanger/fvMeshTopoChanger.C create mode 100644 src/finiteVolume/fvMesh/fvMeshTopoChangers/fvMeshTopoChanger/fvMeshTopoChanger.H create mode 100644 src/finiteVolume/fvMesh/fvMeshTopoChangers/fvMeshTopoChanger/fvMeshTopoChangerNew.C rename src/{dynamicFvMesh/staticFvMesh/staticFvMesh.C => finiteVolume/fvMesh/fvMeshTopoChangers/none/fvMeshTopoChangersNone.C} (78%) rename src/{dynamicFvMesh/staticFvMesh/staticFvMesh.H => finiteVolume/fvMesh/fvMeshTopoChangers/none/fvMeshTopoChangersNone.H} (75%) create mode 100644 src/fvMeshMovers/Make/files create mode 100644 src/fvMeshMovers/Make/options rename src/{dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.C => fvMeshMovers/inkJet/fvMeshMoversInkJet.C} (70%) rename src/{dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.H => fvMeshMovers/inkJet/fvMeshMoversInkJet.H} (80%) rename src/{dynamicFvMesh/dynamicInterpolatedFvMesh/dynamicInterpolatedFvMesh.C => fvMeshMovers/interpolator/fvMeshMoversInterpolator.C} (66%) rename src/{dynamicFvMesh/dynamicInterpolatedFvMesh/dynamicInterpolatedFvMesh.H => fvMeshMovers/interpolator/fvMeshMoversInterpolator.H} (81%) rename src/{dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.C => fvMeshMovers/motionSolver/fvMeshMoversMotionSolver.C} (63%) rename src/{dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.H => fvMeshMovers/motionSolver/fvMeshMoversMotionSolver.H} (68%) create mode 100644 src/fvMeshTopoChangers/Make/files rename src/{dynamicFvMesh => fvMeshTopoChangers}/Make/options (100%) rename src/{topoChangerFvMesh => fvMeshTopoChangers}/linearValveFvMesh/linearValveFvMesh.C (99%) rename src/{topoChangerFvMesh => fvMeshTopoChangers}/linearValveFvMesh/linearValveFvMesh.H (97%) rename src/{topoChangerFvMesh => fvMeshTopoChangers}/linearValveLayersFvMesh/linearValveLayersFvMesh.C (98%) rename src/{topoChangerFvMesh => fvMeshTopoChangers}/linearValveLayersFvMesh/linearValveLayersFvMesh.H (98%) rename src/{topoChangerFvMesh => fvMeshTopoChangers}/mixerFvMesh/mixerFvMesh.C (98%) rename src/{topoChangerFvMesh => fvMeshTopoChangers}/mixerFvMesh/mixerFvMesh.H (98%) rename src/{topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.C => fvMeshTopoChangers/movingCone/fvMeshTopoChangersMovingCone.C} (79%) rename src/{topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.H => fvMeshTopoChangers/movingCone/fvMeshTopoChangersMovingCone.H} (78%) rename src/{topoChangerFvMesh/rawTopoChangerFvMesh/rawTopoChangerFvMesh.C => fvMeshTopoChangers/raw/fvMeshTopoChangersRaw.C} (79%) rename src/{topoChangerFvMesh/rawTopoChangerFvMesh/rawTopoChangerFvMesh.H => fvMeshTopoChangers/raw/fvMeshTopoChangersRaw.H} (77%) rename src/{topoChangerFvMesh/rawTopoChangerFvMesh/rawTopoChangerFvMeshTemplates.C => fvMeshTopoChangers/raw/fvMeshTopoChangersRawTemplates.C} (86%) rename src/{dynamicFvMesh/dynamicRefineFvMesh => fvMeshTopoChangers/refiner}/dynamicMeshDict (95%) rename src/{dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C => fvMeshTopoChangers/refiner/fvMeshTopoChangersRefiner.C} (71%) rename src/{dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.H => fvMeshTopoChangers/refiner/fvMeshTopoChangersRefiner.H} (83%) rename src/{topoChangerFvMesh => fvMeshTopoChangers}/topoChangerFvMesh/topoChangerFvMesh.C (96%) rename src/{topoChangerFvMesh => fvMeshTopoChangers}/topoChangerFvMesh/topoChangerFvMesh.H (97%) create mode 100755 tutorials/incompressible/pimpleFoam/LES/channel395/Allclean diff --git a/applications/solvers/combustion/PDRFoam/Make/options b/applications/solvers/combustion/PDRFoam/Make/options index 7e4c24f6cb..cfa9f3ae61 100644 --- a/applications/solvers/combustion/PDRFoam/Make/options +++ b/applications/solvers/combustion/PDRFoam/Make/options @@ -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 \ @@ -45,6 +43,5 @@ EXE_LIBS = \ -lthermophysicalTransportModels \ -llaminarFlameSpeedModels \ -lfiniteVolume \ - -ldynamicFvMesh \ -lfvModels \ -lfvConstraints diff --git a/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C b/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C index f6e1af6ca2..64f6716cc8 100644 --- a/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C +++ b/applications/solvers/combustion/PDRFoam/PDRFoamAutoRefine.C @@ -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 "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" @@ -122,22 +123,22 @@ int main(int argc, char *argv[]) fvc::makeAbsolute(phi, rho, U); // Test : disable refinement for some cells - PackedBoolList& protectedCell = - refCast(mesh).protectedCell(); + // PackedBoolList& protectedCell = + // refCast(mesh).protectedCell(); - if (protectedCell.empty()) - { - protectedCell.setSize(mesh.nCells()); - protectedCell = 0; - } + // if (protectedCell.empty()) + // { + // protectedCell.setSize(mesh.nCells()); + // protectedCell = 0; + // } - forAll(betav, celli) - { - if (betav[celli] < 0.99) - { - protectedCell[celli] = 1; - } - } + // forAll(betav, celli) + // { + // if (betav[celli] < 0.99) + // { + // protectedCell[celli] = 1; + // } + // } // Flux estimate for introduced faces. volVectorField rhoU("rhoU", rho*U); @@ -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" @@ -193,6 +195,7 @@ int main(int argc, char *argv[]) if (pimple.turbCorr()) { turbulence->correct(); + thermophysicalTransport->correct(); } } diff --git a/applications/solvers/combustion/reactingFoam/Make/options b/applications/solvers/combustion/reactingFoam/Make/options index d03ceba7ba..ab9720a89f 100644 --- a/applications/solvers/combustion/reactingFoam/Make/options +++ b/applications/solvers/combustion/reactingFoam/Make/options @@ -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 \ @@ -27,8 +26,6 @@ EXE_LIBS = \ -lcompressibleMomentumTransportModels \ -lthermophysicalTransportModels \ -lfluidReactionThermophysicalTransportModels \ - -ldynamicFvMesh \ - -ltopoChangerFvMesh \ -lfiniteVolume \ -lfvModels \ -lfvConstraints \ diff --git a/applications/solvers/combustion/reactingFoam/buoyantReactingFoam/Make/options b/applications/solvers/combustion/reactingFoam/buoyantReactingFoam/Make/options index e5daf02f6a..c54cfc8294 100644 --- a/applications/solvers/combustion/reactingFoam/buoyantReactingFoam/Make/options +++ b/applications/solvers/combustion/reactingFoam/buoyantReactingFoam/Make/options @@ -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 \ @@ -29,8 +28,6 @@ EXE_LIBS = \ -lchemistryModel \ -lODE \ -lcombustionModels \ - -ldynamicFvMesh \ - -ltopoChangerFvMesh \ -lfiniteVolume \ -lfvModels \ -lfvConstraints \ diff --git a/applications/solvers/combustion/reactingFoam/buoyantReactingFoam/buoyantReactingFoam.C b/applications/solvers/combustion/reactingFoam/buoyantReactingFoam/buoyantReactingFoam.C index a18d2bc54f..16e4d5bcc7 100644 --- a/applications/solvers/combustion/reactingFoam/buoyantReactingFoam/buoyantReactingFoam.C +++ b/applications/solvers/combustion/reactingFoam/buoyantReactingFoam/buoyantReactingFoam.C @@ -35,7 +35,6 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "dynamicFvMesh.H" #include "fluidReactionThermo.H" #include "combustionModel.H" #include "compressibleMomentumTransportModels.H" @@ -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" diff --git a/applications/solvers/combustion/reactingFoam/engineFoam/Make/options b/applications/solvers/combustion/reactingFoam/engineFoam/Make/options index 2b0f11293d..41206767e5 100644 --- a/applications/solvers/combustion/reactingFoam/engineFoam/Make/options +++ b/applications/solvers/combustion/reactingFoam/engineFoam/Make/options @@ -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 \ @@ -26,7 +25,6 @@ EXE_LIBS = \ -lfvConstraints \ -lsampling \ -lmeshTools \ - -ldynamicFvMesh \ -lmomentumTransportModels \ -lcompressibleMomentumTransportModels \ -lthermophysicalTransportModels \ diff --git a/applications/solvers/combustion/reactingFoam/reactingFoam.C b/applications/solvers/combustion/reactingFoam/reactingFoam.C index d7fe743e52..93173373b3 100644 --- a/applications/solvers/combustion/reactingFoam/reactingFoam.C +++ b/applications/solvers/combustion/reactingFoam/reactingFoam.C @@ -34,7 +34,6 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "dynamicFvMesh.H" #include "fluidReactionThermo.H" #include "combustionModel.H" #include "compressibleMomentumTransportModels.H" @@ -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" diff --git a/applications/solvers/compressible/rhoCentralFoam/Make/options b/applications/solvers/compressible/rhoCentralFoam/Make/options index b102a60f67..d6d9fb4db5 100644 --- a/applications/solvers/compressible/rhoCentralFoam/Make/options +++ b/applications/solvers/compressible/rhoCentralFoam/Make/options @@ -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 = \ @@ -20,6 +19,4 @@ EXE_LIBS = \ -lmomentumTransportModels \ -lcompressibleMomentumTransportModels \ -lthermophysicalTransportModels \ - -ldynamicFvMesh \ - -ltopoChangerFvMesh \ -lmeshTools diff --git a/applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C b/applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C index 9d7cd90004..ac023cf055 100644 --- a/applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C +++ b/applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C @@ -31,7 +31,6 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "dynamicFvMesh.H" #include "psiThermo.H" #include "compressibleMomentumTransportModels.H" #include "fluidThermophysicalTransportModel.H" @@ -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" diff --git a/applications/solvers/compressible/rhoPimpleFoam/Make/options b/applications/solvers/compressible/rhoPimpleFoam/Make/options index e59bbf84c5..b22cafd9a2 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/Make/options +++ b/applications/solvers/compressible/rhoPimpleFoam/Make/options @@ -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 \ @@ -17,8 +16,6 @@ EXE_LIBS = \ -lcompressibleMomentumTransportModels \ -lthermophysicalTransportModels \ -lfiniteVolume \ - -ldynamicFvMesh \ - -ltopoChangerFvMesh \ -lmeshTools \ -lsampling \ -lfvModels \ diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C index d7de830961..75a4a8c5ad 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoPimpleFoam.C @@ -34,7 +34,6 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "dynamicFvMesh.H" #include "fluidThermo.H" #include "compressibleMomentumTransportModels.H" #include "fluidThermophysicalTransportModel.H" @@ -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" diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options b/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options index d6039ba98b..b62c3724d2 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/Make/options @@ -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 \ @@ -19,8 +18,6 @@ EXE_LIBS = \ -lcompressibleMomentumTransportModels \ -lthermophysicalTransportModels \ -lfiniteVolume \ - -ldynamicFvMesh \ - -ltopoChangerFvMesh \ -lmeshTools \ -lsampling \ -lfvModels \ diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C b/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C index 3adff9fdcc..5175cd319b 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C @@ -35,7 +35,6 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "dynamicFvMesh.H" #include "fluidThermo.H" #include "compressibleMomentumTransportModels.H" #include "fluidThermophysicalTransportModel.H" @@ -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" diff --git a/applications/solvers/incompressible/pimpleFoam/Make/options b/applications/solvers/incompressible/pimpleFoam/Make/options index ce2bcfbff1..b09281a516 100644 --- a/applications/solvers/incompressible/pimpleFoam/Make/options +++ b/applications/solvers/incompressible/pimpleFoam/Make/options @@ -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 = \ @@ -16,7 +14,4 @@ EXE_LIBS = \ -lfvModels \ -lfvConstraints \ -lsampling \ - -ldynamicFvMesh \ - -ltopoChangerFvMesh \ - -ldynamicMesh \ -lmeshTools diff --git a/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C b/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C index 980f9f2101..51b5d4a9fd 100644 --- a/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C +++ b/applications/solvers/incompressible/pimpleFoam/pimpleFoam.C @@ -33,7 +33,6 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "dynamicFvMesh.H" #include "viscosityModel.H" #include "incompressibleMomentumTransportModels.H" #include "pimpleControl.H" @@ -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" diff --git a/applications/solvers/lagrangian/denseParticleFoam/Make/options b/applications/solvers/lagrangian/denseParticleFoam/Make/options index 78203194a7..32056a1595 100644 --- a/applications/solvers/lagrangian/denseParticleFoam/Make/options +++ b/applications/solvers/lagrangian/denseParticleFoam/Make/options @@ -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 = \ @@ -23,8 +22,6 @@ EXE_LIBS = \ -lincompressibleMomentumTransportModels \ -lphaseIncompressibleMomentumTransportModels \ -lfiniteVolume \ - -ldynamicFvMesh \ - -ltopoChangerFvMesh \ -lfvModels \ -lfvConstraints \ -lmeshTools diff --git a/applications/solvers/lagrangian/denseParticleFoam/denseParticleFoam.C b/applications/solvers/lagrangian/denseParticleFoam/denseParticleFoam.C index db6268cf46..5d2c1d6dd4 100644 --- a/applications/solvers/lagrangian/denseParticleFoam/denseParticleFoam.C +++ b/applications/solvers/lagrangian/denseParticleFoam/denseParticleFoam.C @@ -76,7 +76,6 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #include "fvCFD.H" -#include "dynamicFvMesh.H" #include "viscosityModel.H" #include "phaseIncompressibleMomentumTransportModel.H" #include "pimpleControl.H" @@ -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" diff --git a/applications/solvers/lagrangian/particleFoam/Make/options b/applications/solvers/lagrangian/particleFoam/Make/options index e02ae263b7..0b63a23dcd 100644 --- a/applications/solvers/lagrangian/particleFoam/Make/options +++ b/applications/solvers/lagrangian/particleFoam/Make/options @@ -7,7 +7,6 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ - -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude EXE_LIBS = \ @@ -20,6 +19,4 @@ EXE_LIBS = \ -lfiniteVolume \ -lregionModels \ -lsurfaceFilmModels \ - -ldynamicFvMesh \ - -ltopoChangerFvMesh \ -lmeshTools diff --git a/applications/solvers/lagrangian/particleFoam/particleFoam.C b/applications/solvers/lagrangian/particleFoam/particleFoam.C index 326f4a8fb6..9f664df0b2 100644 --- a/applications/solvers/lagrangian/particleFoam/particleFoam.C +++ b/applications/solvers/lagrangian/particleFoam/particleFoam.C @@ -33,7 +33,6 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "dynamicFvMesh.H" #include "viscosityModel.H" #include "incompressibleMomentumTransportModels.H" #include "parcelCloudList.H" @@ -47,7 +46,7 @@ int main(int argc, char *argv[]) #include "setRootCaseLists.H" #include "createTime.H" - #include "createDynamicFvMesh.H" + #include "createMesh.H" #include "createFields.H" #include "CourantNo.H" diff --git a/applications/solvers/lagrangian/rhoParticleFoam/Make/options b/applications/solvers/lagrangian/rhoParticleFoam/Make/options index 74a499688e..6a2b3cdd27 100644 --- a/applications/solvers/lagrangian/rhoParticleFoam/Make/options +++ b/applications/solvers/lagrangian/rhoParticleFoam/Make/options @@ -10,8 +10,7 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/regionModels/regionModel/lnInclude \ - -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \ - -I$(LIB_SRC)/dynamicFvMesh/lnInclude + -I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude EXE_LIBS = \ -llagrangian \ @@ -26,5 +25,4 @@ EXE_LIBS = \ -lfvConstraints \ -lmeshTools \ -lregionModels \ - -lsurfaceFilmModels \ - -ldynamicFvMesh + -lsurfaceFilmModels diff --git a/applications/solvers/lagrangian/rhoParticleFoam/rhoParticleFoam.C b/applications/solvers/lagrangian/rhoParticleFoam/rhoParticleFoam.C index 004f4d0dba..2dca314b58 100644 --- a/applications/solvers/lagrangian/rhoParticleFoam/rhoParticleFoam.C +++ b/applications/solvers/lagrangian/rhoParticleFoam/rhoParticleFoam.C @@ -32,7 +32,6 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "dynamicFvMesh.H" #include "fluidThermo.H" #include "compressibleMomentumTransportModels.H" #include "parcelCloudList.H" @@ -46,7 +45,7 @@ int main(int argc, char *argv[]) #include "setRootCaseLists.H" #include "createTime.H" - #include "createDynamicFvMesh.H" + #include "createMesh.H" #include "createFields.H" #include "compressibleCourantNo.H" diff --git a/applications/solvers/multiphase/cavitatingFoam/Make/options b/applications/solvers/multiphase/cavitatingFoam/Make/options index 755ae51eef..aa980c3790 100644 --- a/applications/solvers/multiphase/cavitatingFoam/Make/options +++ b/applications/solvers/multiphase/cavitatingFoam/Make/options @@ -7,7 +7,6 @@ EXE_INC = \ -I$(LIB_SRC)/MomentumTransportModels/incompressible/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/barotropicCompressibilityModel/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude EXE_LIBS = \ @@ -16,7 +15,6 @@ EXE_LIBS = \ -lincompressibleMomentumTransportModels \ -lbarotropicCompressibilityModel \ -lfiniteVolume \ - -ldynamicFvMesh \ -lfvModels \ -lfvConstraints \ -lmeshTools diff --git a/applications/solvers/multiphase/cavitatingFoam/cavitatingFoam.C b/applications/solvers/multiphase/cavitatingFoam/cavitatingFoam.C index 46a033f748..3e8d6a0caf 100644 --- a/applications/solvers/multiphase/cavitatingFoam/cavitatingFoam.C +++ b/applications/solvers/multiphase/cavitatingFoam/cavitatingFoam.C @@ -34,7 +34,6 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "dynamicFvMesh.H" #include "barotropicCompressibilityModel.H" #include "incompressibleTwoPhaseMixture.H" #include "incompressibleMomentumTransportModels.H" @@ -49,7 +48,7 @@ int main(int argc, char *argv[]) #include "setRootCaseLists.H" #include "createTime.H" - #include "createDynamicFvMesh.H" + #include "createMesh.H" #include "createControls.H" #include "createFields.H" #include "createUfIfPresent.H" diff --git a/applications/solvers/multiphase/compressibleInterFoam/Make/options b/applications/solvers/multiphase/compressibleInterFoam/Make/options index 6cc970b0d2..255b9612ed 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/Make/options +++ b/applications/solvers/multiphase/compressibleInterFoam/Make/options @@ -14,8 +14,6 @@ EXE_INC = \ -I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \ -I$(LIB_SRC)/MomentumTransportModels/phaseCompressible/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/dynamicMesh/lnInclude \ - -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/fvModels/lnInclude @@ -35,6 +33,4 @@ EXE_LIBS = \ -lfiniteVolume \ -lfvModels \ -lfvConstraints \ - -lmeshTools \ - -ldynamicMesh \ - -ldynamicFvMesh + -lmeshTools diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C index 93176e0bb1..8f8b40f618 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C @@ -41,7 +41,6 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "dynamicFvMesh.H" #include "CMULES.H" #include "EulerDdtScheme.H" #include "localEulerDdtScheme.H" @@ -64,7 +63,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" diff --git a/applications/solvers/multiphase/interFoam/Make/options b/applications/solvers/multiphase/interFoam/Make/options index 50399aa158..54ce1c3ad2 100644 --- a/applications/solvers/multiphase/interFoam/Make/options +++ b/applications/solvers/multiphase/interFoam/Make/options @@ -11,7 +11,6 @@ EXE_INC = \ -I$(LIB_SRC)/MomentumTransportModels/phaseIncompressible/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude @@ -22,8 +21,6 @@ EXE_LIBS = \ -lincompressibleMomentumTransportModels \ -lincompressibleInterPhaseTransportModel \ -lfiniteVolume \ - -ldynamicFvMesh \ - -ltopoChangerFvMesh \ -lfvModels \ -lfvConstraints \ -lmeshTools diff --git a/applications/solvers/multiphase/interFoam/interFoam.C b/applications/solvers/multiphase/interFoam/interFoam.C index 2be05a6d6f..739c5c6ed3 100644 --- a/applications/solvers/multiphase/interFoam/interFoam.C +++ b/applications/solvers/multiphase/interFoam/interFoam.C @@ -33,7 +33,6 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "dynamicFvMesh.H" #include "CMULES.H" #include "EulerDdtScheme.H" #include "localEulerDdtScheme.H" @@ -57,7 +56,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" diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/Make/options b/applications/solvers/multiphase/interFoam/interMixingFoam/Make/options index 145d027c3f..2dc2547b35 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/Make/options +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/Make/options @@ -11,7 +11,6 @@ EXE_INC = \ -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \ -I$(LIB_SRC)/MomentumTransportModels/incompressible/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude @@ -22,7 +21,6 @@ EXE_LIBS = \ -lmomentumTransportModels \ -lincompressibleMomentumTransportModels \ -lfiniteVolume \ - -ldynamicFvMesh \ -lmeshTools \ -lfvModels \ -lfvConstraints \ diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C b/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C index c1e064d442..e1564aa746 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/interMixingFoam.C @@ -32,7 +32,6 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "dynamicFvMesh.H" #include "CMULES.H" #include "localEulerDdtScheme.H" #include "subCycle.H" @@ -53,7 +52,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" diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam/Make/options b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam/Make/options index 173699dd3d..bd4fdc2ba4 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam/Make/options +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam/Make/options @@ -9,8 +9,7 @@ EXE_INC = \ -I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \ -I$(LIB_SRC)/MomentumTransportModels/phaseCompressible/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/dynamicFvMesh/lnInclude + -I$(LIB_SRC)/meshTools/lnInclude EXE_LIBS = \ -lphaseSystem \ @@ -24,5 +23,4 @@ EXE_LIBS = \ -lfiniteVolume \ -lfvModels \ -lfvConstraints \ - -lmeshTools \ - -ldynamicFvMesh + -lmeshTools diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam/multiphaseEulerFoam.C b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam/multiphaseEulerFoam.C index 013b3db660..feb1e52b08 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam/multiphaseEulerFoam.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseEulerFoam/multiphaseEulerFoam.C @@ -34,7 +34,6 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "dynamicFvMesh.H" #include "phaseSystem.H" #include "phaseCompressibleMomentumTransportModel.H" #include "pimpleControl.H" @@ -50,7 +49,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 "createFieldRefs.H" diff --git a/applications/solvers/multiphase/multiphaseInterFoam/Make/options b/applications/solvers/multiphase/multiphaseInterFoam/Make/options index 670f30a645..d1ee99db7b 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/Make/options +++ b/applications/solvers/multiphase/multiphaseInterFoam/Make/options @@ -6,7 +6,6 @@ EXE_INC = \ -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \ -I$(LIB_SRC)/MomentumTransportModels/incompressible/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude @@ -17,7 +16,6 @@ EXE_LIBS = \ -lmomentumTransportModels \ -lincompressibleMomentumTransportModels \ -lfiniteVolume \ - -ldynamicFvMesh \ -lfvModels \ -lfvConstraints \ -lmeshTools \ diff --git a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseInterFoam.C b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseInterFoam.C index 78c1792393..74148294ec 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseInterFoam.C +++ b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseInterFoam.C @@ -34,7 +34,6 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "dynamicFvMesh.H" #include "multiphaseMixture.H" #include "incompressibleMomentumTransportModels.H" #include "pimpleControl.H" @@ -51,7 +50,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" diff --git a/applications/solvers/multiphase/potentialFreeSurfaceFoam/Make/options b/applications/solvers/multiphase/potentialFreeSurfaceFoam/Make/options index 904f047fd3..915fc1b676 100644 --- a/applications/solvers/multiphase/potentialFreeSurfaceFoam/Make/options +++ b/applications/solvers/multiphase/potentialFreeSurfaceFoam/Make/options @@ -3,7 +3,6 @@ EXE_INC = \ -I$(LIB_SRC)/MomentumTransportModels/incompressible/lnInclude \ -I$(LIB_SRC)/physicalProperties/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude @@ -12,8 +11,6 @@ EXE_LIBS = \ -lmomentumTransportModels \ -lincompressibleMomentumTransportModels \ -lfiniteVolume \ - -ldynamicFvMesh \ - -ltopoChangerFvMesh \ -lmeshTools \ -lfvModels \ -lfvConstraints \ diff --git a/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceFoam.C b/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceFoam.C index 0f09922f03..57904d0757 100644 --- a/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceFoam.C +++ b/applications/solvers/multiphase/potentialFreeSurfaceFoam/potentialFreeSurfaceFoam.C @@ -39,7 +39,6 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "dynamicFvMesh.H" #include "viscosityModel.H" #include "incompressibleMomentumTransportModels.H" #include "pimpleControl.H" @@ -56,7 +55,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" diff --git a/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C b/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C index 455c8054c6..297e918ca0 100644 --- a/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C +++ b/applications/utilities/mesh/advanced/PDRMesh/PDRMesh.C @@ -565,7 +565,7 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" runTime.functionObjects().off(); - #include "createMesh.H" + #include "createMeshNoChangers.H" // Read control dictionary // ~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C index 2c6c1737a7..50b3daf224 100644 --- a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C +++ b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C @@ -89,7 +89,7 @@ int main(int argc, char *argv[]) runTime.functionObjects().off(); instantList timeDirs = timeSelector::selectIfPresent(runTime, args); - #include "createMesh.H" + #include "createMeshNoChangers.H" const word oldInstance = mesh.pointsInstance(); diff --git a/applications/utilities/mesh/advanced/removeFaces/removeFaces.C b/applications/utilities/mesh/advanced/removeFaces/removeFaces.C index 7ce2f25fe2..7d69aa8cac 100644 --- a/applications/utilities/mesh/advanced/removeFaces/removeFaces.C +++ b/applications/utilities/mesh/advanced/removeFaces/removeFaces.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -65,7 +65,7 @@ int main(int argc, char *argv[]) const bool overwrite = args.optionFound("overwrite"); const bool fields = !args.optionFound("noFields"); - #include "createMesh.H" + #include "createMeshNoChangers.H" const word oldInstance = mesh.pointsInstance(); const word setName = args[1]; diff --git a/applications/utilities/mesh/conversion/foamMeshToFluent/fluentFvMesh.C b/applications/utilities/mesh/conversion/foamMeshToFluent/fluentFvMesh.C index 74a420aafc..fb4dd81c68 100644 --- a/applications/utilities/mesh/conversion/foamMeshToFluent/fluentFvMesh.C +++ b/applications/utilities/mesh/conversion/foamMeshToFluent/fluentFvMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -42,7 +42,7 @@ using std::ios; Foam::fluentFvMesh::fluentFvMesh(const IOobject& io) : - fvMesh(io) + fvMesh(io, false) {} diff --git a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C index 1aaf2d7e34..95d17d5ad6 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeMesh/extrudeMesh.C @@ -370,7 +370,7 @@ int main(int argc, char *argv[]) sourceCaseDir ); - #include "createMesh.H" + #include "createMeshNoChangers.H" const polyBoundaryMesh& patches = mesh.boundaryMesh(); diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C index 45a88e1df6..5bd7d9f36f 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.C @@ -790,7 +790,8 @@ Foam::backgroundMeshDecomposition::backgroundMeshDecomposition IOobject::MUST_READ, IOobject::AUTO_WRITE, false - ) + ), + false ), meshCutter_ ( diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControlMesh/cellShapeControlMesh.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControlMesh/cellShapeControlMesh.C index 45cb05704b..319208c682 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControlMesh/cellShapeControlMesh.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/cellShapeControl/cellShapeControlMesh/cellShapeControlMesh.C @@ -378,7 +378,8 @@ Foam::cellShapeControlMesh::cellShapeControlMesh(const Time& runTime) runTime, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE - ) + ), + false ); if (mesh.nPoints() == this->vertexCount()) diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C index 4b3aaae6f5..358e6c8f3a 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMeshIO.C @@ -333,7 +333,8 @@ void Foam::conformalVoronoiMesh::writeMesh(const fileName& instance) // instance, // runTime_, // IOobject::MUST_READ -// ) +// ), +// false // ); // pointIOField dualPoints // ( diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshBackgroundMesh/foamyHexMeshBackgroundMesh.C b/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshBackgroundMesh/foamyHexMeshBackgroundMesh.C index 86cb67aade..2fbdd1a096 100644 --- a/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshBackgroundMesh/foamyHexMeshBackgroundMesh.C +++ b/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshBackgroundMesh/foamyHexMeshBackgroundMesh.C @@ -517,7 +517,7 @@ int main(int argc, char *argv[]) // Distribute the initial mesh if (Pstream::parRun()) { - #include "createMesh.H" + #include "createMeshNoChangers.H" Info<< "Loaded mesh:" << endl; printMeshData(mesh); diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C index de46509c74..3f0bda9771 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C @@ -708,7 +708,8 @@ int main(int argc, char *argv[]) runTime.timeName(), runTime, Foam::IOobject::MUST_READ - ) + ), + false ) ); } diff --git a/applications/utilities/mesh/manipulation/deformedGeom/deformedGeom.C b/applications/utilities/mesh/manipulation/deformedGeom/deformedGeom.C index 6b4a3995d4..9f93085524 100644 --- a/applications/utilities/mesh/manipulation/deformedGeom/deformedGeom.C +++ b/applications/utilities/mesh/manipulation/deformedGeom/deformedGeom.C @@ -49,7 +49,7 @@ int main(int argc, char *argv[]) const scalar scaleFactor = args.argRead(1); #include "createTime.H" - #include "createMesh.H" + #include "createMeshNoChangers.H" volPointInterpolation pInterp(mesh); diff --git a/applications/utilities/mesh/manipulation/mirrorMesh/mirrorFvMesh.C b/applications/utilities/mesh/manipulation/mirrorMesh/mirrorFvMesh.C index 8a544cd62d..a435ed468e 100644 --- a/applications/utilities/mesh/manipulation/mirrorMesh/mirrorFvMesh.C +++ b/applications/utilities/mesh/manipulation/mirrorMesh/mirrorFvMesh.C @@ -31,7 +31,7 @@ License Foam::mirrorFvMesh::mirrorFvMesh(const IOobject& io, const IOobject& dictIO) : - fvMesh(io), + fvMesh(io, false), mirrorMeshDict_(dictIO) { plane mirrorPlane(mirrorMeshDict_); diff --git a/applications/utilities/mesh/manipulation/moveDynamicMesh/Make/options b/applications/utilities/mesh/manipulation/moveDynamicMesh/Make/options index 5dbb0c35a2..6803aa1800 100644 --- a/applications/utilities/mesh/manipulation/moveDynamicMesh/Make/options +++ b/applications/utilities/mesh/manipulation/moveDynamicMesh/Make/options @@ -1,5 +1,4 @@ EXE_INC = \ - -I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/fileFormats/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \ @@ -7,7 +6,5 @@ EXE_INC = \ -I../checkMesh EXE_LIBS = \ - -ldynamicFvMesh \ -lmeshTools \ - -lsampling \ - -ldynamicMesh + -lsampling diff --git a/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C b/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C index 4443614c24..514d6fe27d 100644 --- a/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C +++ b/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,7 +31,7 @@ Description #include "argList.H" #include "Time.H" -#include "dynamicFvMesh.H" +#include "fvMesh.H" #include "pimpleControl.H" #include "vtkSurfaceWriter.H" #include "cyclicAMIPolyPatch.H" @@ -53,7 +53,33 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" - #include "createNamedDynamicFvMesh.H" + + Foam::word regionName; + + if (args.optionReadIfPresent("region", regionName)) + { + Foam::Info + << "Create mesh " << regionName << " for time = " + << runTime.timeName() << Foam::nl << Foam::endl; + } + else + { + regionName = Foam::fvMesh::defaultRegion; + Foam::Info + << "Create mesh for time = " + << runTime.timeName() << Foam::nl << Foam::endl; + } + + Foam::fvMesh mesh + ( + Foam::IOobject + ( + regionName, + runTime.timeName(), + runTime, + Foam::IOobject::MUST_READ + ) + ); const bool checkAMI = args.optionFound("checkAMI"); diff --git a/applications/utilities/mesh/manipulation/moveMesh/moveMesh.C b/applications/utilities/mesh/manipulation/moveMesh/moveMesh.C index 87217c43f3..55d6f780a2 100644 --- a/applications/utilities/mesh/manipulation/moveMesh/moveMesh.C +++ b/applications/utilities/mesh/manipulation/moveMesh/moveMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -42,7 +42,7 @@ int main(int argc, char *argv[]) { #include "setRootCase.H" #include "createTime.H" - #include "createMesh.H" + #include "createMeshNoChangers.H" IOdictionary dynamicMeshDict ( diff --git a/applications/utilities/mesh/manipulation/polyDualMesh/polyDualMesh.C b/applications/utilities/mesh/manipulation/polyDualMesh/polyDualMesh.C index b7a09e485f..f1e43798ca 100644 --- a/applications/utilities/mesh/manipulation/polyDualMesh/polyDualMesh.C +++ b/applications/utilities/mesh/manipulation/polyDualMesh/polyDualMesh.C @@ -384,7 +384,7 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" - #include "createMesh.H" + #include "createMeshNoChangers.H" const word oldInstance = mesh.pointsInstance(); diff --git a/applications/utilities/mesh/manipulation/rotateMesh/rotateMesh.C b/applications/utilities/mesh/manipulation/rotateMesh/rotateMesh.C index 8887e0ea76..567954bb0a 100644 --- a/applications/utilities/mesh/manipulation/rotateMesh/rotateMesh.C +++ b/applications/utilities/mesh/manipulation/rotateMesh/rotateMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -109,7 +109,7 @@ int main(int argc, char *argv[]) instantList timeDirs = timeSelector::select0(runTime, args); - #include "createMesh.H" + #include "createMeshNoChangers.H" forAll(timeDirs, timeI) { diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C index c23c05a043..a22570f243 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposePar.C +++ b/applications/utilities/parallelProcessing/decomposePar/decomposePar.C @@ -957,7 +957,8 @@ int main(int argc, char *argv[]) regionName, processorDb.timeName(), processorDb - ) + ), + false ) ); } diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C index d5800c8faa..d890cbc8c0 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.C @@ -75,7 +75,7 @@ Foam::domainDecomposition::domainDecomposition const fileName& dictFile ) : - fvMesh(io), + fvMesh(io, false), facesInstancePointsPtr_ ( pointsInstance() != facesInstance() diff --git a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C index f57c2bed56..ee3f4f0898 100644 --- a/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C +++ b/applications/utilities/parallelProcessing/reconstructPar/reconstructPar.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -269,7 +269,8 @@ int main(int argc, char *argv[]) runTime.timeName(), runTime, IOobject::MUST_READ - ) + ), + false ); diff --git a/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C b/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C index a41c52eaa4..ba786a501f 100644 --- a/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C +++ b/applications/utilities/parallelProcessing/reconstructParMesh/reconstructParMesh.C @@ -383,7 +383,8 @@ int main(int argc, char *argv[]) regionName, databases[proci].timeName(), databases[proci] - ) + ), + false ); // Initialise its addressing diff --git a/applications/utilities/parallelProcessing/redistributePar/loadOrCreateMesh.C b/applications/utilities/parallelProcessing/redistributePar/loadOrCreateMesh.C index 428a9be631..d9fbd8b4e4 100644 --- a/applications/utilities/parallelProcessing/redistributePar/loadOrCreateMesh.C +++ b/applications/utilities/parallelProcessing/redistributePar/loadOrCreateMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -214,7 +214,7 @@ Foam::autoPtr Foam::loadOrCreateMesh Pstream::parRun() = oldParRun; } - autoPtr meshPtr(new fvMesh(io)); + autoPtr meshPtr(new fvMesh(io, false)); fvMesh& mesh = meshPtr(); diff --git a/applications/utilities/postProcessing/dataConversion/foamDataToFluent/foamDataToFluent.C b/applications/utilities/postProcessing/dataConversion/foamDataToFluent/foamDataToFluent.C index 425844a810..af254aeee2 100644 --- a/applications/utilities/postProcessing/dataConversion/foamDataToFluent/foamDataToFluent.C +++ b/applications/utilities/postProcessing/dataConversion/foamDataToFluent/foamDataToFluent.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -46,7 +46,7 @@ int main(int argc, char *argv[]) instantList timeDirs = timeSelector::select0(runTime, args); - #include "createMesh.H" + #include "createMeshNoChangers.H" // make a directory called proInterface in the case mkDir(runTime.rootPath()/runTime.caseName()/"fluentInterface"); diff --git a/applications/utilities/postProcessing/dataConversion/foamToGMV/foamToGMV.C b/applications/utilities/postProcessing/dataConversion/foamToGMV/foamToGMV.C index c963b8517c..463e9cb59c 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToGMV/foamToGMV.C +++ b/applications/utilities/postProcessing/dataConversion/foamToGMV/foamToGMV.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -57,7 +57,7 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" - #include "createMesh.H" + #include "createMeshNoChangers.H" #include "readConversionProperties.H" diff --git a/applications/utilities/postProcessing/dataConversion/foamToTetDualMesh/foamToTetDualMesh.C b/applications/utilities/postProcessing/dataConversion/foamToTetDualMesh/foamToTetDualMesh.C index 6aa60b8ac7..ea58dac215 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTetDualMesh/foamToTetDualMesh.C +++ b/applications/utilities/postProcessing/dataConversion/foamToTetDualMesh/foamToTetDualMesh.C @@ -156,7 +156,7 @@ int main(int argc, char *argv[]) // Read the mesh - #include "createMesh.H" + #include "createMeshNoChangers.H" // Read the tetDualMesh Info<< "Create tetDualMesh for time = " @@ -170,7 +170,8 @@ int main(int argc, char *argv[]) runTime.timeName(), runTime, IOobject::MUST_READ - ) + ), + false ); // From tet vertices to poly cells/faces const labelIOList pointDualAddressing diff --git a/applications/utilities/postProcessing/dataConversion/smapToFoam/smapToFoam.C b/applications/utilities/postProcessing/dataConversion/smapToFoam/smapToFoam.C index b72c538d1f..e9c05faa4a 100644 --- a/applications/utilities/postProcessing/dataConversion/smapToFoam/smapToFoam.C +++ b/applications/utilities/postProcessing/dataConversion/smapToFoam/smapToFoam.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -64,7 +64,7 @@ int main(int argc, char *argv[]) if (fieldNameDict.found("epsilon")) nameMap.add("ED", word("epsilon")); if (fieldNameDict.found("nuEff")) nameMap.add("VIS", word("nuEff")); - #include "createMesh.H" + #include "createMeshNoChangers.H" IFstream smapFile(args[1]); diff --git a/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoam.C b/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoam.C index 3f285ff716..e7385fcce9 100644 --- a/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoam.C +++ b/applications/utilities/postProcessing/graphics/PVReaders/vtkPVFoam/vtkPVFoam.C @@ -469,7 +469,8 @@ void Foam::vtkPVFoam::updateFoamMesh() dbPtr_().timeName(), dbPtr_(), IOobject::MUST_READ - ) + ), + false ); meshChanged_ = true; diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H index 0da7ed1e0d..112048c7d3 100644 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/USERD_set_filenames.H @@ -75,7 +75,8 @@ int USERD_set_filenames fvMesh::defaultRegion, runTime.timeName(), runTime - ) + ), + false ); // set the available number of time-steps diff --git a/applications/utilities/postProcessing/miscellaneous/postChannel/postChannel.C b/applications/utilities/postProcessing/miscellaneous/postChannel/postChannel.C index 7c847163b5..cf51a27943 100644 --- a/applications/utilities/postProcessing/miscellaneous/postChannel/postChannel.C +++ b/applications/utilities/postProcessing/miscellaneous/postChannel/postChannel.C @@ -56,7 +56,7 @@ int main(int argc, char *argv[]) // Get times list instantList timeDirs = timeSelector::select0(runTime, args); - #include "createMesh.H" + #include "createMeshNoChangers.H" #include "readPhysicalProperties.H" const word& gFormat = runTime.graphFormat(); diff --git a/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C b/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C index 1bc77c5567..b24610c319 100644 --- a/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C +++ b/applications/utilities/preProcessing/applyBoundaryLayer/applyBoundaryLayer.C @@ -94,7 +94,7 @@ int main(int argc, char *argv[]) } #include "createTime.H" - #include "createMesh.H" + #include "createMeshNoChangers.H" #include "createFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/utilities/preProcessing/boxTurb/boxTurb.C b/applications/utilities/preProcessing/boxTurb/boxTurb.C index f0dd2d7f1b..8f66306e82 100644 --- a/applications/utilities/preProcessing/boxTurb/boxTurb.C +++ b/applications/utilities/preProcessing/boxTurb/boxTurb.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -47,7 +47,7 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" - #include "createMesh.H" + #include "createMeshNoChangers.H" #include "createFields.H" #include "readBoxTurbDict.H" diff --git a/applications/utilities/preProcessing/dsmcInitialise/dsmcInitialise.C b/applications/utilities/preProcessing/dsmcInitialise/dsmcInitialise.C index cc2738350c..349981cbbe 100644 --- a/applications/utilities/preProcessing/dsmcInitialise/dsmcInitialise.C +++ b/applications/utilities/preProcessing/dsmcInitialise/dsmcInitialise.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,7 +39,7 @@ int main(int argc, char *argv[]) { #include "setRootCase.H" #include "createTime.H" - #include "createMesh.H" + #include "createMeshNoChangers.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/utilities/preProcessing/engineSwirl/engineSwirl.C b/applications/utilities/preProcessing/engineSwirl/engineSwirl.C index d75e95d165..7d5edbcc51 100644 --- a/applications/utilities/preProcessing/engineSwirl/engineSwirl.C +++ b/applications/utilities/preProcessing/engineSwirl/engineSwirl.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,7 +39,7 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" - #include "createMesh.H" + #include "createMeshNoChangers.H" #include "createFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/utilities/preProcessing/mapFields/mapFields.C b/applications/utilities/preProcessing/mapFields/mapFields.C index f8487d4e1d..d7da1ae83f 100644 --- a/applications/utilities/preProcessing/mapFields/mapFields.C +++ b/applications/utilities/preProcessing/mapFields/mapFields.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -343,7 +343,8 @@ int main(int argc, char *argv[]) targetRegion, runTimeTarget.timeName(), runTimeTarget - ) + ), + false ); Info<< "Target mesh size: " << meshTarget.nCells() << endl; @@ -368,7 +369,8 @@ int main(int argc, char *argv[]) sourceRegion, runTimeSource.timeName(), runTimeSource - ) + ), + false ); Info<< "mesh size: " << meshSource.nCells() << endl; @@ -424,7 +426,8 @@ int main(int argc, char *argv[]) sourceRegion, runTimeSource.timeName(), runTimeSource - ) + ), + false ); Info<< "Source mesh size: " << meshSource.nCells() << endl; @@ -447,7 +450,8 @@ int main(int argc, char *argv[]) targetRegion, runTimeTarget.timeName(), runTimeTarget - ) + ), + false ); Info<< "mesh size: " << meshTarget.nCells() << endl; @@ -536,7 +540,8 @@ int main(int argc, char *argv[]) sourceRegion, runTimeSource.timeName(), runTimeSource - ) + ), + false ); Info<< "mesh size: " << meshSource.nCells() << endl; @@ -571,7 +576,8 @@ int main(int argc, char *argv[]) targetRegion, runTimeTarget.timeName(), runTimeTarget - ) + ), + false ); Info<< "mesh size: " << meshTarget.nCells() << endl; @@ -621,7 +627,8 @@ int main(int argc, char *argv[]) sourceRegion, runTimeSource.timeName(), runTimeSource - ) + ), + false ); fvMesh meshTarget @@ -631,7 +638,8 @@ int main(int argc, char *argv[]) targetRegion, runTimeTarget.timeName(), runTimeTarget - ) + ), + false ); Info<< "Source mesh size: " << meshSource.nCells() << tab diff --git a/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C b/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C index 27477c3c05..7d886d8bc9 100644 --- a/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C +++ b/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C @@ -291,7 +291,8 @@ int main(int argc, char *argv[]) sourceRegion, runTimeSource.timeName(), runTimeSource - ) + ), + false ); fvMesh meshTarget @@ -301,7 +302,8 @@ int main(int argc, char *argv[]) targetRegion, runTimeTarget.timeName(), runTimeTarget - ) + ), + false ); Info<< "Source mesh size: " << meshSource.nCells() << tab diff --git a/applications/utilities/preProcessing/mdInitialise/mdInitialise.C b/applications/utilities/preProcessing/mdInitialise/mdInitialise.C index 9191cff7c2..5a2f76cf45 100644 --- a/applications/utilities/preProcessing/mdInitialise/mdInitialise.C +++ b/applications/utilities/preProcessing/mdInitialise/mdInitialise.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,7 +35,7 @@ int main(int argc, char *argv[]) { #include "setRootCase.H" #include "createTime.H" - #include "createMesh.H" + #include "createMeshNoChangers.H" IOdictionary mdInitialiseDict ( diff --git a/etc/templates/closedVolumeRotating/constant/dynamicMeshDict b/etc/templates/closedVolumeRotating/constant/dynamicMeshDict index 926e9f9447..3987b54f5c 100644 --- a/etc/templates/closedVolumeRotating/constant/dynamicMeshDict +++ b/etc/templates/closedVolumeRotating/constant/dynamicMeshDict @@ -13,9 +13,9 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -dynamicFvMesh dynamicMotionSolverFvMesh; +mover motionSolver; -motionSolverLibs ( "libfvMotionSolvers.so" ); +libs ("libfvMeshMovers.so" "libfvMotionSolvers.so"); motionSolver solidBody; diff --git a/etc/templates/inflowOutflowRotating/constant/dynamicMeshDict b/etc/templates/inflowOutflowRotating/constant/dynamicMeshDict index 926e9f9447..3987b54f5c 100644 --- a/etc/templates/inflowOutflowRotating/constant/dynamicMeshDict +++ b/etc/templates/inflowOutflowRotating/constant/dynamicMeshDict @@ -13,9 +13,9 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -dynamicFvMesh dynamicMotionSolverFvMesh; +mover motionSolver; -motionSolverLibs ( "libfvMotionSolvers.so" ); +libs ("libfvMeshMovers.so" "libfvMotionSolvers.so"); motionSolver solidBody; diff --git a/src/Allwmake b/src/Allwmake index 29f8b1f148..2dfdad6574 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -46,8 +46,8 @@ wmake $targetType dynamicMesh # Compile scotchDecomp, metisDecomp etc. parallel/Allwmake $targetType $* -wmake $targetType dynamicFvMesh -wmake $targetType topoChangerFvMesh +wmake $targetType fvMeshMovers +wmake $targetType fvMeshTopoChangers wmake $targetType conversion wmake $targetType sampling diff --git a/src/MomentumTransportModels/momentumTransportModels/RAS/RASModel/RASModel.C b/src/MomentumTransportModels/momentumTransportModels/RAS/RASModel/RASModel.C index 2ecde9bb93..95faf0c0e5 100644 --- a/src/MomentumTransportModels/momentumTransportModels/RAS/RASModel/RASModel.C +++ b/src/MomentumTransportModels/momentumTransportModels/RAS/RASModel/RASModel.C @@ -183,8 +183,11 @@ Foam::RASModel::New template bool Foam::RASModel::read() { + InfoInFunction << "Hmm" << endl; + if (BasicMomentumTransportModel::read()) { + InfoInFunction << "Hmm1" << endl; RASDict_ <<= this->subDict("RAS"); RASDict_.lookup("turbulence") >> turbulence_; diff --git a/src/MomentumTransportModels/momentumTransportModels/RAS/kEpsilon/kEpsilon.C b/src/MomentumTransportModels/momentumTransportModels/RAS/kEpsilon/kEpsilon.C index 4012db3cd8..b64da9ff5d 100644 --- a/src/MomentumTransportModels/momentumTransportModels/RAS/kEpsilon/kEpsilon.C +++ b/src/MomentumTransportModels/momentumTransportModels/RAS/kEpsilon/kEpsilon.C @@ -196,8 +196,12 @@ kEpsilon::kEpsilon template bool kEpsilon::read() { + InfoInFunction << "Hmm" << endl; + if (eddyViscosity>::read()) { + InfoInFunction << "Hmm1" << endl; + Cmu_.readIfPresent(this->coeffDict()); C1_.readIfPresent(this->coeffDict()); C2_.readIfPresent(this->coeffDict()); diff --git a/src/OpenFOAM/include/createMeshNoChangers.H b/src/OpenFOAM/include/createMeshNoChangers.H new file mode 100644 index 0000000000..f66e97a056 --- /dev/null +++ b/src/OpenFOAM/include/createMeshNoChangers.H @@ -0,0 +1,15 @@ +Foam::Info + << "Create mesh for time = " + << runTime.timeName() << Foam::nl << Foam::endl; + +Foam::fvMesh mesh +( + Foam::IOobject + ( + Foam::fvMesh::defaultRegion, + runTime.timeName(), + runTime, + Foam::IOobject::MUST_READ + ), + false +); diff --git a/src/OpenFOAM/include/createNamedMesh.H b/src/OpenFOAM/include/createNamedMesh.H index bfaa243e10..038102c0be 100644 --- a/src/OpenFOAM/include/createNamedMesh.H +++ b/src/OpenFOAM/include/createNamedMesh.H @@ -22,5 +22,6 @@ Foam::fvMesh mesh runTime.timeName(), runTime, Foam::IOobject::MUST_READ - ) + ), + false ); diff --git a/src/dynamicFvMesh/Make/files b/src/dynamicFvMesh/Make/files deleted file mode 100644 index b5c9a70656..0000000000 --- a/src/dynamicFvMesh/Make/files +++ /dev/null @@ -1,9 +0,0 @@ -dynamicFvMesh/dynamicFvMesh.C -dynamicFvMesh/dynamicFvMeshNew.C -staticFvMesh/staticFvMesh.C -dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.C -dynamicInkJetFvMesh/dynamicInkJetFvMesh.C -dynamicInterpolatedFvMesh/dynamicInterpolatedFvMesh.C -dynamicRefineFvMesh/dynamicRefineFvMesh.C - -LIB = $(FOAM_LIBBIN)/libdynamicFvMesh diff --git a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMeshNew.C b/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMeshNew.C deleted file mode 100644 index 784f410673..0000000000 --- a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMeshNew.C +++ /dev/null @@ -1,79 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -\*---------------------------------------------------------------------------*/ - -#include "staticFvMesh.H" -#include "Time.H" - -// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // - -Foam::autoPtr Foam::dynamicFvMesh::New(const IOobject& io) -{ - typeIOobject dictHeader(dynamicMeshDictIOobject(io)); - - if (dictHeader.headerOk()) - { - IOdictionary dict(dictHeader); - - const word dynamicFvMeshTypeName(dict.lookup("dynamicFvMesh")); - - Info<< "Selecting dynamicFvMesh " << dynamicFvMeshTypeName << endl; - - libs.open - ( - dict, - "dynamicFvMeshLibs", - IOobjectConstructorTablePtr_ - ); - - if (!IOobjectConstructorTablePtr_) - { - FatalErrorInFunction - << "dynamicFvMesh table is empty" - << exit(FatalError); - } - - IOobjectConstructorTable::iterator cstrIter = - IOobjectConstructorTablePtr_->find(dynamicFvMeshTypeName); - - if (cstrIter == IOobjectConstructorTablePtr_->end()) - { - FatalErrorInFunction - << "Unknown dynamicFvMesh type " - << dynamicFvMeshTypeName << nl << nl - << "Valid dynamicFvMesh types are :" << endl - << IOobjectConstructorTablePtr_->sortedToc() - << exit(FatalError); - } - - return autoPtr(cstrIter()(io)); - } - else - { - return autoPtr(new staticFvMesh(io)); - } -} - - -// ************************************************************************* // diff --git a/src/dynamicFvMesh/include/createDynamicFvMesh.H b/src/dynamicFvMesh/include/createDynamicFvMesh.H deleted file mode 100644 index 97303ffded..0000000000 --- a/src/dynamicFvMesh/include/createDynamicFvMesh.H +++ /dev/null @@ -1,18 +0,0 @@ - Info<< "Create mesh for time = " - << runTime.timeName() << nl << endl; - - autoPtr meshPtr - ( - dynamicFvMesh::New - ( - IOobject - ( - dynamicFvMesh::defaultRegion, - runTime.timeName(), - runTime, - IOobject::MUST_READ - ) - ) - ); - - dynamicFvMesh& mesh = meshPtr(); diff --git a/src/dynamicFvMesh/include/createNamedDynamicFvMesh.H b/src/dynamicFvMesh/include/createNamedDynamicFvMesh.H deleted file mode 100644 index 8ffc1490f5..0000000000 --- a/src/dynamicFvMesh/include/createNamedDynamicFvMesh.H +++ /dev/null @@ -1,32 +0,0 @@ - Foam::word regionName; - - if (args.optionReadIfPresent("region", regionName)) - { - Foam::Info - << "Create mesh " << regionName << " for time = " - << runTime.timeName() << Foam::nl << Foam::endl; - } - else - { - regionName = Foam::fvMesh::defaultRegion; - Foam::Info - << "Create mesh for time = " - << runTime.timeName() << Foam::nl << Foam::endl; - } - - - autoPtr meshPtr - ( - dynamicFvMesh::New - ( - IOobject - ( - regionName, - runTime.timeName(), - runTime, - IOobject::MUST_READ - ) - ) - ); - - dynamicFvMesh& mesh = meshPtr(); diff --git a/src/dynamicMesh/motionSolvers/displacement/linearSolver/displacementLinearMotionMotionSolver.H b/src/dynamicMesh/motionSolvers/displacement/linearSolver/displacementLinearMotionMotionSolver.H index c0fc34a8ab..8ed6f30004 100644 --- a/src/dynamicMesh/motionSolvers/displacement/linearSolver/displacementLinearMotionMotionSolver.H +++ b/src/dynamicMesh/motionSolvers/displacement/linearSolver/displacementLinearMotionMotionSolver.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -30,7 +30,9 @@ Description Example: \verbatim - dynamicFvMesh dynamicMotionSolverFvMesh; + mover motionSolver; + + libs ("libfvMeshMovers.so" "libfvMotionSolvers.so"); motionSolver displacementLinearMotion; diff --git a/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.C b/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.C index 311cee53ea..a93832dcb0 100644 --- a/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.C +++ b/src/dynamicMesh/motionSolvers/displacement/points0/points0MotionSolver.C @@ -24,7 +24,6 @@ License \*---------------------------------------------------------------------------*/ #include "points0MotionSolver.H" -#include "mapPolyMesh.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -80,70 +79,7 @@ void Foam::points0MotionSolver::movePoints(const pointField&) void Foam::points0MotionSolver::updateMesh(const mapPolyMesh& mpm) { - // pointMesh already updates pointFields - - motionSolver::updateMesh(mpm); - - // Map points0_. Bit special since we somehow have to come up with - // a sensible points0 position for introduced points. - // Find out scaling between points0 and current points - - // Get the new points either from the map or the mesh - const pointField& points = - ( - mpm.hasMotionPoints() - ? mpm.preMotionPoints() - : mesh().points() - ); - - // Note: boundBox does reduce - const vector span0 = boundBox(points0_).span(); - const vector span = boundBox(points).span(); - - vector scaleFactors(cmptDivide(span0, span)); - - pointField newPoints0(mpm.pointMap().size()); - - forAll(newPoints0, pointi) - { - label oldPointi = mpm.pointMap()[pointi]; - - if (oldPointi >= 0) - { - label masterPointi = mpm.reversePointMap()[oldPointi]; - - if (masterPointi == pointi) - { - newPoints0[pointi] = points0_[oldPointi]; - } - else - { - // New point - assume motion is scaling - newPoints0[pointi] = points0_[oldPointi] + cmptMultiply - ( - scaleFactors, - points[pointi] - points[masterPointi] - ); - } - } - else - { - FatalErrorInFunction - << "Cannot determine co-ordinates of introduced vertices." - << " New vertex " << pointi << " at co-ordinate " - << points[pointi] << exit(FatalError); - } - } - - twoDCorrectPoints(newPoints0); - - points0_.transfer(newPoints0); - - // points0 changed - set to write and check-in to database - points0_.rename("points0"); - points0_.writeOpt() = IOobject::AUTO_WRITE; - points0_.instance() = mesh().time().timeName(); - points0_.checkIn(); + NotImplemented; } diff --git a/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/solidBodyMotionFunction/solidBodyMotionFunction.H b/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/solidBodyMotionFunction/solidBodyMotionFunction.H index 0c08b6ae38..f7b3d8667f 100644 --- a/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/solidBodyMotionFunction/solidBodyMotionFunction.H +++ b/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionFunctions/solidBodyMotionFunction/solidBodyMotionFunction.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -36,7 +36,6 @@ Description SourceFiles solidBodyMotionFunction.C - dynamicFvMeshNew.C \*---------------------------------------------------------------------------*/ diff --git a/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionSolver/solidBodyMotionSolver.C b/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionSolver/solidBodyMotionSolver.C index 06d5740b63..c30a5407a2 100644 --- a/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionSolver/solidBodyMotionSolver.C +++ b/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionSolver/solidBodyMotionSolver.C @@ -30,6 +30,7 @@ License #include "cellSet.H" #include "boolList.H" #include "syncTools.H" +#include "mapPolyMesh.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -56,7 +57,8 @@ Foam::solidBodyMotionSolver::solidBodyMotionSolver points0MotionSolver(mesh, dict, typeName), SBMFPtr_(solidBodyMotionFunction::New(coeffDict(), mesh.time())), pointIDs_(), - moveAllCells_(false) + moveAllCells_(false), + transform_(SBMFPtr_().transformation()) { word cellZoneName = coeffDict().lookupOrDefault("cellZone", "none"); @@ -156,9 +158,11 @@ Foam::solidBodyMotionSolver::~solidBodyMotionSolver() Foam::tmp Foam::solidBodyMotionSolver::curPoints() const { + transform_ = SBMFPtr_().transformation(); + if (moveAllCells_) { - return transformPoints(SBMFPtr_().transformation(), points0_); + return transformPoints(transform_, points0_); } else { @@ -167,7 +171,7 @@ Foam::tmp Foam::solidBodyMotionSolver::curPoints() const UIndirectList(transformedPts, pointIDs_) = transformPoints ( - SBMFPtr_().transformation(), + transform_, pointField(points0_, pointIDs_) ); @@ -176,4 +180,63 @@ Foam::tmp Foam::solidBodyMotionSolver::curPoints() const } +void Foam::solidBodyMotionSolver::updateMesh(const mapPolyMesh& mpm) +{ + // pointMesh already updates pointFields + + motionSolver::updateMesh(mpm); + + // Map points0_. Bit special since we somehow have to come up with + // a sensible points0 position for introduced points. + // Find out scaling between points0 and current points + + // Get the new points either from the map or the mesh + const pointField& points = + ( + mpm.hasMotionPoints() + ? mpm.preMotionPoints() + : mesh().points() + ); + + pointField newPoints0(mpm.pointMap().size()); + + forAll(newPoints0, pointi) + { + label oldPointi = mpm.pointMap()[pointi]; + + if (oldPointi >= 0) + { + label masterPointi = mpm.reversePointMap()[oldPointi]; + + if (masterPointi == pointi) + { + newPoints0[pointi] = points0_[oldPointi]; + } + else + { + newPoints0[pointi] = + transform_.invTransformPoint(points[pointi]); + } + } + else + { + FatalErrorInFunction + << "Cannot determine co-ordinates of introduced vertices." + << " New vertex " << pointi << " at co-ordinate " + << points[pointi] << exit(FatalError); + } + } + + twoDCorrectPoints(newPoints0); + + points0_.transfer(newPoints0); + + // points0 changed - set to write and check-in to database + points0_.rename("points0"); + points0_.writeOpt() = IOobject::AUTO_WRITE; + points0_.instance() = mesh().time().timeName(); + points0_.checkIn(); +} + + // ************************************************************************* // diff --git a/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionSolver/solidBodyMotionSolver.H b/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionSolver/solidBodyMotionSolver.H index bc71e99c04..0181c7bab2 100644 --- a/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionSolver/solidBodyMotionSolver.H +++ b/src/dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionSolver/solidBodyMotionSolver.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -63,6 +63,9 @@ class solidBodyMotionSolver //- Flag to indicate whether all cells should move bool moveAllCells_; + //- Cache the current transform for updateMesh + mutable septernion transform_; + public: @@ -96,6 +99,9 @@ public: virtual void solve() {} + //- Update local data for topology changes + virtual void updateMesh(const mapPolyMesh&); + // Member Operators diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index aa7cecc9d8..9e7842e50c 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -93,6 +93,18 @@ $(faceToCell)/extendedFaceToCellStencil.C $(faceToCell)/extendedCentredFaceToCellStencil.C $(faceToCell)/MeshObjects/centredCFCFaceToCellStencilObject.C +fvMeshMovers = fvMesh/fvMeshMovers + +$(fvMeshMovers)/fvMeshMover/fvMeshMover.C +$(fvMeshMovers)/fvMeshMover/fvMeshMoverNew.C +$(fvMeshMovers)/none/fvMeshMoversNone.C + +fvMeshTopoChangers = fvMesh/fvMeshTopoChangers + +$(fvMeshTopoChangers)/fvMeshTopoChanger/fvMeshTopoChanger.C +$(fvMeshTopoChangers)/fvMeshTopoChanger/fvMeshTopoChangerNew.C +$(fvMeshTopoChangers)/none/fvMeshTopoChangersNone.C + functionObjects/fvMeshFunctionObject/fvMeshFunctionObject.C functionObjects/volRegion/volRegion.C diff --git a/src/dynamicFvMesh/include/createDyMControls.H b/src/finiteVolume/cfdTools/general/include/createDyMControls.H similarity index 100% rename from src/dynamicFvMesh/include/createDyMControls.H rename to src/finiteVolume/cfdTools/general/include/createDyMControls.H diff --git a/src/dynamicFvMesh/include/meshCourantNo.H b/src/finiteVolume/cfdTools/general/include/meshCourantNo.H similarity index 96% rename from src/dynamicFvMesh/include/meshCourantNo.H rename to src/finiteVolume/cfdTools/general/include/meshCourantNo.H index 10a9d32934..f8eea4c242 100644 --- a/src/dynamicFvMesh/include/meshCourantNo.H +++ b/src/finiteVolume/cfdTools/general/include/meshCourantNo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/dynamicFvMesh/include/readDyMControls.H b/src/finiteVolume/cfdTools/general/include/readDyMControls.H similarity index 100% rename from src/dynamicFvMesh/include/readDyMControls.H rename to src/finiteVolume/cfdTools/general/include/readDyMControls.H diff --git a/src/finiteVolume/fvMesh/fvMesh.C b/src/finiteVolume/fvMesh/fvMesh.C index c944d99fcd..0c0bc77101 100644 --- a/src/finiteVolume/fvMesh/fvMesh.C +++ b/src/finiteVolume/fvMesh/fvMesh.C @@ -31,12 +31,16 @@ License #include "SubField.H" #include "demandDrivenData.H" #include "fvMeshLduAddressing.H" +#include "fvMeshTopoChanger.H" +#include "fvMeshMover.H" #include "mapPolyMesh.H" #include "MapFvFields.H" #include "fvMeshMapper.H" #include "mapClouds.H" #include "MeshObject.H" +#include "fvcSurfaceIntegrate.H" + // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam @@ -253,7 +257,7 @@ void Foam::fvMesh::clearOut() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::fvMesh::fvMesh(const IOobject& io) +Foam::fvMesh::fvMesh(const IOobject& io, const bool changers) : polyMesh(io), surfaceInterpolation(*this), @@ -261,6 +265,18 @@ Foam::fvMesh::fvMesh(const IOobject& io) fvSolution(static_cast(*this)), data(static_cast(*this)), boundary_(*this, boundaryMesh()), + topoChanger_ + ( + changers + ? fvMeshTopoChanger::New(*this) + : autoPtr(nullptr) + ), + mover_ + ( + changers + ? fvMeshMover::New(*this) + : autoPtr(nullptr) + ), lduPtr_(nullptr), curTimeIndex_(time().timeIndex()), VPtr_(nullptr), @@ -451,6 +467,21 @@ Foam::fvMesh::~fvMesh() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +bool Foam::fvMesh::dynamic() const +{ + return topoChanger_->dynamic() || mover_->dynamic(); +} + + +bool Foam::fvMesh::update() +{ + // return !(!topoChanger_->update() && !mover_->update()); + topoChanger_->update(); + mover_->update(); + return true; +} + + void Foam::fvMesh::addFvPatches ( const List & p, @@ -554,6 +585,18 @@ const Foam::lduAddressing& Foam::fvMesh::lduAddr() const } +const Foam::fvMeshTopoChanger& Foam::fvMesh::topoChanger() const +{ + return topoChanger_(); +} + + +const Foam::fvMeshMover& Foam::fvMesh::mover() const +{ + return mover_(); +} + + void Foam::fvMesh::mapFields(const mapPolyMesh& meshMap) { if (debug) @@ -847,6 +890,17 @@ void Foam::fvMesh::updateMesh(const mapPolyMesh& mpm) meshObject::updateMesh(*this, mpm); meshObject::updateMesh(*this, mpm); + + if (mover_.valid()) + { + mover_->updateMesh(mpm); + + // Reset the old-time cell volumes prior to mesh-motion + if (V0Ptr_) + { + *V0Ptr_ = V(); + } + } } @@ -1086,6 +1140,16 @@ bool Foam::fvMesh::writeObject ok = ok && V0Ptr_->write(write); } + if (topoChanger_.valid()) + { + topoChanger_->write(write); + } + + if (mover_.valid()) + { + mover_->write(write); + } + return ok && polyMesh::writeObject(fmt, ver, cmp, write); } diff --git a/src/finiteVolume/fvMesh/fvMesh.H b/src/finiteVolume/fvMesh/fvMesh.H index cf4c636ecc..5e3fa2ceb9 100644 --- a/src/finiteVolume/fvMesh/fvMesh.H +++ b/src/finiteVolume/fvMesh/fvMesh.H @@ -69,6 +69,8 @@ namespace Foam { class fvMeshLduAddressing; +class fvMeshTopoChanger; +class fvMeshMover; class volMesh; class mapDistributePolyMesh; @@ -90,6 +92,12 @@ class fvMesh //- Boundary mesh fvBoundaryMesh boundary_; + //- The topo-changer function class + autoPtr topoChanger_; + + //- The mover function class + autoPtr mover_; + // Demand-driven data @@ -171,7 +179,8 @@ public: // Constructors //- Construct from IOobject - explicit fvMesh(const IOobject& io); + // with the option to not instantiate the mesh changers + explicit fvMesh(const IOobject& io, const bool changers = true); //- Construct from cellShapes with boundary. fvMesh @@ -287,6 +296,12 @@ public: return lduAddr().upperAddr(); } + //- Return the topo-changer function class + const fvMeshTopoChanger& topoChanger() const; + + //- Return the mover function class + const fvMeshMover& mover() const; + //- Return cell volumes const DimensionedField& V() const; @@ -329,6 +344,12 @@ public: // Edit + //- Is mesh dynamic + virtual bool dynamic() const; + + //- Update the mesh for both mesh motion and topology change + virtual bool update(); + //- Clear all geometry and addressing void clearOut(); diff --git a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.C b/src/finiteVolume/fvMesh/fvMeshMovers/fvMeshMover/fvMeshMover.C similarity index 51% rename from src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.C rename to src/finiteVolume/fvMesh/fvMeshMovers/fvMeshMover/fvMeshMover.C index 78e4398447..c7ea6579ae 100644 --- a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.C +++ b/src/finiteVolume/fvMesh/fvMeshMovers/fvMeshMover/fvMeshMover.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,94 +23,45 @@ License \*---------------------------------------------------------------------------*/ -#include "dynamicFvMesh.H" +#include "fvMeshMover.H" #include "volFields.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - defineTypeNameAndDebug(dynamicFvMesh, 0); - defineRunTimeSelectionTable(dynamicFvMesh, IOobject); -} - - -// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // - -Foam::IOobject Foam::dynamicFvMesh::dynamicMeshDictIOobject(const IOobject& io) -{ - // defaultRegion (region0) gets loaded from constant, other ones get loaded - // from constant/. Normally we'd use polyMesh::dbDir() but we - // haven't got a polyMesh yet ... - return IOobject - ( - "dynamicMeshDict", - io.time().constant(), - (io.name() == polyMesh::defaultRegion ? "" : io.name()), - io.db(), - IOobject::READ_IF_PRESENT, - IOobject::NO_WRITE, - false - ); + defineTypeNameAndDebug(fvMeshMover, 0); + defineRunTimeSelectionTable(fvMeshMover, fvMesh); } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::dynamicFvMesh::dynamicFvMesh(const IOobject& io) +Foam::fvMeshMover::fvMeshMover(fvMesh& mesh) : - fvMesh(io), - dynamicMeshDict_(IOdictionary(dynamicMeshDictIOobject(io))) -{} - - -Foam::dynamicFvMesh::dynamicFvMesh -( - const IOobject& io, - pointField&& points, - faceList&& faces, - labelList&& allOwner, - labelList&& allNeighbour, - const bool syncPar -) -: - fvMesh + mesh_(mesh), + dynamicMeshDict_ ( - io, - move(points), - move(faces), - move(allOwner), - move(allNeighbour), - syncPar - ), - dynamicMeshDict_(IOdictionary(dynamicMeshDictIOobject(io))) + IOdictionary + ( + IOobject + ( + "dynamicMeshDict", + mesh.time().constant(), + mesh.dbDir(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::NO_WRITE, + false + ) + ) + ) {} -Foam::dynamicFvMesh::dynamicFvMesh +Foam::fvMeshMover::velocityMotionCorrection::velocityMotionCorrection ( - const IOobject& io, - pointField&& points, - faceList&& faces, - cellList&& cells, - const bool syncPar -) -: - fvMesh - ( - io, - move(points), - move(faces), - move(cells), - syncPar - ), - dynamicMeshDict_(IOdictionary(dynamicMeshDictIOobject(io))) -{} - - -Foam::dynamicFvMesh::velocityMotionCorrection::velocityMotionCorrection -( - const dynamicFvMesh& mesh, + const fvMesh& mesh, const dictionary& dict ) : @@ -121,13 +72,13 @@ Foam::dynamicFvMesh::velocityMotionCorrection::velocityMotionCorrection // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::dynamicFvMesh::~dynamicFvMesh() +Foam::fvMeshMover::~fvMeshMover() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::dynamicFvMesh::velocityMotionCorrection::update() const +void Foam::fvMeshMover::velocityMotionCorrection::update() const { forAll(velocityFields_, i) { diff --git a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.H b/src/finiteVolume/fvMesh/fvMeshMovers/fvMeshMover/fvMeshMover.H similarity index 59% rename from src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.H rename to src/finiteVolume/fvMesh/fvMeshMovers/fvMeshMover/fvMeshMover.H index c8076c7b85..c72eaa32ea 100644 --- a/src/dynamicFvMesh/dynamicFvMesh/dynamicFvMesh.H +++ b/src/finiteVolume/fvMesh/fvMeshMovers/fvMeshMover/fvMeshMover.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,19 +22,22 @@ License along with OpenFOAM. If not, see . Class - Foam::dynamicFvMesh + Foam::fvMeshMover Description - Abstract base class for geometry and/or topology changing fvMesh. + Abstract base class for fvMesh movers. + + These classes move the mesh points, update the cell volumes and generate + the corresponding mesh fluxes without any topology change. SourceFiles - dynamicFvMesh.C - dynamicFvMeshNew.C + fvMeshMover.C + fvMeshMoverNew.C \*---------------------------------------------------------------------------*/ -#ifndef dynamicFvMesh_H -#define dynamicFvMesh_H +#ifndef fvMeshMover_H +#define fvMeshMover_H #include "fvMesh.H" @@ -44,29 +47,24 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class dynamicFvMesh Declaration + Class fvMeshMover Declaration \*---------------------------------------------------------------------------*/ -class dynamicFvMesh -: - public fvMesh +class fvMeshMover { // Private Data + //- Non-const fvMesh reference to allow update + fvMesh& mesh_; + //- The dynamicMeshDict dictionary dynamicMeshDict_; - // Private Member Functions - - //- Return the dynamicMeshDict IOobject - static IOobject dynamicMeshDictIOobject(const IOobject& io); - - public: //- Runtime type information - TypeName("dynamicFvMesh"); + TypeName("fvMeshMover"); // Declare run-time constructor selection table @@ -74,10 +72,10 @@ public: declareRunTimeSelectionTable ( autoPtr, - dynamicFvMesh, - IOobject, - (const IOobject& io), - (io) + fvMeshMover, + fvMesh, + (fvMesh& mesh), + (mesh) ); @@ -87,7 +85,7 @@ public: { // Private Data - const dynamicFvMesh& mesh_; + const fvMesh& mesh_; wordList velocityFields_; @@ -97,7 +95,7 @@ public: velocityMotionCorrection ( - const dynamicFvMesh& mesh, + const fvMesh& mesh, const dictionary& dict ); @@ -110,70 +108,63 @@ public: // Constructors - //- Construct from objectRegistry, and read/write options - explicit dynamicFvMesh(const IOobject& io); - - //- Construct from components without boundary. - // Boundary is added using addFvPatches() member function - dynamicFvMesh - ( - const IOobject& io, - pointField&& points, - faceList&& faces, - labelList&& allOwner, - labelList&& allNeighbour, - const bool syncPar = true - ); - - //- Construct without boundary from cells rather than owner/neighbour. - // Boundary is added using addPatches() member function - dynamicFvMesh - ( - const IOobject& io, - pointField&& points, - faceList&& faces, - cellList&& cells, - const bool syncPar = true - ); + //- Construct from fvMesh + explicit fvMeshMover(fvMesh&); //- Disallow default bitwise copy construction - dynamicFvMesh(const dynamicFvMesh&) = delete; + fvMeshMover(const fvMeshMover&) = delete; // Selectors - //- Select, construct and return the dynamicFvMesh + //- Select, construct and return the fvMeshMover // If the constant/dynamicMeshDict does not exist // a staticFvMesh is returned - static autoPtr New(const IOobject& io); + static autoPtr New(fvMesh&); //- Destructor - virtual ~dynamicFvMesh(); + virtual ~fvMeshMover(); // Member Functions - //- Return the dynamicMeshDict - const dictionary& dynamicMeshDict() const + //- Return the fvMesh + fvMesh& mesh() { - return dynamicMeshDict_; + return mesh_; } - //- Is mesh dynamic + //- Return the dynamicMeshDict/mover dict + const dictionary& dict() const + { + return dynamicMeshDict_.subDict("mover"); + } + + //- Is mesh dynamic, i.e. might it change? + // Defaults to true, set to false in the fvMeshMovers::none virtual bool dynamic() const { return true; } + //- Update local data for topology changes + virtual void updateMesh(const mapPolyMesh&) = 0; + //- Update the mesh for both mesh motion and topology change virtual bool update() = 0; + //- Write the mover state + virtual bool write(const bool write = true) const + { + return true; + } + // Member Operators //- Disallow default bitwise assignment - void operator=(const dynamicFvMesh&) = delete; + void operator=(const fvMeshMover&) = delete; }; diff --git a/src/finiteVolume/fvMesh/fvMeshMovers/fvMeshMover/fvMeshMoverNew.C b/src/finiteVolume/fvMesh/fvMeshMovers/fvMeshMover/fvMeshMoverNew.C new file mode 100644 index 0000000000..1dfaae7741 --- /dev/null +++ b/src/finiteVolume/fvMesh/fvMeshMovers/fvMeshMover/fvMeshMoverNew.C @@ -0,0 +1,93 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "fvMeshMoversNone.H" + +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // + +Foam::autoPtr Foam::fvMeshMover::New(fvMesh& mesh) +{ + typeIOobject dictHeader + ( + IOobject + ( + "dynamicMeshDict", + mesh.time().constant(), + mesh.dbDir(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::NO_WRITE, + false + ) + ); + + if (dictHeader.headerOk()) + { + IOdictionary dict(dictHeader); + + if (dict.found("mover")) + { + const dictionary& moverDict = dict.subDict("mover"); + + const word fvMeshMoverTypeName(moverDict.lookup("type")); + + Info<< "Selecting fvMeshMover " << fvMeshMoverTypeName << endl; + + libs.open + ( + moverDict, + "libs", + fvMeshConstructorTablePtr_ + ); + + if (!fvMeshConstructorTablePtr_) + { + FatalErrorInFunction + << "fvMeshMovers table is empty" + << exit(FatalError); + } + + fvMeshConstructorTable::iterator cstrIter = + fvMeshConstructorTablePtr_->find(fvMeshMoverTypeName); + + if (cstrIter == fvMeshConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown fvMeshMover type " + << fvMeshMoverTypeName << nl << nl + << "Valid fvMeshMovers are :" << endl + << fvMeshConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr(cstrIter()(mesh)); + } + } + + return autoPtr(new fvMeshMovers::none(mesh)); +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/fvMesh/fvMeshMovers/none/fvMeshMoversNone.C b/src/finiteVolume/fvMesh/fvMeshMovers/none/fvMeshMoversNone.C new file mode 100644 index 0000000000..c082cac4bf --- /dev/null +++ b/src/finiteVolume/fvMesh/fvMeshMovers/none/fvMeshMoversNone.C @@ -0,0 +1,63 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "fvMeshMoversNone.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace fvMeshMovers +{ + defineTypeNameAndDebug(none, 0); + addToRunTimeSelectionTable(fvMeshMover, none, fvMesh); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::fvMeshMovers::none::none(fvMesh& mesh) +: + fvMeshMover(mesh) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::fvMeshMovers::none::~none() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::fvMeshMovers::none::update() +{ + return false; +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/fvMesh/fvMeshMovers/none/fvMeshMoversNone.H b/src/finiteVolume/fvMesh/fvMeshMovers/none/fvMeshMoversNone.H new file mode 100644 index 0000000000..067d710c1d --- /dev/null +++ b/src/finiteVolume/fvMesh/fvMeshMovers/none/fvMeshMoversNone.H @@ -0,0 +1,106 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::fvMeshMovers::none + +Description + Dummy fvMeshMover which does not move the mesh points + +SourceFiles + none.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fvMeshMoversNone_H +#define fvMeshMoversNone_H + +#include "fvMeshMover.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace fvMeshMovers +{ + +/*---------------------------------------------------------------------------*\ + Class fvMeshMovers::none Declaration +\*---------------------------------------------------------------------------*/ + +class none +: + public fvMeshMover +{ +public: + + //- Runtime type information + TypeName("none"); + + + // Constructors + + //- Construct from fvMesh + none(fvMesh& mesh); + + //- Disallow default bitwise copy construction + none(const none&) = delete; + + + //- Destructor + ~none(); + + + // Member Functions + + //- The mesh is static and does not change so return false + virtual bool dynamic() const + { + return false; + } + + //- Update local data for topology changes + virtual void updateMesh(const mapPolyMesh&) + {} + + //- Dummy update function which does not change the mesh + virtual bool update(); + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const none&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fvMeshMovers +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fvMesh/fvMeshTopoChangers/fvMeshTopoChanger/fvMeshTopoChanger.C b/src/finiteVolume/fvMesh/fvMeshTopoChangers/fvMeshTopoChanger/fvMeshTopoChanger.C new file mode 100644 index 0000000000..ac6b8aa3e6 --- /dev/null +++ b/src/finiteVolume/fvMesh/fvMeshTopoChangers/fvMeshTopoChanger/fvMeshTopoChanger.C @@ -0,0 +1,95 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "fvMeshTopoChanger.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(fvMeshTopoChanger, 0); + defineRunTimeSelectionTable(fvMeshTopoChanger, fvMesh); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::fvMeshTopoChanger::fvMeshTopoChanger(fvMesh& mesh) +: + mesh_(mesh), + dynamicMeshDict_ + ( + IOdictionary + ( + IOobject + ( + "dynamicMeshDict", + mesh.time().constant(), + mesh.dbDir(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::NO_WRITE, + false + ) + ) + ) +{} + + +Foam::fvMeshTopoChanger::velocityMotionCorrection::velocityMotionCorrection +( + const fvMesh& mesh, + const dictionary& dict +) +: + mesh_(mesh), + velocityFields_(dict.lookupOrDefault("velocityFields", wordList())) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::fvMeshTopoChanger::~fvMeshTopoChanger() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::fvMeshTopoChanger::velocityMotionCorrection::update() const +{ + forAll(velocityFields_, i) + { + if (mesh_.foundObject(velocityFields_[i])) + { + mesh_.lookupObjectRef + ( + velocityFields_[i] + ).correctBoundaryConditions(); + } + } +} + +// ************************************************************************* // diff --git a/src/finiteVolume/fvMesh/fvMeshTopoChangers/fvMeshTopoChanger/fvMeshTopoChanger.H b/src/finiteVolume/fvMesh/fvMeshTopoChangers/fvMeshTopoChanger/fvMeshTopoChanger.H new file mode 100644 index 0000000000..a66c77c8b9 --- /dev/null +++ b/src/finiteVolume/fvMesh/fvMeshTopoChangers/fvMeshTopoChanger/fvMeshTopoChanger.H @@ -0,0 +1,182 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::fvMeshTopoChanger + +Description + Abstract base class for fvMesh movers. + + These classes move the mesh points, update the cell volumes and generate + the corresponding mesh fluxes without any topology change. + +SourceFiles + fvMeshTopoChanger.C + fvMeshTopoChangerNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef fvMeshTopoChanger_H +#define fvMeshTopoChanger_H + +#include "fvMesh.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class fvMeshTopoChanger Declaration +\*---------------------------------------------------------------------------*/ + +class fvMeshTopoChanger +{ + // Private Data + + //- Non-const fvMesh reference to allow update + fvMesh& mesh_; + + //- The dynamicMeshDict + dictionary dynamicMeshDict_; + + +public: + + //- Runtime type information + TypeName("fvMeshTopoChanger"); + + + // Declare run-time constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + fvMeshTopoChanger, + fvMesh, + (fvMesh& mesh), + (mesh) + ); + + + //- Helper class to update the velocity boundary conditions + // following mesh motion + class velocityMotionCorrection + { + // Private Data + + const fvMesh& mesh_; + + wordList velocityFields_; + + public: + + // Constructors + + velocityMotionCorrection + ( + const fvMesh& mesh, + const dictionary& dict + ); + + + // Member Functions + + void update() const; + }; + + + // Constructors + + //- Construct from fvMesh + explicit fvMeshTopoChanger(fvMesh&); + + //- Disallow default bitwise copy construction + fvMeshTopoChanger(const fvMeshTopoChanger&) = delete; + + + // Selectors + + //- Select, construct and return the fvMeshTopoChanger + // If the constant/dynamicMeshDict does not exist + // a staticFvMesh is returned + static autoPtr New(fvMesh&); + + + //- Destructor + virtual ~fvMeshTopoChanger(); + + + // Member Functions + + //- Return the fvMesh + fvMesh& mesh() + { + return mesh_; + } + + //- Return the fvMesh + const fvMesh& mesh() const + { + return mesh_; + } + + //- Return the dynamicMeshDict/topoChanger sub-dict + const dictionary& dict() const + { + return dynamicMeshDict_.subDict("topoChanger"); + } + + //- Is mesh dynamic, i.e. might it change? + // Defaults to true, set to false in the fvMeshTopoChangers::none + virtual bool dynamic() const + { + return true; + } + + //- Update the mesh for both mesh motion and topology change + virtual bool update() = 0; + + //- Write the mover state + virtual bool write(const bool write = true) const + { + return true; + } + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const fvMeshTopoChanger&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fvMesh/fvMeshTopoChangers/fvMeshTopoChanger/fvMeshTopoChangerNew.C b/src/finiteVolume/fvMesh/fvMeshTopoChangers/fvMeshTopoChanger/fvMeshTopoChangerNew.C new file mode 100644 index 0000000000..f8f3b8168e --- /dev/null +++ b/src/finiteVolume/fvMesh/fvMeshTopoChangers/fvMeshTopoChanger/fvMeshTopoChangerNew.C @@ -0,0 +1,100 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "fvMeshTopoChangersNone.H" + +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // + +Foam::autoPtr Foam::fvMeshTopoChanger::New +( + fvMesh& mesh +) +{ + typeIOobject dictHeader + ( + IOobject + ( + "dynamicMeshDict", + mesh.time().constant(), + mesh.dbDir(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::NO_WRITE, + false + ) + ); + + if (dictHeader.headerOk()) + { + IOdictionary dict(dictHeader); + + if (dict.found("topoChanger")) + { + const dictionary& topoChangerDict = dict.subDict("topoChanger"); + + const word fvMeshTopoChangerTypeName + ( + topoChangerDict.lookup("type") + ); + + Info<< "Selecting fvMeshTopoChanger " + << fvMeshTopoChangerTypeName << endl; + + libs.open + ( + topoChangerDict, + "libs", + fvMeshConstructorTablePtr_ + ); + + if (!fvMeshConstructorTablePtr_) + { + FatalErrorInFunction + << "fvMeshTopoChangers table is empty" + << exit(FatalError); + } + + fvMeshConstructorTable::iterator cstrIter = + fvMeshConstructorTablePtr_->find(fvMeshTopoChangerTypeName); + + if (cstrIter == fvMeshConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown fvMeshTopoChanger type " + << fvMeshTopoChangerTypeName << nl << nl + << "Valid fvMeshTopoChangers are :" << endl + << fvMeshConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr(cstrIter()(mesh)); + } + } + + return autoPtr(new fvMeshTopoChangers::none(mesh)); +} + + +// ************************************************************************* // diff --git a/src/dynamicFvMesh/staticFvMesh/staticFvMesh.C b/src/finiteVolume/fvMesh/fvMeshTopoChangers/none/fvMeshTopoChangersNone.C similarity index 78% rename from src/dynamicFvMesh/staticFvMesh/staticFvMesh.C rename to src/finiteVolume/fvMesh/fvMeshTopoChangers/none/fvMeshTopoChangersNone.C index 213ba6ad8f..c01de712a5 100644 --- a/src/dynamicFvMesh/staticFvMesh/staticFvMesh.C +++ b/src/finiteVolume/fvMesh/fvMeshTopoChangers/none/fvMeshTopoChangersNone.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,37 +23,38 @@ License \*---------------------------------------------------------------------------*/ -#include "staticFvMesh.H" +#include "fvMeshTopoChangersNone.H" #include "addToRunTimeSelectionTable.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - defineTypeNameAndDebug(staticFvMesh, 0); - addToRunTimeSelectionTable(dynamicFvMesh, staticFvMesh, IOobject); +namespace fvMeshTopoChangers +{ + defineTypeNameAndDebug(none, 0); + addToRunTimeSelectionTable(fvMeshTopoChanger, none, fvMesh); +} } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::staticFvMesh::staticFvMesh(const IOobject& io) +Foam::fvMeshTopoChangers::none::none(fvMesh& mesh) : - dynamicFvMesh(io) + fvMeshTopoChanger(mesh) {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::staticFvMesh::~staticFvMesh() +Foam::fvMeshTopoChangers::none::~none() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::staticFvMesh::update() +bool Foam::fvMeshTopoChangers::none::update() { return false; } diff --git a/src/dynamicFvMesh/staticFvMesh/staticFvMesh.H b/src/finiteVolume/fvMesh/fvMeshTopoChangers/none/fvMeshTopoChangersNone.H similarity index 75% rename from src/dynamicFvMesh/staticFvMesh/staticFvMesh.H rename to src/finiteVolume/fvMesh/fvMeshTopoChangers/none/fvMeshTopoChangersNone.H index b9844e7496..78981b50da 100644 --- a/src/dynamicFvMesh/staticFvMesh/staticFvMesh.H +++ b/src/finiteVolume/fvMesh/fvMeshTopoChangers/none/fvMeshTopoChangersNone.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,56 +22,58 @@ License along with OpenFOAM. If not, see . Class - Foam::staticFvMesh + Foam::fvMeshTopoChangers::none Description - Foam::staticFvMesh + Dummy fvMeshTopoChanger which does not move the mesh points SourceFiles - staticFvMesh.C + none.C \*---------------------------------------------------------------------------*/ -#ifndef staticFvMesh_H -#define staticFvMesh_H +#ifndef fvMeshTopoChangersNone_H +#define fvMeshTopoChangersNone_H -#include "dynamicFvMesh.H" +#include "fvMeshTopoChanger.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { +namespace fvMeshTopoChangers +{ /*---------------------------------------------------------------------------*\ - Class staticFvMesh Declaration + Class none Declaration \*---------------------------------------------------------------------------*/ -class staticFvMesh +class none : - public dynamicFvMesh + public fvMeshTopoChanger { public: //- Runtime type information - TypeName("staticFvMesh"); + TypeName("none"); // Constructors - //- Construct from IOobject - staticFvMesh(const IOobject& io); + //- Construct from fvMesh + none(fvMesh& mesh); //- Disallow default bitwise copy construction - staticFvMesh(const staticFvMesh&) = delete; + none(const none&) = delete; //- Destructor - ~staticFvMesh(); + ~none(); // Member Functions - //- Is mesh dynamic + //- The mesh is static and does not change so return false virtual bool dynamic() const { return false; @@ -84,12 +86,13 @@ public: // Member Operators //- Disallow default bitwise assignment - void operator=(const staticFvMesh&) = delete; + void operator=(const none&) = delete; }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace fvMeshTopoChangers } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/fvMeshMovers/Make/files b/src/fvMeshMovers/Make/files new file mode 100644 index 0000000000..797ac5873d --- /dev/null +++ b/src/fvMeshMovers/Make/files @@ -0,0 +1,5 @@ +motionSolver/fvMeshMoversMotionSolver.C +interpolator/fvMeshMoversInterpolator.C +inkJet/fvMeshMoversInkJet.C + +LIB = $(FOAM_LIBBIN)/libfvMeshMovers diff --git a/src/fvMeshMovers/Make/options b/src/fvMeshMovers/Make/options new file mode 100644 index 0000000000..6e0fa932ab --- /dev/null +++ b/src/fvMeshMovers/Make/options @@ -0,0 +1,7 @@ +EXE_INC = \ + -I$(LIB_SRC)/dynamicMesh/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude + +LIB_LIBS = \ + -ldynamicMesh \ + -lfiniteVolume diff --git a/src/dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.C b/src/fvMeshMovers/inkJet/fvMeshMoversInkJet.C similarity index 70% rename from src/dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.C rename to src/fvMeshMovers/inkJet/fvMeshMoversInkJet.C index 815ce80517..ed5cf016dc 100644 --- a/src/dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.C +++ b/src/fvMeshMovers/inkJet/fvMeshMoversInkJet.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,42 +23,45 @@ License \*---------------------------------------------------------------------------*/ -#include "dynamicInkJetFvMesh.H" -#include "addToRunTimeSelectionTable.H" +#include "fvMeshMoversInkJet.H" #include "volFields.H" #include "mathematicalConstants.H" +#include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - defineTypeNameAndDebug(dynamicInkJetFvMesh, 0); - addToRunTimeSelectionTable(dynamicFvMesh, dynamicInkJetFvMesh, IOobject); +namespace fvMeshMovers +{ + defineTypeNameAndDebug(inkJet, 0); + addToRunTimeSelectionTable(fvMeshMover, inkJet, fvMesh); +} } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::dynamicInkJetFvMesh::dynamicInkJetFvMesh(const IOobject& io) +Foam::fvMeshMovers::inkJet::inkJet(fvMesh& mesh) : - dynamicFvMesh(io), - dynamicMeshCoeffs_(dynamicMeshDict().optionalSubDict(typeName + "Coeffs")), - amplitude_(dynamicMeshCoeffs_.lookup("amplitude")), - frequency_(dynamicMeshCoeffs_.lookup("frequency")), - refPlaneX_(dynamicMeshCoeffs_.lookup("refPlaneX")), + fvMeshMover(mesh), + meshCoeffs_(dict()), + amplitude_(meshCoeffs_.lookup("amplitude")), + frequency_(meshCoeffs_.lookup("frequency")), + refPlaneX_(meshCoeffs_.lookup("refPlaneX")), stationaryPoints_ ( IOobject ( "points", - io.time().constant(), - meshSubDir, - *this, + mesh.time().constant(), + fvMesh::meshSubDir, + mesh, IOobject::MUST_READ, IOobject::NO_WRITE ) ), - velocityMotionCorrection_(*this, dynamicMeshDict()) + velocityMotionCorrection_(mesh, dict()) { Info<< "Performing a dynamic mesh calculation: " << endl << "amplitude: " << amplitude_ @@ -69,22 +72,28 @@ Foam::dynamicInkJetFvMesh::dynamicInkJetFvMesh(const IOobject& io) // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::dynamicInkJetFvMesh::~dynamicInkJetFvMesh() +Foam::fvMeshMovers::inkJet::~inkJet() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::dynamicInkJetFvMesh::update() +void Foam::fvMeshMovers::inkJet::updateMesh(const mapPolyMesh& mpm) { - scalar scalingFunction = + NotImplemented; +} + + +bool Foam::fvMeshMovers::inkJet::update() +{ + const scalar scalingFunction = 0.5* ( - ::cos(constant::mathematical::twoPi*frequency_*time().value()) + cos(constant::mathematical::twoPi*frequency_*mesh().time().value()) - 1.0 ); - Info<< "Mesh scaling. Time = " << time().value() << " scaling: " + Info<< "Mesh scaling. Time = " << mesh().time().value() << " scaling: " << scalingFunction << endl; pointField newPoints = stationaryPoints_; @@ -103,7 +112,7 @@ bool Foam::dynamicInkJetFvMesh::update() ) ); - fvMesh::movePoints(newPoints); + mesh().movePoints(newPoints); velocityMotionCorrection_.update(); diff --git a/src/dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.H b/src/fvMeshMovers/inkJet/fvMeshMoversInkJet.H similarity index 80% rename from src/dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.H rename to src/fvMeshMovers/inkJet/fvMeshMoversInkJet.H index 48f0da79f7..c3e02e02db 100644 --- a/src/dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.H +++ b/src/fvMeshMovers/inkJet/fvMeshMoversInkJet.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Class - Foam::dynamicInkJetFvMesh + Foam::fvMeshMovers::inkJet Description Mesh motion specifically for the "pumping" system of an ink-jet @@ -33,14 +33,14 @@ Description nozzle exit. SourceFiles - dynamicInkJetFvMesh.C + inkJetFvMesh.C \*---------------------------------------------------------------------------*/ -#ifndef dynamicInkJetFvMesh_H -#define dynamicInkJetFvMesh_H +#ifndef fvMeshMoversInkJet_H +#define fvMeshMoversInkJet_H -#include "dynamicFvMesh.H" +#include "fvMeshMover.H" #include "dictionary.H" #include "pointIOField.H" @@ -48,18 +48,20 @@ SourceFiles namespace Foam { +namespace fvMeshMovers +{ /*---------------------------------------------------------------------------*\ - Class dynamicInkJetFvMesh Declaration + Class inkJet Declaration \*---------------------------------------------------------------------------*/ -class dynamicInkJetFvMesh +class inkJet : - public dynamicFvMesh + public fvMeshMover { // Private Data - dictionary dynamicMeshCoeffs_; + dictionary meshCoeffs_; scalar amplitude_; scalar frequency_; @@ -76,24 +78,27 @@ class dynamicInkJetFvMesh public: //- Runtime type information - TypeName("dynamicInkJetFvMesh"); + TypeName("inkJet"); // Constructors - //- Construct from IOobject - dynamicInkJetFvMesh(const IOobject& io); + //- Construct from fvMesh + inkJet(fvMesh& mesh); //- Disallow default bitwise copy construction - dynamicInkJetFvMesh(const dynamicInkJetFvMesh&) = delete; + inkJet(const inkJet&) = delete; //- Destructor - ~dynamicInkJetFvMesh(); + ~inkJet(); // Member Functions + //- Update local data for topology changes + virtual void updateMesh(const mapPolyMesh&); + //- Update the mesh for both mesh motion and topology change virtual bool update(); @@ -101,12 +106,13 @@ public: // Member Operators //- Disallow default bitwise assignment - void operator=(const dynamicInkJetFvMesh&) = delete; + void operator=(const inkJet&) = delete; }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace fvMeshMovers } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/dynamicFvMesh/dynamicInterpolatedFvMesh/dynamicInterpolatedFvMesh.C b/src/fvMeshMovers/interpolator/fvMeshMoversInterpolator.C similarity index 66% rename from src/dynamicFvMesh/dynamicInterpolatedFvMesh/dynamicInterpolatedFvMesh.C rename to src/fvMeshMovers/interpolator/fvMeshMoversInterpolator.C index bb422c80a7..c4205acf04 100644 --- a/src/dynamicFvMesh/dynamicInterpolatedFvMesh/dynamicInterpolatedFvMesh.C +++ b/src/fvMeshMovers/interpolator/fvMeshMoversInterpolator.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,7 +23,7 @@ License \*---------------------------------------------------------------------------*/ -#include "dynamicInterpolatedFvMesh.H" +#include "fvMeshMoversInterpolator.H" #include "volFields.H" #include "pointFields.H" #include "addToRunTimeSelectionTable.H" @@ -32,51 +32,55 @@ License namespace Foam { - defineTypeNameAndDebug(dynamicInterpolatedFvMesh, 0); - addToRunTimeSelectionTable - ( - dynamicFvMesh, - dynamicInterpolatedFvMesh, - IOobject - ); +namespace fvMeshMovers +{ + defineTypeNameAndDebug(interpolator, 0); + addToRunTimeSelectionTable(fvMeshMover, interpolator, fvMesh); +} } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::dynamicInterpolatedFvMesh::dynamicInterpolatedFvMesh(const IOobject& io) +Foam::fvMeshMovers::interpolator::interpolator(fvMesh& mesh) : - dynamicFvMesh(io), - dynamicMeshCoeffs_(dynamicMeshDict().optionalSubDict(typeName + "Coeffs")), - pointInterpolator_(*this, dynamicMeshCoeffs_), - displacement_(dynamicMeshCoeffs_.lookup("displacement")), + fvMeshMover(mesh), + meshCoeffs_(dict()), + pointInterpolator_(mesh, meshCoeffs_), + displacement_(meshCoeffs_.lookup("displacement")), points0_ ( displacement_ - ? new pointIOField(points0IO(*this)) + ? new pointIOField(fvMesh::points0IO(mesh)) : nullptr ), - velocityMotionCorrection_(*this, dynamicMeshDict()) + velocityMotionCorrection_(mesh, dict()) {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::dynamicInterpolatedFvMesh::~dynamicInterpolatedFvMesh() +Foam::fvMeshMovers::interpolator::~interpolator() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::dynamicInterpolatedFvMesh::update() +void Foam::fvMeshMovers::interpolator::updateMesh(const mapPolyMesh& mpm) +{ + NotImplemented; +} + + +bool Foam::fvMeshMovers::interpolator::update() { if (displacement_) { - fvMesh::movePoints(points0_() + pointInterpolator_.curPointField()()); + mesh().movePoints(points0_() + pointInterpolator_.curPointField()()); } else { - fvMesh::movePoints(pointInterpolator_.curPointField()); + mesh().movePoints(pointInterpolator_.curPointField()); } velocityMotionCorrection_.update(); diff --git a/src/dynamicFvMesh/dynamicInterpolatedFvMesh/dynamicInterpolatedFvMesh.H b/src/fvMeshMovers/interpolator/fvMeshMoversInterpolator.H similarity index 81% rename from src/dynamicFvMesh/dynamicInterpolatedFvMesh/dynamicInterpolatedFvMesh.H rename to src/fvMeshMovers/interpolator/fvMeshMoversInterpolator.H index c51175ee7d..076810d72f 100644 --- a/src/dynamicFvMesh/dynamicInterpolatedFvMesh/dynamicInterpolatedFvMesh.H +++ b/src/fvMeshMovers/interpolator/fvMeshMoversInterpolator.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Class - Foam::dynamicInterpolatedFvMesh + Foam::fvMeshMovers::interpolator Description Interpolates pre-specified motion specified as a set of pointVectorFields. @@ -33,7 +33,7 @@ Description Usage Example: \verbatim - dynamicFvMesh dynamicInterpolatedFvMesh; + mover interpolator; displacementLaplacianCoeffs { @@ -51,32 +51,34 @@ Usage provided. SourceFiles - dynamicInterpolatedFvMesh.C + interpolator.C \*---------------------------------------------------------------------------*/ -#ifndef dynamicInterpolatedFvMesh_H -#define dynamicInterpolatedFvMesh_H +#ifndef fvMeshMoversInterpolator_H +#define fvMeshMoversInterpolator_H -#include "dynamicFvMesh.H" +#include "fvMeshMover.H" #include "dynamicMeshPointInterpolator.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { +namespace fvMeshMovers +{ /*---------------------------------------------------------------------------*\ - Class dynamicInterpolatedFvMesh Declaration + Class interpolator Declaration \*---------------------------------------------------------------------------*/ -class dynamicInterpolatedFvMesh +class interpolator : - public dynamicFvMesh + public fvMeshMover { // Private Data - dictionary dynamicMeshCoeffs_; + dictionary meshCoeffs_; dynamicMeshPointInterpolator pointInterpolator_; @@ -94,24 +96,27 @@ class dynamicInterpolatedFvMesh public: //- Runtime type information - TypeName("dynamicInterpolatedFvMesh"); + TypeName("interpolator"); // Constructors - //- Construct from IOobject - dynamicInterpolatedFvMesh(const IOobject& io); + //- Construct from fvMesh + interpolator(fvMesh& mesh); //- Disallow default bitwise copy construction - dynamicInterpolatedFvMesh(const dynamicInterpolatedFvMesh&) = delete; + interpolator(const interpolator&) = delete; //- Destructor - ~dynamicInterpolatedFvMesh(); + ~interpolator(); // Member Functions + //- Update local data for topology changes + virtual void updateMesh(const mapPolyMesh&); + //- Update the mesh for both mesh motion and topology change virtual bool update(); @@ -119,12 +124,13 @@ public: // Member Operators //- Disallow default bitwise assignment - void operator=(const dynamicInterpolatedFvMesh&) = delete; + void operator=(const interpolator&) = delete; }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace fvMeshMovers } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.C b/src/fvMeshMovers/motionSolver/fvMeshMoversMotionSolver.C similarity index 63% rename from src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.C rename to src/fvMeshMovers/motionSolver/fvMeshMoversMotionSolver.C index 7115642335..a65d0e4469 100644 --- a/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.C +++ b/src/fvMeshMovers/motionSolver/fvMeshMoversMotionSolver.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,67 +23,71 @@ License \*---------------------------------------------------------------------------*/ -#include "dynamicMotionSolverFvMesh.H" -#include "addToRunTimeSelectionTable.H" +#include "fvMeshMoversMotionSolver.H" #include "motionSolver.H" +#include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - defineTypeNameAndDebug(dynamicMotionSolverFvMesh, 0); - addToRunTimeSelectionTable - ( - dynamicFvMesh, - dynamicMotionSolverFvMesh, - IOobject - ); +namespace fvMeshMovers +{ + defineTypeNameAndDebug(motionSolver, 0); + addToRunTimeSelectionTable(fvMeshMover, motionSolver, fvMesh); +} } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::dynamicMotionSolverFvMesh::dynamicMotionSolverFvMesh(const IOobject& io) +Foam::fvMeshMovers::motionSolver::motionSolver(fvMesh& mesh) : - dynamicFvMesh(io), - motionPtr_(motionSolver::New(*this, dynamicMeshDict())), - velocityMotionCorrection_(*this, dynamicMeshDict()) + fvMeshMover(mesh), + motionPtr_(Foam::motionSolver::New(mesh, dict())), + velocityMotionCorrection_(mesh, dict()) {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::dynamicMotionSolverFvMesh::~dynamicMotionSolverFvMesh() +Foam::fvMeshMovers::motionSolver::~motionSolver() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -const Foam::motionSolver& Foam::dynamicMotionSolverFvMesh::motion() const +const Foam::motionSolver& Foam::fvMeshMovers::motionSolver::motion() const { return motionPtr_(); } -bool Foam::dynamicMotionSolverFvMesh::update() +void Foam::fvMeshMovers::motionSolver::updateMesh(const mapPolyMesh& mpm) { - fvMesh::movePoints(motionPtr_->newPoints()); + motionPtr_->updateMesh(mpm); +} + + +bool Foam::fvMeshMovers::motionSolver::update() +{ + mesh().movePoints(motionPtr_->newPoints()); velocityMotionCorrection_.update(); return true; } -bool Foam::dynamicMotionSolverFvMesh::writeObject -( - IOstream::streamFormat fmt, - IOstream::versionNumber ver, - IOstream::compressionType cmp, - const bool write -) const +bool Foam::fvMeshMovers::motionSolver::write(const bool write) const { - motionPtr_->write(); - return fvMesh::writeObject(fmt, ver, cmp, write); + if (write) + { + return motionPtr_->write(); + } + else + { + return true; + } } diff --git a/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.H b/src/fvMeshMovers/motionSolver/fvMeshMoversMotionSolver.H similarity index 68% rename from src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.H rename to src/fvMeshMovers/motionSolver/fvMeshMoversMotionSolver.H index 71228619a2..30cc37bb8c 100644 --- a/src/dynamicFvMesh/dynamicMotionSolverFvMesh/dynamicMotionSolverFvMesh.H +++ b/src/fvMeshMovers/motionSolver/fvMeshMoversMotionSolver.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,20 +22,19 @@ License along with OpenFOAM. If not, see . Class - Foam::dynamicMotionSolverFvMesh + Foam::fvMeshMovers:motionSolver Description - The dynamicMotionSolverFvMesh SourceFiles - dynamicMotionSolverFvMesh.C + motionSolver.C \*---------------------------------------------------------------------------*/ -#ifndef dynamicMotionSolverFvMesh_H -#define dynamicMotionSolverFvMesh_H +#ifndef fvMeshMoversMotionSolver_H +#define fvMeshMoversMotionSolver_H -#include "dynamicFvMesh.H" +#include "fvMeshMover.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -44,17 +43,20 @@ namespace Foam class motionSolver; +namespace fvMeshMovers +{ + /*---------------------------------------------------------------------------*\ - Class dynamicMotionSolverFvMesh Declaration + Class motionSolver Declaration \*---------------------------------------------------------------------------*/ -class dynamicMotionSolverFvMesh +class motionSolver : - public dynamicFvMesh + public fvMeshMover { // Private Data - autoPtr motionPtr_; + autoPtr motionPtr_; //- Optional list of vectorFields to update for mesh motion // For modern solvers using Uf and correctPhi to update the flux @@ -65,26 +67,29 @@ class dynamicMotionSolverFvMesh public: //- Runtime type information - TypeName("dynamicMotionSolverFvMesh"); + TypeName("motionSolver"); // Constructors - //- Construct from IOobject - dynamicMotionSolverFvMesh(const IOobject& io); + //- Construct from fvMesh + motionSolver(fvMesh& mesh); //- Disallow default bitwise copy construction - dynamicMotionSolverFvMesh(const dynamicMotionSolverFvMesh&) = delete; + motionSolver(const motionSolver&) = delete; //- Destructor - ~dynamicMotionSolverFvMesh(); + ~motionSolver(); // Member Functions //- Return the motionSolver - const motionSolver& motion() const; + const Foam::motionSolver& motion() const; + + //- Update local data for topology changes + virtual void updateMesh(const mapPolyMesh&); //- Update the mesh for both mesh motion and topology change virtual bool update(); @@ -92,25 +97,20 @@ public: // Write - //- Write the underlying polyMesh and other data - virtual bool writeObject - ( - IOstream::streamFormat fmt, - IOstream::versionNumber ver, - IOstream::compressionType cmp, - const bool write = true - ) const; + //- Write the motion solver state + virtual bool write(const bool write = true) const; // Member Operators //- Disallow default bitwise assignment - void operator=(const dynamicMotionSolverFvMesh&) = delete; + void operator=(const motionSolver&) = delete; }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace fvMeshMovers } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/fvMeshTopoChangers/Make/files b/src/fvMeshTopoChangers/Make/files new file mode 100644 index 0000000000..3f36b60f25 --- /dev/null +++ b/src/fvMeshTopoChangers/Make/files @@ -0,0 +1,9 @@ +refiner/fvMeshTopoChangersRefiner.C +raw/fvMeshTopoChangersRaw.C +movingCone/fvMeshTopoChangersMovingCone.C + +## linearValveFvMesh/linearValveFvMesh.C +## linearValveLayersFvMesh/linearValveLayersFvMesh.C +## mixerFvMesh/mixerFvMesh.C + +LIB = $(FOAM_LIBBIN)/libfvMeshTopoChangers diff --git a/src/dynamicFvMesh/Make/options b/src/fvMeshTopoChangers/Make/options similarity index 100% rename from src/dynamicFvMesh/Make/options rename to src/fvMeshTopoChangers/Make/options diff --git a/src/topoChangerFvMesh/linearValveFvMesh/linearValveFvMesh.C b/src/fvMeshTopoChangers/linearValveFvMesh/linearValveFvMesh.C similarity index 99% rename from src/topoChangerFvMesh/linearValveFvMesh/linearValveFvMesh.C rename to src/fvMeshTopoChangers/linearValveFvMesh/linearValveFvMesh.C index 5d4cd81bff..f1e9d5d6e9 100644 --- a/src/topoChangerFvMesh/linearValveFvMesh/linearValveFvMesh.C +++ b/src/fvMeshTopoChangers/linearValveFvMesh/linearValveFvMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/topoChangerFvMesh/linearValveFvMesh/linearValveFvMesh.H b/src/fvMeshTopoChangers/linearValveFvMesh/linearValveFvMesh.H similarity index 97% rename from src/topoChangerFvMesh/linearValveFvMesh/linearValveFvMesh.H rename to src/fvMeshTopoChangers/linearValveFvMesh/linearValveFvMesh.H index dfbacf1bb2..4955e4bfca 100644 --- a/src/topoChangerFvMesh/linearValveFvMesh/linearValveFvMesh.H +++ b/src/fvMeshTopoChangers/linearValveFvMesh/linearValveFvMesh.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/topoChangerFvMesh/linearValveLayersFvMesh/linearValveLayersFvMesh.C b/src/fvMeshTopoChangers/linearValveLayersFvMesh/linearValveLayersFvMesh.C similarity index 98% rename from src/topoChangerFvMesh/linearValveLayersFvMesh/linearValveLayersFvMesh.C rename to src/fvMeshTopoChangers/linearValveLayersFvMesh/linearValveLayersFvMesh.C index 75260598e0..98f5772f2d 100644 --- a/src/topoChangerFvMesh/linearValveLayersFvMesh/linearValveLayersFvMesh.C +++ b/src/fvMeshTopoChangers/linearValveLayersFvMesh/linearValveLayersFvMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -336,7 +336,7 @@ Foam::tmp Foam::linearValveLayersFvMesh::newPoints() const Foam::linearValveLayersFvMesh::linearValveLayersFvMesh(const IOobject& io) : topoChangerFvMesh(io), - motionDict_(dynamicMeshDict().optionalSubDict(typeName + "Coeffs")) + motionDict_(dict()) { addZonesAndModifiers(); } diff --git a/src/topoChangerFvMesh/linearValveLayersFvMesh/linearValveLayersFvMesh.H b/src/fvMeshTopoChangers/linearValveLayersFvMesh/linearValveLayersFvMesh.H similarity index 98% rename from src/topoChangerFvMesh/linearValveLayersFvMesh/linearValveLayersFvMesh.H rename to src/fvMeshTopoChangers/linearValveLayersFvMesh/linearValveLayersFvMesh.H index b3732f27ea..66e906ddf5 100644 --- a/src/topoChangerFvMesh/linearValveLayersFvMesh/linearValveLayersFvMesh.H +++ b/src/fvMeshTopoChangers/linearValveLayersFvMesh/linearValveLayersFvMesh.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.C b/src/fvMeshTopoChangers/mixerFvMesh/mixerFvMesh.C similarity index 98% rename from src/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.C rename to src/fvMeshTopoChangers/mixerFvMesh/mixerFvMesh.C index 1faed48eb5..eda4746bae 100644 --- a/src/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.C +++ b/src/fvMeshTopoChangers/mixerFvMesh/mixerFvMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -280,7 +280,7 @@ Foam::mixerFvMesh::mixerFvMesh ) : topoChangerFvMesh(io), - motionDict_(dynamicMeshDict().optionalSubDict(typeName + "Coeffs")), + motionDict_(dict()), csPtr_ ( coordinateSystem::New diff --git a/src/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.H b/src/fvMeshTopoChangers/mixerFvMesh/mixerFvMesh.H similarity index 98% rename from src/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.H rename to src/fvMeshTopoChangers/mixerFvMesh/mixerFvMesh.H index 2e3a8e87cf..4ad1499811 100644 --- a/src/topoChangerFvMesh/mixerFvMesh/mixerFvMesh.H +++ b/src/fvMeshTopoChangers/mixerFvMesh/mixerFvMesh.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.C b/src/fvMeshTopoChangers/movingCone/fvMeshTopoChangersMovingCone.C similarity index 79% rename from src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.C rename to src/fvMeshTopoChangers/movingCone/fvMeshTopoChangersMovingCone.C index b285d60b40..c1aad66be0 100644 --- a/src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.C +++ b/src/fvMeshTopoChangers/movingCone/fvMeshTopoChangersMovingCone.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,14 +23,14 @@ License \*---------------------------------------------------------------------------*/ -#include "movingConeTopoFvMesh.H" +#include "fvMeshTopoChangersMovingCone.H" #include "Time.H" #include "mapPolyMesh.H" #include "layerAdditionRemoval.H" -#include "addToRunTimeSelectionTable.H" #include "meshTools.H" #include "OFstream.H" #include "mathematicalConstants.H" +#include "addToRunTimeSelectionTable.H" using namespace Foam::constant::mathematical; @@ -38,20 +38,17 @@ using namespace Foam::constant::mathematical; namespace Foam { - defineTypeNameAndDebug(movingConeTopoFvMesh, 0); - - addToRunTimeSelectionTable - ( - topoChangerFvMesh, - movingConeTopoFvMesh, - IOobject - ); +namespace fvMeshTopoChangers +{ + defineTypeNameAndDebug(movingCone, 0); + addToRunTimeSelectionTable(fvMeshTopoChanger, movingCone, fvMesh); +} } // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -Foam::tmp Foam::movingConeTopoFvMesh::vertexMarkup +Foam::tmp Foam::fvMeshTopoChangers::movingCone::vertexMarkup ( const pointField& p, const scalar curLeft, @@ -84,15 +81,15 @@ Foam::tmp Foam::movingConeTopoFvMesh::vertexMarkup } -void Foam::movingConeTopoFvMesh::addZonesAndModifiers() +void Foam::fvMeshTopoChangers::movingCone::addZonesAndModifiers() { // Add zones and modifiers for motion action if ( - pointZones().size() - || faceZones().size() - || cellZones().size() + mesh().pointZones().size() + || mesh().faceZones().size() + || mesh().cellZones().size() || topoChanger_.size() ) { @@ -103,11 +100,11 @@ void Foam::movingConeTopoFvMesh::addZonesAndModifiers() return; } - Info<< "Time = " << time().timeName() << endl + Info<< "Time = " << mesh().time().timeName() << endl << "Adding zones and modifiers to the mesh" << endl; - const vectorField& fc = faceCentres(); - const vectorField& fa = faceAreas(); + const vectorField& fc = mesh().faceCentres(); + const vectorField& fa = mesh().faceAreas(); labelList zone1(fc.size()); boolList flipZone1(fc.size(), false); @@ -176,7 +173,7 @@ void Foam::movingConeTopoFvMesh::addZonesAndModifiers() zone1, flipZone1, nFz, - faceZones() + mesh().faceZones() ); nFz++; @@ -187,14 +184,14 @@ void Foam::movingConeTopoFvMesh::addZonesAndModifiers() zone2, flipZone2, nFz, - faceZones() + mesh().faceZones() ); nFz++; fz.setSize(nFz); Info<< "Adding mesh zones." << endl; - addZones(pz, fz, cz); + mesh().addZones(pz, fz, cz); // Add layer addition/removal interfaces @@ -235,21 +232,22 @@ void Foam::movingConeTopoFvMesh::addZonesAndModifiers() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::movingConeTopoFvMesh::movingConeTopoFvMesh(const IOobject& io) +Foam::fvMeshTopoChangers::movingCone::movingCone(fvMesh& mesh) : - topoChangerFvMesh(io), - motionDict_(dynamicMeshDict().optionalSubDict(typeName + "Coeffs")), + fvMeshTopoChanger(mesh), + topoChanger_(mesh), + motionDict_(dict()), motionVelAmplitude_(motionDict_.lookup("motionVelAmplitude")), motionVelPeriod_(motionDict_.lookup("motionVelPeriod")), curMotionVel_ ( - motionVelAmplitude_*sin(time().value()*pi/motionVelPeriod_) + motionVelAmplitude_*sin(mesh.time().value()*pi/motionVelPeriod_) ), leftEdge_(motionDict_.lookup("leftEdge")), curLeft_(motionDict_.lookup("leftObstacleEdge")), curRight_(motionDict_.lookup("rightObstacleEdge")) { - Pout<< "Initial time:" << time().value() + Pout<< "Initial time:" << mesh.time().value() << " Initial curMotionVel_:" << curMotionVel_ << endl; @@ -257,23 +255,23 @@ Foam::movingConeTopoFvMesh::movingConeTopoFvMesh(const IOobject& io) curLeft_ = average ( - faceZones() + mesh.faceZones() [ - faceZones().findZoneID("leftExtrusionFaces") + mesh.faceZones().findZoneID("leftExtrusionFaces") ]().localPoints() ).x() - small; curRight_ = average ( - faceZones() + mesh.faceZones() [ - faceZones().findZoneID("rightExtrusionFaces") + mesh.faceZones().findZoneID("rightExtrusionFaces") ]().localPoints() ).x() + small; motionMask_ = vertexMarkup ( - points(), + mesh.points(), curLeft_, curRight_ ); @@ -282,13 +280,13 @@ Foam::movingConeTopoFvMesh::movingConeTopoFvMesh(const IOobject& io) // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::movingConeTopoFvMesh::~movingConeTopoFvMesh() +Foam::fvMeshTopoChangers::movingCone::~movingCone() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::movingConeTopoFvMesh::update() +bool Foam::fvMeshTopoChangers::movingCone::update() { // Do mesh changes (use inflation - put new points in topoChangeMap) autoPtr topoChangeMap = topoChanger_.changeMesh(true); @@ -298,10 +296,12 @@ bool Foam::movingConeTopoFvMesh::update() pointField newPoints; vector curMotionVel_ = - motionVelAmplitude_*sin(time().value()*pi/motionVelPeriod_); + motionVelAmplitude_*sin(mesh().time().value()*pi/motionVelPeriod_); - Pout<< "time:" << time().value() << " curMotionVel_:" << curMotionVel_ - << " curLeft:" << curLeft_ << " curRight:" << curRight_ + Pout<< "time:" << mesh().time().value() + << " curMotionVel_:" << curMotionVel_ + << " curLeft:" << curLeft_ + << " curRight:" << curRight_ << endl; if (topoChangeMap.valid()) @@ -325,7 +325,7 @@ bool Foam::movingConeTopoFvMesh::update() topoChangeMap().preMotionPoints() + ( pos0(0.5 - mag(motionMask_)) // cells above the body - )*curMotionVel_*time().deltaT().value(); + )*curMotionVel_*mesh().time().deltaT().value(); } else { @@ -334,17 +334,17 @@ bool Foam::movingConeTopoFvMesh::update() motionMask_ = vertexMarkup ( - points(), + mesh().points(), curLeft_, curRight_ ); // Move points inside the motionMask newPoints = - points() + mesh().points() + ( pos0(0.5 - mag(motionMask_)) // cells above the body - )*curMotionVel_*time().deltaT().value(); + )*curMotionVel_*mesh().time().deltaT().value(); } } else @@ -352,31 +352,31 @@ bool Foam::movingConeTopoFvMesh::update() Info<< "No topology change" << endl; // Set the mesh motion newPoints = - points() + mesh().points() + ( pos0(0.5 - mag(motionMask_)) // cells above the body - )*curMotionVel_*time().deltaT().value(); + )*curMotionVel_*mesh().time().deltaT().value(); } // The mesh now contains the cells with zero volume Info << "Executing mesh motion" << endl; - movePoints(newPoints); + mesh().movePoints(newPoints); // The mesh now has got non-zero volume cells curLeft_ = average ( - faceZones() + mesh().faceZones() [ - faceZones().findZoneID("leftExtrusionFaces") + mesh().faceZones().findZoneID("leftExtrusionFaces") ]().localPoints() ).x() - small; curRight_ = average ( - faceZones() + mesh().faceZones() [ - faceZones().findZoneID("rightExtrusionFaces") + mesh().faceZones().findZoneID("rightExtrusionFaces") ]().localPoints() ).x() + small; diff --git a/src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.H b/src/fvMeshTopoChangers/movingCone/fvMeshTopoChangersMovingCone.H similarity index 78% rename from src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.H rename to src/fvMeshTopoChangers/movingCone/fvMeshTopoChangersMovingCone.H index 706d595c1b..e39d28b8dc 100644 --- a/src/topoChangerFvMesh/movingConeTopoFvMesh/movingConeTopoFvMesh.H +++ b/src/fvMeshTopoChangers/movingCone/fvMeshTopoChangersMovingCone.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,40 +22,42 @@ License along with OpenFOAM. If not, see . Class - Foam::movingConeTopoFvMesh + Foam::fvMeshTopoChangers::movingCone Description - Sample topoChangerFvMesh that moves an object in x direction - and introduces/removes layers. + Sample fvMeshTopoChanger that moves an object in x direction and + introduces/removes layers. SourceFiles - movingConeTopoFvMesh.C + fvMeshTopoChangersMovingCone.C \*---------------------------------------------------------------------------*/ -#ifndef movingConeTopoFvMesh_H -#define movingConeTopoFvMesh_H +#ifndef fvMeshTopoChangersMovingCone_H +#define fvMeshTopoChangersMovingCone_H -#include "topoChangerFvMesh.H" -#include "motionSolver.H" +#include "fvMeshTopoChanger.H" +#include "polyTopoChanger.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { - -// Forward declaration of classes +namespace fvMeshTopoChangers +{ /*---------------------------------------------------------------------------*\ - Class movingConeTopoFvMesh Declaration + Class movingCone Declaration \*---------------------------------------------------------------------------*/ -class movingConeTopoFvMesh +class movingCone : - public topoChangerFvMesh + public fvMeshTopoChanger { // Private Data + polyTopoChanger topoChanger_; + //- Motion dictionary dictionary motionDict_; @@ -98,20 +100,20 @@ class movingConeTopoFvMesh public: //- Runtime type information - TypeName("movingConeTopoFvMesh"); + TypeName("movingCone"); // Constructors - //- Construct from database - explicit movingConeTopoFvMesh(const IOobject& io); + //- Construct from fvMesh + explicit movingCone(fvMesh& io); //- Disallow default bitwise copy construction - movingConeTopoFvMesh(const movingConeTopoFvMesh&) = delete; + movingCone(const movingCone&) = delete; //- Destructor - virtual ~movingConeTopoFvMesh(); + virtual ~movingCone(); // Member Functions @@ -123,12 +125,13 @@ public: // Member Operators //- Disallow default bitwise assignment - void operator=(const movingConeTopoFvMesh&) = delete; + void operator=(const movingCone&) = delete; }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace fvMeshTopoChangers } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/topoChangerFvMesh/rawTopoChangerFvMesh/rawTopoChangerFvMesh.C b/src/fvMeshTopoChangers/raw/fvMeshTopoChangersRaw.C similarity index 79% rename from src/topoChangerFvMesh/rawTopoChangerFvMesh/rawTopoChangerFvMesh.C rename to src/fvMeshTopoChangers/raw/fvMeshTopoChangersRaw.C index 59ab47bbe7..ccf1aaa181 100644 --- a/src/topoChangerFvMesh/rawTopoChangerFvMesh/rawTopoChangerFvMesh.C +++ b/src/fvMeshTopoChangers/raw/fvMeshTopoChangersRaw.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,52 +23,49 @@ License \*---------------------------------------------------------------------------*/ -#include "rawTopoChangerFvMesh.H" +#include "fvMeshTopoChangersRaw.H" #include "mapPolyMesh.H" -#include "addToRunTimeSelectionTable.H" #include "volFields.H" -#include "linear.H" +#include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - defineTypeNameAndDebug(rawTopoChangerFvMesh, 0); - addToRunTimeSelectionTable - ( - topoChangerFvMesh, - rawTopoChangerFvMesh, - IOobject - ); +namespace fvMeshTopoChangers +{ + defineTypeNameAndDebug(raw, 0); + addToRunTimeSelectionTable(fvMeshTopoChanger, raw, fvMesh); +} } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -// Construct from components -Foam::rawTopoChangerFvMesh::rawTopoChangerFvMesh(const IOobject& io) +Foam::fvMeshTopoChangers::raw::raw(fvMesh& mesh) : - topoChangerFvMesh(io) + fvMeshTopoChanger(mesh), + topoChanger_(mesh) {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::rawTopoChangerFvMesh::~rawTopoChangerFvMesh() +Foam::fvMeshTopoChangers::raw::~raw() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool Foam::rawTopoChangerFvMesh::update() +bool Foam::fvMeshTopoChangers::raw::update() { // Do mesh changes (use inflation - put new points in topoChangeMap) - Info<< "rawTopoChangerFvMesh : Checking for topology changes..." + Info<< "raw : Checking for topology changes..." << endl; // Mesh not moved/changed yet - moving(false); - topoChanging(false); + mesh().moving(false); + mesh().topoChanging(false); // Do any topology changes. Sets topoChanging (through polyTopoChange) autoPtr topoChangeMap = topoChanger_.changeMesh(true); @@ -77,7 +74,7 @@ bool Foam::rawTopoChangerFvMesh::update() if (hasChanged) { - Info<< "rawTopoChangerFvMesh : Done topology changes..." + Info<< "raw : Done topology changes..." << endl; // Temporary: fix fields on patch faces created out of nothing @@ -88,19 +85,24 @@ bool Foam::rawTopoChangerFvMesh::update() // - patch faces created out of previously internal faces // Is face mapped in any way? - PackedBoolList mappedFace(nFaces()); + PackedBoolList mappedFace(mesh().nFaces()); const label nOldInternal = topoChangeMap().oldPatchStarts()[0]; const labelList& faceMap = topoChangeMap().faceMap(); - for (label facei = 0; facei < nInternalFaces(); facei++) + for (label facei = 0; facei < mesh().nInternalFaces(); facei++) { if (faceMap[facei] >= 0) { mappedFace[facei] = 1; } } - for (label facei = nInternalFaces(); facei < nFaces(); facei++) + for + ( + label facei = mesh().nInternalFaces(); + facei < mesh().nFaces(); + facei++ + ) { if (faceMap[facei] >= 0 && faceMap[facei] >= nOldInternal) { @@ -130,8 +132,8 @@ bool Foam::rawTopoChangerFvMesh::update() } // Set unmapped faces to zero - Info<< "rawTopoChangerFvMesh : zeroing unmapped boundary values." - << endl; + Info<< "fvMeshTopoChangers::raw :" + << " zeroing unmapped boundary values." << endl; zeroUnmappedValues(mappedFace); zeroUnmappedValues(mappedFace); zeroUnmappedValues(mappedFace); @@ -143,20 +145,20 @@ bool Foam::rawTopoChangerFvMesh::update() pointField newPoints = topoChangeMap().preMotionPoints(); // Give the meshModifiers opportunity to modify points - Info<< "rawTopoChangerFvMesh :" + Info<< "fvMeshTopoChangers::raw :" << " calling modifyMotionPoints." << endl; topoChanger_.modifyMotionPoints(newPoints); // Actually move points - Info<< "rawTopoChangerFvMesh :" + Info<< "fvMeshTopoChangers::raw :" << " calling movePoints." << endl; - movePoints(newPoints); + mesh().movePoints(newPoints); } } else { - // Pout<< "rawTopoChangerFvMesh :" + // Pout<< "fvMeshTopoChangers::raw :" // << " no topology changes..." << endl; } diff --git a/src/topoChangerFvMesh/rawTopoChangerFvMesh/rawTopoChangerFvMesh.H b/src/fvMeshTopoChangers/raw/fvMeshTopoChangersRaw.H similarity index 77% rename from src/topoChangerFvMesh/rawTopoChangerFvMesh/rawTopoChangerFvMesh.H rename to src/fvMeshTopoChangers/raw/fvMeshTopoChangersRaw.H index fbe40f7918..798f2a9990 100644 --- a/src/topoChangerFvMesh/rawTopoChangerFvMesh/rawTopoChangerFvMesh.H +++ b/src/fvMeshTopoChangers/raw/fvMeshTopoChangersRaw.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,40 +22,45 @@ License along with OpenFOAM. If not, see . Class - Foam::rawTopoChangerFvMesh + Foam::fvMeshTopoChangers::raw Description - topoChangerFvMesh without any added functionality. + fvMeshTopoChanger without any added functionality. Note: run without FOAM_SETNAN. Temporary has unitialised patch data when faces get created out of nothing. SourceFiles - rawTopoChangerFvMesh.C + fvMeshTopoChangersRaw.C \*---------------------------------------------------------------------------*/ -#ifndef rawTopoChangerFvMesh_H -#define rawTopoChangerFvMesh_H +#ifndef fvMeshTopoChangersRaw_H +#define fvMeshTopoChangersRaw_H -#include "topoChangerFvMesh.H" -#include "PackedBoolList.H" +#include "fvMeshTopoChanger.H" +#include "polyTopoChanger.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { - -// Forward declaration of classes +namespace fvMeshTopoChangers +{ /*---------------------------------------------------------------------------*\ - Class rawTopoChangerFvMesh Declaration + Class fvMeshTopoChangers::raw Declaration \*---------------------------------------------------------------------------*/ -class rawTopoChangerFvMesh +class raw : - public topoChangerFvMesh + public fvMeshTopoChanger { + // Private Data + + polyTopoChanger topoChanger_; + + // Private Member Functions //- Set unmapped values @@ -74,20 +79,20 @@ class rawTopoChangerFvMesh public: //- Runtime type information - TypeName("rawTopoChangerFvMesh"); + TypeName("raw"); // Constructors - //- Construct from database - explicit rawTopoChangerFvMesh(const IOobject& io); + //- Construct from fvMesh + explicit raw(fvMesh& io); //- Disallow default bitwise copy construction - rawTopoChangerFvMesh(const rawTopoChangerFvMesh&) = delete; + raw(const raw&) = delete; //- Destructor - virtual ~rawTopoChangerFvMesh(); + virtual ~raw(); // Member Functions @@ -99,18 +104,19 @@ public: // Member Operators //- Disallow default bitwise assignment - void operator=(const rawTopoChangerFvMesh&) = delete; + void operator=(const raw&) = delete; }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +} // End namespace fvMeshTopoChangers } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository - #include "rawTopoChangerFvMeshTemplates.C" + #include "fvMeshTopoChangersRawTemplates.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/topoChangerFvMesh/rawTopoChangerFvMesh/rawTopoChangerFvMeshTemplates.C b/src/fvMeshTopoChangers/raw/fvMeshTopoChangersRawTemplates.C similarity index 86% rename from src/topoChangerFvMesh/rawTopoChangerFvMesh/rawTopoChangerFvMeshTemplates.C rename to src/fvMeshTopoChangers/raw/fvMeshTopoChangersRawTemplates.C index 6acf8d8f7e..13895ff6fe 100644 --- a/src/topoChangerFvMesh/rawTopoChangerFvMesh/rawTopoChangerFvMeshTemplates.C +++ b/src/fvMeshTopoChangers/raw/fvMeshTopoChangersRawTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,13 +23,12 @@ License \*---------------------------------------------------------------------------*/ -#include "rawTopoChangerFvMesh.H" -#include "Time.H" +#include "fvMeshTopoChangersRaw.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template class PatchField, class GeoMesh> -void Foam::rawTopoChangerFvMesh::setUnmappedValues +void Foam::fvMeshTopoChangers::raw::setUnmappedValues ( GeometricField& fld, const PackedBoolList& mappedFace, @@ -62,20 +61,20 @@ void Foam::rawTopoChangerFvMesh::setUnmappedValues template class PatchField, class GeoMesh> -void Foam::rawTopoChangerFvMesh::zeroUnmappedValues +void Foam::fvMeshTopoChangers::raw::zeroUnmappedValues ( const PackedBoolList& mappedFace ) const { typedef GeometricField FieldType; - const wordList fldNames(names(FieldType::typeName)); + const wordList fldNames(mesh().names(FieldType::typeName)); forAll(fldNames, i) { // Pout<< "Checking field " << fldNames[i] << endl; - FieldType& fld = lookupObjectRef(fldNames[i]); + FieldType& fld = mesh().lookupObjectRef(fldNames[i]); setUnmappedValues ( @@ -86,13 +85,13 @@ void Foam::rawTopoChangerFvMesh::zeroUnmappedValues IOobject ( "zero", - time().timeName(), - *this, + mesh().time().timeName(), + mesh(), IOobject::NO_READ, IOobject::NO_WRITE, false ), - *this, + mesh(), dimensioned("0", fld.dimensions(), Zero) ) ); diff --git a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicMeshDict b/src/fvMeshTopoChangers/refiner/dynamicMeshDict similarity index 95% rename from src/dynamicFvMesh/dynamicRefineFvMesh/dynamicMeshDict rename to src/fvMeshTopoChangers/refiner/dynamicMeshDict index 7ef374739e..5c088bdbfa 100644 --- a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicMeshDict +++ b/src/fvMeshTopoChangers/refiner/dynamicMeshDict @@ -13,9 +13,8 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -//dynamicFvMeshLib "libtopoChangerFvMesh.so"; -dynamicFvMesh dynamicRefineFvMesh; -//staticFvMesh; +topoChanger refiner; + mixerFvMeshCoeffs { diff --git a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C b/src/fvMeshTopoChangers/refiner/fvMeshTopoChangersRefiner.C similarity index 71% rename from src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C rename to src/fvMeshTopoChangers/refiner/fvMeshTopoChangersRefiner.C index 6f89ceef18..9160aed795 100644 --- a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C +++ b/src/fvMeshTopoChangers/refiner/fvMeshTopoChangersRefiner.C @@ -23,7 +23,7 @@ License \*---------------------------------------------------------------------------*/ -#include "dynamicRefineFvMesh.H" +#include "fvMeshTopoChangersRefiner.H" #include "surfaceInterpolate.H" #include "polyTopoChange.H" #include "syncTools.H" @@ -36,13 +36,17 @@ License namespace Foam { - defineTypeNameAndDebug(dynamicRefineFvMesh, 0); - addToRunTimeSelectionTable(dynamicFvMesh, dynamicRefineFvMesh, IOobject); +namespace fvMeshTopoChangers +{ + defineTypeNameAndDebug(refiner, 0); + addToRunTimeSelectionTable(fvMeshTopoChanger, refiner, fvMesh); } +} + // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // -Foam::label Foam::dynamicRefineFvMesh::count +Foam::label Foam::fvMeshTopoChangers::refiner::count ( const PackedBoolList& l, const unsigned int val @@ -68,7 +72,7 @@ Foam::label Foam::dynamicRefineFvMesh::count } -void Foam::dynamicRefineFvMesh::calculateProtectedCells +void Foam::fvMeshTopoChangers::refiner::calculateProtectedCells ( PackedBoolList& unrefineableCells ) const @@ -84,26 +88,32 @@ void Foam::dynamicRefineFvMesh::calculateProtectedCells unrefineableCells = protectedCells_; // Get neighbouring cell level - labelList neiLevel(nFaces()-nInternalFaces()); + labelList neiLevel(mesh().nFaces() - mesh().nInternalFaces()); - for (label facei = nInternalFaces(); facei < nFaces(); facei++) + for + ( + label facei = mesh().nInternalFaces(); + facei < mesh().nFaces(); + facei++ + ) { - neiLevel[facei-nInternalFaces()] = cellLevel[faceOwner()[facei]]; + neiLevel[facei - mesh().nInternalFaces()] = + cellLevel[mesh().faceOwner()[facei]]; } - syncTools::swapBoundaryFaceList(*this, neiLevel); + syncTools::swapBoundaryFaceList(mesh(), neiLevel); while (true) { // Pick up faces on border of protected cells - boolList seedFace(nFaces(), false); + boolList seedFace(mesh().nFaces(), false); - forAll(faceNeighbour(), facei) + forAll(mesh().faceNeighbour(), facei) { - label own = faceOwner()[facei]; - bool ownProtected = unrefineableCells.get(own); - label nei = faceNeighbour()[facei]; - bool neiProtected = unrefineableCells.get(nei); + const label own = mesh().faceOwner()[facei]; + const bool ownProtected = unrefineableCells.get(own); + const label nei = mesh().faceNeighbour()[facei]; + const bool neiProtected = unrefineableCells.get(nei); if (ownProtected && (cellLevel[nei] > cellLevel[own])) { @@ -114,38 +124,45 @@ void Foam::dynamicRefineFvMesh::calculateProtectedCells seedFace[facei] = true; } } - for (label facei = nInternalFaces(); facei < nFaces(); facei++) + + for + ( + label facei = mesh().nInternalFaces(); + facei < mesh().nFaces(); + facei++ + ) { - label own = faceOwner()[facei]; - bool ownProtected = unrefineableCells.get(own); + const label own = mesh().faceOwner()[facei]; + const bool ownProtected = unrefineableCells.get(own); + if ( ownProtected - && (neiLevel[facei-nInternalFaces()] > cellLevel[own]) + && (neiLevel[facei-mesh().nInternalFaces()] > cellLevel[own]) ) { seedFace[facei] = true; } } - syncTools::syncFaceList(*this, seedFace, orEqOp()); + syncTools::syncFaceList(mesh(), seedFace, orEqOp()); // Extend unrefineableCells bool hasExtended = false; - for (label facei = 0; facei < nInternalFaces(); facei++) + for (label facei = 0; facei < mesh().nInternalFaces(); facei++) { if (seedFace[facei]) { - label own = faceOwner()[facei]; + const label own = mesh().faceOwner()[facei]; if (unrefineableCells.get(own) == 0) { unrefineableCells.set(own, 1); hasExtended = true; } - label nei = faceNeighbour()[facei]; + const label nei = mesh().faceNeighbour()[facei]; if (unrefineableCells.get(nei) == 0) { unrefineableCells.set(nei, 1); @@ -153,11 +170,18 @@ void Foam::dynamicRefineFvMesh::calculateProtectedCells } } } - for (label facei = nInternalFaces(); facei < nFaces(); facei++) + + for + ( + label facei = mesh().nInternalFaces(); + facei < mesh().nFaces(); + facei++ + ) { if (seedFace[facei]) { - label own = faceOwner()[facei]; + const label own = mesh().faceOwner()[facei]; + if (unrefineableCells.get(own) == 0) { unrefineableCells.set(own, 1); @@ -174,17 +198,15 @@ void Foam::dynamicRefineFvMesh::calculateProtectedCells } -void Foam::dynamicRefineFvMesh::readDict() +void Foam::fvMeshTopoChangers::refiner::readDict() { - const dictionary refineDict - ( - dynamicMeshDict().optionalSubDict(typeName + "Coeffs") - ); + const dictionary& refineDict(dict()); - List> fluxVelocities = List> + const List> fluxVelocities = List> ( refineDict.lookup("correctFluxes") ); + // Rework into hashtable. correctFluxes_.resize(fluxVelocities.size()); forAll(fluxVelocities, i) @@ -196,39 +218,38 @@ void Foam::dynamicRefineFvMesh::readDict() } -// Refines cells, maps fields and recalculates (an approximate) flux Foam::autoPtr -Foam::dynamicRefineFvMesh::refine +Foam::fvMeshTopoChangers::refiner::refine ( const labelList& cellsToRefine ) { // Mesh changing engine. - polyTopoChange meshMod(*this); + polyTopoChange meshMod(mesh()); // Play refinement commands into mesh changer. meshCutter_.setRefinement(cellsToRefine, meshMod); // Create mesh (with inflation), return map from old to new mesh. // autoPtr map = meshMod.changeMesh(*this, true); - autoPtr map = meshMod.changeMesh(*this, false); + autoPtr map = meshMod.changeMesh(mesh(), false); Info<< "Refined from " << returnReduce(map().nOldCells(), sumOp