diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/Make/files b/applications/solvers/multiphase/interPhaseChangeFoam/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..5f65a3a4c24cecc960a90944230ab84fee83fdfe --- /dev/null +++ b/applications/solvers/multiphase/interPhaseChangeFoam/Make/files @@ -0,0 +1,8 @@ +interPhaseChangeFoam.C +phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.C +phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/newPhaseChangeTwoPhaseMixture.C +phaseChangeTwoPhaseMixtures/Kunz/Kunz.C +phaseChangeTwoPhaseMixtures/Merkle/Merkle.C +phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.C + +EXE = $(FOAM_APPBIN)/interPhaseChangeFoam diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/Make/options b/applications/solvers/multiphase/interPhaseChangeFoam/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..f1f3bf58153f2e598918e78159720d420a1ca862 --- /dev/null +++ b/applications/solvers/multiphase/interPhaseChangeFoam/Make/options @@ -0,0 +1,14 @@ +EXE_INC = \ + -I$(LIB_SRC)/transportModels \ + -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ + -I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \ + -I$(LIB_SRC)/LESmodels \ + -I$(LIB_SRC)/LESmodels/LESdeltas/lnInclude \ + -IphaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture \ + -I$(LIB_SRC)/finiteVolume/lnInclude + +EXE_LIBS = \ + -linterfaceProperties \ + -lincompressibleTransportModels \ + -lincompressibleLESmodels \ + -lfiniteVolume diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/UEqn.H b/applications/solvers/multiphase/interPhaseChangeFoam/UEqn.H new file mode 100644 index 0000000000000000000000000000000000000000..fefdeb41c30db3c70841c3630a00f4ecf42970fb --- /dev/null +++ b/applications/solvers/multiphase/interPhaseChangeFoam/UEqn.H @@ -0,0 +1,32 @@ + surfaceScalarField muf = + twoPhaseProperties->muf() + + fvc::interpolate(rho*turbulence->nuSgs()); + + fvVectorMatrix UEqn + ( + fvm::ddt(rho, U) + + fvm::div(rhoPhi, U) + - fvm::Sp(fvc::ddt(rho) + fvc::div(rhoPhi), U) + - fvm::laplacian(muf, U) + - (fvc::grad(U) & fvc::grad(muf)) + //- fvc::div(muf*(fvc::interpolate(dev2(fvc::grad(U))) & mesh.Sf())) + ); + + UEqn.relax(); + + if (momentumPredictor) + { + solve + ( + UEqn + == + fvc::reconstruct + ( + ( + fvc::interpolate(interface.sigmaK())*fvc::snGrad(gamma) + - ghf*fvc::snGrad(rho) + - fvc::snGrad(pd) + ) * mesh.magSf() + ) + ); + } diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/correctPhi.H b/applications/solvers/multiphase/interPhaseChangeFoam/correctPhi.H new file mode 100644 index 0000000000000000000000000000000000000000..171e1670f47dbdf29d3904c47af7d196b706296e --- /dev/null +++ b/applications/solvers/multiphase/interPhaseChangeFoam/correctPhi.H @@ -0,0 +1,50 @@ +{ +# include "continuityErrs.H" + + wordList pcorrTypes(pd.boundaryField().types()); + + for (label i=0; i<pd.boundaryField().size(); i++) + { + if (pd.boundaryField()[i].fixesValue()) + { + pcorrTypes[i] = fixedValueFvPatchScalarField::typeName; + } + } + + volScalarField pcorr + ( + IOobject + ( + "pcorr", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("pcorr", pd.dimensions(), 0.0), + pcorrTypes + ); + + dimensionedScalar rUAf("(1|A(U))", dimTime/rho.dimensions(), 1.0); + + adjustPhi(phi, U, pcorr); + + for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + { + fvScalarMatrix pcorrEqn + ( + fvm::laplacian(rUAf, pcorr) == fvc::div(phi) + ); + + pcorrEqn.setReference(pdRefCell, pdRefValue); + pcorrEqn.solve(); + + if (nonOrth == nNonOrthCorr) + { + phi -= pcorrEqn.flux(); + } + } + +# include "continuityErrs.H" +} diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/createFields.H b/applications/solvers/multiphase/interPhaseChangeFoam/createFields.H new file mode 100644 index 0000000000000000000000000000000000000000..02c3b452957261154ecde3aa6cce97b9f9333307 --- /dev/null +++ b/applications/solvers/multiphase/interPhaseChangeFoam/createFields.H @@ -0,0 +1,98 @@ + Info<< "Reading field pd\n" << endl; + volScalarField pd + ( + IOobject + ( + "pd", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ); + + Info<< "Reading field gamma\n" << endl; + volScalarField gamma + ( + IOobject + ( + "gamma", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ); + + Info<< "Reading field U\n" << endl; + volVectorField U + ( + IOobject + ( + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ); + +# include "createPhi.H" + + Info<< "Creating phaseChangeTwoPhaseMixture\n" << endl; + autoPtr<phaseChangeTwoPhaseMixture> twoPhaseProperties = + phaseChangeTwoPhaseMixture::New(U, phi, "gamma"); + + const dimensionedScalar& rho1 = twoPhaseProperties->rho1(); + const dimensionedScalar& rho2 = twoPhaseProperties->rho2(); + const dimensionedScalar& pSat = twoPhaseProperties->pSat(); + + // Need to store rho for ddt(rho, U) + volScalarField rho + ( + IOobject + ( + "rho", + runTime.timeName(), + mesh, + IOobject::READ_IF_PRESENT + ), + gamma*rho1 + (scalar(1) - gamma)*rho2, + gamma.boundaryField().types() + ); + rho.oldTime(); + + + label pdRefCell = 0; + scalar pdRefValue = 0.0; + setRefCell(pd, mesh.solutionDict().subDict("PISO"), pdRefCell, pdRefValue); + + Info<< "Calculating field g.h" << endl; + volScalarField gh("gh", g & mesh.C()); + surfaceScalarField ghf("ghf", g & mesh.Cf()); + + volScalarField p + ( + IOobject + ( + "p", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + pd + rho*gh + ); + + + // Construct interface from gamma distribution + interfaceProperties interface(gamma, U, twoPhaseProperties()); + + // Construct LES model + autoPtr<LESmodel> turbulence + ( + LESmodel::New(U, phi, twoPhaseProperties()) + ); diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/gammaEqn.H b/applications/solvers/multiphase/interPhaseChangeFoam/gammaEqn.H new file mode 100644 index 0000000000000000000000000000000000000000..0186948920bfdf9fce37c902ee68bbbef6dc4799 --- /dev/null +++ b/applications/solvers/multiphase/interPhaseChangeFoam/gammaEqn.H @@ -0,0 +1,67 @@ +{ + word gammaScheme("div(phi,gamma)"); + word gammarScheme("div(phirb,gamma)"); + + surfaceScalarField phir("phir", phic*interface.nHatf()); + + for (int gCorr=0; gCorr<nGammaCorr; gCorr++) + { + surfaceScalarField phiGamma = + fvc::flux + ( + phi, + gamma, + gammaScheme + ) + + fvc::flux + ( + -fvc::flux(-phir, scalar(1) - gamma, gammarScheme), + gamma, + gammarScheme + ); + + Pair<tmp<volScalarField> > vDotAlphal = + twoPhaseProperties->vDotAlphal(); + const volScalarField& vDotcAlphal = vDotAlphal[0](); + const volScalarField& vDotvAlphal = vDotAlphal[1](); + + volScalarField Sp + ( + IOobject + ( + "Sp", + runTime.timeName(), + mesh + ), + vDotvAlphal - vDotcAlphal + ); + + volScalarField Su + ( + IOobject + ( + "Su", + runTime.timeName(), + mesh + ), + // Divergence term is handled explicitly to be + // consistent with the explicit transport solution + divU*gamma + + vDotcAlphal + ); + + //MULES::explicitSolve(gamma, phi, phiGamma, 1, 0); + //MULES::explicitSolve(oneField(), gamma, phi, phiGamma, Sp, Su, 1, 0); + MULES::implicitSolve(oneField(), gamma, phi, phiGamma, Sp, Su, 1, 0); + + rhoPhi += + (runTime.deltaT()/totalDeltaT) + *(phiGamma*(rho1 - rho2) + phi*rho2); + } + + Info<< "Liquid phase volume fraction = " + << gamma.weightedAverage(mesh.V()).value() + << " Min(gamma) = " << min(gamma).value() + << " Max(gamma) = " << max(gamma).value() + << endl; +} diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/gammaEqnSubCycle.H b/applications/solvers/multiphase/interPhaseChangeFoam/gammaEqnSubCycle.H new file mode 100644 index 0000000000000000000000000000000000000000..c6355d6fb0b9ce882c5c3e904df1ecb8842dbe9c --- /dev/null +++ b/applications/solvers/multiphase/interPhaseChangeFoam/gammaEqnSubCycle.H @@ -0,0 +1,53 @@ +surfaceScalarField rhoPhi +( + IOobject + ( + "rhoPhi", + runTime.timeName(), + mesh + ), + mesh, + dimensionedScalar("0", dimensionSet(1, 0, -1, 0, 0), 0) +); + +{ + label nGammaCorr + ( + readLabel(piso.lookup("nGammaCorr")) + ); + + label nGammaSubCycles + ( + readLabel(piso.lookup("nGammaSubCycles")) + ); + + surfaceScalarField phic = mag(phi/mesh.magSf()); + phic = min(interface.cGamma()*phic, max(phic)); + + volScalarField divU = fvc::div(phi); + + dimensionedScalar totalDeltaT = runTime.deltaT(); + + if (nGammaSubCycles > 1) + { + for + ( + subCycle<volScalarField> gammaSubCycle(gamma, nGammaSubCycles); + !(++gammaSubCycle).end(); + ) + { +# include "gammaEqn.H" + } + } + else + { +# include "gammaEqn.H" + } + + if (nOuterCorr == 1) + { + interface.correct(); + } + + rho == gamma*rho1 + (scalar(1) - gamma)*rho2; +} diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C new file mode 100644 index 0000000000000000000000000000000000000000..de9baf4d7e3cccb06cb66610fc7aa920accbf549 --- /dev/null +++ b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C @@ -0,0 +1,111 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Application + interPhaseChangeFoam + +Description + Solver for 2 incompressible, isothermal immiscible fluids with phase-change + (e.g. cavitation). Uses a VOF (volume of fluid) phase-fraction based + interface capturing approach. The momentum and other fluid properties are + of the "mixture" and a single momentum equation is solved. + + The set of phase-change models provided are designed to simulate cavitation + but other mechanisms of phase-change are supported within this solver + framework. + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "MULES.H" +#include "subCycle.H" +#include "interfaceProperties.H" +#include "phaseChangeTwoPhaseMixture.H" +#include "incompressible/LESmodel/LESmodel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + +# include "setRootCase.H" +# include "createTime.H" +# include "createMesh.H" +# include "readEnvironmentalProperties.H" +# include "readPISOControls.H" +# include "initContinuityErrs.H" +# include "createFields.H" +# include "readTimeControls.H" +# include "correctPhi.H" +# include "CourantNo.H" +# include "setInitialDeltaT.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nStarting time loop\n" << endl; + + while (runTime.run()) + { +# include "readPISOControls.H" +# include "readTimeControls.H" +# include "CourantNo.H" +# include "setDeltaT.H" + + runTime++; + + Info<< "Time = " << runTime.timeName() << nl << endl; + + twoPhaseProperties->correct(); + +# include "gammaEqnSubCycle.H" + + turbulence->correct(); + + for (int oCorr=0; oCorr<nOuterCorr; oCorr++) + { + #include "UEqn.H" + + // --- PISO loop + for (int corr=0; corr<nCorr; corr++) + { + #include "pEqn.H" + } + + #include "continuityErrs.H" + } + + 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/interPhaseChangeFoam/pEqn.H b/applications/solvers/multiphase/interPhaseChangeFoam/pEqn.H new file mode 100644 index 0000000000000000000000000000000000000000..3a7f7e4ebcd00d8b3df2ad966ee3f0a7820e0f52 --- /dev/null +++ b/applications/solvers/multiphase/interPhaseChangeFoam/pEqn.H @@ -0,0 +1,55 @@ +{ + volScalarField rUA = 1.0/UEqn.A(); + surfaceScalarField rUAf = fvc::interpolate(rUA); + + U = rUA*UEqn.H(); + + surfaceScalarField phiU + ( + "phiU", + (fvc::interpolate(U) & mesh.Sf()) + + fvc::ddtPhiCorr(rUA, rho, U, phi) + ); + + phi = phiU + + ( + fvc::interpolate(interface.sigmaK())*fvc::snGrad(gamma) + - ghf*fvc::snGrad(rho) + )*rUAf*mesh.magSf(); + + adjustPhi(phi, U, pd); + + Pair<tmp<volScalarField> > vDotP = twoPhaseProperties->vDotP(); + const volScalarField& vDotcP = vDotP[0](); + const volScalarField& vDotvP = vDotP[1](); + + for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) + { + fvScalarMatrix pdEqn + ( + fvc::div(phi) - fvm::laplacian(rUAf, pd) + + (vDotvP - vDotcP)*(rho*gh - pSat) + fvm::Sp(vDotvP - vDotcP, pd) + ); + + pdEqn.setReference(pdRefCell, pdRefValue); + + if (corr == nCorr-1 && nonOrth == nNonOrthCorr) + { + pdEqn.solve(mesh.solver(pd.name() + "Final")); + } + else + { + pdEqn.solve(mesh.solver(pd.name())); + } + + if (nonOrth == nNonOrthCorr) + { + phi += pdEqn.flux(); + } + } + + p = pd + rho*gh; + + U += rUA*fvc::reconstruct((phi - phiU)/rUAf); + U.correctBoundaryConditions(); +} diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Kunz/Kunz.C b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Kunz/Kunz.C new file mode 100644 index 0000000000000000000000000000000000000000..8f486990cd8aff106020c7c39d519fa4480e2c12 --- /dev/null +++ b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Kunz/Kunz.C @@ -0,0 +1,126 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "Kunz.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace phaseChangeTwoPhaseMixtures +{ + defineTypeNameAndDebug(Kunz, 0); + addToRunTimeSelectionTable(phaseChangeTwoPhaseMixture, Kunz, components); +} +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::phaseChangeTwoPhaseMixtures::Kunz::Kunz +( + const volVectorField& U, + const surfaceScalarField& phi, + const word& alpha1Name +) +: + phaseChangeTwoPhaseMixture(typeName, U, phi, alpha1Name), + + UInf_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf")), + tInf_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf")), + Cc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc")), + Cv_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv")), + + p0_("0", pSat().dimensions(), 0.0), + + mcCoeff_(Cc_*rho2()/tInf_), + mvCoeff_(Cv_*rho2()/(0.5*rho1()*sqr(UInf_)*tInf_)) +{ + correct(); +} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::Pair<Foam::tmp<Foam::volScalarField> > +Foam::phaseChangeTwoPhaseMixtures::Kunz::mDotAlphal() const +{ + const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p"); + volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1)); + + return Pair<tmp<volScalarField> > + ( + mcCoeff_*sqr(limitedAlpha1) + *max(p - pSat(), p0_)/max(p - pSat(), 0.01*pSat()), + + mvCoeff_*min(p - pSat(), p0_) + ); +} + +Foam::Pair<Foam::tmp<Foam::volScalarField> > +Foam::phaseChangeTwoPhaseMixtures::Kunz::mDotP() const +{ + const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p"); + volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1)); + + return Pair<tmp<volScalarField> > + ( + mcCoeff_*sqr(limitedAlpha1)*(1.0 - limitedAlpha1) + *pos(p - pSat())/max(p - pSat(), 0.01*pSat()), + + (-mvCoeff_)*limitedAlpha1*neg(p - pSat()) + ); +} + + +void Foam::phaseChangeTwoPhaseMixtures::Kunz::correct() +{} + + +bool Foam::phaseChangeTwoPhaseMixtures::Kunz::read() +{ + if (phaseChangeTwoPhaseMixture::read()) + { + phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs"); + + phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf") >> UInf_; + phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf") >> tInf_; + phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc") >> Cc_; + phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv") >> Cv_; + + mcCoeff_ = Cc_*rho2()/tInf_; + mvCoeff_ = Cv_*rho2()/(0.5*rho1()*sqr(UInf_)*tInf_); + + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Kunz/Kunz.H b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Kunz/Kunz.H new file mode 100644 index 0000000000000000000000000000000000000000..d78a9a71910dfdb4352ac9940d252a76aa11457e --- /dev/null +++ b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Kunz/Kunz.H @@ -0,0 +1,135 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. + \\/ 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 Generac License as published by the + Free Software Foundation; either 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the ho it will be useful, but WITHOUT + ANY WARRANTY; without even the imarranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE.he GNU General Public License + for more details. + + You should have received a copy oNU General Public License + along with OpenFOAM; if not, write Free Software Foundation, + Inc., 51 Franklin St, Fifth Floorn, MA 02110-1301 USA + +Class + Foam::phaseChangeTwoPhaseMixtures::Kunz + +Description + Kunz cavitation model slightly modified so that the condensation term + is switched off when the pressure is less than the saturation vapour + pressure. This change allows the condensation term to be formulated as + a coefficient multiplying (p - p_sat) so that it can be included as an + implicit term in the pressure equation. + + Reference: + @verbatim + Kunz, R.F., Boger, D.A., Stinebring, D.R., Chyczewski, Lindau. J.W., + Gibeling, H.J., Venkateswaran, S., Govindan, T.R., + “A Preconditioned Implicit Method for Two-Phase Flows with Application + to Cavitation Prediction,†+ Computers and Fluids, + 29(8):849-875, 2000. + @verbatim + +SourceFiles + Kunz.C + +\*--------------------------------------------------------------------*/ + +#ifndef Kunz_H +#define Kunz_H + +#include "phaseChangeTwoPhaseMixture.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace phaseChangeTwoPhaseMixtures +{ + +/*--------------------------------------------------------------------*\ + Class Kunz +\*--------------------------------------------------------------------*/ + +class Kunz +: + public phaseChangeTwoPhaseMixture +{ + // Private data + + dimensionedScalar UInf_; + dimensionedScalar tInf_; + dimensionedScalar Cc_; + dimensionedScalar Cv_; + + dimensionedScalar p0_; + + dimensionedScalar mcCoeff_; + dimensionedScalar mvCoeff_; + + +public: + + //- Runtime type information + TypeName("Kunz"); + + + // Constructors + + //- construct from components + Kunz + ( + const volVectorField& U, + const surfaceScalarField& phi, + const word& alpha1Name = "alpha1" + ); + + + // Destructor + + virtual ~Kunz() + {} + + + // Member Functions + + //- Return the mass condensation and vaporisation rates as a + // coefficient to multiply (1 - alphal) for the condensation rate + // and a coefficient to multiply alphal for the vaporisation rate + virtual Pair<tmp<volScalarField> > mDotAlphal() const; + + //- Return the mass condensation and vaporisation rates as an + // explicit term for the condensation rate and a coefficient to + // multiply (p - pSat) for the vaporisation rate + virtual Pair<tmp<volScalarField> > mDotP() const; + + //- Correct the Kunz phaseChange model + virtual void correct(); + + //- Read the transportProperties dictionary and update + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace phaseChangeTwoPhaseMixtures +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Merkle/#Merkle.C# b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Merkle/#Merkle.C# new file mode 100644 index 0000000000000000000000000000000000000000..52ce5fe3821a1be31c6a1efb2ed0e74cb0649e2b --- /dev/null +++ b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Merkle/#Merkle.C# @@ -0,0 +1,75 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "Merkle.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace phaseChangeTwoPhaseMixtures +{ + defineTypeNameAndDebug(Merkle, 0); + addToRunTimeSelectionTable(phaseChangeTwoPhaseMixture, Merkle, components); +} +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::phaseChangeTwoPhaseMixtures::Merkle::Merkle +( + const volVectorField& U, + const surfaceScalarField& phi, + const word& alpha1Name +) +: + phaseChangeTwoPhaseMixture(typeName, U, phi, alpha1Name), + + UInf_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf")), + tInf_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf")), + Cc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc")), + Cv_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv")), + + p0_("0", pSat().dimensions(), 0.0), + + mcCoeff_(Cc_/(0.5*sqr(UInf_)*tInf_)), + mvCoeff_(Cv_*rho1()/(0.5*sqr(UInf_)*tInf_*rho2())) +{ + correct(); +} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::Pair<Foam::tmp<Foam::volScalarField> > +Foam::phaseChangeTwoPhaseMixtures::Merkle::mDotAlphal() const +{ + const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p"); + + return Pair<tmp<volScalarField> > + ( + mcCoeff_*max(p - pSat(), p0_), diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Merkle/Merkle.C b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Merkle/Merkle.C new file mode 100644 index 0000000000000000000000000000000000000000..9006601ce547254862c5338beceb947862f60f9a --- /dev/null +++ b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Merkle/Merkle.C @@ -0,0 +1,121 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "Merkle.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace phaseChangeTwoPhaseMixtures +{ + defineTypeNameAndDebug(Merkle, 0); + addToRunTimeSelectionTable(phaseChangeTwoPhaseMixture, Merkle, components); +} +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::phaseChangeTwoPhaseMixtures::Merkle::Merkle +( + const volVectorField& U, + const surfaceScalarField& phi, + const word& alpha1Name +) +: + phaseChangeTwoPhaseMixture(typeName, U, phi, alpha1Name), + + UInf_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf")), + tInf_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf")), + Cc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc")), + Cv_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv")), + + p0_("0", pSat().dimensions(), 0.0), + + mcCoeff_(Cc_/(0.5*sqr(UInf_)*tInf_)), + mvCoeff_(Cv_*rho1()/(0.5*sqr(UInf_)*tInf_*rho2())) +{ + correct(); +} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::Pair<Foam::tmp<Foam::volScalarField> > +Foam::phaseChangeTwoPhaseMixtures::Merkle::mDotAlphal() const +{ + const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p"); + + return Pair<tmp<volScalarField> > + ( + mcCoeff_*max(p - pSat(), p0_), + mvCoeff_*min(p - pSat(), p0_) + ); +} + +Foam::Pair<Foam::tmp<Foam::volScalarField> > +Foam::phaseChangeTwoPhaseMixtures::Merkle::mDotP() const +{ + const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p"); + volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1)); + + return Pair<tmp<volScalarField> > + ( + mcCoeff_*(1.0 - limitedAlpha1)*pos(p - pSat()), + (-mvCoeff_)*limitedAlpha1*neg(p - pSat()) + ); +} + + +void Foam::phaseChangeTwoPhaseMixtures::Merkle::correct() +{} + + +bool Foam::phaseChangeTwoPhaseMixtures::Merkle::read() +{ + if (phaseChangeTwoPhaseMixture::read()) + { + phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs"); + + phaseChangeTwoPhaseMixtureCoeffs_.lookup("UInf") >> UInf_; + phaseChangeTwoPhaseMixtureCoeffs_.lookup("tInf") >> tInf_; + phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc") >> Cc_; + phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv") >> Cv_; + + mcCoeff_ = Cc_/(0.5*sqr(UInf_)*tInf_); + mvCoeff_ = Cv_*rho1()/(0.5*sqr(UInf_)*tInf_*rho2()); + + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Merkle/Merkle.H b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Merkle/Merkle.H new file mode 100644 index 0000000000000000000000000000000000000000..c285444d35ea35922bab6b3714e7776f1d9cf3e0 --- /dev/null +++ b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/Merkle/Merkle.H @@ -0,0 +1,129 @@ +/*---------------------------------------------------------------------------*\ + ========Merkle= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. + \\/ 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 Generac License as published by the + Free Software Foundation; either 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the ho it will be useful, but WITHOUT + ANY WARRANTY; without even the imarranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE.he GNU General Public License + for more details. + + You should have received a copy oNU General Public License + along with OpenFOAM; if not, write Free Software Foundation, + Inc., 51 Franklin St, Fifth Floorn, MA 02110-1301 USA + +Class + Foam::phaseChangeTwoPhaseMixtures::Merkle + +Description + Merkle cavitation model. + + Reference: + @verbatim + C. L. Merkle, J. Feng, and P. E. O. Buelow, + "Computational modeling of the dynamics of sheet cavitation", + in Proceedings Third International Symposium on Cavitation + Grenoble, France 1998. + @verbatim + +SourceFiles + Merkle.C + +\*--------------------------------------------------------------------*/ + +#ifndef Merkle_H +#define Merkle_H + +#include "phaseChangeTwoPhaseMixture.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace phaseChangeTwoPhaseMixtures +{ + +/*--------------------------------------------------------------------*\ + Class Merkle +\*--------------------------------------------------------------------*/ + +class Merkle +: + public phaseChangeTwoPhaseMixture +{ + // Private data + + dimensionedScalar UInf_; + dimensionedScalar tInf_; + dimensionedScalar Cc_; + dimensionedScalar Cv_; + + dimensionedScalar p0_; + + dimensionedScalar mcCoeff_; + dimensionedScalar mvCoeff_; + + +public: + + //- Runtime type information + TypeName("Merkle"); + + + // Constructors + + //- construct from components + Merkle + ( + const volVectorField& U, + const surfaceScalarField& phi, + const word& alpha1Name = "alpha1" + ); + + + // Destructor + + virtual ~Merkle() + {} + + + // Member Functions + + //- Return the mass condensation and vaporisation rates as a + // coefficient to multiply (1 - alphal) for the condensation rate + // and a coefficient to multiply alphal for the vaporisation rate + virtual Pair<tmp<volScalarField> > mDotAlphal() const; + + //- Return the mass condensation and vaporisation rates as an + // explicit term for the condensation rate and a coefficient to + // multiply (p - pSat) for the vaporisation rate + virtual Pair<tmp<volScalarField> > mDotP() const; + + //- Correct the Merkle phaseChange model + virtual void correct(); + + //- Read the transportProperties dictionary and update + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace phaseChangeTwoPhaseMixtures +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.C b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.C new file mode 100644 index 0000000000000000000000000000000000000000..b4cfead22e355a86a1420edb6db9f69e103dcdaa --- /dev/null +++ b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.C @@ -0,0 +1,169 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "SchnerrSauer.H" +#include "mathematicalConstants.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace phaseChangeTwoPhaseMixtures +{ + defineTypeNameAndDebug(SchnerrSauer, 0); + addToRunTimeSelectionTable + ( + phaseChangeTwoPhaseMixture, + SchnerrSauer, + components + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::SchnerrSauer +( + const volVectorField& U, + const surfaceScalarField& phi, + const word& alpha1Name +) +: + phaseChangeTwoPhaseMixture(typeName, U, phi, alpha1Name), + + n_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("n")), + dNuc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("dNuc")), + Cc_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc")), + Cv_(phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv")), + + p0_("0", pSat().dimensions(), 0.0) +{ + correct(); +} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::tmp<Foam::volScalarField> +Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::rRb +( + const volScalarField& limitedAlpha1 +) const +{ + return pow + ( + ((4*mathematicalConstant::pi*n_)/3) + *limitedAlpha1/(1.0 + alphaNuc() - limitedAlpha1), + 1.0/3.0 + ); +} + + +Foam::dimensionedScalar +Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::alphaNuc() const +{ + dimensionedScalar Vnuc = n_*mathematicalConstant::pi*pow3(dNuc_)/6; + return Vnuc/(1 + Vnuc); +} + + +Foam::tmp<Foam::volScalarField> +Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::pCoeff +( + const volScalarField& p +) const +{ + volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1)); + volScalarField rho = + (limitedAlpha1*rho1() + (scalar(1) - limitedAlpha1)*rho2()); + + return + (3*rho1()*rho2())*sqrt(2/(3*rho1())) + *rRb(limitedAlpha1)/(rho*sqrt(mag(p - pSat()) + 0.01*pSat())); +} + + +Foam::Pair<Foam::tmp<Foam::volScalarField> > +Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::mDotAlphal() const +{ + const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p"); + volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1)); + + volScalarField pCoeff = this->pCoeff(p); + + return Pair<tmp<volScalarField> > + ( + Cc_*limitedAlpha1*pCoeff*max(p - pSat(), p0_), + + Cv_*(1.0 + alphaNuc() - limitedAlpha1)*pCoeff*min(p - pSat(), p0_) + ); +} + + +Foam::Pair<Foam::tmp<Foam::volScalarField> > +Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::mDotP() const +{ + const volScalarField& p = alpha1_.db().lookupObject<volScalarField>("p"); + volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1)); + + volScalarField apCoeff = limitedAlpha1*pCoeff(p); + + return Pair<tmp<volScalarField> > + ( + Cc_*(1.0 - limitedAlpha1)*pos(p - pSat())*apCoeff, + + (-Cv_)*(1.0 + alphaNuc() - limitedAlpha1)*neg(p - pSat())*apCoeff + ); +} + + +void Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::correct() +{} + + +bool Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::read() +{ + if (phaseChangeTwoPhaseMixture::read()) + { + phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs"); + + phaseChangeTwoPhaseMixtureCoeffs_.lookup("n") >> n_; + phaseChangeTwoPhaseMixtureCoeffs_.lookup("dNuc") >> dNuc_; + phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cc") >> Cc_; + phaseChangeTwoPhaseMixtureCoeffs_.lookup("Cv") >> Cv_; + + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.H b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.H new file mode 100644 index 0000000000000000000000000000000000000000..b708ff5d4fdbc0b8da7ea0ec7b03bc90cdc0f6d9 --- /dev/null +++ b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.H @@ -0,0 +1,142 @@ +/*---------------------------------------------------------------------------*\ + ========Merkle= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. + \\/ 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 Generac License as published by the + Free Software Foundation; either 2 of the License, or (at your + option) any later version. + + OpenFOAM is distributed in the ho it will be useful, but WITHOUT + ANY WARRANTY; without even the imarranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE.he GNU General Public License + for more details. + + You should have received a copy oNU General Public License + along with OpenFOAM; if not, write Free Software Foundation, + Inc., 51 Franklin St, Fifth Floorn, MA 02110-1301 USA + +Class + Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer + +Description + SchnerrSauer cavitation model. + + Reference: + @verbatim + Schnerr, G. H., And Sauer, J., + "Physical and Numerical Modeling of Unsteady Cavitation Dynamics", + Proc. 4th International Conference on Multiphase Flow, + New Orleans, U.S.A., 2001. + @verbatim + +SourceFiles + SchnerrSauer.C + +\*--------------------------------------------------------------------*/ + +#ifndef SchnerrSauer_H +#define SchnerrSauer_H + +#include "phaseChangeTwoPhaseMixture.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace phaseChangeTwoPhaseMixtures +{ + +/*--------------------------------------------------------------------*\ + Class SchnerrSauer +\*--------------------------------------------------------------------*/ + +class SchnerrSauer +: + public phaseChangeTwoPhaseMixture +{ + // Private data + + //- Bubble number density + dimensionedScalar n_; + + //- Nucleation site diameter + dimensionedScalar dNuc_; + + //- Condensation rate coefficient + dimensionedScalar Cc_; + + //- Vapourisation rate coefficient + dimensionedScalar Cv_; + + dimensionedScalar p0_; + + //- Nucleation site volume-fraction + dimensionedScalar alphaNuc() const; + + //- Reciprocal bubble radius + tmp<volScalarField>rRb(const volScalarField& limitedAlpha1) const; + + //- Part of the condensation and vapourisation rates + tmp<volScalarField> pCoeff(const volScalarField& p) const; + + +public: + + //- Runtime type information + TypeName("SchnerrSauer"); + + + // Constructors + + //- construct from components + SchnerrSauer + ( + const volVectorField& U, + const surfaceScalarField& phi, + const word& alpha1Name = "alpha1" + ); + + + // Destructor + + virtual ~SchnerrSauer() + {} + + + // Member Functions + + //- Return the mass condensation and vaporisation rates as a + // coefficient to multiply (1 - alphal) for the condensation rate + // and a coefficient to multiply alphal for the vaporisation rate + virtual Pair<tmp<volScalarField> > mDotAlphal() const; + + //- Return the mass condensation and vaporisation rates as an + // explicit term for the condensation rate and a coefficient to + // multiply (p - pSat) for the vaporisation rate + virtual Pair<tmp<volScalarField> > mDotP() const; + + //- Correct the SchnerrSauer phaseChange model + virtual void correct(); + + //- Read the transportProperties dictionary and update + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace phaseChangeTwoPhaseMixtures +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampling/probeLocations/probeLocations.C b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/newPhaseChangeTwoPhaseMixture.C similarity index 51% rename from applications/utilities/postProcessing/sampling/sampling/probeLocations/probeLocations.C rename to applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/newPhaseChangeTwoPhaseMixture.C index 07e06e8dd6ad5b1d076279ec2f69aed3a4c57fd5..96e85935a01685b708a1e816a094715f1a879927 100644 --- a/applications/utilities/postProcessing/sampling/sampling/probeLocations/probeLocations.C +++ b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/newPhaseChangeTwoPhaseMixture.C @@ -22,65 +22,59 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - Probe locations. - \*---------------------------------------------------------------------------*/ -#include "argList.H" -#include "IOprobes.H" - -using namespace Foam; +#include "phaseChangeTwoPhaseMixture.H" +#include "twoPhaseMixture.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Main program: -int main(int argc, char *argv[]) +Foam::autoPtr<Foam::phaseChangeTwoPhaseMixture> +Foam::phaseChangeTwoPhaseMixture::New +( + const volVectorField& U, + const surfaceScalarField& phi, + const word& alpha1Name +) { + IOdictionary transportPropertiesDict + ( + IOobject + ( + "transportProperties", + U.time().constant(), + U.db(), + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ) + ); -# include "addTimeOptions.H" -# include "setRootCase.H" - -# include "createTime.H" - - // Get times list - instantList Times = runTime.times(); - - // set startTime and endTime depending on -time and -latestTime options -# include "checkTimeOptions.H" - - runTime.setTime(Times[startTime], startTime); + word phaseChangeTwoPhaseMixtureTypeName + ( + transportPropertiesDict.lookup("phaseChangeTwoPhaseMixture") + ); -# include "createMesh.H" + Info<< "Selecting phaseChange model " + << phaseChangeTwoPhaseMixtureTypeName << endl; - IOprobes sniff(mesh, "probesDict", true); + componentsConstructorTable::iterator cstrIter = + componentsConstructorTablePtr_ + ->find(phaseChangeTwoPhaseMixtureTypeName); - for (label i=startTime; i<endTime; i++) + if (cstrIter == componentsConstructorTablePtr_->end()) { - runTime.setTime(Times[i], i); - Info<< "Time = " << runTime.timeName() << endl; - - // Handle geometry/topology changes - polyMesh::readUpdateState state = mesh.readUpdate(); - - if + FatalErrorIn ( - state == polyMesh::POINTS_MOVED - || state == polyMesh::TOPO_CHANGE - ) - { - sniff.read(); - } - - sniff.write(); - - Info<< endl; + "phaseChangeTwoPhaseMixture::New" + ) << "Unknown phaseChangeTwoPhaseMixture type " + << phaseChangeTwoPhaseMixtureTypeName << endl << endl + << "Valid phaseChangeTwoPhaseMixtures are : " << endl + << componentsConstructorTablePtr_->toc() + << exit(FatalError); } - - Info<< "End\n" << endl; - - return 0; + return autoPtr<phaseChangeTwoPhaseMixture>(cstrIter()(U, phi, alpha1Name)); } diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.C b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.C new file mode 100644 index 0000000000000000000000000000000000000000..ddd9c666a2c64778ad8cdc565b0826d8f16dcc0b --- /dev/null +++ b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.C @@ -0,0 +1,94 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*---------------------------------------------------------------------------*/ + +#include "phaseChangeTwoPhaseMixture.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(phaseChangeTwoPhaseMixture, 0); + defineRunTimeSelectionTable(phaseChangeTwoPhaseMixture, components); +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::phaseChangeTwoPhaseMixture::phaseChangeTwoPhaseMixture +( + const word& type, + const volVectorField& U, + const surfaceScalarField& phi, + const word& alpha1Name +) +: + twoPhaseMixture(U, phi, alpha1Name), + phaseChangeTwoPhaseMixtureCoeffs_(subDict(type + "Coeffs")), + pSat_(lookup("pSat")) +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +Foam::Pair<Foam::tmp<Foam::volScalarField> > +Foam::phaseChangeTwoPhaseMixture::vDotAlphal() const +{ + volScalarField alphalCoeff = 1.0/rho1() - alpha1_*(1.0/rho1() - 1.0/rho2()); + Pair<tmp<volScalarField> > mDotAlphal = this->mDotAlphal(); + + return Pair<tmp<volScalarField> > + ( + alphalCoeff*mDotAlphal[0], + alphalCoeff*mDotAlphal[1] + ); +} + +Foam::Pair<Foam::tmp<Foam::volScalarField> > +Foam::phaseChangeTwoPhaseMixture::vDotP() const +{ + dimensionedScalar pCoeff(1.0/rho1() - 1.0/rho2()); + Pair<tmp<volScalarField> > mDotP = this->mDotP(); + + return Pair<tmp<volScalarField> >(pCoeff*mDotP[0], pCoeff*mDotP[1]); +} + + +bool Foam::phaseChangeTwoPhaseMixture::read() +{ + if (twoPhaseMixture::read()) + { + phaseChangeTwoPhaseMixtureCoeffs_ = subDict(type() + "Coeffs"); + lookup("pSat") >> pSat_; + + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.H b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.H new file mode 100644 index 0000000000000000000000000000000000000000..167ab2894652f459b371b8ec82d8def17f229fab --- /dev/null +++ b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.H @@ -0,0 +1,175 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd. + \\/ 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::phaseChangeTwoPhaseMixture + +Description + +SourceFiles + phaseChangeTwoPhaseMixture.C + newPhaseChangeModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef phaseChangeTwoPhaseMixture_H +#define phaseChangeTwoPhaseMixture_H + +#include "twoPhaseMixture.H" +#include "typeInfo.H" +#include "runTimeSelectionTables.H" +#include "volFields.H" +#include "dimensionedScalar.H" +#include "autoPtr.H" +#include "Pair.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class phaseChangeTwoPhaseMixture Declaration +\*---------------------------------------------------------------------------*/ + +class phaseChangeTwoPhaseMixture +: + public twoPhaseMixture +{ + +protected: + + // Protected data + + dictionary phaseChangeTwoPhaseMixtureCoeffs_; + + //- Saturation vapour pressure + dimensionedScalar pSat_; + + + // Private Member Functions + + //- Disallow copy construct + phaseChangeTwoPhaseMixture(const phaseChangeTwoPhaseMixture&); + + //- Disallow default bitwise assignment + void operator=(const phaseChangeTwoPhaseMixture&); + + +public: + + //- Runtime type information + TypeName("phaseChangeTwoPhaseMixture"); + + + // Declare run-time constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + phaseChangeTwoPhaseMixture, + components, + ( + const volVectorField& U, + const surfaceScalarField& phi, + const word& alpha1Name + ), + (U, phi, alpha1Name) + ); + + + // Selectors + + //- Return a reference to the selected phaseChange model + static autoPtr<phaseChangeTwoPhaseMixture> New + ( + const volVectorField& U, + const surfaceScalarField& phi, + const word& alpha1Name + ); + + + // Constructors + + //- Construct from components + phaseChangeTwoPhaseMixture + ( + const word& type, + const volVectorField& U, + const surfaceScalarField& phi, + const word& alpha1Name = "alpha1" + ); + + + // Destructor + + virtual ~phaseChangeTwoPhaseMixture() + {} + + + // Member Functions + + //- Return const-access to the saturation vapour pressure + const dimensionedScalar& pSat() const + { + return pSat_; + } + + //- Return the mass condensation and vaporisation rates as a + // coefficient to multiply (1 - alphal) for the condensation rate + // and a coefficient to multiply alphal for the vaporisation rate + virtual Pair<tmp<volScalarField> > mDotAlphal() const = 0; + + //- Return the mass condensation and vaporisation rates as an + // explicit term for the condensation rate and a coefficient to + // multiply (p - pSat) for the vaporisation rate + virtual Pair<tmp<volScalarField> > mDotP() const = 0; + + //- Return the volumetric condensation and vaporisation rates as a + // coefficient to multiply (1 - alphal) for the condensation rate + // and a coefficient to multiply alphal for the vaporisation rate + Pair<tmp<volScalarField> > vDotAlphal() const; + + //- Return the volumetric condensation and vaporisation rates as an + // explicit term for the condensation rate and a coefficient to + // multiply (p - pSat) for the vaporisation rate + Pair<tmp<volScalarField> > vDotP() const; + + //- Correct the phaseChange model + virtual void correct() = 0; + + //- Read the transportProperties dictionary and update + virtual bool read() = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/utilities/postProcessing/sampling/sampling/sample/Make/files b/applications/utilities/postProcessing/sampling/sample/Make/files similarity index 100% rename from applications/utilities/postProcessing/sampling/sampling/sample/Make/files rename to applications/utilities/postProcessing/sampling/sample/Make/files diff --git a/applications/utilities/postProcessing/sampling/sampling/probeLocations/Make/options b/applications/utilities/postProcessing/sampling/sample/Make/options similarity index 100% rename from applications/utilities/postProcessing/sampling/sampling/probeLocations/Make/options rename to applications/utilities/postProcessing/sampling/sample/Make/options diff --git a/applications/utilities/postProcessing/sampling/sampling/sample/sample.C b/applications/utilities/postProcessing/sampling/sample/sample.C similarity index 100% rename from applications/utilities/postProcessing/sampling/sampling/sample/sample.C rename to applications/utilities/postProcessing/sampling/sample/sample.C diff --git a/applications/utilities/postProcessing/sampling/sampling/sample/sampleDict b/applications/utilities/postProcessing/sampling/sample/sampleDict similarity index 100% rename from applications/utilities/postProcessing/sampling/sampling/sample/sampleDict rename to applications/utilities/postProcessing/sampling/sample/sampleDict diff --git a/applications/utilities/postProcessing/sampling/sampling/probeLocations/Make/files b/applications/utilities/postProcessing/sampling/sampling/probeLocations/Make/files deleted file mode 100644 index 2546931c3f6c7066fdacd5a010b5f092cc07f6f7..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampling/probeLocations/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -probeLocations.C - -EXE = $(FOAM_APPBIN)/probeLocations diff --git a/applications/utilities/postProcessing/sampling/sampling/probeLocations/probesDict b/applications/utilities/postProcessing/sampling/sampling/probeLocations/probesDict deleted file mode 100644 index 3f7679f0dedd0316db3bb3d610209b06bc77370f..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampling/probeLocations/probesDict +++ /dev/null @@ -1,38 +0,0 @@ -/*-------------------------------*- C++ -*---------------------------------*\ -| ========= | -| \\ / OpenFOAM 1.4.1 | -| \\ / | -| \\ / The Open Source CFD Toolbox | -| \\/ http://www.OpenFOAM.org | -\*-------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class dictionary; - location system; - object probesDict; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - - -// Fields to be probed. runTime modifiable! -fields -( - p -); - -// Locations to be probed. runTime modifiable! -probeLocations -( - (0.0254 0.0253 0.0) - (0.0508 0.0253 0.0) - (0.0762 0.0253 0.0) - (0.1016 0.0253 0.0) - (0.1270 0.0253 0.0) - (0.1524 0.0253 0.0) - (0.1778 0.0253 0.0) -); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/utilities/postProcessing/sampling/sampling/sample/Make/options b/applications/utilities/postProcessing/sampling/sampling/sample/Make/options deleted file mode 100644 index 083d04c7a6724b1099fcb35b9b8526573503c7ba..0000000000000000000000000000000000000000 --- a/applications/utilities/postProcessing/sampling/sampling/sample/Make/options +++ /dev/null @@ -1,13 +0,0 @@ -EXE_INC = \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude \ - -I$(LIB_SRC)/triSurface/lnInclude \ - -I$(LIB_SRC)/lagrangian/basic/lnInclude \ - -EXE_LIBS = \ - -lfiniteVolume \ - -lmeshTools \ - -lsampling \ - -ltriSurface \ - -llagrangian diff --git a/applications/utilities/preProcessing/FoamX/lib/FoamX.jar b/applications/utilities/preProcessing/FoamX/lib/FoamX.jar index cf4f9c89d27346bd74dbe4e92fc20e8005a2b13d..dd94900a87113307d4845d45c76db76c964c1f76 100644 Binary files a/applications/utilities/preProcessing/FoamX/lib/FoamX.jar and b/applications/utilities/preProcessing/FoamX/lib/FoamX.jar differ diff --git a/wmake/wcleanAll b/wmake/wcleanAll index ab844fe2d2bb78c76234bf9acd9d8a163a980aa5..b2354bac64d166c7ce8c972649cb790fa2f2a33c 100755 --- a/wmake/wcleanAll +++ b/wmake/wcleanAll @@ -42,6 +42,7 @@ fi for dir in lib applications/bin do if [ -d $dir ] + then rm -rf $dir/* fi done