mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
removing cavitatingFoam - behaviour can be recoved using rasCavitatingFoam etc
This commit is contained in:
@ -1,59 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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
|
||||
|
||||
Global
|
||||
CourantNo
|
||||
|
||||
Description
|
||||
Calculates and outputs the mean and maximum Courant Numbers.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
scalar CoNum = 0.0;
|
||||
scalar meanCoNum = 0.0;
|
||||
scalar acousticCoNum = 0.0;
|
||||
|
||||
if (mesh.nInternalFaces())
|
||||
{
|
||||
surfaceScalarField SfUfbyDelta =
|
||||
mesh.surfaceInterpolation::deltaCoeffs()*mag(phiv);
|
||||
|
||||
CoNum = max(SfUfbyDelta/mesh.magSf())
|
||||
.value()*runTime.deltaT().value();
|
||||
|
||||
meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
|
||||
.value()*runTime.deltaT().value();
|
||||
|
||||
acousticCoNum = max
|
||||
(
|
||||
mesh.surfaceInterpolation::deltaCoeffs()/sqrt(fvc::interpolate(psi))
|
||||
).value()*runTime.deltaT().value();
|
||||
}
|
||||
|
||||
Info<< "phiv Courant Number mean: " << meanCoNum
|
||||
<< " max: " << CoNum
|
||||
<< " acoustic max: " << acousticCoNum
|
||||
<< endl;
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,3 +0,0 @@
|
||||
cavitatingFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/cavitatingFoam
|
||||
@ -1,7 +0,0 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/barotropicCompressibilityModel/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lbarotropicCompressibilityModel
|
||||
@ -1,16 +0,0 @@
|
||||
surfaceScalarField gammaf = fvc::interpolate(gamma);
|
||||
surfaceScalarField muf("muf", gammaf*muv + (1.0 - gammaf)*mul);
|
||||
|
||||
fvVectorMatrix UEqn
|
||||
(
|
||||
fvm::ddt(rho, U)
|
||||
+ fvm::div(phi, U)
|
||||
- fvm::laplacian(muf, U)
|
||||
//- (fvc::grad(U) & fvc::grad(muf))
|
||||
- fvc::div(muf*(fvc::interpolate(dev(fvc::grad(U))) & mesh.Sf()))
|
||||
);
|
||||
|
||||
if (momentumPredictor)
|
||||
{
|
||||
solve(UEqn == -fvc::grad(p));
|
||||
}
|
||||
@ -1,90 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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
|
||||
cavitatingFoam
|
||||
|
||||
Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "barotropicCompressibilityModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
# include "setRootCase.H"
|
||||
|
||||
# include "createTime.H"
|
||||
# include "createMesh.H"
|
||||
# include "readThermodynamicProperties.H"
|
||||
# include "readTransportProperties.H"
|
||||
# include "readControls.H"
|
||||
# include "createFields.H"
|
||||
# include "initContinuityErrs.H"
|
||||
# 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;
|
||||
|
||||
for (int outerCorr=0; outerCorr<nOuterCorr; outerCorr++)
|
||||
{
|
||||
# include "rhoEqn.H"
|
||||
# include "gammaPsi.H"
|
||||
# include "UEqn.H"
|
||||
|
||||
for (int corr=0; corr<nCorr; corr++)
|
||||
{
|
||||
# include "pEqn.H"
|
||||
}
|
||||
}
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
}
|
||||
|
||||
Info<< "\n end \n";
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,22 +0,0 @@
|
||||
{
|
||||
volScalarField thermoRho = psi*p + (1.0 - gamma)*rhol0;
|
||||
|
||||
dimensionedScalar totalMass = fvc::domainIntegrate(rho);
|
||||
|
||||
scalar sumLocalContErr =
|
||||
(
|
||||
fvc::domainIntegrate(mag(rho - thermoRho))/totalMass
|
||||
).value();
|
||||
|
||||
scalar globalContErr =
|
||||
(
|
||||
fvc::domainIntegrate(rho - thermoRho)/totalMass
|
||||
).value();
|
||||
|
||||
cumulativeContErr += globalContErr;
|
||||
|
||||
Info<< "time step continuity errors : sum local = " << sumLocalContErr
|
||||
<< ", global = " << globalContErr
|
||||
<< ", cumulative = " << cumulativeContErr
|
||||
<< endl;
|
||||
}
|
||||
@ -1,75 +0,0 @@
|
||||
Info<< "Reading field p\n" << endl;
|
||||
volScalarField p
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
volScalarField rho
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
volScalarField gamma
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"gamma",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
max(min((rho - rholSat)/(rhovSat - rholSat), scalar(1)), scalar(0))
|
||||
);
|
||||
gamma.oldTime();
|
||||
|
||||
Info<< "Creating barotropicompressibilityModel\n" << endl;
|
||||
autoPtr<barotropicCompressibilityModel> psiModel =
|
||||
barotropicCompressibilityModel::New
|
||||
(
|
||||
thermodynamicProperties,
|
||||
gamma
|
||||
);
|
||||
|
||||
const volScalarField& psi = psiModel->psi();
|
||||
|
||||
rho == max
|
||||
(
|
||||
psi*p
|
||||
+ (1.0 - gamma)*rhol0
|
||||
+ ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat,
|
||||
rhoMin
|
||||
);
|
||||
|
||||
Info<< "Reading field U\n" << endl;
|
||||
volVectorField U
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"U",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
);
|
||||
|
||||
# include "createPhiv.H"
|
||||
# include "compressibleCreatePhi.H"
|
||||
@ -1,10 +0,0 @@
|
||||
{
|
||||
gamma = max(min((rho - rholSat)/(rhovSat - rholSat), scalar(1)), scalar(0));
|
||||
|
||||
Info<< "max-min gamma: " << max(gamma).value()
|
||||
<< " " << min(gamma).value() << endl;
|
||||
|
||||
psiModel->correct();
|
||||
|
||||
//Info<< "min a: " << 1.0/sqrt(max(psi)).value() << endl;
|
||||
}
|
||||
@ -1,80 +0,0 @@
|
||||
{
|
||||
if (nOuterCorr == 1)
|
||||
{
|
||||
p =
|
||||
(
|
||||
rho
|
||||
- (1.0 - gamma)*rhol0
|
||||
- ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat
|
||||
)/psi;
|
||||
}
|
||||
|
||||
surfaceScalarField rhof = fvc::interpolate(rho, "rhof");
|
||||
|
||||
volScalarField rUA = 1.0/UEqn.A();
|
||||
surfaceScalarField rUAf("rUAf", rhof*fvc::interpolate(rUA));
|
||||
volVectorField HbyA = rUA*UEqn.H();
|
||||
|
||||
phiv = (fvc::interpolate(HbyA) & mesh.Sf())
|
||||
+ fvc::ddtPhiCorr(rUA, rho, U, phiv);
|
||||
|
||||
p.boundaryField().updateCoeffs();
|
||||
|
||||
surfaceScalarField phiGradp = rUAf*mesh.magSf()*fvc::snGrad(p);
|
||||
|
||||
phiv -= phiGradp/rhof;
|
||||
|
||||
# include "resetPhivPatches.H"
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::ddt(psi, p)
|
||||
- (rhol0 + (psil - psiv)*pSat)*fvc::ddt(gamma) - pSat*fvc::ddt(psi)
|
||||
+ fvc::div(phiv, rho)
|
||||
+ fvc::div(phiGradp)
|
||||
- fvm::laplacian(rUAf, p)
|
||||
);
|
||||
|
||||
pEqn.solve();
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
phiv += (phiGradp + pEqn.flux())/rhof;
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "max-min p: " << max(p).value()
|
||||
<< " " << min(p).value() << endl;
|
||||
|
||||
|
||||
U = HbyA - rUA*fvc::grad(p);
|
||||
|
||||
// Remove the swirl component of velocity for "wedge" cases
|
||||
if (piso.found("removeSwirl"))
|
||||
{
|
||||
label swirlCmpt(readLabel(piso.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;
|
||||
|
||||
rho == max
|
||||
(
|
||||
psi*p
|
||||
+ (1.0 - gamma)*rhol0
|
||||
+ ((gamma*psiv + (1.0 - gamma)*psil) - psi)*pSat,
|
||||
rhoMin
|
||||
);
|
||||
|
||||
Info<< "max-min rho: " << max(rho).value()
|
||||
<< " " << min(rho).value() << endl;
|
||||
|
||||
# include "gammaPsi.H"
|
||||
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
#include "readTimeControls.H"
|
||||
|
||||
scalar maxAcousticCo
|
||||
(
|
||||
readScalar(runTime.controlDict().lookup("maxAcousticCo"))
|
||||
);
|
||||
|
||||
|
||||
#include "readPISOControls.H"
|
||||
@ -1,27 +0,0 @@
|
||||
Info<< "Reading thermodynamicProperties\n" << endl;
|
||||
|
||||
IOdictionary thermodynamicProperties
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"thermodynamicProperties",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
dimensionedScalar psil(thermodynamicProperties.lookup("psil"));
|
||||
|
||||
dimensionedScalar rholSat(thermodynamicProperties.lookup("rholSat"));
|
||||
|
||||
dimensionedScalar psiv(thermodynamicProperties.lookup("psiv"));
|
||||
|
||||
dimensionedScalar pSat(thermodynamicProperties.lookup("pSat"));
|
||||
|
||||
dimensionedScalar rhovSat("rhovSat", psiv*pSat);
|
||||
|
||||
dimensionedScalar rhol0("rhol0", rholSat - pSat*psil);
|
||||
|
||||
dimensionedScalar rhoMin(thermodynamicProperties.lookup("rhoMin"));
|
||||
@ -1,23 +0,0 @@
|
||||
Info<< "Reading transportProperties\n" << endl;
|
||||
|
||||
IOdictionary transportProperties
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"transportProperties",
|
||||
runTime.constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
dimensionedScalar mul
|
||||
(
|
||||
transportProperties.lookup("mul")
|
||||
);
|
||||
|
||||
dimensionedScalar muv
|
||||
(
|
||||
transportProperties.lookup("muv")
|
||||
);
|
||||
@ -1,15 +0,0 @@
|
||||
fvsPatchScalarFieldField& phiPatches = phi.boundaryField();
|
||||
const fvPatchScalarFieldField& rhoPatches = rho.boundaryField();
|
||||
const fvPatchVectorFieldField& Upatches = U.boundaryField();
|
||||
const fvsPatchVectorFieldField& SfPatches = mesh.Sf().boundaryField();
|
||||
|
||||
forAll(phiPatches, patchI)
|
||||
{
|
||||
if (phi.boundaryField().types()[patchI] == "calculated")
|
||||
{
|
||||
calculatedFvsPatchScalarField& phiPatch =
|
||||
refCast<calculatedFvsPatchScalarField>(phiPatches[patchI]);
|
||||
|
||||
phiPatch == ((rhoPatches[patchI]*Upatches[patchI]) & SfPatches[patchI]);
|
||||
}
|
||||
}
|
||||
@ -1,14 +0,0 @@
|
||||
surfaceScalarField::GeometricBoundaryField& phivPatches = phiv.boundaryField();
|
||||
const volVectorField::GeometricBoundaryField& Upatches = U.boundaryField();
|
||||
const surfaceVectorField::GeometricBoundaryField& SfPatches = mesh.Sf().boundaryField();
|
||||
|
||||
forAll(phivPatches, patchI)
|
||||
{
|
||||
if (phiv.boundaryField().types()[patchI] == "calculated")
|
||||
{
|
||||
calculatedFvsPatchScalarField& phivPatch =
|
||||
refCast<calculatedFvsPatchScalarField>(phivPatches[patchI]);
|
||||
|
||||
phivPatch == (Upatches[patchI] & SfPatches[patchI]);
|
||||
}
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
{
|
||||
fvScalarMatrix rhoEqn
|
||||
(
|
||||
fvm::ddt(rho)
|
||||
+ fvm::div(phiv, rho)
|
||||
);
|
||||
|
||||
rhoEqn.solve();
|
||||
|
||||
phi = rhoEqn.flux();
|
||||
|
||||
Info<< "max-min rho: " << max(rho).value()
|
||||
<< " " << min(rho).value() << endl;
|
||||
|
||||
rho == max(rho, rhoMin);
|
||||
}
|
||||
@ -1,54 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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
|
||||
|
||||
Global
|
||||
setDeltaT
|
||||
|
||||
Description
|
||||
Reset the timestep to maintain a constant maximum courant Number.
|
||||
Reduction of time-step is imediate but increase is damped to avoid
|
||||
unstable oscillations.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
if (adjustTimeStep)
|
||||
{
|
||||
scalar maxDeltaTFact =
|
||||
min(maxCo/(CoNum + SMALL), maxAcousticCo/(acousticCoNum + SMALL));
|
||||
|
||||
scalar deltaTFact = min(min(maxDeltaTFact, 1.0 + 0.1*maxDeltaTFact), 1.2);
|
||||
|
||||
runTime.setDeltaT
|
||||
(
|
||||
min
|
||||
(
|
||||
deltaTFact*runTime.deltaT().value(),
|
||||
maxDeltaT
|
||||
)
|
||||
);
|
||||
|
||||
Info<< "deltaT = " << runTime.deltaT().value() << endl;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,54 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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
|
||||
|
||||
Global
|
||||
setInitialDeltaT
|
||||
|
||||
Description
|
||||
Set the initial timestep corresponding to the timestep adjustment
|
||||
algorithm in setDeltaT
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
if (adjustTimeStep)
|
||||
{
|
||||
# include "CourantNo.H"
|
||||
|
||||
if (CoNum > SMALL)
|
||||
{
|
||||
scalar maxDeltaTFact =
|
||||
min(maxCo/(CoNum + SMALL), maxAcousticCo/(acousticCoNum + SMALL));
|
||||
|
||||
runTime.setDeltaT
|
||||
(
|
||||
min
|
||||
(
|
||||
maxDeltaTFact*runTime.deltaT().value(),
|
||||
maxDeltaT
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user