From fe5a991adeaa520ffa64169228beb04e101bacb6 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Wed, 18 Jan 2023 14:10:48 +0000 Subject: [PATCH] solvers::shockFluid: New solver module for density-based solution of compressible flow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit executed with foamRun for single region simulations of foamMultiRun for multi-region simulations. Replaces rhoCentralFoam and all the corresponding tutorials have been updated and moved to tutorials/modules/shockFluid. Unlike rhoCentralFoam shockFluid supports mesh refinement/unrefinement, topology change, run-time mesh-to-mesh mapping, load-balancing in addition to general mesh-motion. The tutorials/modules/shockFluid/movingCone case has been updated to demonstrate run-time mesh-to-mesh mapping mesh topology change based on the tutorials/modules/incompressibleFluid/movingCone. shockFluid s Description Solver module for density-based solution of compressible flow Based on central-upwind schemes of Kurganov and Tadmor with support for mesh-motion and topology change. Reference: \verbatim Greenshields, C. J., Weller, H. G., Gasparini, L., & Reese, J. M. (2010). Implementation of semi‐discrete, non‐staggered central schemes in a colocated, polyhedral, finite volume framework, for high‐speed viscous flows. International journal for numerical methods in fluids, 63(1), 1-21. \endverbatim SourceFiles shockFluid.C See also Foam::solvers::fluidSolver Foam::solvers::incompressibleFluid --- .../compressible/rhoCentralFoam/Make/files | 3 - .../rhoCentralFoam/createFieldRefs.H | 10 - .../rhoCentralFoam/createFields.H | 108 ------ .../rhoCentralFoam/directionInterpolate.H | 32 -- .../rhoCentralFoam/readFluxScheme.H | 16 - .../rhoCentralFoam/rhoCentralFoam.C | 295 ----------------- .../compressible/rhoCentralFoam/setRDeltaT.H | 29 -- .../solvers/modules/shockFluid/Make/files | 16 + .../shockFluid}/Make/options | 19 +- .../shockFluid/correctDensity.C} | 29 +- .../derivedFvPatchFields}/Make/files | 0 .../derivedFvPatchFields}/Make/options | 0 .../T/smoluchowskiJumpTFvPatchScalarField.C | 2 +- .../T/smoluchowskiJumpTFvPatchScalarField.H | 2 +- .../U/maxwellSlipUFvPatchVectorField.C | 2 +- .../U/maxwellSlipUFvPatchVectorField.H | 2 +- .../mixedFixedValueSlipFvPatchField.C | 2 +- .../mixedFixedValueSlipFvPatchField.H | 2 +- .../mixedFixedValueSlipFvPatchFields.C | 2 +- .../mixedFixedValueSlipFvPatchFields.H | 2 +- .../mixedFixedValueSlipFvPatchFieldsFwd.H | 2 +- .../rho/fixedRhoFvPatchScalarField.C | 2 +- .../rho/fixedRhoFvPatchScalarField.H | 2 +- .../modules/shockFluid/fluxPredictor.C | 130 ++++++++ .../modules/shockFluid/momentumPredictor.C | 81 +++++ .../shockFluid/moveMesh.C} | 41 +-- .../solvers/modules/shockFluid/prePredictor.C | 46 +++ .../modules/shockFluid/pressureCorrector.C | 39 +++ .../solvers/modules/shockFluid/setRDeltaT.C | 75 +++++ .../solvers/modules/shockFluid/shockFluid.C | 309 ++++++++++++++++++ .../solvers/modules/shockFluid/shockFluid.H | 269 +++++++++++++++ .../shockFluid/thermophysicalPredictor.C | 93 ++++++ bin/rhoCentralFoam | 46 +++ etc/config.sh/bash_completion | 25 -- .../modules/fluid/shockTube/Allclean | 8 +- tutorials/modules/fluid/shockTube/Allrun | 5 +- .../modules/fluid/shockTube/createGraphs | 49 +++ .../shockFluid}/LadenburgJet60psi/0.orig/T | 0 .../shockFluid}/LadenburgJet60psi/0.orig/U | 0 .../shockFluid}/LadenburgJet60psi/0.orig/p | 0 .../shockFluid}/LadenburgJet60psi/0/T | 0 .../shockFluid}/LadenburgJet60psi/0/U | 0 .../shockFluid}/LadenburgJet60psi/0/p | 0 .../shockFluid}/LadenburgJet60psi/README | 0 .../constant/momentumTransport | 0 .../constant/physicalProperties | 0 .../LadenburgJet60psi/system/blockMeshDict | 0 .../LadenburgJet60psi/system/controlDict | 4 +- .../LadenburgJet60psi/system/decomposeParDict | 0 .../LadenburgJet60psi/system/fvSchemes | 0 .../LadenburgJet60psi/system/fvSolution | 9 +- .../shockFluid}/biconic25-55Run35/0/T | 0 .../shockFluid}/biconic25-55Run35/0/U | 0 .../shockFluid}/biconic25-55Run35/0/p | 0 .../biconic25-55Run35/0/uniform/time | 30 ++ .../biconic25-55Run35/0/wallHeatFlux | Bin 0 -> 3272 bytes .../shockFluid}/biconic25-55Run35/Allclean | 0 .../shockFluid}/biconic25-55Run35/Allrun | 0 .../shockFluid}/biconic25-55Run35/README | 0 .../biconic25-55Run35/constant/grid256.dat | 0 .../constant/momentumTransport | 0 .../constant/physicalProperties | 0 .../shockFluid}/biconic25-55Run35/sampleCone | 0 .../biconic25-55Run35/system/blockMeshDict | 0 .../biconic25-55Run35/system/collapseDict | 0 .../biconic25-55Run35/system/controlDict | 12 +- .../biconic25-55Run35/system/fvSchemes | 0 .../biconic25-55Run35/system/fvSolution | 12 +- .../biconic25-55Run35/system/sample | 0 .../shockFluid}/forwardStep/0/T | 0 .../shockFluid}/forwardStep/0/U | 0 .../shockFluid}/forwardStep/0/p | 0 .../forwardStep/constant/momentumTransport | 0 .../forwardStep/constant/physicalProperties | 0 .../forwardStep/system/blockMeshDict | 0 .../forwardStep/system/controlDict | 4 +- .../shockFluid}/forwardStep/system/fvSchemes | 0 .../shockFluid/forwardStep}/system/fvSolution | 9 +- .../shockFluid}/movingCone/0/T | 12 +- .../shockFluid}/movingCone/0/U | 12 +- .../shockFluid}/movingCone/0/p | 12 +- .../shockFluid}/movingCone/0/pointMotionUx | 16 +- .../modules/shockFluid/movingCone/Allclean | 8 +- .../modules/shockFluid/movingCone/Allrun | 25 ++ .../shockFluid/movingCone/Allrun-parallel | 43 +++ tutorials/modules/shockFluid/movingCone/U | 52 +++ .../movingCone/constant/dynamicMeshDict | 12 + .../movingCone/constant/momentumTransport | 0 .../movingCone/constant/physicalProperties | 0 .../shockFluid/movingCone/pointMotionUx | 54 +++ .../movingCone/system/blockMeshDict | 9 +- .../movingCone/system/blockMeshDict_1e-05 | 139 ++++++++ .../movingCone/system/blockMeshDict_2e-05 | 139 ++++++++ .../shockFluid}/movingCone/system/controlDict | 4 +- .../movingCone/system/decomposeParDict | 42 +++ .../movingCone/system/decomposeParDict_1e-05 | 42 +++ .../movingCone/system/decomposeParDict_2e-05 | 42 +++ .../shockFluid}/movingCone/system/fvSchemes | 0 .../shockFluid}/movingCone/system/fvSolution | 4 +- .../shockFluid}/obliqueShock/0/T | 0 .../shockFluid}/obliqueShock/0/U | 0 .../shockFluid}/obliqueShock/0/p | 0 .../obliqueShock/constant/momentumTransport | 0 .../obliqueShock/constant/physicalProperties | 0 .../obliqueShock/system/blockMeshDict | 0 .../obliqueShock/system/controlDict | 4 +- .../shockFluid}/obliqueShock/system/fvSchemes | 0 .../obliqueShock}/system/fvSolution | 9 +- .../shockFluid}/shockTube/0/T.orig | 0 .../shockFluid}/shockTube/0/U.orig | 0 .../modules/shockFluid/shockTube/0/mag(U) | 35 ++ .../shockFluid}/shockTube/0/p.orig | 0 .../modules/shockFluid/shockTube/Allclean | 11 + .../shockFluid}/shockTube/Allrun | 1 + .../shockTube/constant/momentumTransport | 0 .../shockTube/constant/physicalProperties | 0 .../modules/shockFluid/shockTube/createGraphs | 49 +++ .../shockTube/system/blockMeshDict | 0 .../shockFluid}/shockTube/system/controlDict | 4 +- .../shockFluid}/shockTube/system/fvSchemes | 0 .../shockFluid/shockTube}/system/fvSolution | 9 +- .../shockFluid}/shockTube/system/sample | 0 .../shockTube/system/setFieldsDict | 0 .../shockFluid}/wedge15Ma5/0/T | 0 .../shockFluid}/wedge15Ma5/0/U | 0 .../shockFluid}/wedge15Ma5/0/p | 0 .../wedge15Ma5/constant/momentumTransport | 0 .../wedge15Ma5/constant/physicalProperties | 0 .../wedge15Ma5/system/blockMeshDict | 0 .../shockFluid}/wedge15Ma5/system/controlDict | 4 +- .../shockFluid}/wedge15Ma5/system/fvSchemes | 0 .../shockFluid/wedge15Ma5}/system/fvSolution | 9 +- 132 files changed, 2021 insertions(+), 656 deletions(-) delete mode 100644 applications/solvers/compressible/rhoCentralFoam/Make/files delete mode 100644 applications/solvers/compressible/rhoCentralFoam/createFieldRefs.H delete mode 100644 applications/solvers/compressible/rhoCentralFoam/createFields.H delete mode 100644 applications/solvers/compressible/rhoCentralFoam/directionInterpolate.H delete mode 100644 applications/solvers/compressible/rhoCentralFoam/readFluxScheme.H delete mode 100644 applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C delete mode 100644 applications/solvers/compressible/rhoCentralFoam/setRDeltaT.H create mode 100644 applications/solvers/modules/shockFluid/Make/files rename applications/solvers/{compressible/rhoCentralFoam => modules/shockFluid}/Make/options (81%) rename applications/solvers/{compressible/rhoCentralFoam/centralCourantNo.H => modules/shockFluid/correctDensity.C} (69%) rename applications/solvers/{compressible/rhoCentralFoam/BCs => modules/shockFluid/derivedFvPatchFields}/Make/files (100%) rename applications/solvers/{compressible/rhoCentralFoam/BCs => modules/shockFluid/derivedFvPatchFields}/Make/options (100%) rename applications/solvers/{compressible/rhoCentralFoam/BCs => modules/shockFluid/derivedFvPatchFields}/T/smoluchowskiJumpTFvPatchScalarField.C (99%) rename applications/solvers/{compressible/rhoCentralFoam/BCs => modules/shockFluid/derivedFvPatchFields}/T/smoluchowskiJumpTFvPatchScalarField.H (98%) rename applications/solvers/{compressible/rhoCentralFoam/BCs => modules/shockFluid/derivedFvPatchFields}/U/maxwellSlipUFvPatchVectorField.C (99%) rename applications/solvers/{compressible/rhoCentralFoam/BCs => modules/shockFluid/derivedFvPatchFields}/U/maxwellSlipUFvPatchVectorField.H (98%) rename applications/solvers/{compressible/rhoCentralFoam/BCs => modules/shockFluid/derivedFvPatchFields}/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.C (98%) rename applications/solvers/{compressible/rhoCentralFoam/BCs => modules/shockFluid/derivedFvPatchFields}/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.H (99%) rename applications/solvers/{compressible/rhoCentralFoam/BCs => modules/shockFluid/derivedFvPatchFields}/mixedFixedValueSlip/mixedFixedValueSlipFvPatchFields.C (96%) rename applications/solvers/{compressible/rhoCentralFoam/BCs => modules/shockFluid/derivedFvPatchFields}/mixedFixedValueSlip/mixedFixedValueSlipFvPatchFields.H (96%) rename applications/solvers/{compressible/rhoCentralFoam/BCs => modules/shockFluid/derivedFvPatchFields}/mixedFixedValueSlip/mixedFixedValueSlipFvPatchFieldsFwd.H (96%) rename applications/solvers/{compressible/rhoCentralFoam/BCs => modules/shockFluid/derivedFvPatchFields}/rho/fixedRhoFvPatchScalarField.C (98%) rename applications/solvers/{compressible/rhoCentralFoam/BCs => modules/shockFluid/derivedFvPatchFields}/rho/fixedRhoFvPatchScalarField.H (98%) create mode 100644 applications/solvers/modules/shockFluid/fluxPredictor.C create mode 100644 applications/solvers/modules/shockFluid/momentumPredictor.C rename applications/solvers/{compressible/rhoCentralFoam/setDeltaT.H => modules/shockFluid/moveMesh.C} (68%) create mode 100644 applications/solvers/modules/shockFluid/prePredictor.C create mode 100644 applications/solvers/modules/shockFluid/pressureCorrector.C create mode 100644 applications/solvers/modules/shockFluid/setRDeltaT.C create mode 100644 applications/solvers/modules/shockFluid/shockFluid.C create mode 100644 applications/solvers/modules/shockFluid/shockFluid.H create mode 100644 applications/solvers/modules/shockFluid/thermophysicalPredictor.C create mode 100755 bin/rhoCentralFoam rename applications/solvers/compressible/rhoCentralFoam/Allwclean => tutorials/modules/fluid/shockTube/Allclean (58%) create mode 100755 tutorials/modules/fluid/shockTube/createGraphs rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/LadenburgJet60psi/0.orig/T (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/LadenburgJet60psi/0.orig/U (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/LadenburgJet60psi/0.orig/p (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/LadenburgJet60psi/0/T (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/LadenburgJet60psi/0/U (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/LadenburgJet60psi/0/p (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/LadenburgJet60psi/README (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/LadenburgJet60psi/constant/momentumTransport (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/LadenburgJet60psi/constant/physicalProperties (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/LadenburgJet60psi/system/blockMeshDict (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/LadenburgJet60psi/system/controlDict (95%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/LadenburgJet60psi/system/decomposeParDict (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/LadenburgJet60psi/system/fvSchemes (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/LadenburgJet60psi/system/fvSolution (94%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/biconic25-55Run35/0/T (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/biconic25-55Run35/0/U (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/biconic25-55Run35/0/p (100%) create mode 100644 tutorials/modules/shockFluid/biconic25-55Run35/0/uniform/time create mode 100644 tutorials/modules/shockFluid/biconic25-55Run35/0/wallHeatFlux rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/biconic25-55Run35/Allclean (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/biconic25-55Run35/Allrun (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/biconic25-55Run35/README (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/biconic25-55Run35/constant/grid256.dat (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/biconic25-55Run35/constant/momentumTransport (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/biconic25-55Run35/constant/physicalProperties (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/biconic25-55Run35/sampleCone (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/biconic25-55Run35/system/blockMeshDict (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/biconic25-55Run35/system/collapseDict (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/biconic25-55Run35/system/controlDict (88%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/biconic25-55Run35/system/fvSchemes (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/biconic25-55Run35/system/fvSolution (89%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/biconic25-55Run35/system/sample (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/forwardStep/0/T (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/forwardStep/0/U (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/forwardStep/0/p (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/forwardStep/constant/momentumTransport (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/forwardStep/constant/physicalProperties (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/forwardStep/system/blockMeshDict (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/forwardStep/system/controlDict (95%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/forwardStep/system/fvSchemes (100%) rename tutorials/{compressible/rhoCentralFoam/obliqueShock => modules/shockFluid/forwardStep}/system/fvSolution (94%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/movingCone/0/T (91%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/movingCone/0/U (91%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/movingCone/0/p (91%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/movingCone/0/pointMotionUx (86%) rename applications/solvers/compressible/rhoCentralFoam/Allwmake => tutorials/modules/shockFluid/movingCone/Allclean (50%) create mode 100755 tutorials/modules/shockFluid/movingCone/Allrun create mode 100755 tutorials/modules/shockFluid/movingCone/Allrun-parallel create mode 100644 tutorials/modules/shockFluid/movingCone/U rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/movingCone/constant/dynamicMeshDict (87%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/movingCone/constant/momentumTransport (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/movingCone/constant/physicalProperties (100%) create mode 100644 tutorials/modules/shockFluid/movingCone/pointMotionUx rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/movingCone/system/blockMeshDict (93%) create mode 100644 tutorials/modules/shockFluid/movingCone/system/blockMeshDict_1e-05 create mode 100644 tutorials/modules/shockFluid/movingCone/system/blockMeshDict_2e-05 rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/movingCone/system/controlDict (95%) create mode 100644 tutorials/modules/shockFluid/movingCone/system/decomposeParDict create mode 100644 tutorials/modules/shockFluid/movingCone/system/decomposeParDict_1e-05 create mode 100644 tutorials/modules/shockFluid/movingCone/system/decomposeParDict_2e-05 rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/movingCone/system/fvSchemes (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/movingCone/system/fvSolution (97%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/obliqueShock/0/T (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/obliqueShock/0/U (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/obliqueShock/0/p (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/obliqueShock/constant/momentumTransport (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/obliqueShock/constant/physicalProperties (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/obliqueShock/system/blockMeshDict (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/obliqueShock/system/controlDict (95%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/obliqueShock/system/fvSchemes (100%) rename tutorials/{compressible/rhoCentralFoam/shockTube => modules/shockFluid/obliqueShock}/system/fvSolution (94%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/shockTube/0/T.orig (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/shockTube/0/U.orig (100%) create mode 100644 tutorials/modules/shockFluid/shockTube/0/mag(U) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/shockTube/0/p.orig (100%) create mode 100755 tutorials/modules/shockFluid/shockTube/Allclean rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/shockTube/Allrun (95%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/shockTube/constant/momentumTransport (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/shockTube/constant/physicalProperties (100%) create mode 100755 tutorials/modules/shockFluid/shockTube/createGraphs rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/shockTube/system/blockMeshDict (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/shockTube/system/controlDict (95%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/shockTube/system/fvSchemes (100%) rename tutorials/{compressible/rhoCentralFoam/wedge15Ma5 => modules/shockFluid/shockTube}/system/fvSolution (94%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/shockTube/system/sample (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/shockTube/system/setFieldsDict (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/wedge15Ma5/0/T (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/wedge15Ma5/0/U (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/wedge15Ma5/0/p (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/wedge15Ma5/constant/momentumTransport (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/wedge15Ma5/constant/physicalProperties (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/wedge15Ma5/system/blockMeshDict (100%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/wedge15Ma5/system/controlDict (95%) rename tutorials/{compressible/rhoCentralFoam => modules/shockFluid}/wedge15Ma5/system/fvSchemes (100%) rename tutorials/{compressible/rhoCentralFoam/forwardStep => modules/shockFluid/wedge15Ma5}/system/fvSolution (94%) diff --git a/applications/solvers/compressible/rhoCentralFoam/Make/files b/applications/solvers/compressible/rhoCentralFoam/Make/files deleted file mode 100644 index 7c0c3704ee..0000000000 --- a/applications/solvers/compressible/rhoCentralFoam/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -rhoCentralFoam.C - -EXE = $(FOAM_APPBIN)/rhoCentralFoam diff --git a/applications/solvers/compressible/rhoCentralFoam/createFieldRefs.H b/applications/solvers/compressible/rhoCentralFoam/createFieldRefs.H deleted file mode 100644 index 5522ccd6aa..0000000000 --- a/applications/solvers/compressible/rhoCentralFoam/createFieldRefs.H +++ /dev/null @@ -1,10 +0,0 @@ -volScalarField& p = thermo.p(); -const volScalarField& T = thermo.T(); -const volScalarField& psi = thermo.psi(); -const volScalarField& mu = thermo.mu(); - -bool inviscid(true); -if (max(mu.primitiveField()) > 0.0) -{ - inviscid = false; -} diff --git a/applications/solvers/compressible/rhoCentralFoam/createFields.H b/applications/solvers/compressible/rhoCentralFoam/createFields.H deleted file mode 100644 index b1a44f1e98..0000000000 --- a/applications/solvers/compressible/rhoCentralFoam/createFields.H +++ /dev/null @@ -1,108 +0,0 @@ -#include "createRDeltaT.H" - -Info<< "Reading thermophysical properties\n" << endl; - -autoPtr pThermo -( - psiThermo::New(mesh) -); -psiThermo& thermo = pThermo(); - -volScalarField& e = thermo.he(); - -Info<< "Reading field U\n" << endl; -volVectorField U -( - IOobject - ( - "U", - runTime.name(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh -); - -volScalarField rho -( - IOobject - ( - "rho", - runTime.name(), - mesh, - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - thermo.renameRho() -); - -volVectorField rhoU -( - IOobject - ( - "rhoU", - runTime.name(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - rho*U -); - -volScalarField rhoE -( - IOobject - ( - "rhoE", - runTime.name(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - rho*(e + 0.5*magSqr(U)) -); - -surfaceScalarField pos -( - IOobject - ( - "pos", - runTime.name(), - mesh - ), - mesh, - dimensionedScalar(dimless, 1.0) -); - -surfaceScalarField neg -( - IOobject - ( - "neg", - runTime.name(), - mesh - ), - mesh, - dimensionedScalar(dimless, -1.0) -); - -surfaceScalarField phi("phi", fvc::flux(rhoU)); - -Info<< "Creating turbulence model\n" << endl; -autoPtr turbulence -( - compressible::momentumTransportModel::New - ( - rho, - U, - phi, - thermo - ) -); - -Info<< "Creating thermophysical transport model\n" << endl; -autoPtr thermophysicalTransport -( - fluidThermoThermophysicalTransportModel::New(turbulence(), thermo) -); diff --git a/applications/solvers/compressible/rhoCentralFoam/directionInterpolate.H b/applications/solvers/compressible/rhoCentralFoam/directionInterpolate.H deleted file mode 100644 index 058258ba95..0000000000 --- a/applications/solvers/compressible/rhoCentralFoam/directionInterpolate.H +++ /dev/null @@ -1,32 +0,0 @@ -namespace Foam -{ - -//- Interpolate field vf according to direction dir -template -tmp> interpolate -( - const VolField& vf, - const surfaceScalarField& dir, - const word& reconFieldName = word::null -) -{ - tmp> tsf - ( - fvc::interpolate - ( - vf, - dir, - "reconstruct(" - + (reconFieldName != word::null ? reconFieldName : vf.name()) - + ')' - ) - ); - - SurfaceField& sf = tsf.ref(); - - sf.rename(vf.name() + '_' + dir.name()); - - return tsf; -} - -} diff --git a/applications/solvers/compressible/rhoCentralFoam/readFluxScheme.H b/applications/solvers/compressible/rhoCentralFoam/readFluxScheme.H deleted file mode 100644 index 4cba5629f7..0000000000 --- a/applications/solvers/compressible/rhoCentralFoam/readFluxScheme.H +++ /dev/null @@ -1,16 +0,0 @@ -word fluxScheme("Kurganov"); -if (mesh.schemes().dict().readIfPresent("fluxScheme", fluxScheme)) -{ - if ((fluxScheme == "Tadmor") || (fluxScheme == "Kurganov")) - { - Info<< "fluxScheme: " << fluxScheme << endl; - } - else - { - FatalErrorInFunction - << "fluxScheme: " << fluxScheme - << " is not a valid choice. " - << "Options are: Tadmor, Kurganov" - << abort(FatalError); - } -} diff --git a/applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C b/applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C deleted file mode 100644 index f531536a70..0000000000 --- a/applications/solvers/compressible/rhoCentralFoam/rhoCentralFoam.C +++ /dev/null @@ -1,295 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2023 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 - rhoCentralFoam - -Description - Density-based compressible flow solver based on central-upwind schemes of - Kurganov and Tadmor with support for mesh-motion and topology changes. - -\*---------------------------------------------------------------------------*/ - -#include "fvCFD.H" -#include "psiThermo.H" -#include "compressibleMomentumTransportModels.H" -#include "fluidThermoThermophysicalTransportModel.H" -#include "fixedRhoFvPatchScalarField.H" -#include "directionInterpolate.H" -#include "localEulerDdtScheme.H" -#include "fvcSmooth.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -int main(int argc, char *argv[]) -{ - #define NO_CONTROL - #include "postProcess.H" - - #include "setRootCaseLists.H" - #include "createTime.H" - #include "createMesh.H" - #include "createFields.H" - #include "createFieldRefs.H" - #include "createTimeControls.H" - - turbulence->validate(); - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - - #include "readFluxScheme.H" - - dimensionedScalar v_zero("v_zero", dimVolume/dimTime, 0.0); - - // Courant numbers used to adjust the time-step - scalar CoNum = 0.0; - - Info<< "\nStarting time loop\n" << endl; - - while (runTime.run()) - { - #include "readTimeControls.H" - - if (!LTS) - { - #include "setDeltaT.H" - - // Update the mesh for topology change, mesh to mesh mapping - mesh.update(); - - runTime++; - - // Move the mesh - mesh.move(); - } - - // --- Directed interpolation of primitive fields onto faces - - const surfaceScalarField rho_pos(interpolate(rho, pos)); - const surfaceScalarField rho_neg(interpolate(rho, neg)); - - const surfaceVectorField rhoU_pos(interpolate(rhoU, pos, U.name())); - const surfaceVectorField rhoU_neg(interpolate(rhoU, neg, U.name())); - - const surfaceVectorField U_pos("U_pos", rhoU_pos/rho_pos); - const surfaceVectorField U_neg("U_neg", rhoU_neg/rho_neg); - - const volScalarField rPsi("rPsi", 1.0/psi); - const surfaceScalarField rPsi_pos(interpolate(rPsi, pos, T.name())); - const surfaceScalarField rPsi_neg(interpolate(rPsi, neg, T.name())); - - const surfaceScalarField p_pos("p_pos", rho_pos*rPsi_pos); - const surfaceScalarField p_neg("p_neg", rho_neg*rPsi_neg); - - surfaceScalarField phiv_pos("phiv_pos", U_pos & mesh.Sf()); - surfaceScalarField phiv_neg("phiv_neg", U_neg & mesh.Sf()); - - // Make fluxes relative to mesh-motion - if (mesh.moving()) - { - phiv_pos -= mesh.phi(); - phiv_neg -= mesh.phi(); - } - - const volScalarField c("c", sqrt(thermo.Cp()/thermo.Cv()*rPsi)); - const surfaceScalarField cSf_pos - ( - "cSf_pos", - interpolate(c, pos, T.name())*mesh.magSf() - ); - const surfaceScalarField cSf_neg - ( - "cSf_neg", - interpolate(c, neg, T.name())*mesh.magSf() - ); - - const surfaceScalarField ap - ( - "ap", - max(max(phiv_pos + cSf_pos, phiv_neg + cSf_neg), v_zero) - ); - const surfaceScalarField am - ( - "am", - min(min(phiv_pos - cSf_pos, phiv_neg - cSf_neg), v_zero) - ); - - const surfaceScalarField a_pos - ( - "a_pos", - fluxScheme == "Tadmor" - ? surfaceScalarField::New("a_pos", mesh, 0.5) - : ap/(ap - am) - ); - - const surfaceScalarField a_neg("a_neg", 1.0 - a_pos); - - phiv_pos *= a_pos; - phiv_neg *= a_neg; - - const surfaceScalarField aSf - ( - "aSf", - fluxScheme == "Tadmor" - ? -0.5*max(mag(am), mag(ap)) - : am*a_pos - ); - - const surfaceScalarField aphiv_pos("aphiv_pos", phiv_pos - aSf); - const surfaceScalarField aphiv_neg("aphiv_neg", phiv_neg + aSf); - - { - const surfaceScalarField amaxSf - ( - max(mag(aphiv_pos), mag(aphiv_neg)) - ); - - #include "centralCourantNo.H" - - if (LTS) - { - #include "setRDeltaT.H" - runTime++; - } - } - - Info<< "Time = " << runTime.userTimeName() << nl << endl; - - phi = aphiv_pos*rho_pos + aphiv_neg*rho_neg; - - // --- Solve density - solve(fvm::ddt(rho) + fvc::div(phi)); - - turbulence->predict(); - thermophysicalTransport->predict(); - - const volScalarField muEff("muEff", rho*turbulence->nuEff()); - const volTensorField tauMC("tauMC", muEff*dev2(Foam::T(fvc::grad(U)))); - - // --- Solve momentum - { - const surfaceVectorField phiUp - ( - (aphiv_pos*rhoU_pos + aphiv_neg*rhoU_neg) - + (a_pos*p_pos + a_neg*p_neg)*mesh.Sf() - ); - - solve(fvm::ddt(rhoU) + fvc::div(phiUp)); - - U.ref() = - rhoU() - /rho(); - U.correctBoundaryConditions(); - rhoU.boundaryFieldRef() == rho.boundaryField()*U.boundaryField(); - - if (!inviscid) - { - solve - ( - fvm::ddt(rho, U) - fvc::ddt(rho, U) - - fvm::laplacian(muEff, U) - - fvc::div(tauMC) - ); - rhoU = rho*U; - } - } - - // --- Solve energy - { - const surfaceScalarField e_pos(interpolate(e, pos, T.name())); - const surfaceScalarField e_neg(interpolate(e, neg, T.name())); - - surfaceScalarField phiEp - ( - "phiEp", - aphiv_pos*(rho_pos*(e_pos + 0.5*magSqr(U_pos)) + p_pos) - + aphiv_neg*(rho_neg*(e_neg + 0.5*magSqr(U_neg)) + p_neg) - + aSf*p_pos - aSf*p_neg - ); - - // Make flux for pressure-work absolute - if (mesh.moving()) - { - phiEp += mesh.phi()*(a_pos*p_pos + a_neg*p_neg); - } - - solve - ( - fvm::ddt(rhoE) - + fvc::div(phiEp) - ); - - e = rhoE/rho - 0.5*magSqr(U); - e.correctBoundaryConditions(); - thermo.correct(); - rhoE.boundaryFieldRef() == - rho.boundaryField()* - ( - e.boundaryField() + 0.5*magSqr(U.boundaryField()) - ); - - if (!inviscid) - { - const surfaceScalarField sigmaDotU - ( - "sigmaDotU", - ( - fvc::interpolate(muEff)*mesh.magSf()*fvc::snGrad(U) - + fvc::dotInterpolate(mesh.Sf(), tauMC) - ) - & (a_pos*U_pos + a_neg*U_neg) - ); - - solve - ( - fvm::ddt(rho, e) - fvc::ddt(rho, e) - + thermophysicalTransport->divq(e) - - fvc::div(sigmaDotU) - ); - thermo.correct(); - rhoE = rho*(e + 0.5*magSqr(U)); - } - } - - { - p.ref() = rho()/psi(); - p.correctBoundaryConditions(); - rho.boundaryFieldRef() == psi.boundaryField()*p.boundaryField(); - } - - turbulence->correct(); - thermophysicalTransport->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/compressible/rhoCentralFoam/setRDeltaT.H b/applications/solvers/compressible/rhoCentralFoam/setRDeltaT.H deleted file mode 100644 index b126cb82a0..0000000000 --- a/applications/solvers/compressible/rhoCentralFoam/setRDeltaT.H +++ /dev/null @@ -1,29 +0,0 @@ -{ - volScalarField& rDeltaT = trDeltaT.ref(); - - scalar rDeltaTSmoothingCoeff - ( - runTime.controlDict().lookupOrDefault - ( - "rDeltaTSmoothingCoeff", - 0.02 - ) - ); - - // Set the reciprocal time-step from the local Courant number - rDeltaT.ref() = max - ( - 1/dimensionedScalar(dimTime, maxDeltaT), - fvc::surfaceSum(amaxSf)()() - /((2*maxCo)*mesh.V()) - ); - - // Update the boundary values of the reciprocal time-step - rDeltaT.correctBoundaryConditions(); - - fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff); - - Info<< "Flow time scale min/max = " - << gMin(1/rDeltaT.primitiveField()) - << ", " << gMax(1/rDeltaT.primitiveField()) << endl; -} diff --git a/applications/solvers/modules/shockFluid/Make/files b/applications/solvers/modules/shockFluid/Make/files new file mode 100644 index 0000000000..ab60cc9c60 --- /dev/null +++ b/applications/solvers/modules/shockFluid/Make/files @@ -0,0 +1,16 @@ +setRDeltaT.C +moveMesh.C +prePredictor.C +fluxPredictor.C +correctDensity.C +momentumPredictor.C +thermophysicalPredictor.C +pressureCorrector.C +shockFluid.C + +derivedFvPatchFields/mixedFixedValueSlip/mixedFixedValueSlipFvPatchFields.C +derivedFvPatchFields/U/maxwellSlipUFvPatchVectorField.C +derivedFvPatchFields/T/smoluchowskiJumpTFvPatchScalarField.C +derivedFvPatchFields/rho/fixedRhoFvPatchScalarField.C + +LIB = $(FOAM_LIBBIN)/libshockFluid diff --git a/applications/solvers/compressible/rhoCentralFoam/Make/options b/applications/solvers/modules/shockFluid/Make/options similarity index 81% rename from applications/solvers/compressible/rhoCentralFoam/Make/options rename to applications/solvers/modules/shockFluid/Make/options index f7b1cf9d1e..abed2f88fb 100644 --- a/applications/solvers/compressible/rhoCentralFoam/Make/options +++ b/applications/solvers/modules/shockFluid/Make/options @@ -1,24 +1,23 @@ EXE_INC = \ - -IBCs/lnInclude \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(FOAM_SOLVERS)/modules/fluidSolver/lnInclude \ -I$(LIB_SRC)/physicalProperties/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \ -I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \ -I$(LIB_SRC)/ThermophysicalTransportModels/thermophysicalTransportModel/lnInclude \ -I$(LIB_SRC)/ThermophysicalTransportModels/fluid/lnInclude \ -I$(LIB_SRC)/ThermophysicalTransportModels/fluidThermo/lnInclude \ + -I$(LIB_SRC)/finiteVolume/cfdTools \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude -EXE_LIBS = \ - -lfiniteVolume \ - -lfvModels \ - -lfvConstraints \ +LIB_LIBS = \ + -lfluidSolver \ -lfluidThermophysicalModels \ - -lspecie \ - -lrhoCentralFoam \ -lmomentumTransportModels \ -lcompressibleMomentumTransportModels \ -lcoupledThermophysicalTransportModels \ - -lmeshTools + -lfiniteVolume \ + -lmeshTools \ + -lfvModels \ + -lfvConstraints diff --git a/applications/solvers/compressible/rhoCentralFoam/centralCourantNo.H b/applications/solvers/modules/shockFluid/correctDensity.C similarity index 69% rename from applications/solvers/compressible/rhoCentralFoam/centralCourantNo.H rename to applications/solvers/modules/shockFluid/correctDensity.C index 64973905e6..3862cf654e 100644 --- a/applications/solvers/compressible/rhoCentralFoam/centralCourantNo.H +++ b/applications/solvers/modules/shockFluid/correctDensity.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -21,24 +21,27 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -Global - centralCourantNo - -Description - Calculates the mean and maximum wave speed based Courant Numbers. - \*---------------------------------------------------------------------------*/ +#include "shockFluid.H" + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::solvers::shockFluid::correctDensity() { - const scalarField sumAmaxSf(fvc::surfaceSum(amaxSf)().primitiveField()); + fvScalarMatrix rhoEqn + ( + fvm::ddt(rho) + fvc::div(phi) + == + fvModels().source(rho) + ); - CoNum = 0.5*gMax(sumAmaxSf/mesh.V().field())*runTime.deltaTValue(); + fvConstraints().constrain(rhoEqn); - scalar meanCoNum = - 0.5*(gSum(sumAmaxSf)/gSum(mesh.V().field()))*runTime.deltaTValue(); + rhoEqn.solve(); - Info<< "Mean and max Courant Numbers = " - << meanCoNum << " " << CoNum << endl; + fvConstraints().constrain(rho); } + // ************************************************************************* // diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/Make/files b/applications/solvers/modules/shockFluid/derivedFvPatchFields/Make/files similarity index 100% rename from applications/solvers/compressible/rhoCentralFoam/BCs/Make/files rename to applications/solvers/modules/shockFluid/derivedFvPatchFields/Make/files diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/Make/options b/applications/solvers/modules/shockFluid/derivedFvPatchFields/Make/options similarity index 100% rename from applications/solvers/compressible/rhoCentralFoam/BCs/Make/options rename to applications/solvers/modules/shockFluid/derivedFvPatchFields/Make/options diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C b/applications/solvers/modules/shockFluid/derivedFvPatchFields/T/smoluchowskiJumpTFvPatchScalarField.C similarity index 99% rename from applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C rename to applications/solvers/modules/shockFluid/derivedFvPatchFields/T/smoluchowskiJumpTFvPatchScalarField.C index 84dba6d080..32f506e703 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C +++ b/applications/solvers/modules/shockFluid/derivedFvPatchFields/T/smoluchowskiJumpTFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.H b/applications/solvers/modules/shockFluid/derivedFvPatchFields/T/smoluchowskiJumpTFvPatchScalarField.H similarity index 98% rename from applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.H rename to applications/solvers/modules/shockFluid/derivedFvPatchFields/T/smoluchowskiJumpTFvPatchScalarField.H index c866d92412..30bf9f946e 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.H +++ b/applications/solvers/modules/shockFluid/derivedFvPatchFields/T/smoluchowskiJumpTFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C b/applications/solvers/modules/shockFluid/derivedFvPatchFields/U/maxwellSlipUFvPatchVectorField.C similarity index 99% rename from applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C rename to applications/solvers/modules/shockFluid/derivedFvPatchFields/U/maxwellSlipUFvPatchVectorField.C index 9215cb78e3..60dbaa21cc 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C +++ b/applications/solvers/modules/shockFluid/derivedFvPatchFields/U/maxwellSlipUFvPatchVectorField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.H b/applications/solvers/modules/shockFluid/derivedFvPatchFields/U/maxwellSlipUFvPatchVectorField.H similarity index 98% rename from applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.H rename to applications/solvers/modules/shockFluid/derivedFvPatchFields/U/maxwellSlipUFvPatchVectorField.H index 8adc3c2ac8..61a88ec642 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.H +++ b/applications/solvers/modules/shockFluid/derivedFvPatchFields/U/maxwellSlipUFvPatchVectorField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.C b/applications/solvers/modules/shockFluid/derivedFvPatchFields/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.C similarity index 98% rename from applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.C rename to applications/solvers/modules/shockFluid/derivedFvPatchFields/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.C index ed425e357d..825c640f2f 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.C +++ b/applications/solvers/modules/shockFluid/derivedFvPatchFields/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.H b/applications/solvers/modules/shockFluid/derivedFvPatchFields/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.H similarity index 99% rename from applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.H rename to applications/solvers/modules/shockFluid/derivedFvPatchFields/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.H index b3c98733e9..aa4646761f 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.H +++ b/applications/solvers/modules/shockFluid/derivedFvPatchFields/mixedFixedValueSlip/mixedFixedValueSlipFvPatchField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchFields.C b/applications/solvers/modules/shockFluid/derivedFvPatchFields/mixedFixedValueSlip/mixedFixedValueSlipFvPatchFields.C similarity index 96% rename from applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchFields.C rename to applications/solvers/modules/shockFluid/derivedFvPatchFields/mixedFixedValueSlip/mixedFixedValueSlipFvPatchFields.C index 9ba51165bc..dd77350f8f 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchFields.C +++ b/applications/solvers/modules/shockFluid/derivedFvPatchFields/mixedFixedValueSlip/mixedFixedValueSlipFvPatchFields.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-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchFields.H b/applications/solvers/modules/shockFluid/derivedFvPatchFields/mixedFixedValueSlip/mixedFixedValueSlipFvPatchFields.H similarity index 96% rename from applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchFields.H rename to applications/solvers/modules/shockFluid/derivedFvPatchFields/mixedFixedValueSlip/mixedFixedValueSlipFvPatchFields.H index 022da6e257..3426e3a5bb 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchFields.H +++ b/applications/solvers/modules/shockFluid/derivedFvPatchFields/mixedFixedValueSlip/mixedFixedValueSlipFvPatchFields.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-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchFieldsFwd.H b/applications/solvers/modules/shockFluid/derivedFvPatchFields/mixedFixedValueSlip/mixedFixedValueSlipFvPatchFieldsFwd.H similarity index 96% rename from applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchFieldsFwd.H rename to applications/solvers/modules/shockFluid/derivedFvPatchFields/mixedFixedValueSlip/mixedFixedValueSlipFvPatchFieldsFwd.H index c3e8e547cf..433e7c1a89 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip/mixedFixedValueSlipFvPatchFieldsFwd.H +++ b/applications/solvers/modules/shockFluid/derivedFvPatchFields/mixedFixedValueSlip/mixedFixedValueSlipFvPatchFieldsFwd.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-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/rho/fixedRhoFvPatchScalarField.C b/applications/solvers/modules/shockFluid/derivedFvPatchFields/rho/fixedRhoFvPatchScalarField.C similarity index 98% rename from applications/solvers/compressible/rhoCentralFoam/BCs/rho/fixedRhoFvPatchScalarField.C rename to applications/solvers/modules/shockFluid/derivedFvPatchFields/rho/fixedRhoFvPatchScalarField.C index 626520f093..0cba45e24b 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/rho/fixedRhoFvPatchScalarField.C +++ b/applications/solvers/modules/shockFluid/derivedFvPatchFields/rho/fixedRhoFvPatchScalarField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/rho/fixedRhoFvPatchScalarField.H b/applications/solvers/modules/shockFluid/derivedFvPatchFields/rho/fixedRhoFvPatchScalarField.H similarity index 98% rename from applications/solvers/compressible/rhoCentralFoam/BCs/rho/fixedRhoFvPatchScalarField.H rename to applications/solvers/modules/shockFluid/derivedFvPatchFields/rho/fixedRhoFvPatchScalarField.H index ab74d62202..3451375a0a 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/rho/fixedRhoFvPatchScalarField.H +++ b/applications/solvers/modules/shockFluid/derivedFvPatchFields/rho/fixedRhoFvPatchScalarField.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/applications/solvers/modules/shockFluid/fluxPredictor.C b/applications/solvers/modules/shockFluid/fluxPredictor.C new file mode 100644 index 0000000000..bdf95b9424 --- /dev/null +++ b/applications/solvers/modules/shockFluid/fluxPredictor.C @@ -0,0 +1,130 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 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 "shockFluid.H" + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::solvers::shockFluid::fluxPredictor() +{ + if (!pos.valid()) + { + pos = surfaceScalarField::New + ( + "pos", + mesh, + dimensionedScalar(dimless, 1) + ); + + neg = surfaceScalarField::New + ( + "neg", + mesh, + dimensionedScalar(dimless, -1.0) + ); + } + + rho_pos = interpolate(rho, pos()); + rho_neg = interpolate(rho, neg()); + + rhoU_pos = interpolate(rhoU, pos(), U.name()); + rhoU_neg = interpolate(rhoU, neg(), U.name()); + + U_pos = surfaceVectorField::New("U_pos", rhoU_pos()/rho_pos()); + U_neg = surfaceVectorField::New("U_neg", rhoU_neg()/rho_neg()); + + const volScalarField& T = thermo.T(); + + const volScalarField rPsi("rPsi", 1.0/thermo.psi()); + const surfaceScalarField rPsi_pos(interpolate(rPsi, pos(), T.name())); + const surfaceScalarField rPsi_neg(interpolate(rPsi, neg(), T.name())); + + p_pos = surfaceScalarField::New("p_pos", rho_pos()*rPsi_pos); + p_neg = surfaceScalarField::New("p_neg", rho_neg()*rPsi_neg); + + surfaceScalarField phiv_pos("phiv_pos", U_pos() & mesh.Sf()); + surfaceScalarField phiv_neg("phiv_neg", U_neg() & mesh.Sf()); + + // Make fluxes relative to mesh-motion + if (mesh.moving()) + { + phiv_pos -= mesh.phi(); + phiv_neg -= mesh.phi(); + } + + const volScalarField c("c", sqrt(thermo.Cp()/thermo.Cv()*rPsi)); + const surfaceScalarField cSf_pos + ( + "cSf_pos", + interpolate(c, pos(), T.name())*mesh.magSf() + ); + const surfaceScalarField cSf_neg + ( + "cSf_neg", + interpolate(c, neg(), T.name())*mesh.magSf() + ); + + const dimensionedScalar v_zero("v_zero", dimVolume/dimTime, 0); + + const surfaceScalarField ap + ( + "ap", + max(max(phiv_pos + cSf_pos, phiv_neg + cSf_neg), v_zero) + ); + const surfaceScalarField am + ( + "am", + min(min(phiv_pos - cSf_pos, phiv_neg - cSf_neg), v_zero) + ); + + a_pos = surfaceScalarField::New + ( + "a_pos", + fluxScheme == "Tadmor" + ? surfaceScalarField::New("a_pos", mesh, 0.5) + : ap/(ap - am) + ); + + a_neg = surfaceScalarField::New("a_neg", 1.0 - a_pos()); + + phiv_pos *= a_pos(); + phiv_neg *= a_neg(); + + aSf = surfaceScalarField::New + ( + "aSf", + fluxScheme == "Tadmor" + ? -0.5*max(mag(am), mag(ap)) + : am*a_pos() + ); + + aphiv_pos = surfaceScalarField::New("aphiv_pos", phiv_pos - aSf()); + aphiv_neg = surfaceScalarField::New("aphiv_neg", phiv_neg + aSf()); + + phi = aphiv_pos()*rho_pos() + aphiv_neg()*rho_neg(); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/shockFluid/momentumPredictor.C b/applications/solvers/modules/shockFluid/momentumPredictor.C new file mode 100644 index 0000000000..4b5c920947 --- /dev/null +++ b/applications/solvers/modules/shockFluid/momentumPredictor.C @@ -0,0 +1,81 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 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 "shockFluid.H" +#include "fvmDdt.H" +#include "fvmDiv.H" +#include "fvcDdt.H" + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::solvers::shockFluid::momentumPredictor() +{ + if (!inviscid) + { + muEff.clear(); + tauMC.clear(); + + muEff = volScalarField::New("muEff", rho*momentumTransport->nuEff()); + tauMC = new volTensorField + ( + "tauMC", + muEff()*dev2(Foam::T(fvc::grad(U))) + ); + } + + const surfaceVectorField phiUp + ( + (aphiv_pos()*rhoU_pos() + aphiv_neg()*rhoU_neg()) + + (a_pos()*p_pos() + a_neg()*p_neg())*mesh.Sf() + ); + + solve(fvm::ddt(rhoU) + fvc::div(phiUp)); + + U.ref() = rhoU()/rho(); + U.correctBoundaryConditions(); + + if (!inviscid) + { + solve + ( + fvm::ddt(rho, U) - fvc::ddt(rho, U) + - fvm::laplacian(muEff(), U) + - fvc::div(tauMC()) + == + fvModels().source(rho, U) + ); + + rhoU == rho*U; + } + else + { + rhoU.boundaryFieldRef() == rho.boundaryField()*U.boundaryField(); + } + + fvConstraints().constrain(U); +} + + +// ************************************************************************* // diff --git a/applications/solvers/compressible/rhoCentralFoam/setDeltaT.H b/applications/solvers/modules/shockFluid/moveMesh.C similarity index 68% rename from applications/solvers/compressible/rhoCentralFoam/setDeltaT.H rename to applications/solvers/modules/shockFluid/moveMesh.C index 1f5fd4221a..54ffb27f45 100644 --- a/applications/solvers/compressible/rhoCentralFoam/setDeltaT.H +++ b/applications/solvers/modules/shockFluid/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-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -21,30 +21,33 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . -Global - setDeltaT - -Description - Reset the timestep to maintain a constant maximum courant Number. - Reduction of time-step is immediate, but increase is damped to avoid - unstable oscillations. - \*---------------------------------------------------------------------------*/ -if (adjustTimeStep) -{ - scalar deltaT = 1.2*runTime.deltaTValue(); +#include "shockFluid.H" - if (CoNum > small) +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +bool Foam::solvers::shockFluid::moveMesh() +{ + if (pimple.firstIter() || pimple.moveMeshOuterCorrectors()) { - deltaT = min(deltaT, maxCo/CoNum*runTime.deltaTValue()); + // Move the mesh + mesh.move(); + + if (mesh.changing()) + { + if (mesh.topoChanged()) + { + } + + meshCourantNo(); + + return true; + } } - deltaT = min(deltaT, maxDeltaT); - - runTime.setDeltaT(deltaT); - - Info<< "deltaT = " << runTime.deltaTValue() << endl; + return false; } + // ************************************************************************* // diff --git a/applications/solvers/modules/shockFluid/prePredictor.C b/applications/solvers/modules/shockFluid/prePredictor.C new file mode 100644 index 0000000000..764b09dd21 --- /dev/null +++ b/applications/solvers/modules/shockFluid/prePredictor.C @@ -0,0 +1,46 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 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 "shockFluid.H" + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::solvers::shockFluid::prePredictor() +{ + fluxPredictor(); + + correctDensity(); + + fvModels().correct(); + + if (!inviscid && pimple.predictTransport()) + { + momentumTransport->predict(); + thermophysicalTransport->predict(); + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/shockFluid/pressureCorrector.C b/applications/solvers/modules/shockFluid/pressureCorrector.C new file mode 100644 index 0000000000..397e8805f5 --- /dev/null +++ b/applications/solvers/modules/shockFluid/pressureCorrector.C @@ -0,0 +1,39 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 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 "shockFluid.H" + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::solvers::shockFluid::pressureCorrector() +{ + const volScalarField& psi = thermo.psi(); + p.ref() = rho()/psi(); + p.correctBoundaryConditions(); + rho.boundaryFieldRef() == psi.boundaryField()*p.boundaryField(); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/shockFluid/setRDeltaT.C b/applications/solvers/modules/shockFluid/setRDeltaT.C new file mode 100644 index 0000000000..5e1902f807 --- /dev/null +++ b/applications/solvers/modules/shockFluid/setRDeltaT.C @@ -0,0 +1,75 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 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 "shockFluid.H" +#include "fvcSmooth.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::solvers::shockFluid::setRDeltaT(const surfaceScalarField& amaxSf) +{ + volScalarField& rDeltaT = trDeltaT.ref(); + + const dictionary& pimpleDict = pimple.dict(); + + const scalar maxCo + ( + pimpleDict.lookupOrDefault("maxCo", 0.8) + ); + + const scalar rDeltaTSmoothingCoeff + ( + pimpleDict.lookupOrDefault + ( + "rDeltaTSmoothingCoeff", + 0.02 + ) + ); + + const scalar maxDeltaT + ( + pimpleDict.lookupOrDefault("maxDeltaT", great) + ); + + // Set the reciprocal time-step from the local Courant number + rDeltaT.ref() = max + ( + 1/dimensionedScalar(dimTime, maxDeltaT), + fvc::surfaceSum(amaxSf)()() + /((2*maxCo)*mesh.V()) + ); + + // Update the boundary values of the reciprocal time-step + rDeltaT.correctBoundaryConditions(); + + fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff); + + Info<< "Flow time scale min/max = " + << gMin(1/rDeltaT.primitiveField()) + << ", " << gMax(1/rDeltaT.primitiveField()) << endl; +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/shockFluid/shockFluid.C b/applications/solvers/modules/shockFluid/shockFluid.C new file mode 100644 index 0000000000..1eae1bd1b5 --- /dev/null +++ b/applications/solvers/modules/shockFluid/shockFluid.C @@ -0,0 +1,309 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 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 "shockFluid.H" +#include "localEulerDdtScheme.H" +#include "hydrostaticInitialisation.H" +#include "fvcMeshPhi.H" +#include "fvcVolumeIntegrate.H" +#include "fvcReconstruct.H" +#include "fvcSnGrad.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solvers +{ + defineTypeNameAndDebug(shockFluid, 0); + addToRunTimeSelectionTable(solver, shockFluid, fvMesh); +} +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::solvers::shockFluid::correctCoNum(const surfaceScalarField& amaxSf) +{ + const scalarField sumAmaxSf(fvc::surfaceSum(amaxSf)().primitiveField()); + + CoNum = 0.5*gMax(sumAmaxSf/mesh.V().field())*runTime.deltaTValue(); + + const scalar meanCoNum = + 0.5*(gSum(sumAmaxSf)/gSum(mesh.V().field()))*runTime.deltaTValue(); + + Info<< "Courant Number mean: " << meanCoNum + << " max: " << CoNum << endl; +} + + +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // + +void Foam::solvers::shockFluid::clearTemporaryFields() +{ + rho_pos.clear(); + rho_neg.clear(); + + rhoU_pos.clear(); + rhoU_neg.clear(); + + U_pos.clear(); + U_neg.clear(); + + p_pos.clear(); + p_neg.clear(); + + a_pos.clear(); + a_neg.clear(); + + aSf.clear(); + + aphiv_pos.clear(); + aphiv_neg.clear(); + + muEff.clear(); + tauMC.clear(); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::solvers::shockFluid::shockFluid(fvMesh& mesh) +: + fluidSolver(mesh), + + thermo_(psiThermo::New(mesh)), + + thermo(thermo_()), + + p(thermo.p()), + + rho + ( + IOobject + ( + "rho", + runTime.name(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + thermo.renameRho() + ), + + U + ( + IOobject + ( + "U", + runTime.name(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ), + + rhoU + ( + IOobject + ( + "rhoU", + runTime.name(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + rho*U + ), + + rhoE + ( + IOobject + ( + "rhoE", + runTime.name(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + rho*(thermo.he() + 0.5*magSqr(U)) + ), + + phi + ( + IOobject + ( + "phi", + runTime.name(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + linearInterpolate(rho*U) & mesh.Sf() + ), + + inviscid + ( + max(thermo.mu()().primitiveField()) > 0 + ? false + : true + ), + + momentumTransport + ( + inviscid + ? autoPtr(nullptr) + : compressible::momentumTransportModel::New + ( + rho, + U, + phi, + thermo + ) + ), + + thermophysicalTransport + ( + inviscid + ? autoPtr(nullptr) + : fluidThermoThermophysicalTransportModel::New + ( + momentumTransport(), + thermo + ) + ), + + fluxScheme + ( + mesh.schemes().dict().lookupOrDefault("fluxScheme", "Kurganov") + ) +{ + // Read the controls + read(); + + thermo.validate(type(), "e"); + + if (momentumTransport.valid()) + { + momentumTransport->validate(); + } + + fluxPredictor(); + + if (transient()) + { + const surfaceScalarField amaxSf + ( + max(mag(aphiv_pos()), mag(aphiv_neg())) + ); + + correctCoNum(amaxSf); + } + else if (LTS) + { + Info<< "Using LTS" << endl; + + trDeltaT = tmp + ( + new volScalarField + ( + IOobject + ( + fv::localEulerDdt::rDeltaTName, + runTime.name(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedScalar(dimless/dimTime, 1), + extrapolatedCalculatedFvPatchScalarField::typeName + ) + ); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::solvers::shockFluid::~shockFluid() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::solvers::shockFluid::preSolve() +{ + // Read the controls + read(); + + { + const surfaceScalarField amaxSf + ( + max(mag(aphiv_pos()), mag(aphiv_neg())) + ); + + if (transient()) + { + correctCoNum(amaxSf); + } + else if (LTS) + { + setRDeltaT(amaxSf); + } + } + + fvModels().preUpdateMesh(); + + if (mesh.topoChanging()) + { + pos.clear(); + neg.clear(); + + clearTemporaryFields(); + } + + // Update the mesh for topology change, mesh to mesh mapping + mesh.update(); +} + + +void Foam::solvers::shockFluid::postCorrector() +{ + if (!inviscid && pimple.correctTransport()) + { + momentumTransport->correct(); + thermophysicalTransport->correct(); + } +} + + +void Foam::solvers::shockFluid::postSolve() +{} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/shockFluid/shockFluid.H b/applications/solvers/modules/shockFluid/shockFluid.H new file mode 100644 index 0000000000..42331c8395 --- /dev/null +++ b/applications/solvers/modules/shockFluid/shockFluid.H @@ -0,0 +1,269 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 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::solvers::shockFluid + +Description + Solver module for density-based solution of compressible flow + + Based on central-upwind schemes of Kurganov and Tadmor with support for + mesh-motion and topology change. + + Reference: + \verbatim + Greenshields, C. J., Weller, H. G., Gasparini, L., + & Reese, J. M. (2010). + Implementation of semi‐discrete, non‐staggered central schemes + in a colocated, polyhedral, finite volume framework, + for high‐speed viscous flows. + International journal for numerical methods in fluids, 63(1), 1-21. + \endverbatim + +SourceFiles + shockFluid.C + +See also + Foam::solvers::fluidSolver + Foam::solvers::incompressibleFluid + +\*---------------------------------------------------------------------------*/ + +#ifndef shockFluid_H +#define shockFluid_H + +#include "fluidSolver.H" +#include "psiThermo.H" +#include "compressibleMomentumTransportModels.H" +#include "fluidThermoThermophysicalTransportModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solvers +{ + +/*---------------------------------------------------------------------------*\ + Class shockFluid Declaration +\*---------------------------------------------------------------------------*/ + +class shockFluid +: + public fluidSolver +{ + +protected: + + // Thermophysical properties + + //- Pointer to the fluid thermophysical properties + autoPtr thermo_; + + //- Reference to the fluid thermophysical properties + psiThermo& thermo; + + //- Reference to the pressure field + volScalarField& p; + + //- The continuity density field + volScalarField rho; + + //- Velocity field + volVectorField U; + + //- The momentum field + volVectorField rhoU; + + //- The energy field + volScalarField rhoE; + + + // Kinematic properties + + //- Mass-flux field + surfaceScalarField phi; + + + // Momentum transport + + bool inviscid; + + //- Pointer to the momentum transport model + autoPtr momentumTransport; + + + // Thermophysical transport + + autoPtr + thermophysicalTransport; + + + // Controls + + word fluxScheme; + + + // Cached temporary fields + + tmp pos; + tmp neg; + + tmp rho_pos; + tmp rho_neg; + + tmp rhoU_pos; + tmp rhoU_neg; + + tmp U_pos; + tmp U_neg; + + tmp p_pos; + tmp p_neg; + + tmp a_pos; + tmp a_neg; + + tmp aSf; + + tmp aphiv_pos; + tmp aphiv_neg; + + tmp muEff; + tmp tauMC; + + //- Optional LTS reciprocal time-step field + tmp trDeltaT; + + +private: + + // Private Member Functions + + //- Set rDeltaT for LTS + void setRDeltaT(const surfaceScalarField& amaxSf); + + //- Correct the cached Courant numbers + void correctCoNum(const surfaceScalarField& amaxSf); + + //- Construct the continuity equation and correct the density + void correctDensity(); + + //- Interpolate field vf according to direction dir + template + inline tmp> interpolate + ( + const VolField& vf, + const surfaceScalarField& dir, + const word& reconFieldName = word::null + ) + { + tmp> tsf + ( + fvc::interpolate + ( + vf, + dir, + "reconstruct(" + + (reconFieldName != word::null ? reconFieldName : vf.name()) + + ')' + ) + ); + + SurfaceField& sf = tsf.ref(); + + sf.rename(vf.name() + '_' + dir.name()); + + return tsf; + } + + void fluxPredictor(); + + void clearTemporaryFields(); + + +public: + + //- Runtime type information + TypeName("shockFluid"); + + + // Constructors + + //- Construct from region mesh + shockFluid(fvMesh& mesh); + + //- Disallow default bitwise copy construction + shockFluid(const shockFluid&) = delete; + + + //- Destructor + virtual ~shockFluid(); + + + // Member Functions + + //- Called at the start of the time-step, before the PIMPLE loop + virtual void preSolve(); + + //- Called at the start of the PIMPLE loop to move the mesh + virtual bool moveMesh(); + + //- Called at the start of the PIMPLE loop + virtual void prePredictor(); + + //- Construct and optionally solve the momentum equation + virtual void momentumPredictor(); + + //- Construct and solve the energy equation, + // convert to temperature + // and update thermophysical and transport properties + virtual void thermophysicalPredictor(); + + //- Construct and solve the pressure equation in the PISO loop + virtual void pressureCorrector(); + + //- Correct the momentum and thermophysical transport modelling + virtual void postCorrector(); + + //- Called after the PIMPLE loop at the end of the time-step + virtual void postSolve(); + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const shockFluid&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace solvers +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/shockFluid/thermophysicalPredictor.C b/applications/solvers/modules/shockFluid/thermophysicalPredictor.C new file mode 100644 index 0000000000..e775ae8830 --- /dev/null +++ b/applications/solvers/modules/shockFluid/thermophysicalPredictor.C @@ -0,0 +1,93 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 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 "shockFluid.H" +#include "fvcDdt.H" +#include "fvmDiv.H" + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::solvers::shockFluid::thermophysicalPredictor() +{ + volScalarField& e = thermo.he(); + + const surfaceScalarField e_pos(interpolate(e, pos, thermo.T().name())); + const surfaceScalarField e_neg(interpolate(e, neg, thermo.T().name())); + + surfaceScalarField phiEp + ( + "phiEp", + aphiv_pos()*(rho_pos()*(e_pos + 0.5*magSqr(U_pos())) + p_pos()) + + aphiv_neg()*(rho_neg()*(e_neg + 0.5*magSqr(U_neg())) + p_neg()) + + aSf()*(p_pos() - p_neg()) + ); + + // Make flux for pressure-work absolute + if (mesh.moving()) + { + phiEp += mesh.phi()*(a_pos()*p_pos() + a_neg()*p_neg()); + } + + solve(fvm::ddt(rhoE) + fvc::div(phiEp)); + + e = rhoE/rho - 0.5*magSqr(U); + e.correctBoundaryConditions(); + thermo.correct(); + rhoE.boundaryFieldRef() == + rho.boundaryField()* + ( + e.boundaryField() + 0.5*magSqr(U.boundaryField()) + ); + + if (!inviscid) + { + const surfaceScalarField sigmaDotU + ( + "sigmaDotU", + ( + fvc::interpolate(muEff())*mesh.magSf()*fvc::snGrad(U) + + fvc::dotInterpolate(mesh.Sf(), tauMC()) + ) + & (a_pos()*U_pos() + a_neg()*U_neg()) + ); + + solve + ( + fvm::ddt(rho, e) - fvc::ddt(rho, e) + + thermophysicalTransport->divq(e) + - fvc::div(sigmaDotU) + == + fvModels().source(rho, e) + ); + + fvConstraints().constrain(e); + + thermo.correct(); + rhoE = rho*(e + 0.5*magSqr(U)); + } +} + + +// ************************************************************************* // diff --git a/bin/rhoCentralFoam b/bin/rhoCentralFoam new file mode 100755 index 0000000000..7adb60a1d0 --- /dev/null +++ b/bin/rhoCentralFoam @@ -0,0 +1,46 @@ +#!/bin/sh +#------------------------------------------------------------------------------ +# ========= | +# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox +# \\ / O peration | Website: https://openfoam.org +# \\ / A nd | Copyright (C) 2023 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 +# rhoCentralFoam +# +# Description +# Script to inform the user that rhoCentralFoam has been superseded +# and replaced by the more general shockFluid solver module +# executed by the foamRun application. +# +#------------------------------------------------------------------------------ + +cat < /dev/null 2>&1 +then + echo 'gnuplot not found - skipping graph creation' >&2 + exit 1 +fi + +time=$(foamListTimes -latestTime) + +graphFile=postProcessing/sample/$time/data.xy + +gnuplot<sV=|KgRB4(s11P}-%I1Cpd4l_724DhH4VnK|dNfL-g z35bXSA}xxZO))g7f(idOj@~<# zjvi*CtBdKqGf+=Y$A^Jo+uknhKUcKa>*KR%HNY??7L0QO{tSx7oI-If)5&_5Ip!9G zOWrV7UKpQ^V>Zkkm>ZAB@#jT|F_u8Y5SSAdit|~*U>;Y36ODP`{(@j3ZjNC=LSd-D z+`xb*Mh)b#LiBn3eGAEw?1fy+8sq*|9>bzBcbqQ}Ly40EaFHZd94raNc3~`TaA+83 zsa7<@=fB|N9nAja)-hl(#Vs;}IXELqQaF&u4`B%xy2LR5U@nUvxkX}Ub65hwq8StM zIIe6Khs9?u5V`2*@YsLSp<$@8Xyo~Sjb315D>1+Xe;< zMnG@~&Rw8!sZDPq%n;Kv5kDl`cMF3N%oXB%E{h}STRcn{H+W%Q%uwv}=Y??t#N$eQ zOJuNlTwF5!A~y@;3nN4EB^o4$m1)al#o-X0$oLf$+m{~K)0-k{?+U} zYBHZu;q=Y+N0(Em&{X;u6`51PenY{5olht*5p;CEIh_I-?ITvoObWz)_wxbwSu#v- z&Tt(rA%krpb$&$%8CWETR#ROvut}l&gPxNho3&??Uoi=ap4rac6p=u8TK;*aB?&Za zsO$kc39Ju>4*7Qz;TdIrp37MxTr>A02OJ;*ojv9_y`2cEm9jcRDnvM}CWtf}mIgz$ zZC?T-3Y zfS!h3Qld-2%*!D4W53R$ywtthNWJsO$GyX{p>!U_YL1(+Pyd1BvN*k+1G9+m+04*L z|4S4ikZY{g8$;zt<&a9r5Zc*6JJN7}0PV~Dxj6RLT|}E{)*N)|M&p|0CZa=KDCi6( z5W04vj5u5RWK{=hI91&Q4@9LiI@Eb|P8A?y;PNP84X85jU6Li7ZUcE7*>7qV#yG*|H5?$SpNJO(UQS zJ@Xwnr**vxjqN+da&fzjRvMY>U6AiaZM^v7R_D4=On=W+t=VqWeqc>*uVD{*-1T+x z`s5zuda=zRmv#qzbHmH9?DIQFw6f~=6!96j+rso;b3JHl((#0;JKbnh@r0G{a2N7x z{zSc2tpgpEdGJ9@Ycm=?mHF`l!&;>M7Mt8Mop?dufwsdiVDF+UA$2i2o1=;qRz6f_CS|2eYXA;jm!F=naY>c=l`*i0}Q; zC~saQ4gTx)O8;@51bsZqgxCiZh_=!f+6B`R4 z-!Jl|$V1(^AIe(Q9}qNc~RZyk{I0qB&XP zbGIqL(`(~Rt)&3jVYTS#=VYi3PGX%>CBxjgjMeL<$&ma}vg^t@5a_}RAdVRjO<|+!fsRjl9s7-~2+8$#5UK+FlhFrHW5otLUKA z*zQ}slMYr{@9oh?G*E7wF7?x*fp6JQFVhZE;aist0asp8;9$-jT055ls~vMbw)>q7 zySEg$dY>f2Z?(0K6iqVZXzet!Ds5e=eE`F~(goe75-iH&MTxq0UXjmw{8 zw4itypFpN@9eN+jIWjO-kFt{UOq9Cnk#Y^^YH(2v>KT+1xM>0U)G+1CxM_sy%r}%i z;3MRnJ$Z~OeFL51zY3gORgEqu7N;KZx{8___#HttRY>iND~IpJS0dVd(SwygR-k01 zwM;ci1zNML=gOw!auikaCM3?V9Btb((SG7_8QP#q+4?%Z3{6p^&el-NP-@fY&yOvy zpw@ME*;yu~$Ym6t(Kua#hQcR}i=ztB`bCWtBM}(9Fd+vQ{sUU$tfVPe_&Z#%anK>z>% literal 0 HcmV?d00001 diff --git a/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/Allclean b/tutorials/modules/shockFluid/biconic25-55Run35/Allclean similarity index 100% rename from tutorials/compressible/rhoCentralFoam/biconic25-55Run35/Allclean rename to tutorials/modules/shockFluid/biconic25-55Run35/Allclean diff --git a/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/Allrun b/tutorials/modules/shockFluid/biconic25-55Run35/Allrun similarity index 100% rename from tutorials/compressible/rhoCentralFoam/biconic25-55Run35/Allrun rename to tutorials/modules/shockFluid/biconic25-55Run35/Allrun diff --git a/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/README b/tutorials/modules/shockFluid/biconic25-55Run35/README similarity index 100% rename from tutorials/compressible/rhoCentralFoam/biconic25-55Run35/README rename to tutorials/modules/shockFluid/biconic25-55Run35/README diff --git a/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/constant/grid256.dat b/tutorials/modules/shockFluid/biconic25-55Run35/constant/grid256.dat similarity index 100% rename from tutorials/compressible/rhoCentralFoam/biconic25-55Run35/constant/grid256.dat rename to tutorials/modules/shockFluid/biconic25-55Run35/constant/grid256.dat diff --git a/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/constant/momentumTransport b/tutorials/modules/shockFluid/biconic25-55Run35/constant/momentumTransport similarity index 100% rename from tutorials/compressible/rhoCentralFoam/biconic25-55Run35/constant/momentumTransport rename to tutorials/modules/shockFluid/biconic25-55Run35/constant/momentumTransport diff --git a/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/constant/physicalProperties b/tutorials/modules/shockFluid/biconic25-55Run35/constant/physicalProperties similarity index 100% rename from tutorials/compressible/rhoCentralFoam/biconic25-55Run35/constant/physicalProperties rename to tutorials/modules/shockFluid/biconic25-55Run35/constant/physicalProperties diff --git a/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/sampleCone b/tutorials/modules/shockFluid/biconic25-55Run35/sampleCone similarity index 100% rename from tutorials/compressible/rhoCentralFoam/biconic25-55Run35/sampleCone rename to tutorials/modules/shockFluid/biconic25-55Run35/sampleCone diff --git a/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/system/blockMeshDict b/tutorials/modules/shockFluid/biconic25-55Run35/system/blockMeshDict similarity index 100% rename from tutorials/compressible/rhoCentralFoam/biconic25-55Run35/system/blockMeshDict rename to tutorials/modules/shockFluid/biconic25-55Run35/system/blockMeshDict diff --git a/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/system/collapseDict b/tutorials/modules/shockFluid/biconic25-55Run35/system/collapseDict similarity index 100% rename from tutorials/compressible/rhoCentralFoam/biconic25-55Run35/system/collapseDict rename to tutorials/modules/shockFluid/biconic25-55Run35/system/collapseDict diff --git a/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/system/controlDict b/tutorials/modules/shockFluid/biconic25-55Run35/system/controlDict similarity index 88% rename from tutorials/compressible/rhoCentralFoam/biconic25-55Run35/system/controlDict rename to tutorials/modules/shockFluid/biconic25-55Run35/system/controlDict index 6f6916ef4f..28357677fb 100644 --- a/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/system/controlDict +++ b/tutorials/modules/shockFluid/biconic25-55Run35/system/controlDict @@ -14,7 +14,9 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -application rhoCentralFoam; +application foamRun; + +solver shockFluid; startFrom latestTime; @@ -26,7 +28,7 @@ endTime 1e-3; deltaT 1e-7; -writeControl adjustableRunTime; +writeControl runTime; writeInterval 5e-5; @@ -44,11 +46,7 @@ timePrecision 6; runTimeModifiable true; -adjustTimeStep yes; - -maxCo 0.5; - -maxDeltaT 2e-8; +adjustTimeStep no; functions { diff --git a/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/system/fvSchemes b/tutorials/modules/shockFluid/biconic25-55Run35/system/fvSchemes similarity index 100% rename from tutorials/compressible/rhoCentralFoam/biconic25-55Run35/system/fvSchemes rename to tutorials/modules/shockFluid/biconic25-55Run35/system/fvSchemes diff --git a/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/system/fvSolution b/tutorials/modules/shockFluid/biconic25-55Run35/system/fvSolution similarity index 89% rename from tutorials/compressible/rhoCentralFoam/biconic25-55Run35/system/fvSolution rename to tutorials/modules/shockFluid/biconic25-55Run35/system/fvSolution index 2dea979eca..68db3d5d54 100644 --- a/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/system/fvSolution +++ b/tutorials/modules/shockFluid/biconic25-55Run35/system/fvSolution @@ -16,12 +16,12 @@ FoamFile solvers { - "(rho|rhoU|rhoE)" + "(rho|rhoU|rhoE).*" { solver diagonal; } - U + "U.*" { solver smoothSolver; smoother GaussSeidel; @@ -30,12 +30,18 @@ solvers relTol 0.01; } - e + "e.*" { $U; relTol 0.1; } } +PIMPLE +{ + maxCo 0.5; + maxDeltaT 2e-8; +} + // ************************************************************************* // diff --git a/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/system/sample b/tutorials/modules/shockFluid/biconic25-55Run35/system/sample similarity index 100% rename from tutorials/compressible/rhoCentralFoam/biconic25-55Run35/system/sample rename to tutorials/modules/shockFluid/biconic25-55Run35/system/sample diff --git a/tutorials/compressible/rhoCentralFoam/forwardStep/0/T b/tutorials/modules/shockFluid/forwardStep/0/T similarity index 100% rename from tutorials/compressible/rhoCentralFoam/forwardStep/0/T rename to tutorials/modules/shockFluid/forwardStep/0/T diff --git a/tutorials/compressible/rhoCentralFoam/forwardStep/0/U b/tutorials/modules/shockFluid/forwardStep/0/U similarity index 100% rename from tutorials/compressible/rhoCentralFoam/forwardStep/0/U rename to tutorials/modules/shockFluid/forwardStep/0/U diff --git a/tutorials/compressible/rhoCentralFoam/forwardStep/0/p b/tutorials/modules/shockFluid/forwardStep/0/p similarity index 100% rename from tutorials/compressible/rhoCentralFoam/forwardStep/0/p rename to tutorials/modules/shockFluid/forwardStep/0/p diff --git a/tutorials/compressible/rhoCentralFoam/forwardStep/constant/momentumTransport b/tutorials/modules/shockFluid/forwardStep/constant/momentumTransport similarity index 100% rename from tutorials/compressible/rhoCentralFoam/forwardStep/constant/momentumTransport rename to tutorials/modules/shockFluid/forwardStep/constant/momentumTransport diff --git a/tutorials/compressible/rhoCentralFoam/forwardStep/constant/physicalProperties b/tutorials/modules/shockFluid/forwardStep/constant/physicalProperties similarity index 100% rename from tutorials/compressible/rhoCentralFoam/forwardStep/constant/physicalProperties rename to tutorials/modules/shockFluid/forwardStep/constant/physicalProperties diff --git a/tutorials/compressible/rhoCentralFoam/forwardStep/system/blockMeshDict b/tutorials/modules/shockFluid/forwardStep/system/blockMeshDict similarity index 100% rename from tutorials/compressible/rhoCentralFoam/forwardStep/system/blockMeshDict rename to tutorials/modules/shockFluid/forwardStep/system/blockMeshDict diff --git a/tutorials/compressible/rhoCentralFoam/forwardStep/system/controlDict b/tutorials/modules/shockFluid/forwardStep/system/controlDict similarity index 95% rename from tutorials/compressible/rhoCentralFoam/forwardStep/system/controlDict rename to tutorials/modules/shockFluid/forwardStep/system/controlDict index fb65f90b0e..4f07f86e72 100644 --- a/tutorials/compressible/rhoCentralFoam/forwardStep/system/controlDict +++ b/tutorials/modules/shockFluid/forwardStep/system/controlDict @@ -14,7 +14,9 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -application rhoCentralFoam; +application foamRun; + +solver shockFluid; startFrom startTime; diff --git a/tutorials/compressible/rhoCentralFoam/forwardStep/system/fvSchemes b/tutorials/modules/shockFluid/forwardStep/system/fvSchemes similarity index 100% rename from tutorials/compressible/rhoCentralFoam/forwardStep/system/fvSchemes rename to tutorials/modules/shockFluid/forwardStep/system/fvSchemes diff --git a/tutorials/compressible/rhoCentralFoam/obliqueShock/system/fvSolution b/tutorials/modules/shockFluid/forwardStep/system/fvSolution similarity index 94% rename from tutorials/compressible/rhoCentralFoam/obliqueShock/system/fvSolution rename to tutorials/modules/shockFluid/forwardStep/system/fvSolution index d398c538f2..b3030f2c10 100644 --- a/tutorials/compressible/rhoCentralFoam/obliqueShock/system/fvSolution +++ b/tutorials/modules/shockFluid/forwardStep/system/fvSolution @@ -16,12 +16,12 @@ FoamFile solvers { - "(rho|rhoU|rhoE)" + "(rho|rhoU|rhoE).*" { solver diagonal; } - U + "U.*" { solver smoothSolver; smoother GaussSeidel; @@ -30,7 +30,7 @@ solvers relTol 0.01; } - h + "e.*" { $U; tolerance 1e-10; @@ -38,5 +38,8 @@ solvers } } +PIMPLE +{} + // ************************************************************************* // diff --git a/tutorials/compressible/rhoCentralFoam/movingCone/0/T b/tutorials/modules/shockFluid/movingCone/0/T similarity index 91% rename from tutorials/compressible/rhoCentralFoam/movingCone/0/T rename to tutorials/modules/shockFluid/movingCone/0/T index ec130dcc47..f74d7d7f1e 100644 --- a/tutorials/compressible/rhoCentralFoam/movingCone/0/T +++ b/tutorials/modules/shockFluid/movingCone/0/T @@ -19,6 +19,8 @@ internalField uniform 300; boundaryField { + #includeEtc "caseDicts/setConstraintTypes" + movingWall { type zeroGradient; @@ -44,16 +46,6 @@ boundaryField { type zeroGradient; } - - back - { - type wedge; - } - - front - { - type wedge; - } } // ************************************************************************* // diff --git a/tutorials/compressible/rhoCentralFoam/movingCone/0/U b/tutorials/modules/shockFluid/movingCone/0/U similarity index 91% rename from tutorials/compressible/rhoCentralFoam/movingCone/0/U rename to tutorials/modules/shockFluid/movingCone/0/U index d444079a3b..4a34324300 100644 --- a/tutorials/compressible/rhoCentralFoam/movingCone/0/U +++ b/tutorials/modules/shockFluid/movingCone/0/U @@ -19,6 +19,8 @@ internalField uniform (0 0 0); boundaryField { + #includeEtc "caseDicts/setConstraintTypes" + movingWall { type movingWallVelocity; @@ -45,16 +47,6 @@ boundaryField { type noSlip; } - - back - { - type wedge; - } - - front - { - type wedge; - } } // ************************************************************************* // diff --git a/tutorials/compressible/rhoCentralFoam/movingCone/0/p b/tutorials/modules/shockFluid/movingCone/0/p similarity index 91% rename from tutorials/compressible/rhoCentralFoam/movingCone/0/p rename to tutorials/modules/shockFluid/movingCone/0/p index 830acc5d39..5279c547cb 100644 --- a/tutorials/compressible/rhoCentralFoam/movingCone/0/p +++ b/tutorials/modules/shockFluid/movingCone/0/p @@ -19,6 +19,8 @@ internalField uniform 1e5; boundaryField { + #includeEtc "caseDicts/setConstraintTypes" + movingWall { type zeroGradient; @@ -44,16 +46,6 @@ boundaryField { type zeroGradient; } - - back - { - type wedge; - } - - front - { - type wedge; - } } // ************************************************************************* // diff --git a/tutorials/compressible/rhoCentralFoam/movingCone/0/pointMotionUx b/tutorials/modules/shockFluid/movingCone/0/pointMotionUx similarity index 86% rename from tutorials/compressible/rhoCentralFoam/movingCone/0/pointMotionUx rename to tutorials/modules/shockFluid/movingCone/0/pointMotionUx index bdd5916ff8..1ce776a060 100644 --- a/tutorials/compressible/rhoCentralFoam/movingCone/0/pointMotionUx +++ b/tutorials/modules/shockFluid/movingCone/0/pointMotionUx @@ -19,16 +19,18 @@ internalField uniform 0; boundaryField { + #includeEtc "caseDicts/setConstraintTypes" + movingWall { type uniformFixedValue; - uniformValue constant 160; + uniformValue constant 150; } farFieldMoving { type uniformFixedValue; - uniformValue constant 160; + uniformValue constant 150; } fixedWall @@ -47,16 +49,6 @@ boundaryField { type slip; } - - back - { - type wedge; - } - - front - { - type wedge; - } } // ************************************************************************* // diff --git a/applications/solvers/compressible/rhoCentralFoam/Allwmake b/tutorials/modules/shockFluid/movingCone/Allclean similarity index 50% rename from applications/solvers/compressible/rhoCentralFoam/Allwmake rename to tutorials/modules/shockFluid/movingCone/Allclean index e6ead0f47d..15b463efe7 100755 --- a/applications/solvers/compressible/rhoCentralFoam/Allwmake +++ b/tutorials/modules/shockFluid/movingCone/Allclean @@ -1,9 +1,11 @@ #!/bin/sh cd ${0%/*} || exit 1 # Run from this directory -# Parse arguments for library compilation -. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments +# Source tutorial clean functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions -(wmake $targetType BCs && wmake $targetType) +rm -rf constant/meshToMesh* + +cleanCase #------------------------------------------------------------------------------ diff --git a/tutorials/modules/shockFluid/movingCone/Allrun b/tutorials/modules/shockFluid/movingCone/Allrun new file mode 100755 index 0000000000..d36e85b4bd --- /dev/null +++ b/tutorials/modules/shockFluid/movingCone/Allrun @@ -0,0 +1,25 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +application=$(getApplication) + +mapTimes="1e-05 2e-05" + +# Iterate the string variable using for loop +for mapTime in $mapTimes; do + + runApplication -a blockMesh -dict blockMeshDict_$mapTime + rm -rf constant/meshToMesh_$mapTime + mkdir constant/meshToMesh_$mapTime + mv constant/polyMesh constant/meshToMesh_$mapTime + +done + +runApplication -a blockMesh + +runApplication $application + +#------------------------------------------------------------------------------ diff --git a/tutorials/modules/shockFluid/movingCone/Allrun-parallel b/tutorials/modules/shockFluid/movingCone/Allrun-parallel new file mode 100755 index 0000000000..fe26befd2b --- /dev/null +++ b/tutorials/modules/shockFluid/movingCone/Allrun-parallel @@ -0,0 +1,43 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +mapTimes="1e-05 2e-05" + +# Iterate the string variable using for loop +for mapTime in $mapTimes; do + + runApplication -a blockMesh -dict blockMeshDict_$mapTime + runApplication -a decomposePar -force -noFields -dict decomposeParDict_$mapTime + + rm -rf constant/meshToMesh_$mapTime + mkdir constant/meshToMesh_$mapTime + + for procI in processor* + do + mv $procI/constant/polyMesh constant/meshToMesh_$mapTime/$procI + done + + mv constant/polyMesh constant/meshToMesh_$mapTime + +done + +runApplication -a blockMesh -dict blockMeshDict +runApplication -a decomposePar -force + +for mapTime in $mapTimes; do + + for procI in processor* + do + mkdir $procI/constant/meshToMesh_$mapTime + mv constant/meshToMesh_$mapTime/$procI $procI/constant/meshToMesh_$mapTime/polyMesh + done + +done + +runParallel $(getApplication) +runApplication reconstructPar + +#------------------------------------------------------------------------------ diff --git a/tutorials/modules/shockFluid/movingCone/U b/tutorials/modules/shockFluid/movingCone/U new file mode 100644 index 0000000000..4a34324300 --- /dev/null +++ b/tutorials/modules/shockFluid/movingCone/U @@ -0,0 +1,52 @@ +/*--------------------------------*- 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 volVectorField; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + #includeEtc "caseDicts/setConstraintTypes" + + movingWall + { + type movingWallVelocity; + value $internalField; + } + + farFieldMoving + { + type noSlip; + } + + fixedWall + { + type noSlip; + } + + left + { + type pressureInletOutletVelocity; + value $internalField; + } + + farField + { + type noSlip; + } +} + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoCentralFoam/movingCone/constant/dynamicMeshDict b/tutorials/modules/shockFluid/movingCone/constant/dynamicMeshDict similarity index 87% rename from tutorials/compressible/rhoCentralFoam/movingCone/constant/dynamicMeshDict rename to tutorials/modules/shockFluid/movingCone/constant/dynamicMeshDict index d5c6ec7409..80423065cc 100644 --- a/tutorials/compressible/rhoCentralFoam/movingCone/constant/dynamicMeshDict +++ b/tutorials/modules/shockFluid/movingCone/constant/dynamicMeshDict @@ -27,4 +27,16 @@ mover } +topoChanger +{ + type meshToMesh; + + libs ("libmeshToMeshTopoChanger.so"); + + times (1e-5 2e-5); + + timeDelta 1e-9; +} + + // ************************************************************************* // diff --git a/tutorials/compressible/rhoCentralFoam/movingCone/constant/momentumTransport b/tutorials/modules/shockFluid/movingCone/constant/momentumTransport similarity index 100% rename from tutorials/compressible/rhoCentralFoam/movingCone/constant/momentumTransport rename to tutorials/modules/shockFluid/movingCone/constant/momentumTransport diff --git a/tutorials/compressible/rhoCentralFoam/movingCone/constant/physicalProperties b/tutorials/modules/shockFluid/movingCone/constant/physicalProperties similarity index 100% rename from tutorials/compressible/rhoCentralFoam/movingCone/constant/physicalProperties rename to tutorials/modules/shockFluid/movingCone/constant/physicalProperties diff --git a/tutorials/modules/shockFluid/movingCone/pointMotionUx b/tutorials/modules/shockFluid/movingCone/pointMotionUx new file mode 100644 index 0000000000..16a2d72c02 --- /dev/null +++ b/tutorials/modules/shockFluid/movingCone/pointMotionUx @@ -0,0 +1,54 @@ +/*--------------------------------*- 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 pointScalarField; + object pointMotionUx; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + #includeEtc "caseDicts/setConstraintTypes" + + movingWall + { + type uniformFixedValue; + uniformValue constant 1; + } + + farFieldMoving + { + type uniformFixedValue; + uniformValue constant 1; + } + + fixedWall + { + type uniformFixedValue; + uniformValue constant 0; + } + + left + { + type uniformFixedValue; + uniformValue constant 0; + } + + farField + { + type slip; + } +} + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoCentralFoam/movingCone/system/blockMeshDict b/tutorials/modules/shockFluid/movingCone/system/blockMeshDict similarity index 93% rename from tutorials/compressible/rhoCentralFoam/movingCone/system/blockMeshDict rename to tutorials/modules/shockFluid/movingCone/system/blockMeshDict index 082cd126d2..a6494535ef 100644 --- a/tutorials/compressible/rhoCentralFoam/movingCone/system/blockMeshDict +++ b/tutorials/modules/shockFluid/movingCone/system/blockMeshDict @@ -41,15 +41,20 @@ vertices blocks ( - hex (0 1 5 4 0 1 13 12) (15 15 1) simpleGrading (1 1 1) + hex (0 1 5 4 0 1 13 12) (8 15 1) simpleGrading (1 1 1) hex (2 3 7 6 2 3 15 14) (20 20 1) simpleGrading (2 0.25 1) - hex (4 5 9 8 12 13 17 16) (15 15 1) simpleGrading (1 1 1) + hex (4 5 9 8 12 13 17 16) (8 15 1) simpleGrading (1 1 1) hex (5 6 10 9 13 14 18 17) (50 15 1) simpleGrading (1 1 1) hex (6 7 11 10 14 15 19 18) (20 15 1) simpleGrading (2 1 1) ); boundary ( + internal + { + type internal; + faces (); + } movingWall { type wall; diff --git a/tutorials/modules/shockFluid/movingCone/system/blockMeshDict_1e-05 b/tutorials/modules/shockFluid/movingCone/system/blockMeshDict_1e-05 new file mode 100644 index 0000000000..abbc01bfc0 --- /dev/null +++ b/tutorials/modules/shockFluid/movingCone/system/blockMeshDict_1e-05 @@ -0,0 +1,139 @@ +/*--------------------------------*- 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; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 0.001; + +vertices +( + (-7.5 0 0) + (-5.5 0 0) + (-2 0 0) + (0 0 0) + (-7.5 0.75 -0.03271454) + (-5.5 0.75 -0.03271454) + (-2 2 -0.087238774) + (0 2 -0.087238774) + (-7.5 2.5 -0.10904846) + (-5.5 2.5 -0.10904846) + (-2 2.5 -0.10904846) + (0 2.5 -0.10904846) + (-7.5 0.75 0.03271454) + (-5.5 0.75 0.03271454) + (-2 2 0.087238774) + (0 2 0.087238774) + (-7.5 2.5 0.10904846) + (-5.5 2.5 0.10904846) + (-2 2.5 0.10904846) + (0 2.5 0.10904846) +); + +blocks +( + hex (0 1 5 4 0 1 13 12) (16 15 1) simpleGrading (1 1 1) + hex (2 3 7 6 2 3 15 14) (10 20 1) simpleGrading (2 0.25 1) + hex (4 5 9 8 12 13 17 16) (16 15 1) simpleGrading (1 1 1) + hex (5 6 10 9 13 14 18 17) (50 15 1) simpleGrading (1 1 1) + hex (6 7 11 10 14 15 19 18) (10 15 1) simpleGrading (2 1 1) +); + +boundary +( + internal + { + type internal; + faces (); + } + movingWall + { + type wall; + faces + ( + (1 5 13 1) + (5 6 14 13) + (2 2 14 6) + ); + } + farFieldMoving + { + type patch; + faces + ( + (9 17 18 10) + ); + } + fixedWall + { + type wall; + faces + ( + (3 7 15 3) + (7 11 19 15) + ); + } + axis + { + type empty; + faces + ( + (0 1 1 0) + (2 3 3 2) + ); + } + left + { + type patch; + faces + ( + (0 0 12 4) + (4 12 16 8) + ); + } + farField + { + type patch; + faces + ( + (8 16 17 9) + (10 18 19 11) + ); + } + back + { + type wedge; + faces + ( + (0 4 5 1) + (2 6 7 3) + (4 8 9 5) + (5 9 10 6) + (6 10 11 7) + ); + } + front + { + type wedge; + faces + ( + (0 1 13 12) + (2 3 15 14) + (12 13 17 16) + (13 14 18 17) + (14 15 19 18) + ); + } +); + + +// ************************************************************************* // diff --git a/tutorials/modules/shockFluid/movingCone/system/blockMeshDict_2e-05 b/tutorials/modules/shockFluid/movingCone/system/blockMeshDict_2e-05 new file mode 100644 index 0000000000..7e60858711 --- /dev/null +++ b/tutorials/modules/shockFluid/movingCone/system/blockMeshDict_2e-05 @@ -0,0 +1,139 @@ +/*--------------------------------*- 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; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 0.001; + +vertices +( + (-7.5 0 0) + (-4 0 0) + (-0.5 0 0) + (0 0 0) + (-7.5 0.75 -0.03271454) + (-4 0.75 -0.03271454) + (-0.5 2 -0.087238774) + (0 2 -0.087238774) + (-7.5 2.5 -0.10904846) + (-4 2.5 -0.10904846) + (-0.5 2.5 -0.10904846) + (0 2.5 -0.10904846) + (-7.5 0.75 0.03271454) + (-4 0.75 0.03271454) + (-0.5 2 0.087238774) + (0 2 0.087238774) + (-7.5 2.5 0.10904846) + (-4 2.5 0.10904846) + (-0.5 2.5 0.10904846) + (0 2.5 0.10904846) +); + +blocks +( + hex (0 1 5 4 0 1 13 12) (25 15 1) simpleGrading (1 1 1) + hex (2 3 7 6 2 3 15 14) (5 20 1) simpleGrading (2 0.25 1) + hex (4 5 9 8 12 13 17 16) (25 15 1) simpleGrading (1 1 1) + hex (5 6 10 9 13 14 18 17) (50 15 1) simpleGrading (1 1 1) + hex (6 7 11 10 14 15 19 18) (5 15 1) simpleGrading (2 1 1) +); + +boundary +( + internal + { + type internal; + faces (); + } + movingWall + { + type wall; + faces + ( + (1 5 13 1) + (5 6 14 13) + (2 2 14 6) + ); + } + farFieldMoving + { + type patch; + faces + ( + (9 17 18 10) + ); + } + fixedWall + { + type wall; + faces + ( + (3 7 15 3) + (7 11 19 15) + ); + } + axis + { + type empty; + faces + ( + (0 1 1 0) + (2 3 3 2) + ); + } + left + { + type patch; + faces + ( + (0 0 12 4) + (4 12 16 8) + ); + } + farField + { + type patch; + faces + ( + (8 16 17 9) + (10 18 19 11) + ); + } + back + { + type wedge; + faces + ( + (0 4 5 1) + (2 6 7 3) + (4 8 9 5) + (5 9 10 6) + (6 10 11 7) + ); + } + front + { + type wedge; + faces + ( + (0 1 13 12) + (2 3 15 14) + (12 13 17 16) + (13 14 18 17) + (14 15 19 18) + ); + } +); + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoCentralFoam/movingCone/system/controlDict b/tutorials/modules/shockFluid/movingCone/system/controlDict similarity index 95% rename from tutorials/compressible/rhoCentralFoam/movingCone/system/controlDict rename to tutorials/modules/shockFluid/movingCone/system/controlDict index 1cfb7149bd..a41dfb68be 100644 --- a/tutorials/compressible/rhoCentralFoam/movingCone/system/controlDict +++ b/tutorials/modules/shockFluid/movingCone/system/controlDict @@ -14,7 +14,9 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -application rhoCentralFoam; +application foamRun; + +solver shockFluid; startFrom startTime; diff --git a/tutorials/modules/shockFluid/movingCone/system/decomposeParDict b/tutorials/modules/shockFluid/movingCone/system/decomposeParDict new file mode 100644 index 0000000000..eeda159389 --- /dev/null +++ b/tutorials/modules/shockFluid/movingCone/system/decomposeParDict @@ -0,0 +1,42 @@ +/*--------------------------------*- 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 "system"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 4; + +method hierarchical; + +simpleCoeffs +{ + n (2 1 1); +} + +hierarchicalCoeffs +{ + n (4 1 1); + order xyz; +} + +manualCoeffs +{ + dataFile ""; +} + +distributed no; + +roots ( ); + + +// ************************************************************************* // diff --git a/tutorials/modules/shockFluid/movingCone/system/decomposeParDict_1e-05 b/tutorials/modules/shockFluid/movingCone/system/decomposeParDict_1e-05 new file mode 100644 index 0000000000..9a200b8a99 --- /dev/null +++ b/tutorials/modules/shockFluid/movingCone/system/decomposeParDict_1e-05 @@ -0,0 +1,42 @@ +/*--------------------------------*- 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 "system"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 4; + +method scotch; + +simpleCoeffs +{ + n (2 1 1); +} + +hierarchicalCoeffs +{ + n (4 1 1); + order xyz; +} + +manualCoeffs +{ + dataFile ""; +} + +distributed no; + +roots ( ); + + +// ************************************************************************* // diff --git a/tutorials/modules/shockFluid/movingCone/system/decomposeParDict_2e-05 b/tutorials/modules/shockFluid/movingCone/system/decomposeParDict_2e-05 new file mode 100644 index 0000000000..32f6bb75e1 --- /dev/null +++ b/tutorials/modules/shockFluid/movingCone/system/decomposeParDict_2e-05 @@ -0,0 +1,42 @@ +/*--------------------------------*- 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 "system"; + object decomposeParDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +numberOfSubdomains 4; + +method hierarchical; + +simpleCoeffs +{ + n (2 1 1); +} + +hierarchicalCoeffs +{ + n (2 2 1); + order xyz; +} + +manualCoeffs +{ + dataFile ""; +} + +distributed no; + +roots ( ); + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoCentralFoam/movingCone/system/fvSchemes b/tutorials/modules/shockFluid/movingCone/system/fvSchemes similarity index 100% rename from tutorials/compressible/rhoCentralFoam/movingCone/system/fvSchemes rename to tutorials/modules/shockFluid/movingCone/system/fvSchemes diff --git a/tutorials/compressible/rhoCentralFoam/movingCone/system/fvSolution b/tutorials/modules/shockFluid/movingCone/system/fvSolution similarity index 97% rename from tutorials/compressible/rhoCentralFoam/movingCone/system/fvSolution rename to tutorials/modules/shockFluid/movingCone/system/fvSolution index 5f0f148059..fb108c552c 100644 --- a/tutorials/compressible/rhoCentralFoam/movingCone/system/fvSolution +++ b/tutorials/modules/shockFluid/movingCone/system/fvSolution @@ -59,7 +59,7 @@ solvers relTol 0; } - cellMotionUx + "cellMotionUx.*" { solver PCG; preconditioner DIC; @@ -72,7 +72,7 @@ PIMPLE { momentumPredictor yes; correctPhi yes; - nOuterCorrectors 2; + nOuterCorrectors 1; nCorrectors 2; transonic yes; nNonOrthogonalCorrectors 0; diff --git a/tutorials/compressible/rhoCentralFoam/obliqueShock/0/T b/tutorials/modules/shockFluid/obliqueShock/0/T similarity index 100% rename from tutorials/compressible/rhoCentralFoam/obliqueShock/0/T rename to tutorials/modules/shockFluid/obliqueShock/0/T diff --git a/tutorials/compressible/rhoCentralFoam/obliqueShock/0/U b/tutorials/modules/shockFluid/obliqueShock/0/U similarity index 100% rename from tutorials/compressible/rhoCentralFoam/obliqueShock/0/U rename to tutorials/modules/shockFluid/obliqueShock/0/U diff --git a/tutorials/compressible/rhoCentralFoam/obliqueShock/0/p b/tutorials/modules/shockFluid/obliqueShock/0/p similarity index 100% rename from tutorials/compressible/rhoCentralFoam/obliqueShock/0/p rename to tutorials/modules/shockFluid/obliqueShock/0/p diff --git a/tutorials/compressible/rhoCentralFoam/obliqueShock/constant/momentumTransport b/tutorials/modules/shockFluid/obliqueShock/constant/momentumTransport similarity index 100% rename from tutorials/compressible/rhoCentralFoam/obliqueShock/constant/momentumTransport rename to tutorials/modules/shockFluid/obliqueShock/constant/momentumTransport diff --git a/tutorials/compressible/rhoCentralFoam/obliqueShock/constant/physicalProperties b/tutorials/modules/shockFluid/obliqueShock/constant/physicalProperties similarity index 100% rename from tutorials/compressible/rhoCentralFoam/obliqueShock/constant/physicalProperties rename to tutorials/modules/shockFluid/obliqueShock/constant/physicalProperties diff --git a/tutorials/compressible/rhoCentralFoam/obliqueShock/system/blockMeshDict b/tutorials/modules/shockFluid/obliqueShock/system/blockMeshDict similarity index 100% rename from tutorials/compressible/rhoCentralFoam/obliqueShock/system/blockMeshDict rename to tutorials/modules/shockFluid/obliqueShock/system/blockMeshDict diff --git a/tutorials/compressible/rhoCentralFoam/obliqueShock/system/controlDict b/tutorials/modules/shockFluid/obliqueShock/system/controlDict similarity index 95% rename from tutorials/compressible/rhoCentralFoam/obliqueShock/system/controlDict rename to tutorials/modules/shockFluid/obliqueShock/system/controlDict index 090a72d377..32edec617f 100644 --- a/tutorials/compressible/rhoCentralFoam/obliqueShock/system/controlDict +++ b/tutorials/modules/shockFluid/obliqueShock/system/controlDict @@ -14,7 +14,9 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -application rhoCentralFoam; +application foamRun; + +solver shockFluid; startFrom startTime; diff --git a/tutorials/compressible/rhoCentralFoam/obliqueShock/system/fvSchemes b/tutorials/modules/shockFluid/obliqueShock/system/fvSchemes similarity index 100% rename from tutorials/compressible/rhoCentralFoam/obliqueShock/system/fvSchemes rename to tutorials/modules/shockFluid/obliqueShock/system/fvSchemes diff --git a/tutorials/compressible/rhoCentralFoam/shockTube/system/fvSolution b/tutorials/modules/shockFluid/obliqueShock/system/fvSolution similarity index 94% rename from tutorials/compressible/rhoCentralFoam/shockTube/system/fvSolution rename to tutorials/modules/shockFluid/obliqueShock/system/fvSolution index d398c538f2..b3030f2c10 100644 --- a/tutorials/compressible/rhoCentralFoam/shockTube/system/fvSolution +++ b/tutorials/modules/shockFluid/obliqueShock/system/fvSolution @@ -16,12 +16,12 @@ FoamFile solvers { - "(rho|rhoU|rhoE)" + "(rho|rhoU|rhoE).*" { solver diagonal; } - U + "U.*" { solver smoothSolver; smoother GaussSeidel; @@ -30,7 +30,7 @@ solvers relTol 0.01; } - h + "e.*" { $U; tolerance 1e-10; @@ -38,5 +38,8 @@ solvers } } +PIMPLE +{} + // ************************************************************************* // diff --git a/tutorials/compressible/rhoCentralFoam/shockTube/0/T.orig b/tutorials/modules/shockFluid/shockTube/0/T.orig similarity index 100% rename from tutorials/compressible/rhoCentralFoam/shockTube/0/T.orig rename to tutorials/modules/shockFluid/shockTube/0/T.orig diff --git a/tutorials/compressible/rhoCentralFoam/shockTube/0/U.orig b/tutorials/modules/shockFluid/shockTube/0/U.orig similarity index 100% rename from tutorials/compressible/rhoCentralFoam/shockTube/0/U.orig rename to tutorials/modules/shockFluid/shockTube/0/U.orig diff --git a/tutorials/modules/shockFluid/shockTube/0/mag(U) b/tutorials/modules/shockFluid/shockTube/0/mag(U) new file mode 100644 index 0000000000..c87e6a6602 --- /dev/null +++ b/tutorials/modules/shockFluid/shockTube/0/mag(U) @@ -0,0 +1,35 @@ +/*--------------------------------*- 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 volScalarField; + location "0"; + object mag(U); +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + sides + { + type calculated; + value uniform 0; + } + empty + { + type empty; + } +} + + +// ************************************************************************* // diff --git a/tutorials/compressible/rhoCentralFoam/shockTube/0/p.orig b/tutorials/modules/shockFluid/shockTube/0/p.orig similarity index 100% rename from tutorials/compressible/rhoCentralFoam/shockTube/0/p.orig rename to tutorials/modules/shockFluid/shockTube/0/p.orig diff --git a/tutorials/modules/shockFluid/shockTube/Allclean b/tutorials/modules/shockFluid/shockTube/Allclean new file mode 100755 index 0000000000..5b682f3541 --- /dev/null +++ b/tutorials/modules/shockFluid/shockTube/Allclean @@ -0,0 +1,11 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory + +# Source tutorial clean functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +cleanCase + +rm -rf *.eps + +#------------------------------------------------------------------------------ diff --git a/tutorials/compressible/rhoCentralFoam/shockTube/Allrun b/tutorials/modules/shockFluid/shockTube/Allrun similarity index 95% rename from tutorials/compressible/rhoCentralFoam/shockTube/Allrun rename to tutorials/modules/shockFluid/shockTube/Allrun index 0fb2b0c86c..d34a07e581 100755 --- a/tutorials/compressible/rhoCentralFoam/shockTube/Allrun +++ b/tutorials/modules/shockFluid/shockTube/Allrun @@ -8,5 +8,6 @@ runApplication blockMesh runApplication setFields runApplication $(getApplication) runApplication -s sample foamPostProcess -func sample +./createGraphs #------------------------------------------------------------------------------ diff --git a/tutorials/compressible/rhoCentralFoam/shockTube/constant/momentumTransport b/tutorials/modules/shockFluid/shockTube/constant/momentumTransport similarity index 100% rename from tutorials/compressible/rhoCentralFoam/shockTube/constant/momentumTransport rename to tutorials/modules/shockFluid/shockTube/constant/momentumTransport diff --git a/tutorials/compressible/rhoCentralFoam/shockTube/constant/physicalProperties b/tutorials/modules/shockFluid/shockTube/constant/physicalProperties similarity index 100% rename from tutorials/compressible/rhoCentralFoam/shockTube/constant/physicalProperties rename to tutorials/modules/shockFluid/shockTube/constant/physicalProperties diff --git a/tutorials/modules/shockFluid/shockTube/createGraphs b/tutorials/modules/shockFluid/shockTube/createGraphs new file mode 100755 index 0000000000..1f6cef82b1 --- /dev/null +++ b/tutorials/modules/shockFluid/shockTube/createGraphs @@ -0,0 +1,49 @@ +#!/bin/sh + +if ! which gnuplot > /dev/null 2>&1 +then + echo 'gnuplot not found - skipping graph creation' >&2 + exit 1 +fi + +time=$(foamListTimes -latestTime) + +graphFile=postProcessing/sample/$time/data.xy + +gnuplot<