diff --git a/applications/solvers/multiphase/compressibleInterFoam/Allwclean b/applications/solvers/modules/fluid/compressibleVoF/Allwclean similarity index 100% rename from applications/solvers/multiphase/compressibleInterFoam/Allwclean rename to applications/solvers/modules/fluid/compressibleVoF/Allwclean diff --git a/applications/solvers/multiphase/compressibleInterFoam/Allwmake b/applications/solvers/modules/fluid/compressibleVoF/Allwmake similarity index 100% rename from applications/solvers/multiphase/compressibleInterFoam/Allwmake rename to applications/solvers/modules/fluid/compressibleVoF/Allwmake diff --git a/applications/solvers/modules/fluid/compressibleVoF/Make/files b/applications/solvers/modules/fluid/compressibleVoF/Make/files new file mode 100644 index 0000000000..d9c9a59678 --- /dev/null +++ b/applications/solvers/modules/fluid/compressibleVoF/Make/files @@ -0,0 +1,9 @@ +setRDeltaT.C +moveMesh.C +alphaPredictor.C +momentumPredictor.C +thermophysicalPredictor.C +pressureCorrector.C +compressibleVoF.C + +LIB = $(FOAM_LIBBIN)/libcompressibleVoF diff --git a/applications/solvers/multiphase/compressibleInterFoam/Make/options b/applications/solvers/modules/fluid/compressibleVoF/Make/options similarity index 67% rename from applications/solvers/multiphase/compressibleInterFoam/Make/options rename to applications/solvers/modules/fluid/compressibleVoF/Make/options index 795c199081..857e2b90fe 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/Make/options +++ b/applications/solvers/modules/fluid/compressibleVoF/Make/options @@ -1,36 +1,30 @@ EXE_INC = \ - -I. \ + -I$(FOAM_SOLVERS)/modules/fluid/fluidSolver/lnInclude \ -IcompressibleTwoPhaseMixture \ -IcompressibleInterPhaseTransportModel/lnInclude \ -ItwoPhaseChange/lnInclude \ -I$(LIB_SRC)/physicalProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/multicomponentThermo/lnInclude \ -I$(LIB_SRC)/twoPhaseModels/twoPhaseMixture/lnInclude \ -I$(LIB_SRC)/twoPhaseModels/interfaceProperties/lnInclude \ -I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \ -I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \ -I$(LIB_SRC)/MomentumTransportModels/phaseCompressible/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude \ - -I$(LIB_SRC)/fvModels/lnInclude + -I$(LIB_SRC)/meshTools/lnInclude -EXE_LIBS = \ +LIB_LIBS = \ + -lfluidSolver \ -lcompressibleTwoPhaseMixture \ -ltwoPhaseSurfaceTension \ -lfluidThermophysicalModels \ - -lspecie \ -ltwoPhaseMixture \ -ltwoPhaseProperties \ -linterfaceProperties \ -lcompressibleTwoPhaseChangeModels \ - -lmomentumTransportModels \ - -lcompressibleMomentumTransportModels \ -lcompressibleInterPhaseTransportModel \ -lfiniteVolume \ -lfvModels \ -lfvConstraints \ - -lmeshTools + -lmeshTools \ + -lsampling diff --git a/applications/solvers/multiphase/compressibleInterFoam/VoFClouds/Make/files b/applications/solvers/modules/fluid/compressibleVoF/VoFClouds/Make/files similarity index 100% rename from applications/solvers/multiphase/compressibleInterFoam/VoFClouds/Make/files rename to applications/solvers/modules/fluid/compressibleVoF/VoFClouds/Make/files diff --git a/applications/solvers/multiphase/compressibleInterFoam/VoFClouds/Make/options b/applications/solvers/modules/fluid/compressibleVoF/VoFClouds/Make/options similarity index 100% rename from applications/solvers/multiphase/compressibleInterFoam/VoFClouds/Make/options rename to applications/solvers/modules/fluid/compressibleVoF/VoFClouds/Make/options diff --git a/applications/solvers/multiphase/compressibleInterFoam/VoFClouds/VoFClouds.C b/applications/solvers/modules/fluid/compressibleVoF/VoFClouds/VoFClouds.C similarity index 100% rename from applications/solvers/multiphase/compressibleInterFoam/VoFClouds/VoFClouds.C rename to applications/solvers/modules/fluid/compressibleVoF/VoFClouds/VoFClouds.C diff --git a/applications/solvers/multiphase/compressibleInterFoam/VoFClouds/VoFClouds.H b/applications/solvers/modules/fluid/compressibleVoF/VoFClouds/VoFClouds.H similarity index 100% rename from applications/solvers/multiphase/compressibleInterFoam/VoFClouds/VoFClouds.H rename to applications/solvers/modules/fluid/compressibleVoF/VoFClouds/VoFClouds.H diff --git a/applications/solvers/multiphase/compressibleInterFoam/VoFSolidificationMeltingSource/VoFSolidificationMeltingSource.C b/applications/solvers/modules/fluid/compressibleVoF/VoFSolidificationMeltingSource/VoFSolidificationMeltingSource.C similarity index 100% rename from applications/solvers/multiphase/compressibleInterFoam/VoFSolidificationMeltingSource/VoFSolidificationMeltingSource.C rename to applications/solvers/modules/fluid/compressibleVoF/VoFSolidificationMeltingSource/VoFSolidificationMeltingSource.C diff --git a/applications/solvers/multiphase/compressibleInterFoam/VoFSolidificationMeltingSource/VoFSolidificationMeltingSource.H b/applications/solvers/modules/fluid/compressibleVoF/VoFSolidificationMeltingSource/VoFSolidificationMeltingSource.H similarity index 100% rename from applications/solvers/multiphase/compressibleInterFoam/VoFSolidificationMeltingSource/VoFSolidificationMeltingSource.H rename to applications/solvers/modules/fluid/compressibleVoF/VoFSolidificationMeltingSource/VoFSolidificationMeltingSource.H diff --git a/applications/solvers/multiphase/compressibleInterFoam/VoFSurfaceFilm/Make/files b/applications/solvers/modules/fluid/compressibleVoF/VoFSurfaceFilm/Make/files similarity index 100% rename from applications/solvers/multiphase/compressibleInterFoam/VoFSurfaceFilm/Make/files rename to applications/solvers/modules/fluid/compressibleVoF/VoFSurfaceFilm/Make/files diff --git a/applications/solvers/multiphase/compressibleInterFoam/VoFSurfaceFilm/Make/options b/applications/solvers/modules/fluid/compressibleVoF/VoFSurfaceFilm/Make/options similarity index 100% rename from applications/solvers/multiphase/compressibleInterFoam/VoFSurfaceFilm/Make/options rename to applications/solvers/modules/fluid/compressibleVoF/VoFSurfaceFilm/Make/options diff --git a/applications/solvers/multiphase/compressibleInterFoam/VoFSurfaceFilm/VoFPatchTransfer/VoFPatchTransfer.C b/applications/solvers/modules/fluid/compressibleVoF/VoFSurfaceFilm/VoFPatchTransfer/VoFPatchTransfer.C similarity index 99% rename from applications/solvers/multiphase/compressibleInterFoam/VoFSurfaceFilm/VoFPatchTransfer/VoFPatchTransfer.C rename to applications/solvers/modules/fluid/compressibleVoF/VoFSurfaceFilm/VoFPatchTransfer/VoFPatchTransfer.C index ebdb712320..57c95c7e9d 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/VoFSurfaceFilm/VoFPatchTransfer/VoFPatchTransfer.C +++ b/applications/solvers/modules/fluid/compressibleVoF/VoFSurfaceFilm/VoFPatchTransfer/VoFPatchTransfer.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/applications/solvers/multiphase/compressibleInterFoam/VoFSurfaceFilm/VoFPatchTransfer/VoFPatchTransfer.H b/applications/solvers/modules/fluid/compressibleVoF/VoFSurfaceFilm/VoFPatchTransfer/VoFPatchTransfer.H similarity index 98% rename from applications/solvers/multiphase/compressibleInterFoam/VoFSurfaceFilm/VoFPatchTransfer/VoFPatchTransfer.H rename to applications/solvers/modules/fluid/compressibleVoF/VoFSurfaceFilm/VoFPatchTransfer/VoFPatchTransfer.H index 0d022ecddb..4c2249838f 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/VoFSurfaceFilm/VoFPatchTransfer/VoFPatchTransfer.H +++ b/applications/solvers/modules/fluid/compressibleVoF/VoFSurfaceFilm/VoFPatchTransfer/VoFPatchTransfer.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/applications/solvers/multiphase/compressibleInterFoam/VoFSurfaceFilm/VoFSurfaceFilm.C b/applications/solvers/modules/fluid/compressibleVoF/VoFSurfaceFilm/VoFSurfaceFilm.C similarity index 100% rename from applications/solvers/multiphase/compressibleInterFoam/VoFSurfaceFilm/VoFSurfaceFilm.C rename to applications/solvers/modules/fluid/compressibleVoF/VoFSurfaceFilm/VoFSurfaceFilm.C diff --git a/applications/solvers/multiphase/compressibleInterFoam/VoFSurfaceFilm/VoFSurfaceFilm.H b/applications/solvers/modules/fluid/compressibleVoF/VoFSurfaceFilm/VoFSurfaceFilm.H similarity index 100% rename from applications/solvers/multiphase/compressibleInterFoam/VoFSurfaceFilm/VoFSurfaceFilm.H rename to applications/solvers/modules/fluid/compressibleVoF/VoFSurfaceFilm/VoFSurfaceFilm.H diff --git a/applications/solvers/multiphase/compressibleInterFoam/VoFTurbulenceDamping/Make/files b/applications/solvers/modules/fluid/compressibleVoF/VoFTurbulenceDamping/Make/files similarity index 100% rename from applications/solvers/multiphase/compressibleInterFoam/VoFTurbulenceDamping/Make/files rename to applications/solvers/modules/fluid/compressibleVoF/VoFTurbulenceDamping/Make/files diff --git a/applications/solvers/multiphase/compressibleInterFoam/VoFTurbulenceDamping/Make/options b/applications/solvers/modules/fluid/compressibleVoF/VoFTurbulenceDamping/Make/options similarity index 100% rename from applications/solvers/multiphase/compressibleInterFoam/VoFTurbulenceDamping/Make/options rename to applications/solvers/modules/fluid/compressibleVoF/VoFTurbulenceDamping/Make/options diff --git a/applications/solvers/multiphase/compressibleInterFoam/VoFTurbulenceDamping/VoFTurbulenceDamping.C b/applications/solvers/modules/fluid/compressibleVoF/VoFTurbulenceDamping/VoFTurbulenceDamping.C similarity index 100% rename from applications/solvers/multiphase/compressibleInterFoam/VoFTurbulenceDamping/VoFTurbulenceDamping.C rename to applications/solvers/modules/fluid/compressibleVoF/VoFTurbulenceDamping/VoFTurbulenceDamping.C diff --git a/applications/solvers/multiphase/compressibleInterFoam/VoFTurbulenceDamping/VoFTurbulenceDamping.H b/applications/solvers/modules/fluid/compressibleVoF/VoFTurbulenceDamping/VoFTurbulenceDamping.H similarity index 100% rename from applications/solvers/multiphase/compressibleInterFoam/VoFTurbulenceDamping/VoFTurbulenceDamping.H rename to applications/solvers/modules/fluid/compressibleVoF/VoFTurbulenceDamping/VoFTurbulenceDamping.H diff --git a/applications/solvers/modules/fluid/compressibleVoF/alphaPredictor.C b/applications/solvers/modules/fluid/compressibleVoF/alphaPredictor.C new file mode 100644 index 0000000000..e03deac98a --- /dev/null +++ b/applications/solvers/modules/fluid/compressibleVoF/alphaPredictor.C @@ -0,0 +1,110 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "compressibleVoF.H" +#include "interfaceCompression.H" +#include "CMULES.H" +#include "localEulerDdtScheme.H" +#include "CrankNicolsonDdtScheme.H" +#include "subCycle.H" + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::solvers::compressibleVoF::alphaPredictor() +{ + #include "alphaControls.H" + + volScalarField& alpha2(mixture.alpha2()); + + const volScalarField& rho1 = mixture.thermo1().rho(); + const volScalarField& rho2 = mixture.thermo2().rho(); + + tmp talphaPhi1(alphaPhi1); + + if (nAlphaSubCycles > 1) + { + dimensionedScalar totalDeltaT = runTime.deltaT(); + + talphaPhi1 = new surfaceScalarField + ( + IOobject + ( + "alphaPhi1", + runTime.timeName(), + mesh + ), + mesh, + dimensionedScalar(alphaPhi1.dimensions(), 0) + ); + + surfaceScalarField rhoPhiSum + ( + IOobject + ( + "rhoPhiSum", + runTime.timeName(), + mesh + ), + mesh, + dimensionedScalar(rhoPhi.dimensions(), 0) + ); + + tmp trSubDeltaT; + + if (LTS) + { + trSubDeltaT = + fv::localEulerDdt::localRSubDeltaT(mesh, nAlphaSubCycles); + } + + for + ( + subCycle alphaSubCycle(alpha1, nAlphaSubCycles); + !(++alphaSubCycle).end(); + ) + { + #include "alphaEqn.H" + talphaPhi1.ref() += (runTime.deltaT()/totalDeltaT)*alphaPhi1; + rhoPhiSum += (runTime.deltaT()/totalDeltaT)*rhoPhi; + } + + alphaPhi1 = talphaPhi1(); + rhoPhi = rhoPhiSum; + } + else + { + #include "alphaEqn.H" + } + + contErr = + ( + fvc::ddt(rho)()() + fvc::div(rhoPhi)()() + - (fvModels().source(alpha1, rho1)&rho1)() + - (fvModels().source(alpha2, rho2)&rho2)() + ); +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleInterFoam/alphaSuSp.H b/applications/solvers/modules/fluid/compressibleVoF/alphaSuSp.H similarity index 100% rename from applications/solvers/multiphase/compressibleInterFoam/alphaSuSp.H rename to applications/solvers/modules/fluid/compressibleVoF/alphaSuSp.H diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterPhaseTransportModel/Make/files b/applications/solvers/modules/fluid/compressibleVoF/compressibleInterPhaseTransportModel/Make/files similarity index 100% rename from applications/solvers/multiphase/compressibleInterFoam/compressibleInterPhaseTransportModel/Make/files rename to applications/solvers/modules/fluid/compressibleVoF/compressibleInterPhaseTransportModel/Make/files diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterPhaseTransportModel/Make/options b/applications/solvers/modules/fluid/compressibleVoF/compressibleInterPhaseTransportModel/Make/options similarity index 100% rename from applications/solvers/multiphase/compressibleInterFoam/compressibleInterPhaseTransportModel/Make/options rename to applications/solvers/modules/fluid/compressibleVoF/compressibleInterPhaseTransportModel/Make/options diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterPhaseTransportModel/compressibleInterPhaseTransportModel.C b/applications/solvers/modules/fluid/compressibleVoF/compressibleInterPhaseTransportModel/compressibleInterPhaseTransportModel.C similarity index 98% rename from applications/solvers/multiphase/compressibleInterFoam/compressibleInterPhaseTransportModel/compressibleInterPhaseTransportModel.C rename to applications/solvers/modules/fluid/compressibleVoF/compressibleInterPhaseTransportModel/compressibleInterPhaseTransportModel.C index 988d640bfa..8b0aeb2951 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterPhaseTransportModel/compressibleInterPhaseTransportModel.C +++ b/applications/solvers/modules/fluid/compressibleVoF/compressibleInterPhaseTransportModel/compressibleInterPhaseTransportModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterPhaseTransportModel/compressibleInterPhaseTransportModel.H b/applications/solvers/modules/fluid/compressibleVoF/compressibleInterPhaseTransportModel/compressibleInterPhaseTransportModel.H similarity index 98% rename from applications/solvers/multiphase/compressibleInterFoam/compressibleInterPhaseTransportModel/compressibleInterPhaseTransportModel.H rename to applications/solvers/modules/fluid/compressibleVoF/compressibleInterPhaseTransportModel/compressibleInterPhaseTransportModel.H index 405d5d0d47..6ee5bf48cb 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterPhaseTransportModel/compressibleInterPhaseTransportModel.H +++ b/applications/solvers/modules/fluid/compressibleVoF/compressibleInterPhaseTransportModel/compressibleInterPhaseTransportModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleTwoPhaseMixture/Make/files b/applications/solvers/modules/fluid/compressibleVoF/compressibleTwoPhaseMixture/Make/files similarity index 100% rename from applications/solvers/multiphase/compressibleInterFoam/compressibleTwoPhaseMixture/Make/files rename to applications/solvers/modules/fluid/compressibleVoF/compressibleTwoPhaseMixture/Make/files diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleTwoPhaseMixture/Make/options b/applications/solvers/modules/fluid/compressibleVoF/compressibleTwoPhaseMixture/Make/options similarity index 100% rename from applications/solvers/multiphase/compressibleInterFoam/compressibleTwoPhaseMixture/Make/options rename to applications/solvers/modules/fluid/compressibleVoF/compressibleTwoPhaseMixture/Make/options diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleTwoPhaseMixture/compressibleTwoPhaseMixture.C b/applications/solvers/modules/fluid/compressibleVoF/compressibleTwoPhaseMixture/compressibleTwoPhaseMixture.C similarity index 98% rename from applications/solvers/multiphase/compressibleInterFoam/compressibleTwoPhaseMixture/compressibleTwoPhaseMixture.C rename to applications/solvers/modules/fluid/compressibleVoF/compressibleTwoPhaseMixture/compressibleTwoPhaseMixture.C index c3b72b4fe8..a3f6cb4956 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleTwoPhaseMixture/compressibleTwoPhaseMixture.C +++ b/applications/solvers/modules/fluid/compressibleVoF/compressibleTwoPhaseMixture/compressibleTwoPhaseMixture.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleTwoPhaseMixture/compressibleTwoPhaseMixture.H b/applications/solvers/modules/fluid/compressibleVoF/compressibleTwoPhaseMixture/compressibleTwoPhaseMixture.H similarity index 98% rename from applications/solvers/multiphase/compressibleInterFoam/compressibleTwoPhaseMixture/compressibleTwoPhaseMixture.H rename to applications/solvers/modules/fluid/compressibleVoF/compressibleTwoPhaseMixture/compressibleTwoPhaseMixture.H index 4b9284c1a7..fb5689ebcd 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleTwoPhaseMixture/compressibleTwoPhaseMixture.H +++ b/applications/solvers/modules/fluid/compressibleVoF/compressibleTwoPhaseMixture/compressibleTwoPhaseMixture.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/applications/solvers/modules/fluid/compressibleVoF/compressibleVoF.C b/applications/solvers/modules/fluid/compressibleVoF/compressibleVoF.C new file mode 100644 index 0000000000..bba8065dd7 --- /dev/null +++ b/applications/solvers/modules/fluid/compressibleVoF/compressibleVoF.C @@ -0,0 +1,368 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "compressibleVoF.H" +#include "localEulerDdtScheme.H" +#include "hydrostaticInitialisation.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solvers +{ + defineTypeNameAndDebug(compressibleVoF, 0); + addToRunTimeSelectionTable(solver, compressibleVoF, fvMesh); +} +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::solvers::compressibleVoF::correctCoNum() +{ + fluidSolver::correctCoNum(phi); + + alphaCoNum = 0; + scalar meanAlphaCoNum = 0; + + if (mesh.nInternalFaces()) + { + const scalarField sumPhi + ( + mixture.nearInterface()().primitiveField() + *fvc::surfaceSum(mag(phi))().primitiveField() + ); + + alphaCoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue(); + + meanAlphaCoNum = + 0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue(); + } + + Info<< "Interface Courant Number mean: " << meanAlphaCoNum + << " max: " << alphaCoNum << endl; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::solvers::compressibleVoF::compressibleVoF(fvMesh& mesh) +: + fluidSolver(mesh), + + U + ( + IOobject + ( + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ), + + phi + ( + IOobject + ( + "phi", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + linearInterpolate(U) & mesh.Sf() + ), + + mixture(U, phi), + + alpha1(mixture.alpha1()), + + alphaRestart + ( + typeIOobject + ( + IOobject::groupName("alphaPhi", alpha1.group()), + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ).headerOk() + ), + + buoyancy(mesh), + + p_rgh(buoyancy.p_rgh), + + rho(mixture.rho()), + + dgdt + ( + IOobject + ( + "dgdt", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + alpha1*fvc::div(phi) + ), + + pressureReference + ( + mixture.p(), + p_rgh, + pimple.dict(), + false + ), + + pMin + ( + "pMin", + dimPressure, + mixture + ), + + rhoPhi + ( + IOobject + ( + "rhoPhi", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + fvc::interpolate(rho)*phi + ), + + alphaPhi1 + ( + IOobject + ( + IOobject::groupName("alphaPhi", alpha1.group()), + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + phi*fvc::interpolate(alpha1) + ), + + K("K", 0.5*magSqr(U)), + + turbulence + ( + rho, + U, + phi, + rhoPhi, + alphaPhi1, + mixture + ), + + phaseChangePtr + ( + compressible::twoPhaseChangeModel::New(mixture) + ), + + phaseChange(*phaseChangePtr), + + MRF(mesh) +{ + // Read the controls + read(); + + mesh.schemes().setFluxRequired(p_rgh.name()); + mesh.schemes().setFluxRequired(alpha1.name()); + + if (alphaRestart) + { + Info << "Restarting alpha" << endl; + } + + if (mesh.dynamic()) + { + Info<< "Constructing face momentum Uf" << endl; + + Uf = new surfaceVectorField + ( + IOobject + ( + "Uf", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + fvc::interpolate(U) + ); + } + + if (transient()) + { + correctCoNum(); + } + else if (LTS) + { + Info<< "Using LTS" << endl; + + trDeltaT = tmp + ( + new volScalarField + ( + IOobject + ( + fv::localEulerDdt::rDeltaTName, + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedScalar(dimless/dimTime, 1), + extrapolatedCalculatedFvPatchScalarField::typeName + ) + ); + } + + if (correctPhi) + { + rAU = new volScalarField + ( + IOobject + ( + "rAU", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedScalar(dimTime/dimDensity, 1) + ); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::solvers::compressibleVoF::~compressibleVoF() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::scalar Foam::solvers::compressibleVoF::maxDeltaT() const +{ + const scalar maxAlphaCo + ( + runTime.controlDict().lookup("maxAlphaCo") + ); + + const scalar deltaT = fluidSolver::maxDeltaT(); + + if (alphaCoNum > small) + { + return min + ( + deltaT, + maxAlphaCo/(alphaCoNum + small)*runTime.deltaTValue() + ); + } + else + { + return deltaT; + } +} + + +void Foam::solvers::compressibleVoF::prePredictor() +{ + fvModels().correct(); + alphaPredictor(); + turbulence.correctPhasePhi(); +} + + +void Foam::solvers::compressibleVoF::preSolve() +{ + // Read the controls + read(); + + if (transient()) + { + correctCoNum(); + } + else if (LTS) + { + setRDeltaT(); + } + + // Store divU from the previous mesh so that it can be mapped + // and used in correctPhi to ensure the corrected phi has the + // same divergence + if (correctPhi && mesh.topoChanged()) + { + // Construct and register divU for mapping + divU = new volScalarField + ( + "divU0", + fvc::div(fvc::absolute(phi, U)) + ); + } + + fvModels().preUpdateMesh(); + + // Update the mesh for topology change, mesh to mesh mapping + mesh.update(); +} + + +void Foam::solvers::compressibleVoF::momentumTransportCorrector() +{ + if (pimple.transportCorr()) + { + turbulence.correct(); + } +} + + +void Foam::solvers::compressibleVoF::thermophysicalTransportCorrector() +{} + + +void Foam::solvers::compressibleVoF::postSolve() +{ + divU.clear(); +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/compressibleVoF/compressibleVoF.H b/applications/solvers/modules/fluid/compressibleVoF/compressibleVoF.H new file mode 100644 index 0000000000..256f378e9c --- /dev/null +++ b/applications/solvers/modules/fluid/compressibleVoF/compressibleVoF.H @@ -0,0 +1,272 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::solvers::compressibleVoF + +Description + Solver module for for 2 compressible, non-isothermal immiscible fluids + using a VOF (volume of fluid) phase-fraction based interface capturing + approach, with optional mesh motion and mesh topology changes including + adaptive re-meshing. + + The momentum and other fluid properties are of the "mixture" and a single + momentum equation is solved. + + Either mixture or two-phase transport modelling may be selected. In the + mixture approach a single laminar, RAS or LES model is selected to model the + momentum stress. In the Euler-Euler two-phase approach separate laminar, + RAS or LES selected models are selected for each of the phases. + + Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and + pseudo-transient and steady simulations. + + Optional fvModels and fvConstraints are provided to enhance the simulation + in many ways including adding various sources, Lagrangian + particles, surface film etc. and constraining or limiting the solution. + +SourceFiles + compressibleVoF.C + +See also + Foam::solvers::fluidSolver + Foam::solvers::incompressibleFluid + +\*---------------------------------------------------------------------------*/ + +#ifndef compressibleVoF_H +#define compressibleVoF_H + +#include "fluidSolver.H" +#include "compressibleInterPhaseTransportModel.H" +#include "twoPhaseChangeModel.H" +#include "buoyancy.H" +#include "pressureReference.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace solvers +{ + +/*---------------------------------------------------------------------------*\ + Class compressibleVoF Declaration +\*---------------------------------------------------------------------------*/ + +class compressibleVoF +: + public fluidSolver +{ + +protected: + + // Kinematic properties + + //- Velocity field + volVectorField U; + + //- Volumetric-flux field + surfaceScalarField phi; + + + // Phase properties + + //- The compressible two-phase mixture + compressibleTwoPhaseMixture mixture; + + //- Reference to the primary phase-fraction + volScalarField& alpha1; + + //- Switch indicating if this is a restart + bool alphaRestart; + + scalar alphaCoNum; + + + // Thermophysical properties + + //- Buoyancy force + solvers::buoyancy buoyancy; + + //- Reference to the buoyant pressure for buoyant cases + // otherwise to the pressure + volScalarField& p_rgh; + + //- Reference to the mixture continuity density field + const volScalarField& rho; + + //- Compressibility source + volScalarField::Internal dgdt; + + + // Pressure reference + + //- Pressure reference + Foam::pressureReference pressureReference; + + //- Minimum pressure + dimensionedScalar pMin; + + + // Kinematic properties + + //- Mass flux field + surfaceScalarField rhoPhi; + + // Phase-1 volumetric flux + surfaceScalarField alphaPhi1; + + //- Kinetic energy field + // Used in the energy equation + volScalarField K; + + + // Momentum transport + + //- Momentum transport model + compressibleInterPhaseTransportModel turbulence; + + autoPtr phaseChangePtr; + + compressible::twoPhaseChangeModel& phaseChange; + + + // Optional models + + //- MRF zone list + IOMRFZoneList MRF; + + + // Cached temporary fields + + tmp rAU; + + tmp contErr; + + //- MULES Correction + tmp talphaPhi1Corr0; + + //- Pointer to the surface momentum field + // used to recreate the flux after mesh-change + autoPtr Uf; + + //- Pointer to the momentum divergence field + // used in correctPhi to ensure the corrected phi has the + // same divergence + autoPtr divU; + + //- Optional LTS reciprocal time-step field + tmp trDeltaT; + + //- Cached momentum matrix + // shared between the momentum predictor and pressure corrector + tmp tUEqn; + + +private: + + // Private Member Functions + + //- Set rDeltaT for LTS + virtual void setRDeltaT(); + + //- Correct the cached Courant numbers + void correctCoNum(); + + //- Solve for the phase-fractions + void alphaPredictor(); + + +public: + + //- Runtime type information + TypeName("compressibleVoF"); + + + // Constructors + + //- Construct from region mesh + compressibleVoF(fvMesh& mesh); + + //- Disallow default bitwise copy construction + compressibleVoF(const compressibleVoF&) = delete; + + + //- Destructor + virtual ~compressibleVoF(); + + + // Member Functions + + //- Return the current maximum time-step for stable solution + virtual scalar maxDeltaT() const; + + //- 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 transport modelling + // Newtonian, non-Newtonian or turbulent + virtual void momentumTransportCorrector(); + + //- Correct the thermophysical transport modelling + virtual void thermophysicalTransportCorrector(); + + //- Called after the PIMPLE loop at the end of the time-step + virtual void postSolve(); + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const compressibleVoF&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace solvers +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/compressibleVoF/momentumPredictor.C b/applications/solvers/modules/fluid/compressibleVoF/momentumPredictor.C new file mode 100644 index 0000000000..970c1ada83 --- /dev/null +++ b/applications/solvers/modules/fluid/compressibleVoF/momentumPredictor.C @@ -0,0 +1,69 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "compressibleVoF.H" + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::solvers::compressibleVoF::momentumPredictor() +{ + tUEqn = + ( + fvm::ddt(rho, U) + fvm::div(rhoPhi, U) - fvm::Sp(contErr(), U) + + MRF.DDt(rho, U) + + turbulence.divDevTau(U) + == + fvModels().source(rho, U) + ); + fvVectorMatrix& UEqn = tUEqn.ref(); + + UEqn.relax(); + + fvConstraints().constrain(UEqn); + + if (pimple.momentumPredictor()) + { + solve + ( + UEqn + == + fvc::reconstruct + ( + ( + mixture.surfaceTensionForce() + - buoyancy.ghf*fvc::snGrad(rho) + - fvc::snGrad(p_rgh) + ) * mesh.magSf() + ) + ); + + fvConstraints().constrain(U); + + K = 0.5*magSqr(U); + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/compressibleVoF/moveMesh.C b/applications/solvers/modules/fluid/compressibleVoF/moveMesh.C new file mode 100644 index 0000000000..1c22912427 --- /dev/null +++ b/applications/solvers/modules/fluid/compressibleVoF/moveMesh.C @@ -0,0 +1,93 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "compressibleVoF.H" +#include "CorrectPhi.H" + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +bool Foam::solvers::compressibleVoF::moveMesh() +{ + if (pimple.firstIter() || pimple.moveMeshOuterCorrectors()) + { + if (correctPhi && !divU.valid()) + { + // Construct and register divU for correctPhi + divU = new volScalarField + ( + "divU0", + fvc::div(fvc::absolute(phi, U)) + ); + } + + // Move the mesh + mesh.move(); + + if (mesh.changing()) + { + buoyancy.moveMesh(); + + MRF.update(); + + if (correctPhi) + { + // Calculate absolute flux + // from the mapped surface velocity + phi = mesh.Sf() & Uf(); + + correctUphiBCs(U, phi, true); + + CorrectPhi + ( + phi, + U, + p_rgh, + surfaceScalarField("rAUf", fvc::interpolate(rAU())), + divU(), + pressureReference, + pimple + ); + + // Make the fluxes relative to the mesh motion + fvc::makeRelative(phi, U); + } + + mixture.correct(); + + meshCourantNo(); + + divU.clear(); + + return true; + } + + divU.clear(); + } + + return false; +} + + +// ************************************************************************* // diff --git a/applications/solvers/modules/fluid/compressibleVoF/pressureCorrector.C b/applications/solvers/modules/fluid/compressibleVoF/pressureCorrector.C new file mode 100644 index 0000000000..95db6cc076 --- /dev/null +++ b/applications/solvers/modules/fluid/compressibleVoF/pressureCorrector.C @@ -0,0 +1,222 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "compressibleVoF.H" +#include "constrainHbyA.H" +#include "constrainPressure.H" +#include "adjustPhi.H" + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::solvers::compressibleVoF::pressureCorrector() +{ + volScalarField& p = mixture.p(); + + const volScalarField& alpha2(mixture.alpha2()); + + const volScalarField& rho1 = mixture.rho1(); + const volScalarField& rho2 = mixture.rho2(); + + const volScalarField& psi1 = mixture.thermo1().psi(); + const volScalarField& psi2 = mixture.thermo2().psi(); + + fvVectorMatrix& UEqn = tUEqn.ref(); + + if (rAU.valid()) + { + rAU.ref() = 1.0/UEqn.A(); + } + else + { + rAU = 1.0/UEqn.A(); + } + + surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU())); + + const surfaceScalarField alphaPhi2("alphaPhi2", phi - alphaPhi1); + + while (pimple.correct()) + { + volVectorField HbyA(constrainHbyA(rAU()*UEqn.H(), U, p_rgh)); + surfaceScalarField phiHbyA + ( + "phiHbyA", + fvc::flux(HbyA) + + MRF.zeroFilter(fvc::interpolate(rho*rAU())*fvc::ddtCorr(U, phi, Uf)) + ); + + MRF.makeRelative(phiHbyA); + + surfaceScalarField phig + ( + ( + mixture.surfaceTensionForce() + - buoyancy.ghf*fvc::snGrad(rho) + )*rAUf*mesh.magSf() + ); + + phiHbyA += phig; + + // Update the pressure BCs to ensure flux consistency + constrainPressure(p_rgh, U, phiHbyA, rAUf, MRF); + + // Cache the phase change pressure source + fvScalarMatrix Sp_rgh(phaseChange.Sp_rgh(rho, buoyancy.gh, p_rgh)); + + // Make the fluxes relative to the mesh motion + fvc::makeRelative(phiHbyA, U); + + tmp p_rghEqnComp1; + tmp p_rghEqnComp2; + + if (pimple.transonic()) + { + const surfaceScalarField rho1f(fvc::interpolate(rho1)); + const surfaceScalarField rho2f(fvc::interpolate(rho2)); + + surfaceScalarField phid1("phid1", fvc::interpolate(psi1)*phi); + surfaceScalarField phid2("phid2", fvc::interpolate(psi2)*phi); + + p_rghEqnComp1 = + ( + (fvc::ddt(alpha1, rho1) + fvc::div(alphaPhi1*rho1f))/rho1 + - fvc::ddt(alpha1) - fvc::div(alphaPhi1) + + (alpha1/rho1) + *correction + ( + psi1*fvm::ddt(p_rgh) + + fvm::div(phid1, p_rgh) - fvm::Sp(fvc::div(phid1), p_rgh) + ) + ); + + p_rghEqnComp2 = + ( + (fvc::ddt(alpha2, rho2) + fvc::div(alphaPhi2*rho2f))/rho2 + - fvc::ddt(alpha2) - fvc::div(alphaPhi2) + + (alpha2/rho2) + *correction + ( + psi2*fvm::ddt(p_rgh) + + fvm::div(phid2, p_rgh) - fvm::Sp(fvc::div(phid2), p_rgh) + ) + ); + } + else + { + const surfaceScalarField rho1f(fvc::interpolate(rho1)); + const surfaceScalarField rho2f(fvc::interpolate(rho2)); + + p_rghEqnComp1 = + ( + (fvc::ddt(alpha1, rho1) + fvc::div(alphaPhi1*rho1f))/rho1 + - fvc::ddt(alpha1) - fvc::div(alphaPhi1) + + (alpha1*psi1/rho1)*correction(fvm::ddt(p_rgh)) + ); + + p_rghEqnComp2 = + ( + (fvc::ddt(alpha2, rho2) + fvc::div(alphaPhi2*rho2f))/rho2 + - fvc::ddt(alpha2) - fvc::div(alphaPhi2) + + (alpha2*psi2/rho2)*correction(fvm::ddt(p_rgh)) + ); + } + + if (mesh.moving()) + { + p_rghEqnComp1.ref() += fvc::div(mesh.phi())*alpha1; + p_rghEqnComp2.ref() += fvc::div(mesh.phi())*alpha2; + } + + p_rghEqnComp1.ref() *= pos(alpha1); + p_rghEqnComp2.ref() *= pos(alpha2); + + p_rghEqnComp1.ref() -= + (fvModels().source(alpha1, mixture.thermo1().rho())&rho1)/rho1; + p_rghEqnComp2.ref() -= + (fvModels().source(alpha2, mixture.thermo2().rho())&rho2)/rho2; + + if (pimple.transonic()) + { + p_rghEqnComp1.ref().relax(); + p_rghEqnComp2.ref().relax(); + } + + // Cache p_rgh prior to solve for density update + volScalarField p_rgh_0(p_rgh); + + while (pimple.correctNonOrthogonal()) + { + fvScalarMatrix p_rghEqnIncomp + ( + fvc::div(phiHbyA) - fvm::laplacian(rAUf, p_rgh) + == Sp_rgh + ); + + solve + ( + p_rghEqnComp1() + p_rghEqnComp2() + p_rghEqnIncomp + ); + + if (pimple.finalNonOrthogonalIter()) + { + dgdt = + ( + alpha1*(p_rghEqnComp2 & p_rgh) + - alpha2*(p_rghEqnComp1 & p_rgh) + ); + + phi = phiHbyA + p_rghEqnIncomp.flux(); + + p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*buoyancy.gh, pMin); + p_rgh = p - (alpha1*rho1 + alpha2*rho2)*buoyancy.gh; + p_rgh.correctBoundaryConditions(); + + U = HbyA + + rAU()*fvc::reconstruct((phig + p_rghEqnIncomp.flux())/rAUf); + U.correctBoundaryConditions(); + fvConstraints().constrain(U); + } + } + + // Correct Uf if the mesh is moving + fvc::correctUf(Uf, U, fvc::absolute(phi, U), MRF); + + // Update densities from change in p_rgh + mixture.thermo1().correctRho(psi1*(p_rgh - p_rgh_0)); + mixture.thermo2().correctRho(psi2*(p_rgh - p_rgh_0)); + mixture.correct(); + + // Correct p_rgh for consistency with p and the updated densities + p_rgh = p - rho*buoyancy.gh; + p_rgh.correctBoundaryConditions(); + } + + K = 0.5*magSqr(U); + + tUEqn.clear(); +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/compressibleInterFoam/rhofs.H b/applications/solvers/modules/fluid/compressibleVoF/rhofs.H similarity index 100% rename from applications/solvers/multiphase/compressibleInterFoam/rhofs.H rename to applications/solvers/modules/fluid/compressibleVoF/rhofs.H diff --git a/applications/solvers/modules/fluid/compressibleVoF/setRDeltaT.C b/applications/solvers/modules/fluid/compressibleVoF/setRDeltaT.C new file mode 100644 index 0000000000..13de7a4783 --- /dev/null +++ b/applications/solvers/modules/fluid/compressibleVoF/setRDeltaT.C @@ -0,0 +1,181 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "compressibleVoF.H" +#include "fvcSmooth.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::solvers::compressibleVoF::setRDeltaT() +{ + volScalarField& rDeltaT = trDeltaT.ref(); + + const dictionary& pimpleDict = pimple.dict(); + + const scalar maxCo + ( + pimpleDict.lookupOrDefault("maxCo", 0.9) + ); + + const scalar maxAlphaCo + ( + pimpleDict.lookupOrDefault("maxAlphaCo", 0.2) + ); + + const scalar rDeltaTSmoothingCoeff + ( + pimpleDict.lookupOrDefault("rDeltaTSmoothingCoeff", 0.1) + ); + + const label nAlphaSpreadIter + ( + pimpleDict.lookupOrDefault