From 160ee637f9a42864327eff2646d777496dc2ac6b Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Thu, 11 Aug 2022 18:23:15 +0100 Subject: [PATCH] MRF: Further developed to replace SRF MRF (multiple reference frames) can now be used to simulate SRF (single reference frame) cases by defining the MRF zone to include all the cells is the mesh and applying appropriate boundary conditions. The huge advantage of this is that MRF can easily be added to any solver by the addition of forcing terms in the momentum equation and absolute velocity to relative flux conversions in the formulation of the pressure equation rather than having to reformulate the momentum and pressure system based on the relative velocity as in traditional SRF. Also most of the OpenFOAM solver applications and all the solver modules already support MRF. To enable this generalisation of MRF the transformations necessary on the velocity boundary conditions in the MRF zone can no longer be handled by the MRFZone class itself but special adapted fvPatchFields are required. Although this adds to the case setup it provides much greater flexibility and now complex inlet/outlet conditions can be applied within the MRF zone, necessary for some SRF case and which was not possible in the original MRF implementation. Now for walls rotating within the MRF zone the new 'MRFnoSlip' velocity boundary conditions must be applied, e.g. in the tutorials/modules/incompressibleFluid/mixerVessel2DMRF/constant/MRFProperties case: boundaryField { rotor { type MRFnoSlip; } stator { type noSlip; } front { type empty; } back { type empty; } } similarly for SRF cases, e.g. in the tutorials/modules/incompressibleFluid/mixerSRF case: boundaryField { inlet { type fixedValue; value uniform (0 0 -10); } outlet { type pressureInletOutletVelocity; value $internalField; } rotor { type MRFnoSlip; } outerWall { type noSlip; } cyclic_half0 { type cyclic; } cyclic_half1 { type cyclic; } } For SRF case all the cells should be selected in the MRFproperties dictionary which is achieved by simply setting the optional 'selectionMode' entry to all, e.g.: SRF { selectionMode all; origin (0 0 0); axis (0 0 1); rpm 1000; } In the above the rotational speed is set in RPM rather than rad/s simply by setting the 'rpm' entry rather than 'omega'. The tutorials/modules/incompressibleFluid/rotor2DSRF case is more complex and demonstrates a transient SRF simulation of a rotor requiring the free-stream velocity to rotate around the apparently stationary rotor which is achieved using the new 'MRFFreestreamVelocity' velocity boundary condition. The equivalent simulation can be achieved by simply rotating the entire mesh and keeping the free-stream flow stationary and this is demonstrated in the tutorials/modules/incompressibleFluid/rotor2DRotating case for comparison. The special SRFSimpleFoam and SRFPimpleFoam solvers are now redundant and have been replaced by redirection scripts providing details of the case migration process. --- .../solvers/combustion/XiFoam/PDRFoam/UEqn.H | 2 - applications/solvers/combustion/XiFoam/UEqn.H | 2 - .../compressible/rhoPorousSimpleFoam/UEqn.H | 2 - .../incompressible/SRFPimpleFoam/Make/files | 3 - .../incompressible/SRFPimpleFoam/Make/options | 17 - .../SRFPimpleFoam/SRFPimpleFoam.C | 110 ----- .../incompressible/SRFPimpleFoam/UrelEqn.H | 19 - .../SRFPimpleFoam/createFields.H | 75 ---- .../incompressible/SRFPimpleFoam/pEqn.H | 62 --- .../incompressible/SRFSimpleFoam/Make/files | 3 - .../incompressible/SRFSimpleFoam/Make/options | 17 - .../SRFSimpleFoam/SRFSimpleFoam.C | 91 ---- .../incompressible/SRFSimpleFoam/UrelEqn.H | 22 - .../SRFSimpleFoam/createFields.H | 73 ---- .../incompressible/SRFSimpleFoam/pEqn.H | 55 --- .../incompressible/porousSimpleFoam/UEqn.H | 2 - .../solvers/incompressible/simpleFoam/UEqn.H | 2 - .../modules/fluid/fluidSolver/Make/options | 2 +- .../incompressibleFluid/momentumPredictor.C | 2 - .../fluid/isothermalFluid/momentumPredictor.C | 2 - .../VoFSolidificationMeltingSource.C | 2 +- ...incompressibleTwoPhaseInteractingMixture.C | 1 - .../solvers/multiphase/interFoam/UEqn.H | 2 - .../interFoam/interMixingFoam/UEqn.H | 2 - .../MovingPhaseModel/MovingPhaseModel.C | 1 - .../multiphase/multiphaseInterFoam/UEqn.H | 2 - .../potentialFreeSurfaceFoam/UEqn.H | 2 - bin/SRFPimpleFoam | 61 +++ bin/SRFSimpleFoam | 61 +++ .../dynamicCode/codedFvModelTemplate.C | 2 +- etc/config.sh/bash_completion | 50 --- src/finiteVolume/Make/files | 11 +- .../cfdTools/general/MRF/MRFZone.C | 399 +++++------------- .../cfdTools/general/MRF/MRFZone.H | 62 +-- .../cfdTools/general/MRF/MRFZoneList.C | 69 --- .../cfdTools/general/MRF/MRFZoneList.H | 30 +- .../cfdTools/general/MRF/MRFZoneTemplates.C | 77 +--- .../MRFFreestreamVelocityFvPatchVectorField.C | 130 ++++++ ...MRFFreestreamVelocityFvPatchVectorField.H} | 101 ++--- .../MRFPatchField/MRFPatchField.C} | 103 +++-- .../MRFPatchField/MRFPatchField.H} | 60 +-- .../MRFnoSlip/MRFnoSlipFvPatchVectorField.C} | 91 ++-- .../MRFnoSlip/MRFnoSlipFvPatchVectorField.H} | 99 ++--- .../general/SRF/SRFModel/SRFModel/SRFModel.C | 217 ---------- .../general/SRF/SRFModel/SRFModel/SRFModel.H | 191 --------- .../SRF/SRFModel/SRFModel/SRFModelNew.C | 72 ---- .../SRFFreestreamVelocityFvPatchVectorField.C | 168 -------- .../SRFVelocityFvPatchVectorField.C | 176 -------- .../SRFVelocityFvPatchVectorField.H | 219 ---------- src/finiteVolume/fvMesh/fvCellSet/fvCellSet.C | 111 +++-- src/finiteVolume/fvMesh/fvCellSet/fvCellSet.H | 22 +- .../fixedTemperatureConstraint.C | 2 +- .../fixedValueConstraint.C | 2 +- src/fvConstraints/limitMag/limitMag.C | 2 +- .../limitTemperature/limitTemperature.C | 2 +- .../meanVelocityForce/meanVelocityForce.C | 2 +- .../accelerationSource/accelerationSource.C | 2 +- .../actuationDiskSource/actuationDiskSource.C | 2 +- .../effectivenessHeatExchangerSource.C | 2 +- .../explicitPorositySource.C | 2 +- src/fvModels/derived/heatSource/heatSource.C | 2 +- .../derived/heatTransfer/heatTransfer.C | 2 +- src/fvModels/derived/massSource/massSource.C | 2 +- .../derived/rotorDiskSource/rotorDiskSource.C | 2 +- .../solidificationMeltingSource.C | 2 +- .../semiImplicitSource/semiImplicitSource.C | 2 +- .../parcel/parcels/include/makeParcelForces.H | 4 +- .../Momentum/ParticleForces/SRF/SRFForce.C | 107 ----- .../Momentum/ParticleForces/SRF/SRFForce.H | 130 ------ .../SRFPimpleFoam/rotor2D/Allrun | 12 - .../incompressible/SRFSimpleFoam/mixer/0/Urel | 57 --- .../SRFSimpleFoam/mixer/0/omega | 56 --- .../SRFSimpleFoam/mixer/system/blockMeshDict | 152 ------- .../SRFSimpleFoam/mixer/system/fvSolution | 51 --- tutorials/modules/CHT/heatExchanger/0/air/U | 3 +- .../heatExchanger/constant/air/MRFProperties | 10 +- tutorials/modules/fluid/mixerVessel2DMRF/0/U | 3 +- .../mixerVessel2DMRF/constant/MRFProperties | 8 +- .../modules/incompressibleFluid/mixerSRF/0/U | 5 +- .../incompressibleFluid/mixerSRF/0/epsilon | 2 +- .../modules/incompressibleFluid/mixerSRF/0/k | 2 +- .../incompressibleFluid/mixerSRF/0/nut | 2 +- .../incompressibleFluid/mixerSRF/0/omega | 2 +- .../modules/incompressibleFluid/mixerSRF/0/p | 2 +- .../mixerSRF/constant/MRFProperties | 13 +- .../mixerSRF/system/blockMeshDict | 60 +-- .../incompressibleFluid/mixerVessel2DMRF/0/U | 3 +- .../mixerVessel2DMRF/constant/MRFProperties | 10 +- .../incompressibleFluid/rotor2DRotating/0/U | 45 ++ .../rotor2DRotating}/0/epsilon | 0 .../incompressibleFluid/rotor2DRotating}/0/k | 0 .../rotor2DRotating}/0/nut | 0 .../incompressibleFluid/rotor2DRotating}/0/p | 3 +- .../rotor2DRotating/constant/dynamicMeshDict} | 21 +- .../constant/momentumTransport | 0 .../constant/physicalProperties | 0 .../rotor2DRotating/system/blockMeshDict | 185 ++++++++ .../rotor2DRotating}/system/controlDict | 4 +- .../rotor2DRotating}/system/fvSchemes | 4 +- .../rotor2DRotating/system/fvSolution | 85 ++++ .../incompressibleFluid/rotor2DSRF/0/U} | 12 +- .../incompressibleFluid/rotor2DSRF}/0/epsilon | 33 +- .../incompressibleFluid/rotor2DSRF}/0/k | 35 +- .../incompressibleFluid/rotor2DSRF}/0/nut | 29 +- .../incompressibleFluid/rotor2DSRF}/0/p | 29 +- .../rotor2DSRF/constant/MRFProperties} | 17 +- .../rotor2DSRF}/constant/momentumTransport | 2 +- .../rotor2DSRF}/constant/physicalProperties | 2 +- .../rotor2DSRF}/system/blockMeshDict | 2 +- .../rotor2DSRF}/system/controlDict | 17 +- .../rotor2DSRF}/system/fvSchemes | 20 +- .../rotor2DSRF}/system/fvSolution | 4 +- .../driftFluxFoam/RAS/mixerVessel2DMRF/0/U | 3 +- .../mixerVessel2DMRF/constant/MRFProperties | 10 +- .../interFoam/laminar/mixerVessel2DMRF/0/U | 3 +- .../mixerVessel2DMRF/constant/MRFProperties | 10 +- .../laminar/mixerVessel2DMRF/0/U.air | 3 +- .../laminar/mixerVessel2DMRF/0/U.mercury | 3 +- .../laminar/mixerVessel2DMRF/0/U.oil | 3 +- .../laminar/mixerVessel2DMRF/0/U.water | 3 +- .../mixerVessel2DMRF/constant/MRFProperties | 10 +- .../laminar/mixerVessel2DMRF/0/U | 3 +- .../mixerVessel2DMRF/constant/MRFProperties | 10 +- 123 files changed, 1191 insertions(+), 3300 deletions(-) delete mode 100644 applications/solvers/incompressible/SRFPimpleFoam/Make/files delete mode 100644 applications/solvers/incompressible/SRFPimpleFoam/Make/options delete mode 100644 applications/solvers/incompressible/SRFPimpleFoam/SRFPimpleFoam.C delete mode 100644 applications/solvers/incompressible/SRFPimpleFoam/UrelEqn.H delete mode 100644 applications/solvers/incompressible/SRFPimpleFoam/createFields.H delete mode 100644 applications/solvers/incompressible/SRFPimpleFoam/pEqn.H delete mode 100644 applications/solvers/incompressible/SRFSimpleFoam/Make/files delete mode 100644 applications/solvers/incompressible/SRFSimpleFoam/Make/options delete mode 100644 applications/solvers/incompressible/SRFSimpleFoam/SRFSimpleFoam.C delete mode 100644 applications/solvers/incompressible/SRFSimpleFoam/UrelEqn.H delete mode 100644 applications/solvers/incompressible/SRFSimpleFoam/createFields.H delete mode 100644 applications/solvers/incompressible/SRFSimpleFoam/pEqn.H create mode 100755 bin/SRFPimpleFoam create mode 100755 bin/SRFSimpleFoam create mode 100644 src/finiteVolume/cfdTools/general/MRF/derivedFvPatchFields/MRFFreestreamVelocity/MRFFreestreamVelocityFvPatchVectorField.C rename src/finiteVolume/cfdTools/general/{SRF/derivedFvPatchFields/SRFFreestreamVelocityFvPatchVectorField/SRFFreestreamVelocityFvPatchVectorField.H => MRF/derivedFvPatchFields/MRFFreestreamVelocity/MRFFreestreamVelocityFvPatchVectorField.H} (56%) rename src/finiteVolume/cfdTools/general/{SRF/SRFModel/rpm/rpm.C => MRF/derivedFvPatchFields/MRFPatchField/MRFPatchField.C} (50%) rename src/finiteVolume/cfdTools/general/{SRF/SRFModel/rpm/rpm.H => MRF/derivedFvPatchFields/MRFPatchField/MRFPatchField.H} (65%) rename src/finiteVolume/cfdTools/general/{SRF/derivedFvPatchFields/SRFWallVelocityFvPatchVectorField/SRFWallVelocityFvPatchVectorField.C => MRF/derivedFvPatchFields/MRFnoSlip/MRFnoSlipFvPatchVectorField.C} (56%) rename src/finiteVolume/cfdTools/general/{SRF/derivedFvPatchFields/SRFWallVelocityFvPatchVectorField/SRFWallVelocityFvPatchVectorField.H => MRF/derivedFvPatchFields/MRFnoSlip/MRFnoSlipFvPatchVectorField.H} (57%) delete mode 100644 src/finiteVolume/cfdTools/general/SRF/SRFModel/SRFModel/SRFModel.C delete mode 100644 src/finiteVolume/cfdTools/general/SRF/SRFModel/SRFModel/SRFModel.H delete mode 100644 src/finiteVolume/cfdTools/general/SRF/SRFModel/SRFModel/SRFModelNew.C delete mode 100644 src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFFreestreamVelocityFvPatchVectorField/SRFFreestreamVelocityFvPatchVectorField.C delete mode 100644 src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C delete mode 100644 src/finiteVolume/cfdTools/general/SRF/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.H delete mode 100644 src/lagrangian/parcel/submodels/Momentum/ParticleForces/SRF/SRFForce.C delete mode 100644 src/lagrangian/parcel/submodels/Momentum/ParticleForces/SRF/SRFForce.H delete mode 100755 tutorials/incompressible/SRFPimpleFoam/rotor2D/Allrun delete mode 100644 tutorials/incompressible/SRFSimpleFoam/mixer/0/Urel delete mode 100644 tutorials/incompressible/SRFSimpleFoam/mixer/0/omega delete mode 100644 tutorials/incompressible/SRFSimpleFoam/mixer/system/blockMeshDict delete mode 100644 tutorials/incompressible/SRFSimpleFoam/mixer/system/fvSolution create mode 100644 tutorials/modules/incompressibleFluid/rotor2DRotating/0/U rename tutorials/{incompressible/SRFPimpleFoam/rotor2D => modules/incompressibleFluid/rotor2DRotating}/0/epsilon (100%) rename tutorials/{incompressible/SRFPimpleFoam/rotor2D => modules/incompressibleFluid/rotor2DRotating}/0/k (100%) rename tutorials/{incompressible/SRFPimpleFoam/rotor2D => modules/incompressibleFluid/rotor2DRotating}/0/nut (100%) rename tutorials/{incompressible/SRFPimpleFoam/rotor2D => modules/incompressibleFluid/rotor2DRotating}/0/p (91%) rename tutorials/{incompressible/SRFPimpleFoam/rotor2D/constant/SRFProperties => modules/incompressibleFluid/rotor2DRotating/constant/dynamicMeshDict} (67%) rename tutorials/{incompressible/SRFPimpleFoam/rotor2D => modules/incompressibleFluid/rotor2DRotating}/constant/momentumTransport (100%) rename tutorials/{incompressible/SRFPimpleFoam/rotor2D => modules/incompressibleFluid/rotor2DRotating}/constant/physicalProperties (100%) create mode 100644 tutorials/modules/incompressibleFluid/rotor2DRotating/system/blockMeshDict rename tutorials/{incompressible/SRFPimpleFoam/rotor2D => modules/incompressibleFluid/rotor2DRotating}/system/controlDict (94%) rename tutorials/{incompressible/SRFPimpleFoam/rotor2D => modules/incompressibleFluid/rotor2DRotating}/system/fvSchemes (91%) create mode 100644 tutorials/modules/incompressibleFluid/rotor2DRotating/system/fvSolution rename tutorials/{incompressible/SRFPimpleFoam/rotor2D/0/Urel => modules/incompressibleFluid/rotor2DSRF/0/U} (79%) rename tutorials/{incompressible/SRFSimpleFoam/mixer => modules/incompressibleFluid/rotor2DSRF}/0/epsilon (65%) rename tutorials/{incompressible/SRFSimpleFoam/mixer => modules/incompressibleFluid/rotor2DSRF}/0/k (62%) rename tutorials/{incompressible/SRFSimpleFoam/mixer => modules/incompressibleFluid/rotor2DSRF}/0/nut (70%) rename tutorials/{incompressible/SRFSimpleFoam/mixer => modules/incompressibleFluid/rotor2DSRF}/0/p (70%) rename tutorials/{incompressible/SRFSimpleFoam/mixer/constant/SRFProperties => modules/incompressibleFluid/rotor2DSRF/constant/MRFProperties} (82%) rename tutorials/{incompressible/SRFSimpleFoam/mixer => modules/incompressibleFluid/rotor2DSRF}/constant/momentumTransport (96%) rename tutorials/{incompressible/SRFSimpleFoam/mixer => modules/incompressibleFluid/rotor2DSRF}/constant/physicalProperties (94%) rename tutorials/{incompressible/SRFPimpleFoam/rotor2D => modules/incompressibleFluid/rotor2DSRF}/system/blockMeshDict (99%) rename tutorials/{incompressible/SRFSimpleFoam/mixer => modules/incompressibleFluid/rotor2DSRF}/system/controlDict (80%) rename tutorials/{incompressible/SRFSimpleFoam/mixer => modules/incompressibleFluid/rotor2DSRF}/system/fvSchemes (66%) rename tutorials/{incompressible/SRFPimpleFoam/rotor2D => modules/incompressibleFluid/rotor2DSRF}/system/fvSolution (96%) diff --git a/applications/solvers/combustion/XiFoam/PDRFoam/UEqn.H b/applications/solvers/combustion/XiFoam/PDRFoam/UEqn.H index 114131c94e..88674e781b 100644 --- a/applications/solvers/combustion/XiFoam/PDRFoam/UEqn.H +++ b/applications/solvers/combustion/XiFoam/PDRFoam/UEqn.H @@ -1,5 +1,3 @@ - MRF.correctBoundaryVelocity(U); - fvVectorMatrix UEqn ( betav*fvm::ddt(rho, U) + fvm::div(phi, U) diff --git a/applications/solvers/combustion/XiFoam/UEqn.H b/applications/solvers/combustion/XiFoam/UEqn.H index 1c08541677..a26acd7134 100644 --- a/applications/solvers/combustion/XiFoam/UEqn.H +++ b/applications/solvers/combustion/XiFoam/UEqn.H @@ -1,5 +1,3 @@ - MRF.correctBoundaryVelocity(U); - fvVectorMatrix UEqn ( fvm::ddt(rho, U) + fvm::div(phi, U) diff --git a/applications/solvers/compressible/rhoPorousSimpleFoam/UEqn.H b/applications/solvers/compressible/rhoPorousSimpleFoam/UEqn.H index cedba27681..f77aaf6106 100644 --- a/applications/solvers/compressible/rhoPorousSimpleFoam/UEqn.H +++ b/applications/solvers/compressible/rhoPorousSimpleFoam/UEqn.H @@ -1,7 +1,5 @@ // Construct the Momentum equation - MRF.correctBoundaryVelocity(U); - tmp tUEqn ( fvm::div(phi, U) diff --git a/applications/solvers/incompressible/SRFPimpleFoam/Make/files b/applications/solvers/incompressible/SRFPimpleFoam/Make/files deleted file mode 100644 index a15ee9be6a..0000000000 --- a/applications/solvers/incompressible/SRFPimpleFoam/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -SRFPimpleFoam.C - -EXE = $(FOAM_APPBIN)/SRFPimpleFoam diff --git a/applications/solvers/incompressible/SRFPimpleFoam/Make/options b/applications/solvers/incompressible/SRFPimpleFoam/Make/options deleted file mode 100644 index d138c73b43..0000000000 --- a/applications/solvers/incompressible/SRFPimpleFoam/Make/options +++ /dev/null @@ -1,17 +0,0 @@ -EXE_INC = \ - -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \ - -I$(LIB_SRC)/MomentumTransportModels/incompressible/lnInclude \ - -I$(LIB_SRC)/physicalProperties/lnInclude \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude - -EXE_LIBS = \ - -lmomentumTransportModels \ - -lincompressibleMomentumTransportModels \ - -lphysicalProperties \ - -lfiniteVolume \ - -lmeshTools \ - -lfvModels \ - -lfvConstraints \ - -lsampling diff --git a/applications/solvers/incompressible/SRFPimpleFoam/SRFPimpleFoam.C b/applications/solvers/incompressible/SRFPimpleFoam/SRFPimpleFoam.C deleted file mode 100644 index 78f753de8b..0000000000 --- a/applications/solvers/incompressible/SRFPimpleFoam/SRFPimpleFoam.C +++ /dev/null @@ -1,110 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 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 . - -Application - SRFPimpleFoam - -Description - Large time-step transient solver for incompressible, turbulent flow in a - single rotating frame. - - Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected. - -\*---------------------------------------------------------------------------*/ - -#include "fvCFD.H" -#include "viscosityModel.H" -#include "incompressibleMomentumTransportModels.H" -#include "pimpleControl.H" -#include "pressureReference.H" -#include "SRFModel.H" -#include "fvModels.H" -#include "fvConstraints.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -int main(int argc, char *argv[]) -{ - #include "postProcess.H" - - #include "setRootCaseLists.H" - #include "createTime.H" - #include "createMesh.H" - #include "createControl.H" - #include "createTimeControls.H" - #include "createFields.H" - #include "initContinuityErrs.H" - - turbulence->validate(); - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - - Info<< "\nStarting time loop\n" << endl; - - while (pimple.run(runTime)) - { - #include "readTimeControls.H" - #include "CourantNo.H" - #include "setDeltaT.H" - - runTime++; - - Info<< "Time = " << runTime.userTimeName() << nl << endl; - - // --- Pressure-velocity PIMPLE corrector loop - while (pimple.loop()) - { - fvModels.correct(); - - #include "UrelEqn.H" - - // --- Pressure corrector loop - while (pimple.correct()) - { - #include "pEqn.H" - } - - // Update the absolute velocity - U = Urel + SRF->U(); - - if (pimple.turbCorr()) - { - viscosity->correct(); - turbulence->correct(); - } - } - - runTime.write(); - - Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" - << " ClockTime = " << runTime.elapsedClockTime() << " s" - << nl << endl; - } - - Info<< "End\n" << endl; - - return 0; -} - - -// ************************************************************************* // diff --git a/applications/solvers/incompressible/SRFPimpleFoam/UrelEqn.H b/applications/solvers/incompressible/SRFPimpleFoam/UrelEqn.H deleted file mode 100644 index 8b358bcaf9..0000000000 --- a/applications/solvers/incompressible/SRFPimpleFoam/UrelEqn.H +++ /dev/null @@ -1,19 +0,0 @@ - // Relative momentum predictor - tmp tUrelEqn - ( - fvm::ddt(Urel) - + fvm::div(phi, Urel) - + turbulence->divDevSigma(Urel) - + SRF->Su() - == - fvModels.source(Urel) - ); - fvVectorMatrix& UrelEqn = tUrelEqn.ref(); - - UrelEqn.relax(); - - fvConstraints.constrain(UrelEqn); - - solve(UrelEqn == -fvc::grad(p)); - - fvConstraints.constrain(Urel); diff --git a/applications/solvers/incompressible/SRFPimpleFoam/createFields.H b/applications/solvers/incompressible/SRFPimpleFoam/createFields.H deleted file mode 100644 index 94c7aaba32..0000000000 --- a/applications/solvers/incompressible/SRFPimpleFoam/createFields.H +++ /dev/null @@ -1,75 +0,0 @@ -Info<< "Reading field p\n" << endl; -volScalarField p -( - IOobject - ( - "p", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh -); - -Info<< "Reading field Urel\n" << endl; -volVectorField Urel -( - IOobject - ( - "Urel", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh -); - -Info<< "Reading/calculating face flux field phi\n" << endl; -surfaceScalarField phi -( - IOobject - ( - "phi", - runTime.timeName(), - mesh, - IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE - ), - linearInterpolate(Urel) & mesh.Sf() -); - -pressureReference pressureReference(p, pimple.dict()); -mesh.schemes().setFluxRequired(p.name()); - -Info<< "Creating SRF model\n" << endl; -autoPtr SRF -( - SRF::SRFModel::New(Urel) -); - -// Create the absolute velocity -volVectorField U -( - IOobject - ( - "U", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - Urel + SRF->U() -); - - -autoPtr viscosity(viscosityModel::New(mesh)); - -autoPtr turbulence -( - incompressible::momentumTransportModel::New(U, phi, viscosity) -); - -#include "createFvModels.H" -#include "createFvConstraints.H" diff --git a/applications/solvers/incompressible/SRFPimpleFoam/pEqn.H b/applications/solvers/incompressible/SRFPimpleFoam/pEqn.H deleted file mode 100644 index e678c78e54..0000000000 --- a/applications/solvers/incompressible/SRFPimpleFoam/pEqn.H +++ /dev/null @@ -1,62 +0,0 @@ -volScalarField rAUrel(1.0/UrelEqn.A()); -volVectorField HbyA("HbyA", Urel); -HbyA = rAUrel*UrelEqn.H(); - -surfaceScalarField phiHbyA -( - "phiHbyA", - fvc::flux(HbyA) - + fvc::interpolate(rAUrel)*fvc::ddtCorr(Urel, phi) -); - -adjustPhi(phiHbyA, Urel, p); - -tmp rAtUrel(rAUrel); - -if (pimple.consistent()) -{ - rAtUrel = 1.0/max(1.0/rAUrel - UrelEqn.H1(), 0.1/rAUrel); - phiHbyA += - fvc::interpolate(rAtUrel() - rAUrel)*fvc::snGrad(p)*mesh.magSf(); - HbyA -= (rAUrel - rAtUrel())*fvc::grad(p); -} - -if (pimple.nCorrPiso() <= 1) -{ - tUrelEqn.clear(); -} - -// Update the pressure BCs to ensure flux consistency -constrainPressure(p, Urel, phiHbyA, rAtUrel()); - -// Non-orthogonal pressure corrector loop -while (pimple.correctNonOrthogonal()) -{ - // Pressure corrector - fvScalarMatrix pEqn - ( - fvm::laplacian(rAtUrel(), p) == fvc::div(phiHbyA) - ); - - pEqn.setReference - ( - pressureReference.refCell(), - pressureReference.refValue() - ); - - pEqn.solve(); - - if (pimple.finalNonOrthogonalIter()) - { - phi = phiHbyA - pEqn.flux(); - } -} - -#include "continuityErrs.H" - -p.relax(); - -// Momentum corrector -Urel = HbyA - rAtUrel()*fvc::grad(p); -Urel.correctBoundaryConditions(); -fvConstraints.constrain(Urel); diff --git a/applications/solvers/incompressible/SRFSimpleFoam/Make/files b/applications/solvers/incompressible/SRFSimpleFoam/Make/files deleted file mode 100644 index 3250f4139d..0000000000 --- a/applications/solvers/incompressible/SRFSimpleFoam/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -SRFSimpleFoam.C - -EXE = $(FOAM_APPBIN)/SRFSimpleFoam diff --git a/applications/solvers/incompressible/SRFSimpleFoam/Make/options b/applications/solvers/incompressible/SRFSimpleFoam/Make/options deleted file mode 100644 index d138c73b43..0000000000 --- a/applications/solvers/incompressible/SRFSimpleFoam/Make/options +++ /dev/null @@ -1,17 +0,0 @@ -EXE_INC = \ - -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \ - -I$(LIB_SRC)/MomentumTransportModels/incompressible/lnInclude \ - -I$(LIB_SRC)/physicalProperties/lnInclude \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude - -EXE_LIBS = \ - -lmomentumTransportModels \ - -lincompressibleMomentumTransportModels \ - -lphysicalProperties \ - -lfiniteVolume \ - -lmeshTools \ - -lfvModels \ - -lfvConstraints \ - -lsampling diff --git a/applications/solvers/incompressible/SRFSimpleFoam/SRFSimpleFoam.C b/applications/solvers/incompressible/SRFSimpleFoam/SRFSimpleFoam.C deleted file mode 100644 index 5d90a8e01b..0000000000 --- a/applications/solvers/incompressible/SRFSimpleFoam/SRFSimpleFoam.C +++ /dev/null @@ -1,91 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 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 . - -Application - SRFSimpleFoam - -Description - Steady-state solver for incompressible, turbulent flow of non-Newtonian - fluids in a single rotating frame. - -\*---------------------------------------------------------------------------*/ - -#include "fvCFD.H" -#include "viscosityModel.H" -#include "incompressibleMomentumTransportModels.H" -#include "SRFModel.H" -#include "simpleControl.H" -#include "pressureReference.H" -#include "fvModels.H" -#include "fvConstraints.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -int main(int argc, char *argv[]) -{ - #include "postProcess.H" - - #include "setRootCaseLists.H" - #include "createTime.H" - #include "createMesh.H" - #include "createControl.H" - #include "createFields.H" - #include "initContinuityErrs.H" - - turbulence->validate(); - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - - Info<< "\nStarting time loop\n" << endl; - - while (simple.loop(runTime)) - { - Info<< "Time = " << runTime.userTimeName() << nl << endl; - - fvModels.correct(); - - // --- Pressure-velocity SIMPLE corrector - { - #include "UrelEqn.H" - #include "pEqn.H" - } - - U = Urel + SRF->U(); - - viscosity->correct(); - turbulence->correct(); - - runTime.write(); - - Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" - << " ClockTime = " << runTime.elapsedClockTime() << " s" - << nl << endl; - } - - Info<< "End\n" << endl; - - return 0; -} - - -// ************************************************************************* // diff --git a/applications/solvers/incompressible/SRFSimpleFoam/UrelEqn.H b/applications/solvers/incompressible/SRFSimpleFoam/UrelEqn.H deleted file mode 100644 index 46491fb3cf..0000000000 --- a/applications/solvers/incompressible/SRFSimpleFoam/UrelEqn.H +++ /dev/null @@ -1,22 +0,0 @@ - // Relative momentum predictor - - tmp tUrelEqn - ( - fvm::div(phi, Urel) - + turbulence->divDevSigma(Urel) - + SRF->Su() - == - fvModels.source(Urel) - ); - fvVectorMatrix& UrelEqn = tUrelEqn.ref(); - - UrelEqn.relax(); - - fvConstraints.constrain(UrelEqn); - - if (simple.momentumPredictor()) - { - solve(UrelEqn == -fvc::grad(p)); - - fvConstraints.constrain(Urel); - } diff --git a/applications/solvers/incompressible/SRFSimpleFoam/createFields.H b/applications/solvers/incompressible/SRFSimpleFoam/createFields.H deleted file mode 100644 index 62a3ee0fec..0000000000 --- a/applications/solvers/incompressible/SRFSimpleFoam/createFields.H +++ /dev/null @@ -1,73 +0,0 @@ -Info<< "Reading field p\n" << endl; -volScalarField p -( - IOobject - ( - "p", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh -); - -Info<< "Reading field Urel\n" << endl; -volVectorField Urel -( - IOobject - ( - "Urel", - runTime.timeName(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh -); - -Info<< "Reading/calculating face flux field phi\n" << endl; -surfaceScalarField phi -( - IOobject - ( - "phi", - runTime.timeName(), - mesh, - IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE - ), - linearInterpolate(Urel) & mesh.Sf() -); - -pressureReference pressureReference(p, simple.dict()); - -mesh.schemes().setFluxRequired(p.name()); - -Info<< "Creating SRF model\n" << endl; -autoPtr SRF(SRF::SRFModel::New(Urel)); - -// Construct the absolute velocity -volVectorField U -( - IOobject - ( - "U", - runTime.timeName(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - Urel + SRF->U() -); - - -autoPtr viscosity(viscosityModel::New(mesh)); - -autoPtr turbulence -( - incompressible::momentumTransportModel::New(U, phi, viscosity) -); - -#include "createFvModels.H" -#include "createFvConstraints.H" diff --git a/applications/solvers/incompressible/SRFSimpleFoam/pEqn.H b/applications/solvers/incompressible/SRFSimpleFoam/pEqn.H deleted file mode 100644 index 5af5c25231..0000000000 --- a/applications/solvers/incompressible/SRFSimpleFoam/pEqn.H +++ /dev/null @@ -1,55 +0,0 @@ -{ - volScalarField rAUrel(1.0/UrelEqn.A()); - volVectorField HbyA("HbyA", Urel); - HbyA = rAUrel*UrelEqn.H(); - - surfaceScalarField phiHbyA("phiHbyA", fvc::flux(HbyA)); - adjustPhi(phiHbyA, Urel, p); - - tmp rAtUrel(rAUrel); - - if (simple.consistent()) - { - rAtUrel = 1.0/(1.0/rAUrel - UrelEqn.H1()); - phiHbyA += - fvc::interpolate(rAtUrel() - rAUrel)*fvc::snGrad(p)*mesh.magSf(); - HbyA -= (rAUrel - rAtUrel())*fvc::grad(p); - } - - tUrelEqn.clear(); - - // Update the pressure BCs to ensure flux consistency - constrainPressure(p, Urel, phiHbyA, rAtUrel()); - - // Non-orthogonal pressure corrector loop - while (simple.correctNonOrthogonal()) - { - fvScalarMatrix pEqn - ( - fvm::laplacian(rAtUrel(), p) == fvc::div(phiHbyA) - ); - - pEqn.setReference - ( - pressureReference.refCell(), - pressureReference.refValue() - ); - - pEqn.solve(); - - if (simple.finalNonOrthogonalIter()) - { - phi = phiHbyA - pEqn.flux(); - } - } - - #include "continuityErrs.H" - - // Explicitly relax pressure for momentum corrector - p.relax(); - - // Momentum corrector - Urel = HbyA - rAtUrel()*fvc::grad(p); - Urel.correctBoundaryConditions(); - fvConstraints.constrain(Urel); -} diff --git a/applications/solvers/incompressible/porousSimpleFoam/UEqn.H b/applications/solvers/incompressible/porousSimpleFoam/UEqn.H index d831d55fb8..9286158749 100644 --- a/applications/solvers/incompressible/porousSimpleFoam/UEqn.H +++ b/applications/solvers/incompressible/porousSimpleFoam/UEqn.H @@ -1,7 +1,5 @@ // Construct the Momentum equation - MRF.correctBoundaryVelocity(U); - tmp tUEqn ( fvm::div(phi, U) diff --git a/applications/solvers/incompressible/simpleFoam/UEqn.H b/applications/solvers/incompressible/simpleFoam/UEqn.H index 16ba8b5e55..86306adef9 100644 --- a/applications/solvers/incompressible/simpleFoam/UEqn.H +++ b/applications/solvers/incompressible/simpleFoam/UEqn.H @@ -1,7 +1,5 @@ // Momentum predictor - MRF.correctBoundaryVelocity(U); - tmp tUEqn ( fvm::div(phi, U) diff --git a/applications/solvers/modules/fluid/fluidSolver/Make/options b/applications/solvers/modules/fluid/fluidSolver/Make/options index 4544d945fd..c330dbfc7a 100644 --- a/applications/solvers/modules/fluid/fluidSolver/Make/options +++ b/applications/solvers/modules/fluid/fluidSolver/Make/options @@ -1,4 +1,4 @@ -EXE_INC = -ggdb3 \ +EXE_INC = \ -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \ -I$(LIB_SRC)/MomentumTransportModels/incompressible/lnInclude \ -I$(LIB_SRC)/physicalProperties/lnInclude \ diff --git a/applications/solvers/modules/fluid/incompressibleFluid/momentumPredictor.C b/applications/solvers/modules/fluid/incompressibleFluid/momentumPredictor.C index 76fb1750bd..48796235e3 100644 --- a/applications/solvers/modules/fluid/incompressibleFluid/momentumPredictor.C +++ b/applications/solvers/modules/fluid/incompressibleFluid/momentumPredictor.C @@ -29,8 +29,6 @@ License void Foam::solvers::incompressibleFluid::momentumPredictor() { - MRF.correctBoundaryVelocity(U); - tUEqn = ( fvm::ddt(U) + fvm::div(phi, U) diff --git a/applications/solvers/modules/fluid/isothermalFluid/momentumPredictor.C b/applications/solvers/modules/fluid/isothermalFluid/momentumPredictor.C index 967b761fe5..e23eca03d0 100644 --- a/applications/solvers/modules/fluid/isothermalFluid/momentumPredictor.C +++ b/applications/solvers/modules/fluid/isothermalFluid/momentumPredictor.C @@ -29,8 +29,6 @@ License void Foam::solvers::isothermalFluid::momentumPredictor() { - MRF.correctBoundaryVelocity(U); - tUEqn = ( fvm::ddt(rho, U) + fvm::div(phi, U) diff --git a/applications/solvers/multiphase/compressibleInterFoam/VoFSolidificationMeltingSource/VoFSolidificationMeltingSource.C b/applications/solvers/multiphase/compressibleInterFoam/VoFSolidificationMeltingSource/VoFSolidificationMeltingSource.C index 2cb983a7f9..e83ce33d1d 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/VoFSolidificationMeltingSource/VoFSolidificationMeltingSource.C +++ b/applications/solvers/multiphase/compressibleInterFoam/VoFSolidificationMeltingSource/VoFSolidificationMeltingSource.C @@ -86,7 +86,7 @@ Foam::fv::VoFSolidificationMeltingSource::VoFSolidificationMeltingSource ) : fvModel(name, modelType, dict, mesh), - set_(coeffs(), mesh), + set_(mesh, coeffs()), alphaSolidT_(), L_("L", dimEnergy/dimMass, NaN), relax_(NaN), diff --git a/applications/solvers/multiphase/driftFluxFoam/incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.C b/applications/solvers/multiphase/driftFluxFoam/incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.C index c4fb800b86..8baea1cdb8 100644 --- a/applications/solvers/multiphase/driftFluxFoam/incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.C +++ b/applications/solvers/multiphase/driftFluxFoam/incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.C @@ -224,7 +224,6 @@ Foam::incompressibleTwoPhaseInteractingMixture::divTauDm() const void Foam::incompressibleTwoPhaseInteractingMixture::correct() { - MRF_.correctBoundaryVelocity(U_); mu_ = muModel_->mu(rhoc_*nucModel_->nu(), U_); UdmModel_->correct(); } diff --git a/applications/solvers/multiphase/interFoam/UEqn.H b/applications/solvers/multiphase/interFoam/UEqn.H index b3317395c4..508bf78f82 100644 --- a/applications/solvers/multiphase/interFoam/UEqn.H +++ b/applications/solvers/multiphase/interFoam/UEqn.H @@ -1,5 +1,3 @@ - MRF.correctBoundaryVelocity(U); - fvVectorMatrix UEqn ( fvm::ddt(rho, U) + fvm::div(rhoPhi, U) diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/UEqn.H b/applications/solvers/multiphase/interFoam/interMixingFoam/UEqn.H index 984ac6f757..fb1fd9a51c 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/UEqn.H +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/UEqn.H @@ -1,5 +1,3 @@ - MRF.correctBoundaryVelocity(U); - fvVectorMatrix UEqn ( fvm::ddt(rho, U) + fvm::div(rhoPhi, U) diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C index 68e1574e0a..210180e6cf 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.C @@ -241,7 +241,6 @@ template void Foam::MovingPhaseModel::correct() { BasePhaseModel::correct(); - this->fluid().MRF().correctBoundaryVelocity(U_); } diff --git a/applications/solvers/multiphase/multiphaseInterFoam/UEqn.H b/applications/solvers/multiphase/multiphaseInterFoam/UEqn.H index 984ac6f757..fb1fd9a51c 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/UEqn.H +++ b/applications/solvers/multiphase/multiphaseInterFoam/UEqn.H @@ -1,5 +1,3 @@ - MRF.correctBoundaryVelocity(U); - fvVectorMatrix UEqn ( fvm::ddt(rho, U) + fvm::div(rhoPhi, U) diff --git a/applications/solvers/multiphase/potentialFreeSurfaceFoam/UEqn.H b/applications/solvers/multiphase/potentialFreeSurfaceFoam/UEqn.H index 2db0e87069..1234a78660 100644 --- a/applications/solvers/multiphase/potentialFreeSurfaceFoam/UEqn.H +++ b/applications/solvers/multiphase/potentialFreeSurfaceFoam/UEqn.H @@ -1,5 +1,3 @@ -MRF.correctBoundaryVelocity(U); - tmp tUEqn ( fvm::ddt(U) + fvm::div(phi, U) diff --git a/bin/SRFPimpleFoam b/bin/SRFPimpleFoam new file mode 100755 index 0000000000..8ce27ad309 --- /dev/null +++ b/bin/SRFPimpleFoam @@ -0,0 +1,61 @@ +#!/bin/sh +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | Website: https://openfoam.org +# \\ / A nd | Copyright (C) 2022 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 . +# +# Script +# SRFPimpleFoam +# +# Description +# Script to inform the user that SRFPimpleFoam has been superseded +# and replaced by the more general incompressibleFluid solver module +# executed by the foamRun application. +# +#------------------------------------------------------------------------------ + +cat <. +# +# Script +# SRFSimpleFoam +# +# Description +# Script to inform the user that SRFSimpleFoam has been superseded +# and replaced by the more general incompressibleFluid solver module +# executed by the foamRun application. +# +#------------------------------------------------------------------------------ + +cat <(pp)) { forAll(pp, i) { @@ -98,33 +91,15 @@ void Foam::MRFZone::setMRFFaces() if (zoneCell[own[facei]]) { - faceType[facei] = 2; - nZoneFaces++; - } - } - } - else if (!isA(pp)) - { - forAll(pp, i) - { - const label facei = pp.start() + i; - - if (zoneCell[own[facei]]) - { - faceType[facei] = 1; + faceInMRF[facei] = true; nZoneFaces++; } } } } - // Synchronise the faceType across processor patches - syncTools::syncFaceList(mesh_, faceType, maxEqOp