Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
commit
0b1693a773
8
applications/solvers/multiphase/cavitatingFoam/Allwclean
Executable file
8
applications/solvers/multiphase/cavitatingFoam/Allwclean
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # run from this directory
|
||||
set -x
|
||||
|
||||
wclean
|
||||
wclean cavitatingDyMFoam
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
8
applications/solvers/multiphase/cavitatingFoam/Allwmake
Executable file
8
applications/solvers/multiphase/cavitatingFoam/Allwmake
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # run from this directory
|
||||
set -x
|
||||
|
||||
wmake
|
||||
wmake cavitatingDyMFoam
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
@ -0,0 +1,3 @@
|
||||
cavitatingDyMFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/cavitatingDyMFoam
|
@ -0,0 +1,22 @@
|
||||
EXE_INC = \
|
||||
-I.. \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \
|
||||
-I$(LIB_SRC)/thermophysicalModels/barotropicCompressibilityModel/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicFvMesh/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lincompressibleTransportModels \
|
||||
-lincompressibleTurbulenceModel \
|
||||
-lincompressibleRASModels \
|
||||
-lincompressibleLESModels \
|
||||
-lfiniteVolume \
|
||||
-lbarotropicCompressibilityModel \
|
||||
-ldynamicMesh \
|
||||
-lmeshTools \
|
||||
-ldynamicFvMesh
|
@ -0,0 +1,132 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 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.
|
||||
|
||||
Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "dynamicFvMesh.H"
|
||||
#include "barotropicCompressibilityModel.H"
|
||||
#include "twoPhaseMixture.H"
|
||||
#include "turbulenceModel.H"
|
||||
#include "pimpleControl.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "setRootCase.H"
|
||||
|
||||
#include "createTime.H"
|
||||
#include "createDynamicFvMesh.H"
|
||||
#include "readThermodynamicProperties.H"
|
||||
#include "readControls.H"
|
||||
#include "createFields.H"
|
||||
#include "initContinuityErrs.H"
|
||||
|
||||
pimpleControl pimple(mesh);
|
||||
|
||||
surfaceScalarField phivAbs("phivAbs", phiv);
|
||||
fvc::makeAbsolute(phivAbs, U);
|
||||
|
||||
#include "compressibleCourantNo.H"
|
||||
#include "setInitialDeltaT.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
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;
|
||||
|
||||
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
|
||||
|
||||
{
|
||||
// Calculate the relative velocity used to map relative flux phiv
|
||||
volVectorField Urel("Urel", U);
|
||||
|
||||
if (mesh.moving())
|
||||
{
|
||||
Urel -= fvc::reconstruct(fvc::meshPhi(U));
|
||||
}
|
||||
|
||||
// Do any mesh changes
|
||||
mesh.update();
|
||||
}
|
||||
|
||||
if (mesh.changing())
|
||||
{
|
||||
Info<< "Execution time for mesh.update() = "
|
||||
<< runTime.elapsedCpuTime() - timeBeforeMeshUpdate
|
||||
<< " s" << endl;
|
||||
|
||||
#include "correctPhi.H"
|
||||
}
|
||||
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
#include "rhoEqn.H"
|
||||
#include "gammaPsi.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;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
@ -0,0 +1,48 @@
|
||||
{
|
||||
wordList pcorrTypes
|
||||
(
|
||||
p.boundaryField().size(),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
);
|
||||
|
||||
forAll (p.boundaryField(), i)
|
||||
{
|
||||
if (p.boundaryField()[i].fixesValue())
|
||||
{
|
||||
pcorrTypes[i] = fixedValueFvPatchScalarField::typeName;
|
||||
}
|
||||
}
|
||||
|
||||
volScalarField pcorr
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"pcorr",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("pcorr", p.dimensions(), 0.0),
|
||||
pcorrTypes
|
||||
);
|
||||
|
||||
surfaceScalarField rhof(fvc::interpolate(rho, "div(phiv,rho)"));
|
||||
dimensionedScalar rAUf("(1|A(U))", dimTime, 1.0);
|
||||
|
||||
while (pimple.correctNonOrthogonal())
|
||||
{
|
||||
fvScalarMatrix pcorrEqn
|
||||
(
|
||||
fvm::laplacian(rAUf, pcorr) == fvc::ddt(rho) + fvc::div(phiv*rhof)
|
||||
);
|
||||
|
||||
pcorrEqn.solve();
|
||||
|
||||
if (pimple.finalNonOrthogonalIter())
|
||||
{
|
||||
phiv -= pcorrEqn.flux()/rhof;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
{
|
||||
if (pimple.nCorrPIMPLE() == 1)
|
||||
{
|
||||
p =
|
||||
(
|
||||
rho
|
||||
- (1.0 - gamma)*rhol0
|
||||
- ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat
|
||||
)/psi;
|
||||
}
|
||||
|
||||
surfaceScalarField rhof("rhof", fvc::interpolate(rho));
|
||||
|
||||
volScalarField rAU(1.0/UEqn.A());
|
||||
surfaceScalarField rAUf("Dp", rhof*fvc::interpolate(rAU));
|
||||
|
||||
volVectorField HbyA("HbyA", U);
|
||||
HbyA = rAU*UEqn.H();
|
||||
|
||||
phiv = (fvc::interpolate(HbyA) & mesh.Sf())
|
||||
+ fvc::ddtPhiCorr(rAU, rho, U, phivAbs);
|
||||
fvc::makeRelative(phiv, U);
|
||||
|
||||
surfaceScalarField phiGradp(rAUf*mesh.magSf()*fvc::snGrad(p));
|
||||
|
||||
phiv -= phiGradp/rhof;
|
||||
|
||||
volScalarField rho0(rho - psi*p);
|
||||
|
||||
while (pimple.correctNonOrthogonal())
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvc::ddt(rho)
|
||||
+ psi*correction(fvm::ddt(p))
|
||||
+ fvc::div(phiv, rho)
|
||||
+ fvc::div(phiGradp)
|
||||
- fvm::laplacian(rAUf, p)
|
||||
);
|
||||
|
||||
pEqn.solve(mesh.solver(p.select(pimple.finalInnerIter())));
|
||||
|
||||
if (pimple.finalNonOrthogonalIter())
|
||||
{
|
||||
phiv += (phiGradp + pEqn.flux())/rhof;
|
||||
phivAbs = fvc::absolute(phiv, U);
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "Predicted p max-min : " << max(p).value()
|
||||
<< " " << min(p).value() << endl;
|
||||
|
||||
rho == max(rho0 + psi*p, rhoMin);
|
||||
|
||||
#include "gammaPsi.H"
|
||||
|
||||
p =
|
||||
(
|
||||
rho
|
||||
- (1.0 - gamma)*rhol0
|
||||
- ((gamma*psiv + (1.0 - gamma)*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;
|
||||
}
|
@ -67,6 +67,7 @@ PIMPLE
|
||||
nCorrectors 2;
|
||||
nNonOrthogonalCorrectors 0;
|
||||
nAlphaSubCycles 2;
|
||||
nAlphaCorr 1;
|
||||
pRefValue 0;
|
||||
pRefPoint (0.1 0.1 1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user