Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions applications/solvers/dfHighSpeedFoam/createFields.H
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,22 @@ const volScalarField& T = thermo.T();
const volScalarField& psi = thermo.psi();
const volScalarField& mu = thermo.mu();

bool inviscid(true);
if (max(mu.primitiveField()) > 0.0)
{
inviscid = false;
}
dictionary thermoDict
(
IOdictionary
(
IOobject
(
"thermophysicalProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE
)
)
);

bool inviscid(thermoDict.lookup("inviscid"));

Info<< "Reading field U\n" << endl;
volVectorField U
Expand Down
2 changes: 1 addition & 1 deletion applications/solvers/dfHighSpeedFoam/rhoEEqn.H
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if (!inviscid)
(
fvm::ddt(rho, e) - fvc::ddt(rho, e)
// alpha in deepflame is considered to calculate h by default (kappa/Cp), so multiply gamma to correct alpha
- fvc::laplacian(turbulence->alphaEff()*thermo.gamma(), e)
- fvm::laplacian(turbulence->alphaEff()*thermo.gamma(), e)
+ diffAlphaD
==
fvc::div(hDiffCorrFlux)
Expand Down
30 changes: 17 additions & 13 deletions applications/solvers/dfHighSpeedFoam/rhoYEqn.H
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
hDiffCorrFlux = Zero;
diffAlphaD = Zero;
sumYDiffError = Zero;
if (!inviscid)
{
hDiffCorrFlux = Zero;
diffAlphaD = Zero;
sumYDiffError = Zero;
}

tmp<fv::convectionScheme<scalar>> mvConvection
(
Expand All @@ -13,12 +16,6 @@ tmp<fv::convectionScheme<scalar>> mvConvection
)
);

forAll(Y, i)
{
sumYDiffError += chemistry.rhoD(i)*fvc::grad(Y[i]);
}
const surfaceScalarField phiUc = linearInterpolate(sumYDiffError) & mesh.Sf();

{
start = std::clock();
chemistry.solve(mesh.time().deltaTValue());
Expand All @@ -34,12 +31,9 @@ const surfaceScalarField phiUc = linearInterpolate(sumYDiffError) & mesh.Sf();
forAll(Y, i)
{
volScalarField& Yi = Y[i];
hDiffCorrFlux += chemistry.hai(i)*(chemistry.rhoD(i)*fvc::grad(Yi) - Yi*sumYDiffError);
diffAlphaD += fvc::laplacian(thermo.alpha()*chemistry.hai(i), Yi);

if (i != inertIndex)
{
tmp<volScalarField> DEff = chemistry.rhoD(i) + turbulence->mut()/Sct;
{
fvScalarMatrix YiEqn
(
fvm::ddt(rho, Yi)
Expand All @@ -50,6 +44,16 @@ const surfaceScalarField phiUc = linearInterpolate(sumYDiffError) & mesh.Sf();

if (!inviscid)
{
forAll(Y, i)
{
sumYDiffError += chemistry.rhoD(i)*fvc::grad(Y[i]);
}
const surfaceScalarField phiUc = linearInterpolate(sumYDiffError) & mesh.Sf();

hDiffCorrFlux += chemistry.hai(i)*(chemistry.rhoD(i)*fvc::grad(Yi) - Yi*sumYDiffError);
diffAlphaD += fvc::laplacian(thermo.alpha()*chemistry.hai(i), Yi);
tmp<volScalarField> DEff = chemistry.rhoD(i) + turbulence->mut()/Sct;

YiEqn -= fvm::laplacian(DEff(), Yi) - mvConvection->fvmDiv(phiUc, Yi);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ FoamFile
object thermophysicalProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

inviscid true;
// ************************************************************************* //
26 changes: 13 additions & 13 deletions examples/dfHighSpeedFoam/det_1D_H2_01mm/system/fvSchemes
Original file line number Diff line number Diff line change
Expand Up @@ -19,39 +19,39 @@ fluxScheme Kurganov;

ddtSchemes
{
default Euler;
default Euler;
}

gradSchemes
{
default Gauss linear;
default Gauss linear;
}

divSchemes
{
default none;
div(tauMC) Gauss linear;
div(hDiffCorrFlux) Gauss cubic;
div(phi,Yi_h) Gauss vanLeer;
default none;
div(tauMC) Gauss linear;
div(hDiffCorrFlux) Gauss cubic;
div(phi,Yi_h) Gauss vanLeer;
}

laplacianSchemes
{
default Gauss linear uncorrected;
default Gauss linear uncorrected;
}

interpolationSchemes
{
default linear;
reconstruct(rho) Minmod;
reconstruct(U) MinmodV;
reconstruct(T) Minmod;
reconstruct(Yi) Minmod;
default linear;
reconstruct(rho) Minmod;
reconstruct(U) MinmodV;
reconstruct(T) Minmod;
reconstruct(Yi) Minmod;
}

snGradSchemes
{
default uncorrected;
default uncorrected;
}


Expand Down
36 changes: 18 additions & 18 deletions examples/dfHighSpeedFoam/det_1D_H2_01mm/system/fvSolution
Original file line number Diff line number Diff line change
Expand Up @@ -19,41 +19,41 @@ solvers
{
U
{
//solver smoothSolver;
//smoother GaussSeidel;
//nSweeps 2;
//tolerance 1e-17;
//relTol 0;
//solver smoothSolver;
//smoother GaussSeidel;
//nSweeps 2;
//tolerance 1e-17;
//relTol 0;

solver PBiCGStab;
preconditioner DIC;
tolerance 1e-11;
relTol 0;
solver PBiCGStab;
preconditioner DIC;
tolerance 1e-11;
relTol 0;
}

h
{
$U;
tolerance 1e-11;
relTol 0;
$U;
tolerance 1e-11;
relTol 0;
}

e
{
$U;
tolerance 1e-11;
relTol 0;
$U;
tolerance 1e-11;
relTol 0;
}

"rho.*"
{
solver diagonal;
solver diagonal;
}

"(O2|N2|Yi)"
{
solver PBiCGStab;
preconditioner DILU;
solver PBiCGStab;
preconditioner DILU;
tolerance 1e-11;
relTol 0;
}
Expand Down