sonicFoam solver and tutorial updates

This commit is contained in:
andy
2009-06-25 13:19:41 +01:00
parent c8d033f1ef
commit fac1b596b8
26 changed files with 176 additions and 153 deletions

View File

@ -0,0 +1,8 @@
fvVectorMatrix UEqn
(
fvm::ddt(rho, U)
+ fvm::div(phi, U)
+ turbulence->divDevRhoReff(U)
);
solve(UEqn == -fvc::grad(p));

View File

@ -1,12 +0,0 @@
{
# include "rhoEqn.H"
}
{
scalar sumLocalContErr = (sum(mag(rho - psi*p))/sum(rho)).value();
scalar globalContErr = (sum(rho - psi*p)/sum(rho)).value();
cumulativeContErr += globalContErr;
Info<< "time step continuity errors : sum local = " << sumLocalContErr
<< ", global = " << globalContErr
<< ", cumulative = " << cumulativeContErr << endl;
}

View File

@ -7,7 +7,7 @@
basicPsiThermo& thermo = pThermo(); basicPsiThermo& thermo = pThermo();
volScalarField& p = thermo.p(); volScalarField& p = thermo.p();
volScalarField& h = thermo.h(); volScalarField& e = thermo.e();
const volScalarField& psi = thermo.psi(); const volScalarField& psi = thermo.psi();
volScalarField rho volScalarField rho
@ -49,7 +49,3 @@
thermo thermo
) )
); );
Info<< "Creating field DpDt\n" << endl;
volScalarField DpDt =
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);

View File

@ -0,0 +1,12 @@
{
solve
(
fvm::ddt(rho, e)
+ fvm::div(phi, e)
- fvm::laplacian(turbulence->alphaEff(), e)
==
- p*fvc::div(phi/fvc::interpolate(rho))
);
thermo.correct();
}

View File

@ -1,12 +0,0 @@
{
solve
(
fvm::ddt(rho, h)
+ fvm::div(phi, h)
- fvm::laplacian(turbulence->alphaEff(), h)
==
DpDt
);
thermo.correct();
}

View File

@ -0,0 +1,37 @@
rho = thermo.rho();
volScalarField rUA = 1.0/UEqn.A();
U = rUA*UEqn.H();
surfaceScalarField phid
(
"phid",
fvc::interpolate(psi)
*(
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
)
);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
fvm::ddt(psi, p)
+ fvm::div(phid, p)
- fvm::laplacian(rho*rUA, p)
);
pEqn.solve();
if (nonOrth == nNonOrthCorr)
{
phi = pEqn.flux();
}
}
#include "rhoEqn.H"
#include "compressibleContinuityErrs.H"
U -= rUA*fvc::grad(p);
U.correctBoundaryConditions();

View File

