sonicFoam: change internal energy equation formulation to conserve total energy

This commit is contained in:
Henry
2012-09-12 15:36:39 +01:00
parent 4d0620eaa6
commit 7eef5af786
16 changed files with 2056 additions and 62 deletions

View File

@ -6,3 +6,4 @@ fvVectorMatrix UEqn
); );
solve(UEqn == -fvc::grad(p)); solve(UEqn == -fvc::grad(p));
K = 0.5*magSqr(U);

View File

@ -49,3 +49,6 @@
thermo thermo
) )
); );
Info<< "Creating field kinetic energy K\n" << endl;
volScalarField K("K", 0.5*magSqr(U));

View File

@ -5,7 +5,7 @@
+ fvm::div(phi, e) + fvm::div(phi, e)
- fvm::laplacian(turbulence->alphaEff(), e) - fvm::laplacian(turbulence->alphaEff(), e)
== ==
- p*fvc::div(phi/fvc::interpolate(rho)) - (fvc::ddt(rho, K) + fvc::div(phi, volScalarField("Ekp", K + p/rho)))
); );
thermo.correct(); thermo.correct();

View File

@ -39,3 +39,4 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
U = HbyA - rAU*fvc::grad(p); U = HbyA - rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
K = 0.5*magSqr(U);

View File

@ -56,16 +56,12 @@ int main(int argc, char *argv[])
#include "compressibleCourantNo.H" #include "compressibleCourantNo.H"
#include "rhoEqn.H" #include "rhoEqn.H"
#include "UEqn.H" #include "UEqn.H"
#include "eEqn.H"
// --- PISO loop // --- PISO loop
for (int corr=0; corr<nCorr; corr++) for (int corr=0; corr<nCorr; corr++)
{ {
#include "eEqn.H"
#include "pEqn.H" #include "pEqn.H"
} }

View File

@ -16,7 +16,7 @@ FoamFile
dimensions [0 1 -1 0 0 0 0]; dimensions [0 1 -1 0 0 0 0];
internalField uniform (0 0 0); internalField uniform (3 0 0);
boundaryField boundaryField
{ {

View File

@ -33,7 +33,7 @@ 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(phi,K) Gauss limitedLinear 1; div(phi,Ekp) Gauss limitedLinear 1;
div((muEff*dev2(T(grad(U))))) Gauss linear 1; div((muEff*dev2(T(grad(U))))) Gauss linear 1;
} }

File diff suppressed because it is too large Load Diff

View File

@ -10,6 +10,7 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class volVectorField; class volVectorField;
location "0";
object U; object U;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -24,11 +25,11 @@ boundaryField
{ {
type zeroGradient; type zeroGradient;
} }
empty empty
{ {
type empty; type empty;
} }
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -10,6 +10,7 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class volScalarField; class volScalarField;
location "0";
object magU; object magU;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -31,4 +32,5 @@ boundaryField
} }
} }
// ************************************************************************* // // ************************************************************************* //

File diff suppressed because it is too large Load Diff

View File

@ -33,7 +33,7 @@ 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(phi,K) Gauss limitedLinear 1; div(phi,Ekp) Gauss limitedLinear 1;
div((muEff*dev2(T(grad(U))))) Gauss linear 1; div((muEff*dev2(T(grad(U))))) Gauss linear 1;
} }

View File

