diff --git a/applications/solvers/compressible/sonicFoam/UEqn.H b/applications/solvers/compressible/sonicFoam/UEqn.H new file mode 100644 index 0000000000..25506783ae --- /dev/null +++ b/applications/solvers/compressible/sonicFoam/UEqn.H @@ -0,0 +1,8 @@ +fvVectorMatrix UEqn +( + fvm::ddt(rho, U) + + fvm::div(phi, U) + + turbulence->divDevRhoReff(U) +); + +solve(UEqn == -fvc::grad(p)); diff --git a/applications/solvers/compressible/sonicFoam/compressibleContinuityErrs.H b/applications/solvers/compressible/sonicFoam/compressibleContinuityErrs.H deleted file mode 100644 index 128d99c946..0000000000 --- a/applications/solvers/compressible/sonicFoam/compressibleContinuityErrs.H +++ /dev/null @@ -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; -} diff --git a/applications/solvers/compressible/sonicFoam/createFields.H b/applications/solvers/compressible/sonicFoam/createFields.H index bbb5d10526..5d03dd2bb7 100644 --- a/applications/solvers/compressible/sonicFoam/createFields.H +++ b/applications/solvers/compressible/sonicFoam/createFields.H @@ -7,7 +7,7 @@ basicPsiThermo& thermo = pThermo(); volScalarField& p = thermo.p(); - volScalarField& h = thermo.h(); + volScalarField& e = thermo.e(); const volScalarField& psi = thermo.psi(); volScalarField rho @@ -35,7 +35,7 @@ mesh ); -# include "compressibleCreatePhi.H" + #include "compressibleCreatePhi.H" Info<< "Creating turbulence model\n" << endl; @@ -49,7 +49,3 @@ thermo ) ); - - Info<< "Creating field DpDt\n" << endl; - volScalarField DpDt = - fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p); diff --git a/applications/solvers/compressible/sonicFoam/eEqn.H b/applications/solvers/compressible/sonicFoam/eEqn.H new file mode 100644 index 0000000000..1d1d6aef0b --- /dev/null +++ b/applications/solvers/compressible/sonicFoam/eEqn.H @@ -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(); +} diff --git a/applications/solvers/compressible/sonicFoam/hEqn.H b/applications/solvers/compressible/sonicFoam/hEqn.H deleted file mode 100644 index baa2dab343..0000000000 --- a/applications/solvers/compressible/sonicFoam/hEqn.H +++ /dev/null @@ -1,12 +0,0 @@ -{ - solve - ( - fvm::ddt(rho, h) - + fvm::div(phi, h) - - fvm::laplacian(turbulence->alphaEff(), h) - == - DpDt - ); - - thermo.correct(); -} diff --git a/applications/solvers/compressible/sonicFoam/pEqn.H b/applications/solvers/compressible/sonicFoam/pEqn.H new file mode 100644 index 0000000000..96a500d4c2 --- /dev/null +++ b/applications/solvers/compressible/sonicFoam/pEqn.H @@ -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(); diff --git a/applications/solvers/compressible/sonicFoam/readThermodynamicProperties.H b/applications/solvers/compressible/sonicFoam/readThermodynamicProperties.H deleted file mode 100644 index 1fc57fc5fd..0000000000 --- a/applications/solvers/compressible/sonicFoam/readThermodynamicProperties.H +++ /dev/null @@ -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") - ); diff --git a/applications/solvers/compressible/sonicFoam/readTransportProperties.H b/applications/solvers/compressible/sonicFoam/readTransportProperties.H deleted file mode 100644 index 1502e2033a..0000000000 --- a/applications/solvers/compressible/sonicFoam/readTransportProperties.H +++ /dev/null @@ -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") - ); diff --git a/applications/solvers/compressible/sonicFoam/sonicFoam.C b/applications/solvers/compressible/sonicFoam/sonicFoam.C index c9eda00fa3..df100262ef 100644 --- a/applications/solvers/compressible/sonicFoam/sonicFoam.C +++ b/applications/solvers/compressible/sonicFoam/sonicFoam.C @@ -58,64 +58,21 @@ int main(int argc, char *argv[]) #include "rhoEqn.H" - fvVectorMatrix UEqn - ( - fvm::ddt(rho, U) - + fvm::div(phi, U) - + turbulence->divDevRhoReff(U) - ); + #include "UEqn.H" - solve(UEqn == -fvc::grad(p)); - - #include "hEqn.H" + #include "eEqn.H" // --- PISO loop for (int corr=0; corrcorrect(); - rho = psi*p; + rho = thermo.rho(); runTime.write(); diff --git a/tutorials/compressible/sonicFoam/Allrun b/tutorials/compressible/sonicFoam/Allrun new file mode 100755 index 0000000000..4f1a1e464a --- /dev/null +++ b/tutorials/compressible/sonicFoam/Allrun @@ -0,0 +1,5 @@ +#!/bin/sh +set -x + +(cd laminar && ./Allrun) +(cd ras && ./Allrun) diff --git a/tutorials/compressible/sonicFoam/laminar/Allrun b/tutorials/compressible/sonicFoam/laminar/Allrun new file mode 100755 index 0000000000..573ff3a12d --- /dev/null +++ b/tutorials/compressible/sonicFoam/laminar/Allrun @@ -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 diff --git a/tutorials/compressible/sonicFoam/laminar/forwardStep/constant/thermophysicalProperties b/tutorials/compressible/sonicFoam/laminar/forwardStep/constant/thermophysicalProperties new file mode 100644 index 0000000000..82d43de570 --- /dev/null +++ b/tutorials/compressible/sonicFoam/laminar/forwardStep/constant/thermophysicalProperties @@ -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>>>>; + +mixture air 1 11640.31 1.78571 0 0 0.7; + + +// ************************************************************************* // diff --git a/tutorials/compressible/sonicFoam/laminar/forwardStep/constant/transportProperties b/tutorials/compressible/sonicFoam/laminar/forwardStep/constant/turbulenceProperties similarity index 84% rename from tutorials/compressible/sonicFoam/laminar/forwardStep/constant/transportProperties rename to tutorials/compressible/sonicFoam/laminar/forwardStep/constant/turbulenceProperties index 1e9d5be60c..c2c3b28a1b 100644 --- a/tutorials/compressible/sonicFoam/laminar/forwardStep/constant/transportProperties +++ b/tutorials/compressible/sonicFoam/laminar/forwardStep/constant/turbulenceProperties @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.5 | +| \\ / O peration | Version: dev | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ @@ -11,11 +11,11 @@ FoamFile format ascii; class dictionary; location "constant"; - object transportProperties; + object turbulenceProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -mu mu [ 1 -1 -1 0 0 0 0 ] 0; +simulationType laminar; // ************************************************************************* // diff --git a/tutorials/compressible/sonicFoam/laminar/forwardStep/system/fvSchemes b/tutorials/compressible/sonicFoam/laminar/forwardStep/system/fvSchemes index 1c36c50aa6..6bebe35dfb 100644 --- a/tutorials/compressible/sonicFoam/laminar/forwardStep/system/fvSchemes +++ b/tutorials/compressible/sonicFoam/laminar/forwardStep/system/fvSchemes @@ -30,17 +30,19 @@ gradSchemes divSchemes { default none; - div(phi,U) Gauss limitedLinearV 1; + div(phi,U) Gauss upwind; div(phid,p) 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 { default none; - laplacian(mu,U) Gauss linear corrected; - laplacian(mu,e) 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 diff --git a/tutorials/compressible/sonicFoam/laminar/shockTube/constant/thermophysicalProperties b/tutorials/compressible/sonicFoam/laminar/shockTube/constant/thermophysicalProperties new file mode 100644 index 0000000000..2560f39757 --- /dev/null +++ b/tutorials/compressible/sonicFoam/laminar/shockTube/constant/thermophysicalProperties @@ -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>>>>; + +mixture air 1 28.9 717.5 0 0 0.7; + + +// ************************************************************************* // diff --git a/tutorials/compressible/sonicFoam/laminar/shockTube/constant/transportProperties b/tutorials/compressible/sonicFoam/laminar/shockTube/constant/turbulenceProperties similarity index 84% rename from tutorials/compressible/sonicFoam/laminar/shockTube/constant/transportProperties rename to tutorials/compressible/sonicFoam/laminar/shockTube/constant/turbulenceProperties index 1e9d5be60c..c2c3b28a1b 100644 --- a/tutorials/compressible/sonicFoam/laminar/shockTube/constant/transportProperties +++ b/tutorials/compressible/sonicFoam/laminar/shockTube/constant/turbulenceProperties @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.5 | +| \\ / O peration | Version: dev | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ @@ -11,11 +11,11 @@ FoamFile format ascii; class dictionary; location "constant"; - object transportProperties; + object turbulenceProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -mu mu [ 1 -1 -1 0 0 0 0 ] 0; +simulationType laminar; // ************************************************************************* // diff --git a/tutorials/compressible/sonicFoam/laminar/shockTube/system/fvSchemes b/tutorials/compressible/sonicFoam/laminar/shockTube/system/fvSchemes index deef4abd26..6bebe35dfb 100644 --- a/tutorials/compressible/sonicFoam/laminar/shockTube/system/fvSchemes +++ b/tutorials/compressible/sonicFoam/laminar/shockTube/system/fvSchemes @@ -33,14 +33,16 @@ divSchemes div(phi,U) Gauss upwind; div(phid,p) 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 { default none; - laplacian(mu,U) Gauss linear corrected; - laplacian(mu,e) 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 diff --git a/tutorials/compressible/sonicFoam/ras/nacaAirfoil/constant/thermophysicalProperties b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/constant/thermophysicalProperties index 97425177af..5580ffd632 100644 --- a/tutorials/compressible/sonicFoam/ras/nacaAirfoil/constant/thermophysicalProperties +++ b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/constant/thermophysicalProperties @@ -15,9 +15,9 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -thermoType hPsiThermo>>>>; +thermoType ePsiThermo>>>>; -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; // ************************************************************************* // diff --git a/tutorials/compressible/sonicFoam/laminar/shockTube/constant/thermodynamicProperties b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/constant/turbulenceProperties similarity index 79% rename from tutorials/compressible/sonicFoam/laminar/shockTube/constant/thermodynamicProperties rename to tutorials/compressible/sonicFoam/ras/nacaAirfoil/constant/turbulenceProperties index 99575bf65f..3721a46a2e 100644 --- a/tutorials/compressible/sonicFoam/laminar/shockTube/constant/thermodynamicProperties +++ b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/constant/turbulenceProperties @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.5 | +| \\ / O peration | Version: dev | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ @@ -11,13 +11,11 @@ FoamFile format ascii; class dictionary; location "constant"; - object thermodynamicProperties; + object turbulenceProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -Cv Cv [ 0 2 -2 -1 0 0 0 ] 717.5; - -R R [ 0 2 -2 -1 0 0 0 ] 287; +simulationType RASModel; // ************************************************************************* // diff --git a/tutorials/compressible/sonicFoam/ras/nacaAirfoil/system/controlDict b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/system/controlDict index ce2e9218c9..aad6ecd97e 100644 --- a/tutorials/compressible/sonicFoam/ras/nacaAirfoil/system/controlDict +++ b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/system/controlDict @@ -49,7 +49,12 @@ functions { type forceCoeffs; functionObjectLibs ( "libforces.so" ); - patches ( WALL10 ); + outputControl timeStep; + outputInterval 1; + patches + ( + WALL10 + ); pName p; UName U; log true; diff --git a/tutorials/compressible/sonicFoam/ras/nacaAirfoil/system/fvSchemes b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/system/fvSchemes index 0cab17b88e..444443d62d 100644 --- a/tutorials/compressible/sonicFoam/ras/nacaAirfoil/system/fvSchemes +++ b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/system/fvSchemes @@ -35,7 +35,7 @@ divSchemes div(R) Gauss linear; div(phid,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; } @@ -47,7 +47,7 @@ laplacianSchemes laplacian(DREff,R) 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(alphaEff,h) Gauss linear limited 0.5; + laplacian(alphaEff,e) Gauss linear limited 0.5; } interpolationSchemes @@ -63,7 +63,7 @@ snGradSchemes fluxRequired { default no; - p ; + p; } diff --git a/tutorials/compressible/sonicFoam/ras/nacaAirfoil/system/fvSolution b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/system/fvSolution index a1782db685..d46dcd13cf 100644 --- a/tutorials/compressible/sonicFoam/ras/nacaAirfoil/system/fvSolution +++ b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/system/fvSolution @@ -41,7 +41,7 @@ solvers relTol 0; } - h + e { solver PBiCG; preconditioner DILU; diff --git a/tutorials/compressible/sonicFoam/ras/prism/constant/thermophysicalProperties b/tutorials/compressible/sonicFoam/ras/prism/constant/thermophysicalProperties index 39b28b3681..5580ffd632 100644 --- a/tutorials/compressible/sonicFoam/ras/prism/constant/thermophysicalProperties +++ b/tutorials/compressible/sonicFoam/ras/prism/constant/thermophysicalProperties @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.5 | +| \\ / O peration | Version: dev | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ @@ -15,9 +15,9 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -thermoType hPsiThermo>>>>; +thermoType ePsiThermo>>>>; -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; // ************************************************************************* // diff --git a/tutorials/compressible/sonicFoam/laminar/forwardStep/constant/thermodynamicProperties b/tutorials/compressible/sonicFoam/ras/prism/constant/turbulenceProperties similarity index 79% rename from tutorials/compressible/sonicFoam/laminar/forwardStep/constant/thermodynamicProperties rename to tutorials/compressible/sonicFoam/ras/prism/constant/turbulenceProperties index c6bf31c073..3721a46a2e 100644 --- a/tutorials/compressible/sonicFoam/laminar/forwardStep/constant/thermodynamicProperties +++ b/tutorials/compressible/sonicFoam/ras/prism/constant/turbulenceProperties @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.5 | +| \\ / O peration | Version: dev | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ @@ -11,13 +11,11 @@ FoamFile format ascii; class dictionary; location "constant"; - object thermodynamicProperties; + object turbulenceProperties; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -Cv Cv [ 0 2 -2 -1 0 0 0 ] 1.78571; - -R R [ 0 2 -2 -1 0 0 0 ] 0.714286; +simulationType RASModel; // ************************************************************************* // diff --git a/tutorials/compressible/sonicFoam/ras/prism/system/fvSchemes b/tutorials/compressible/sonicFoam/ras/prism/system/fvSchemes index 7b3c03466f..9737d97c28 100644 --- a/tutorials/compressible/sonicFoam/ras/prism/system/fvSchemes +++ b/tutorials/compressible/sonicFoam/ras/prism/system/fvSchemes @@ -35,7 +35,7 @@ divSchemes div(R) Gauss linear; div(phid,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; } @@ -47,7 +47,7 @@ laplacianSchemes laplacian(DREff,R) Gauss linear corrected; laplacian(DepsilonEff,epsilon) 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 @@ -63,7 +63,7 @@ snGradSchemes fluxRequired { default no; - p ; + p; } diff --git a/tutorials/compressible/sonicFoam/ras/prism/system/fvSolution b/tutorials/compressible/sonicFoam/ras/prism/system/fvSolution index 5341a980f4..5ff77210a9 100644 --- a/tutorials/compressible/sonicFoam/ras/prism/system/fvSolution +++ b/tutorials/compressible/sonicFoam/ras/prism/system/fvSolution @@ -41,7 +41,7 @@ solvers relTol 0; } - h + e { solver PBiCG; preconditioner DILU;