@ -1,23 +0,0 @@
Info<< "Reading thermodynamicProperties\n" << endl;
IOdictionary thermodynamicProperties
(
IOobject
(
"thermodynamicProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
dimensionedScalar R
(
thermodynamicProperties.lookup("R")
);
dimensionedScalar Cv
(
thermodynamicProperties.lookup("Cv")
);

View File

@ -1,18 +0,0 @@
Info<< "Reading transportProperties\n" << endl;
IOdictionary transportProperties
(
IOobject
(
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
dimensionedScalar mu
(
transportProperties.lookup("mu")
);

View File

@ -58,64 +58,21 @@ int main(int argc, char *argv[])
#include "rhoEqn.H" #include "rhoEqn.H"
fvVectorMatrix UEqn #include "UEqn.H"
(
fvm::ddt(rho, U)
+ fvm::div(phi, U)
+ turbulence->divDevRhoReff(U)
);
solve(UEqn == -fvc::grad(p)); #include "eEqn.H"
#include "hEqn.H"
// --- PISO loop // --- PISO loop
for (int corr=0; corr<nCorr; corr++) for (int corr=0; corr<nCorr; corr++)
{ {
volScalarField rUA = 1.0/UEqn.A(); #include "pEqn.H"
U = rUA*UEqn.H();
surfaceScalarField phid
(
"phid",
fvc::interpolate(psi)
*(
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
)
);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
fvm::ddt(psi, p)
+ fvm::div(phid, p)
- fvm::laplacian(rho*rUA, p)
);
pEqn.solve();
if (nonOrth == nNonOrthCorr)
{
phi = pEqn.flux();
} }
}
#include "compressibleContinuityErrs.H"
U -= rUA*fvc::grad(p);
U.correctBoundaryConditions();
}
DpDt =
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
turbulence->correct(); turbulence->correct();
rho = psi*p; rho = thermo.rho();
runTime.write(); runTime.write();

View File

@ -0,0 +1,5 @@
#!/bin/sh
set -x
(cd laminar && ./Allrun)
(cd ras && ./Allrun)

View File

@ -0,0 +1,22 @@
#!/bin/sh
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
# Get application name from directory
application=sonicFoam
cases=" \
forwardStep \
shockTube \
"
for case in $cases
do
(cd $case && runApplication blockMesh)
#
if [ "$case" = "shockTube" ] ; then
(cd $case && ./Allrun)
else
(cd $case && runApplication $application)
fi
#
done

View File

@ -0,0 +1,23 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object thermophysicalProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
thermoType ePsiThermo<pureMixture<constTransport<specieThermo<eConstThermo<perfectGas>>>>>;
mixture air 1 11640.31 1.78571 0 0 0.7;
// ************************************************************************* //

View File

@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5 | | \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -11,11 +11,11 @@ FoamFile
format ascii; format ascii;
class dictionary; class dictionary;
location "constant"; location "constant";
object transportProperties; object turbulenceProperties;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
mu mu [ 1 -1 -1 0 0 0 0 ] 0; simulationType laminar;
// ************************************************************************* // // ************************************************************************* //

View File

@ -30,17 +30,19 @@ gradSchemes
divSchemes divSchemes
{ {
default none; default none;
div(phi,U) Gauss limitedLinearV 1; div(phi,U) Gauss upwind;
div(phid,p) Gauss limitedLinear 1; div(phid,p) Gauss limitedLinear 1;
div(phi,e) Gauss limitedLinear 1; div(phi,e) Gauss limitedLinear 1;
div(phiU,p) Gauss limitedLinear 1;
div((muEff*dev2(grad(U).T()))) Gauss linear 1;
} }
laplacianSchemes laplacianSchemes
{ {
default none; default none;
laplacian(mu,U) Gauss linear corrected;
laplacian(mu,e) Gauss linear corrected;
laplacian((rho*(1|A(U))),p) Gauss linear corrected; laplacian((rho*(1|A(U))),p) Gauss linear corrected;
laplacian(muEff,U) Gauss linear corrected;
laplacian(alphaEff,e) Gauss linear corrected;
} }
interpolationSchemes interpolationSchemes

View File

@ -0,0 +1,23 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object thermophysicalProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
thermoType ePsiThermo<pureMixture<constTransport<specieThermo<eConstThermo<perfectGas>>>>>;
mixture air 1 28.9 717.5 0 0 0.7;
// ************************************************************************* //

View File

@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5 | | \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -11,11 +11,11 @@ FoamFile
format ascii; format ascii;
class dictionary; class dictionary;
location "constant"; location "constant";
object transportProperties; object turbulenceProperties;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
mu mu [ 1 -1 -1 0 0 0 0 ] 0; simulationType laminar;
// ************************************************************************* // // ************************************************************************* //

View File

@ -33,14 +33,16 @@ divSchemes
div(phi,U) Gauss upwind; div(phi,U) Gauss upwind;
div(phid,p) Gauss limitedLinear 1; div(phid,p) Gauss limitedLinear 1;
div(phi,e) Gauss limitedLinear 1; div(phi,e) Gauss limitedLinear 1;
div(phiU,p) Gauss limitedLinear 1;
div((muEff*dev2(grad(U).T()))) Gauss linear 1;
} }
laplacianSchemes laplacianSchemes
{ {
default none; default none;
laplacian(mu,U) Gauss linear corrected;
laplacian(mu,e) Gauss linear corrected;
laplacian((rho*(1|A(U))),p) Gauss linear corrected; laplacian((rho*(1|A(U))),p) Gauss linear corrected;
laplacian(muEff,U) Gauss linear corrected;
laplacian(alphaEff,e) Gauss linear corrected;
} }
interpolationSchemes interpolationSchemes

View File

@ -15,9 +15,9 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
thermoType hPsiThermo<pureMixture<constTransport<specieThermo<hConstThermo<perfectGas>>>>>; thermoType ePsiThermo<pureMixture<constTransport<specieThermo<eConstThermo<perfectGas>>>>>;
mixture air 1 28.9 1000 2.544e+06 1.8e-05 0.7; mixture air 1 28.9 717.5 0 1.8e-05 0.7;
// ************************************************************************* // // ************************************************************************* //

View File