@ -29,25 +29,17 @@ divSchemes
{ {
default none; default none;
div(phi,U) Gauss limitedLinearV 1; div(phi,U) Gauss limitedLinearV 1;
div(phi,e) Gauss limitedLinear 1;
div(phi,Ekp) Gauss limitedLinear 1;
div(phid,p) Gauss limitedLinear 1;
div(phi,k) Gauss upwind; div(phi,k) Gauss upwind;
div(phi,epsilon) Gauss upwind; div(phi,epsilon) Gauss upwind;
div(phi,R) Gauss upwind;
div(R) Gauss linear;
div(phid,p) Gauss limitedLinear 1;
div(phi,K) Gauss limitedLinear 1;
div(phi,e) Gauss limitedLinear 1;
div((muEff*dev2(T(grad(U))))) Gauss linear; div((muEff*dev2(T(grad(U))))) Gauss linear;
} }
laplacianSchemes laplacianSchemes
{ {
default none; default Gauss linear limited 0.5;
laplacian(muEff,U) Gauss linear limited 0.5;
laplacian(DkEff,k) Gauss linear limited 0.5;
laplacian(DREff,R) Gauss linear limited 0.5;
laplacian(DepsilonEff,epsilon) Gauss linear limited 0.5;
laplacian(Dp,p) Gauss linear limited 0.5;
laplacian(alphaEff,e) Gauss linear limited 0.5;
} }
interpolationSchemes interpolationSchemes

View File

@ -17,6 +17,11 @@ FoamFile
solvers solvers
{ {
rho
{
solver diagonal;
}
p p
{ {
solver PBiCG; solver PBiCG;
@ -25,26 +30,23 @@ solvers
relTol 0; relTol 0;
} }
rho "(U|e)"
{
solver PCG;
preconditioner DIC;
tolerance 1e-08;
relTol 0;
}
"(U|e|k|epsilon|R)"
{ {
$p; $p;
tolerance 1e-08; tolerance 1e-9;
relTol 0; }
"(k|epsilon)"
{
$p;
tolerance 1e-10;
} }
} }
PISO PISO
{ {
nCorrectors 2; nCorrectors 2;
nNonOrthogonalCorrectors 2; nNonOrthogonalCorrectors 0;
} }

View File

@ -29,25 +29,17 @@ divSchemes
{ {
default none; default none;
div(phi,U) Gauss limitedLinearV 1; div(phi,U) Gauss limitedLinearV 1;
div(phi,e) Gauss limitedLinear 1;
div(phi,Ekp) Gauss limitedLinear 1;
div(phid,p) Gauss limitedLinear 1;
div(phi,k) Gauss upwind; div(phi,k) Gauss upwind;
div(phi,epsilon) Gauss upwind; div(phi,epsilon) Gauss upwind;
div(phi,R) Gauss upwind;
div(R) Gauss linear;
div(phid,p) Gauss limitedLinear 1;
div(phi,K) Gauss limitedLinear 1;
div(phi,e) Gauss limitedLinear 1;
div((muEff*dev2(T(grad(U))))) Gauss linear; div((muEff*dev2(T(grad(U))))) Gauss linear;
} }
laplacianSchemes laplacianSchemes
{ {
default none; default Gauss linear corrected;
laplacian(muEff,U) Gauss linear corrected;
laplacian(DkEff,k) Gauss linear corrected;
laplacian(DREff,R) Gauss linear corrected;
laplacian(DepsilonEff,epsilon) Gauss linear corrected;
laplacian(Dp,p) Gauss linear corrected;
laplacian(alphaEff,e) Gauss linear corrected;
} }
interpolationSchemes interpolationSchemes

View File

@ -17,6 +17,11 @@ FoamFile
solvers solvers
{ {
rho
{
solver diagonal;
}
p p
{ {
solver PBiCG; solver PBiCG;
@ -25,34 +30,23 @@ solvers
relTol 0; relTol 0;
} }
rho
{
solver PCG;
preconditioner DIC;
tolerance 1e-05;
relTol 0;
}
"(U|e|R)" "(U|e|R)"
{ {
$p; $p;
tolerance 1e-05; tolerance 1e-05;
relTol 0;
} }
"(k|epsilon)" "(k|epsilon)"
{ {
$p; $p;
tolerance 1e-08; tolerance 1e-08;
relTol 0;
} }
} }
PISO PISO
{ {
nCorrectors 2; nCorrectors 2;
nNonOrthogonalCorrectors 2; nNonOrthogonalCorrectors 0;
} }