diff --git a/applications/solvers/multiphase/cavitatingFoam/Allwclean b/applications/solvers/multiphase/cavitatingFoam/Allwclean
new file mode 100755
index 0000000000..62548246e9
--- /dev/null
+++ b/applications/solvers/multiphase/cavitatingFoam/Allwclean
@@ -0,0 +1,8 @@
+#!/bin/sh
+cd ${0%/*} || exit 1 # run from this directory
+set -x
+
+wclean
+wclean cavitatingDyMFoam
+
+# ----------------------------------------------------------------- end-of-file
diff --git a/applications/solvers/multiphase/cavitatingFoam/Allwmake b/applications/solvers/multiphase/cavitatingFoam/Allwmake
new file mode 100755
index 0000000000..211c1978b2
--- /dev/null
+++ b/applications/solvers/multiphase/cavitatingFoam/Allwmake
@@ -0,0 +1,8 @@
+#!/bin/sh
+cd ${0%/*} || exit 1 # run from this directory
+set -x
+
+wmake
+wmake cavitatingDyMFoam
+
+# ----------------------------------------------------------------- end-of-file
diff --git a/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/Make/files b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/Make/files
new file mode 100644
index 0000000000..57cd74e01d
--- /dev/null
+++ b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/Make/files
@@ -0,0 +1,3 @@
+cavitatingDyMFoam.C
+
+EXE = $(FOAM_APPBIN)/cavitatingDyMFoam
diff --git a/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/Make/options b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/Make/options
new file mode 100644
index 0000000000..fa204ce58f
--- /dev/null
+++ b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/Make/options
@@ -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
diff --git a/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/cavitatingDyMFoam.C b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/cavitatingDyMFoam.C
new file mode 100644
index 0000000000..45bc766761
--- /dev/null
+++ b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/cavitatingDyMFoam.C
@@ -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 .
+
+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;
+}
+
+
+// ************************************************************************* //
diff --git a/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/correctPhi.H b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/correctPhi.H
new file mode 100644
index 0000000000..8115b791e9
--- /dev/null
+++ b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/correctPhi.H
@@ -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;
+ }
+ }
+}
diff --git a/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/pEqn.H b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/pEqn.H
new file mode 100644
index 0000000000..a4e9e0b40f
--- /dev/null
+++ b/applications/solvers/multiphase/cavitatingFoam/cavitatingDyMFoam/pEqn.H
@@ -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;
+}
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C
index 3a150c6f70..18d5b33242 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.C
@@ -84,4 +84,13 @@ Foam::fanFvPatchField::fanFvPatchField
{}
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+template
+Foam::tmp > Foam::fanFvPatchField::jump() const
+{
+ return uniformJumpFvPatchField::jump();
+}
+
+
// ************************************************************************* //
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H
index 463ebeb543..bf0762f478 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H
+++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchField.H
@@ -172,6 +172,9 @@ public:
// Evaluation functions
+ //- Return the "jump" across the patch
+ tmp > jump() const;
+
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
};
@@ -185,6 +188,10 @@ fanFvPatchField::fanFvPatchField
const DimensionedField&,
const dictionary&
);
+
+template<>
+tmp > fanFvPatchField::jump() const;
+
template<>
void fanFvPatchField::updateCoeffs();
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C
index 668d43483d..7922b66fe3 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/fan/fanFvPatchFields.C
@@ -30,18 +30,16 @@ License
#include "Tuple2.H"
#include "polynomial.H"
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
-
-// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
-
-makeTemplatePatchTypeField
-(
- fvPatchScalarField,
- fanFvPatchScalarField
-);
+ makeTemplatePatchTypeField
+ (
+ fvPatchScalarField,
+ fanFvPatchScalarField
+ );
+}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@@ -115,15 +113,10 @@ Foam::fanFvPatchField::fanFvPatchField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
-//- Specialisation of the jump-condition for the pressure
template<>
-void Foam::fanFvPatchField::updateCoeffs()
+Foam::tmp >
+Foam::fanFvPatchField::jump() const
{
- if (this->updated())
- {
- return;
- }
-
if (this->cyclicPatch().owner())
{
const surfaceScalarField& phi =
@@ -139,15 +132,33 @@ void Foam::fanFvPatchField::updateCoeffs()
Un /= patch().lookupPatchField("rho");
}
- this->jump_ = this->jumpTable_->value(Un);
+ return this->jumpTable_->value(Un);
+ }
+ else
+ {
+ return refCast >
+ (
+ this->neighbourPatchField()
+ ).jump();
+ }
+}
+
+
+template<>
+void Foam::fanFvPatchField::updateCoeffs()
+{
+ if (this->updated())
+ {
+ return;
+ }
+
+ if (this->cyclicPatch().owner())
+ {
+ this->jump_ = jump();
}
uniformJumpFvPatchField::updateCoeffs();
}
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace Foam
-
// ************************************************************************* //
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C
index e58270ec63..9ef4be21a4 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJump/fixedJumpFvPatchField.C
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
+ \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -138,7 +138,8 @@ template
void Foam::fixedJumpFvPatchField::write(Ostream& os) const
{
fvPatchField::write(os);
- os.writeKeyword("patchType") << "cyclic" << token::END_STATEMENT << nl;
+ os.writeKeyword("patchType") << this->interfaceFieldType()
+ << token::END_STATEMENT << nl;
jump_.writeEntry("jump", os);
this->writeEntry("value", os);
}
diff --git a/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C
index d9cdc383a3..4c3290cf2d 100644
--- a/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C
+++ b/src/finiteVolume/fields/fvPatchFields/derived/fixedJumpAMI/fixedJumpAMIFvPatchField.C
@@ -141,7 +141,8 @@ template
void Foam::fixedJumpAMIFvPatchField::write(Ostream& os) const
{
fvPatchField::write(os);
- os.writeKeyword("patchType") << "cyclicAMI" << token::END_STATEMENT << nl;
+ os.writeKeyword("patchType") << this->interfaceFieldType()
+ << token::END_STATEMENT << nl;
jump_.writeEntry("jump", os);
this->writeEntry("value", os);
}
diff --git a/tutorials/multiphase/twoLiquidMixingFoam/lockExchange/system/fvSolution b/tutorials/multiphase/twoLiquidMixingFoam/lockExchange/system/fvSolution
index 19d27d99be..962f2cdfd6 100644
--- a/tutorials/multiphase/twoLiquidMixingFoam/lockExchange/system/fvSolution
+++ b/tutorials/multiphase/twoLiquidMixingFoam/lockExchange/system/fvSolution
@@ -67,6 +67,7 @@ PIMPLE
nCorrectors 2;
nNonOrthogonalCorrectors 0;
nAlphaSubCycles 2;
+ nAlphaCorr 1;
pRefValue 0;
pRefPoint (0.1 0.1 1);
}