@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5 | | \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -11,13 +11,11 @@ FoamFile
format ascii; format ascii;
class dictionary; class dictionary;
location "constant"; location "constant";
object thermodynamicProperties; object turbulenceProperties;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Cv Cv [ 0 2 -2 -1 0 0 0 ] 717.5; simulationType RASModel;
R R [ 0 2 -2 -1 0 0 0 ] 287;
// ************************************************************************* // // ************************************************************************* //

View File

@ -49,7 +49,12 @@ functions
{ {
type forceCoeffs; type forceCoeffs;
functionObjectLibs ( "libforces.so" ); functionObjectLibs ( "libforces.so" );
patches ( WALL10 ); outputControl timeStep;
outputInterval 1;
patches
(
WALL10
);
pName p; pName p;
UName U; UName U;
log true; log true;

View File

@ -35,7 +35,7 @@ divSchemes
div(R) Gauss linear; div(R) Gauss linear;
div(phid,p) Gauss limitedLinear 1; div(phid,p) Gauss limitedLinear 1;
div(phiU,p) Gauss limitedLinear 1; div(phiU,p) Gauss limitedLinear 1;
div(phi,h) Gauss limitedLinear 1; div(phi,e) Gauss limitedLinear 1;
div((muEff*dev2(grad(U).T()))) Gauss linear; div((muEff*dev2(grad(U).T()))) Gauss linear;
} }
@ -47,7 +47,7 @@ laplacianSchemes
laplacian(DREff,R) Gauss linear limited 0.5; laplacian(DREff,R) Gauss linear limited 0.5;
laplacian(DepsilonEff,epsilon) Gauss linear limited 0.5; laplacian(DepsilonEff,epsilon) Gauss linear limited 0.5;
laplacian((rho*(1|A(U))),p) Gauss linear limited 0.5; laplacian((rho*(1|A(U))),p) Gauss linear limited 0.5;
laplacian(alphaEff,h) Gauss linear limited 0.5; laplacian(alphaEff,e) Gauss linear limited 0.5;
} }
interpolationSchemes interpolationSchemes

View File

@ -41,7 +41,7 @@ solvers
relTol 0; relTol 0;
} }
h e
{ {
solver PBiCG; solver PBiCG;
preconditioner DILU; preconditioner DILU;

View File

@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5 | | \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -15,9 +15,9 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
thermoType hPsiThermo<pureMixture<constTransport<specieThermo<hConstThermo<perfectGas>>>>>; thermoType ePsiThermo<pureMixture<constTransport<specieThermo<eConstThermo<perfectGas>>>>>;
mixture air 1 28.9 1300 2.544e+06 1.84e-05 0.7; mixture air 1 28.9 717.5 0 1.8e-05 0.7;
// ************************************************************************* // // ************************************************************************* //

View File

@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | | ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5 | | \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org | | \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | | | \\/ M anipulation | |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -11,13 +11,11 @@ FoamFile
format ascii; format ascii;
class dictionary; class dictionary;
location "constant"; location "constant";
object thermodynamicProperties; object turbulenceProperties;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Cv Cv [ 0 2 -2 -1 0 0 0 ] 1.78571; simulationType RASModel;
R R [ 0 2 -2 -1 0 0 0 ] 0.714286;
// ************************************************************************* // // ************************************************************************* //

View File

@ -35,7 +35,7 @@ divSchemes
div(R) Gauss linear; div(R) Gauss linear;
div(phid,p) Gauss limitedLinear 1; div(phid,p) Gauss limitedLinear 1;
div(phiU,p) Gauss limitedLinear 1; div(phiU,p) Gauss limitedLinear 1;
div(phi,h) Gauss limitedLinear 1; div(phi,e) Gauss limitedLinear 1;
div((muEff*dev2(grad(U).T()))) Gauss linear; div((muEff*dev2(grad(U).T()))) Gauss linear;
} }
@ -47,7 +47,7 @@ laplacianSchemes
laplacian(DREff,R) Gauss linear corrected; laplacian(DREff,R) Gauss linear corrected;
laplacian(DepsilonEff,epsilon) Gauss linear corrected; laplacian(DepsilonEff,epsilon) Gauss linear corrected;
laplacian((rho*(1|A(U))),p) Gauss linear corrected; laplacian((rho*(1|A(U))),p) Gauss linear corrected;
laplacian(alphaEff,h) Gauss linear corrected; laplacian(alphaEff,e) Gauss linear corrected;
} }
interpolationSchemes interpolationSchemes

View File

@ -41,7 +41,7 @@ solvers
relTol 0; relTol 0;
} }
h e
{ {
solver PBiCG; solver PBiCG;
preconditioner DILU; preconditioner DILU;