cavitatingFoam: Merged with cavitatingDyMFoam

cavitatingFoam can now run with static or dynamic meshes selected in the
constant/dynamicMeshDict dictionary.
This commit is contained in:
Henry Weller
2018-07-04 17:03:16 +01:00
parent 42cafa62b8
commit 648989d50c
14 changed files with 45 additions and 269 deletions

View File

@ -7,6 +7,7 @@ EXE_INC = \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/barotropicCompressibilityModel/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \
@ -14,5 +15,6 @@ EXE_LIBS = \
-lincompressibleTurbulenceModels \
-lbarotropicCompressibilityModel \
-lfiniteVolume \
-ldynamicFvMesh \
-lfvOptions \
-lmeshTools

View File

@ -1,3 +0,0 @@
cavitatingDyMFoam.C
EXE = $(FOAM_APPBIN)/cavitatingDyMFoam

View File

@ -1,23 +0,0 @@
EXE_INC = \
-I.. \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/barotropicCompressibilityModel/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude
EXE_LIBS = \
-lturbulenceModels \
-lincompressibleTurbulenceModels \
-lbarotropicCompressibilityModel \
-lfiniteVolume \
-lfvOptions \
-ldynamicMesh \
-ldynamicFvMesh \
-lmeshTools

View File

@ -1,125 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2018 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 <http://www.gnu.org/licenses/>.
Application
cavitatingFoam
Description
Transient cavitation code based on the homogeneous equilibrium model
from which the compressibility of the liquid/vapour "mixture" is obtained,
with optional mesh motion and mesh topology changes.
Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "dynamicFvMesh.H"
#include "barotropicCompressibilityModel.H"
#include "incompressibleTwoPhaseMixture.H"
#include "turbulentTransportModel.H"
#include "CorrectPhi.H"
#include "pimpleControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "postProcess.H"
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createDynamicFvMesh.H"
#include "createControls.H"
#include "createFields.H"
#include "createUf.H"
#include "createPcorrTypes.H"
#include "CourantNo.H"
#include "setInitialDeltaT.H"
turbulence->validate();
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
while (runTime.run())
{
#include "readControls.H"
{
#include "CourantNo.H"
#include "setDeltaT.H"
runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl;
// Do any mesh changes
mesh.update();
if (mesh.changing() && correctPhi)
{
// Calculate absolute flux from the mapped surface velocity
phi = mesh.Sf() & Uf;
#include "correctPhi.H"
// Make the flux relative to the mesh motion
fvc::makeRelative(phi, U);
}
}
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
#include "rhoEqn.H"
#include "alphavPsi.H"
#include "UEqn.H"
// --- Pressure corrector loop
while (pimple.correct())
{
#include "pEqn.H"
}
if (pimple.turbCorr())
{
turbulence->correct();
}
}
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -1,6 +0,0 @@
#include "createDyMControls.H"
scalar maxAcousticCo
(
readScalar(runTime.controlDict().lookup("maxAcousticCo"))
);

View File

@ -1,88 +0,0 @@
{
if (pimple.nCorrPimple() == 1)
{
p =
(
rho
- alphal*rhol0
- ((alphav*psiv + alphal*psil) - psi)*pSat
)/psi;
}
surfaceScalarField rhof("rhof", fvc::interpolate(rho));
volScalarField rAU(1.0/UEqn.A());
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p));
phi = fvc::flux(HbyA)
+ rhorAUf*fvc::ddtCorr(U, Uf);
fvc::makeRelative(phi, U);
surfaceScalarField phiGradp(rhorAUf*mesh.magSf()*fvc::snGrad(p));
phi -= phiGradp/rhof;
volScalarField rho0(rho - psi*p);
while (pimple.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
fvc::ddt(rho)
+ psi*correction(fvm::ddt(p))
+ fvc::div(phi, rho)
+ fvc::div(phiGradp)
- fvm::laplacian(rhorAUf, p)
);
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
if (pimple.finalNonOrthogonalIter())
{
phi += (phiGradp + pEqn.flux())/rhof;
}
}
Info<< "Predicted p max-min : " << max(p).value()
<< " " << min(p).value() << endl;
rho == max(rho0 + psi*p, rhoMin);
#include "alphavPsi.H"
p =
(
rho
- alphal*rhol0
- ((alphav*psiv + alphal*psil) - psi)*pSat
)/psi;
p.correctBoundaryConditions();
Info<< "Phase-change corrected p max-min : " << max(p).value()
<< " " << min(p).value() << endl;
// Correct velocity
U = HbyA - rAU*fvc::grad(p);
// Remove the swirl component of velocity for "wedge" cases
if (pimple.dict().found("removeSwirl"))
{
label swirlCmpt(readLabel(pimple.dict().lookup("removeSwirl")));
Info<< "Removing swirl component-" << swirlCmpt << " of U" << endl;
U.field().replace(swirlCmpt, 0.0);
}
U.correctBoundaryConditions();
Info<< "max(U) " << max(mag(U)).value() << endl;
{
Uf = fvc::interpolate(U);
surfaceVectorField n(mesh.Sf()/mesh.magSf());
Uf += n*(phi/mesh.magSf() - (n & Uf));
}
}

View File

@ -1,3 +0,0 @@
#include "readDyMControls.H"
maxAcousticCo = readScalar(runTime.controlDict().lookup("maxAcousticCo"));

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2018 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -26,16 +26,19 @@ Application
Description
Transient cavitation code based on the homogeneous equilibrium model
from which the compressibility of the liquid/vapour "mixture" is obtained.
from which the compressibility of the liquid/vapour "mixture" is obtained,
with optional mesh motion and mesh topology changes.
Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "dynamicFvMesh.H"
#include "barotropicCompressibilityModel.H"
#include "incompressibleTwoPhaseMixture.H"
#include "turbulentTransportModel.H"
#include "CorrectPhi.H"
#include "pimpleControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -46,10 +49,11 @@ int main(int argc, char *argv[])
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createMesh.H"
#include "createControl.H"
#include "createDynamicFvMesh.H"
#include "createControls.H"
#include "createFields.H"
#include "createUfIfPresent.H"
#include "createPcorrTypes.H"
#include "CourantNo.H"
#include "setInitialDeltaT.H"
@ -62,11 +66,29 @@ int main(int argc, char *argv[])
while (runTime.run())
{
#include "readControls.H"
#include "CourantNo.H"
#include "setDeltaT.H"
runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl;
{
#include "CourantNo.H"
#include "setDeltaT.H"
runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl;
// Do any mesh changes
mesh.update();
if (mesh.changing() && correctPhi)
{
// Calculate absolute flux from the mapped surface velocity
phi = mesh.Sf() & Uf();
#include "correctPhi.H"
// Make the flux relative to the mesh motion
fvc::makeRelative(phi, U);
}
}
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())

View File

@ -1,4 +1,4 @@
#include "createTimeControls.H"
#include "createDyMControls.H"
scalar maxAcousticCo
(

View File

@ -15,19 +15,21 @@
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p));
phi = fvc::flux(HbyA)
+ rhorAUf*fvc::ddtCorr(U, phi);
phi = fvc::flux(HbyA) + rhorAUf*fvc::ddtCorr(U, phi, Uf);
fvc::makeRelative(phi, U);
surfaceScalarField phiGradp(rhorAUf*mesh.magSf()*fvc::snGrad(p));
phi -= phiGradp/rhof;
volScalarField rho0(rho - psi*p);
while (pimple.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
fvm::ddt(psi, p)
- (rhol0 + (psil - psiv)*pSat)*fvc::ddt(alphav) - pSat*fvc::ddt(psi)
fvc::ddt(rho)
+ psi*correction(fvm::ddt(p))
+ fvc::div(phi, rho)
+ fvc::div(phiGradp)
- fvm::laplacian(rhorAUf, p)
@ -44,13 +46,7 @@
Info<< "Predicted p max-min : " << max(p).value()
<< " " << min(p).value() << endl;
rho == max
(
psi*p
+ alphal*rhol0
+ ((alphav*psiv + alphal*psil) - psi)*pSat,
rhoMin
);
rho == max(rho0 + psi*p, rhoMin);
#include "alphavPsi.H"
@ -82,4 +78,7 @@
U.correctBoundaryConditions();
Info<< "max(U) " << max(mag(U)).value() << endl;
// Correct Uf if the mesh is moving
fvc::correctUf(Uf, U, phi);
}

View File

@ -1,3 +1,3 @@
#include "readTimeControls.H"
#include "readDyMControls.H"
maxAcousticCo = readScalar(runTime.controlDict().lookup("maxAcousticCo"));

1
bin/cavitatingDyMFoam Symbolic link
View File

@ -0,0 +1 @@
mergedDyM