Skip to content

Commit

Permalink
Merge pull request #245 from xiao312/master
Browse files Browse the repository at this point in the history
Update EEqn.H & YEqn.H for dfLowMachFoam and dfSprayFoam
  • Loading branch information
pkuLmq authored Apr 14, 2023
2 parents 75f0dfc + 05b9fe3 commit b2fb349
Show file tree
Hide file tree
Showing 6 changed files with 180 additions and 70 deletions.
43 changes: 31 additions & 12 deletions applications/solvers/dfLowMachFoam/EEqn.H
Original file line number Diff line number Diff line change
@@ -1,18 +1,37 @@
{
volScalarField& he = thermo.he();

fvScalarMatrix EEqn
(
fvm::ddt(rho, he) + mvConvection->fvmDiv(phi, he)
+ fvc::ddt(rho, K) + fvc::div(phi, K)
- dpdt
- fvm::laplacian(turbulence->alphaEff(), he)
+ diffAlphaD
==
fvc::div(hDiffCorrFlux)
);
if ( turbName == "laminar")
{
fvScalarMatrix EEqn
(
fvm::ddt(rho, he) + mvConvection->fvmDiv(phi, he)
+ fvc::ddt(rho, K) + fvc::div(phi, K)
- dpdt
- fvm::laplacian(turbulence->alphaEff(), he)
+ diffAlphaD
==
fvc::div(hDiffCorrFlux)
);

EEqn.relax();

EEqn.solve();
}
else
{
fvScalarMatrix EEqn
(
fvm::ddt(rho, he) + mvConvection->fvmDiv(phi, he)
+ fvc::ddt(rho, K) + fvc::div(phi, K)
- dpdt
- fvm::laplacian(turbulence->alphaEff(), he)
);

EEqn.relax();

EEqn.solve();
}

EEqn.relax();

EEqn.solve();
}
56 changes: 41 additions & 15 deletions applications/solvers/dfLowMachFoam/YEqn.H
Original file line number Diff line number Diff line change
Expand Up @@ -53,25 +53,51 @@ time_monitor_corrDiff += double(end - start) / double(CLOCKS_PER_SEC);
if (i != inertIndex)
{
tmp<volScalarField> DEff = chemistry->rhoD(i) + turbulence->mut()/Sct;
fvScalarMatrix YiEqn
(
fvm::ddt(rho, Yi)
+ mvConvection->fvmDiv(phi, Yi)
+ mvConvection->fvmDiv(phiUc, Yi)
==

if (turbName == "laminar")
{
fvScalarMatrix YiEqn
(
fvm::ddt(rho, Yi)
+ mvConvection->fvmDiv(phi, Yi)
+ mvConvection->fvmDiv(phiUc, Yi)
==
(
splitting
? fvm::laplacian(DEff(), Yi)
: (fvm::laplacian(DEff(), Yi) + combustion->R(Yi))
)
);

YiEqn.relax();

YiEqn.solve("Yi");

Yi.max(0.0);
Yt += Yi;
}
else
{
fvScalarMatrix YiEqn
(
splitting
? fvm::laplacian(DEff(), Yi)
: (fvm::laplacian(DEff(), Yi) + combustion->R(Yi))
)
);
fvm::ddt(rho, Yi)
+ mvConvection->fvmDiv(phi, Yi)
==
(
splitting
? fvm::laplacian(DEff(), Yi)
: (fvm::laplacian(DEff(), Yi) + combustion->R(Yi))
)
);

YiEqn.relax();

YiEqn.relax();
YiEqn.solve("Yi");

YiEqn.solve("Yi");
Yi.max(0.0);
Yt += Yi;
}

Yi.max(0.0);
Yt += Yi;
}
}

Expand Down
4 changes: 3 additions & 1 deletion applications/solvers/dfLowMachFoam/createFields.H
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,12 @@ autoPtr<CombustionModel<basicThermo>> combustion
Info<< "end Creating reaction model\n" << endl;


//const word combModelName(combustion->type());
const word combModelName(mesh.objectRegistry::lookupObject<IOdictionary>("combustionProperties").lookup("combustionModel"));
Info << "Combustion Model Name is confirmed as "<< combModelName << endl;

const word turbName(mesh.objectRegistry::lookupObject<IOdictionary>("turbulenceProperties").lookup("simulationType"));
Info << "Turbulence Model Name is confirmed as "<< turbName << endl;

dfChemistryModel<basicThermo>* chemistry = combustion->chemistry();
PtrList<volScalarField>& Y = chemistry->Y();
const word inertSpecie(chemistry->lookup("inertSpecie"));
Expand Down
82 changes: 57 additions & 25 deletions applications/solvers/dfSprayFoam/EEqn.H
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,61 @@
hcSource.source() -= parcels.rhoTrans(i)*chemistry->mixture().Hc(i)/runTime.deltaT();
}
//hSource.source() -= parcels.hsTrans()/runTime.deltaT();// equivalent to parcels.Sh(he)
fvScalarMatrix EEqn
(
fvm::ddt(rho, he) + mvConvection->fvmDiv(phi, he)
+ fvc::ddt(rho, K) + fvc::div(phi, K)
- dpdt
- fvm::laplacian(turbulence->alphaEff(), he)
+ diffAlphaD
==
rho*(U&g)
+ parcels.Sh(he)
+ hcSource
+ fvc::div(hDiffCorrFlux)
//+ radiation->Sh(thermo, he)
//+ fvOptions(rho, he)
);

EEqn.relax();

//fvOptions.constrain(EEqn);

EEqn.solve();

//fvOptions.correct(he);

//radiation->correct();

if ( turbName == "laminar")
{
fvScalarMatrix EEqn
(
fvm::ddt(rho, he) + mvConvection->fvmDiv(phi, he)
+ fvc::ddt(rho, K) + fvc::div(phi, K)
- dpdt
- fvm::laplacian(turbulence->alphaEff(), he)
+ diffAlphaD
==
rho*(U&g)
+ parcels.Sh(he)
+ hcSource
+ fvc::div(hDiffCorrFlux)
//+ radiation->Sh(thermo, he)
//+ fvOptions(rho, he)
);

EEqn.relax();

//fvOptions.constrain(EEqn);

EEqn.solve();

//fvOptions.correct(he);

//radiation->correct();
}
else
{
fvScalarMatrix EEqn
(
fvm::ddt(rho, he) + mvConvection->fvmDiv(phi, he)
+ fvc::ddt(rho, K) + fvc::div(phi, K)
- dpdt
- fvm::laplacian(turbulence->alphaEff(), he)
+ diffAlphaD
==
rho*(U&g)
+ parcels.Sh(he)
+ hcSource
+ fvc::div(hDiffCorrFlux)
//+ radiation->Sh(thermo, he)
//+ fvOptions(rho, he)
);

EEqn.relax();

//fvOptions.constrain(EEqn);

EEqn.solve();

//fvOptions.correct(he);

//radiation->correct();
}
}
62 changes: 45 additions & 17 deletions applications/solvers/dfSprayFoam/YEqn.H
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,56 @@ const surfaceScalarField phiUc = linearInterpolate(sumYDiffError) & mesh.Sf();
if (i != inertIndex)
{
tmp<volScalarField> DEff = chemistry->rhoD(i) + turbulence->mut()/Sct;
fvScalarMatrix YEqn
(
fvm::ddt(rho, Yi)
+ mvConvection->fvmDiv(phi, Yi)
- fvm::laplacian(DEff(), Yi)
+ mvConvection->fvmDiv(phiUc, Yi)
==
parcels.SYi(i, Yi)
+ combustion->R(Yi)
//+ fvOptions(rho, Yi)
);

if ( turbName == "laminar")
{
fvScalarMatrix YEqn
(
fvm::ddt(rho, Yi)
+ mvConvection->fvmDiv(phi, Yi)
- fvm::laplacian(DEff(), Yi)
+ mvConvection->fvmDiv(phiUc, Yi)
==
parcels.SYi(i, Yi)
+ combustion->R(Yi)
//+ fvOptions(rho, Yi)
);

YEqn.relax();
YEqn.relax();

//fvOptions.constrain(YEqn);
//fvOptions.constrain(YEqn);

YEqn.solve("Yi");
YEqn.solve("Yi");

//fvOptions.correct(Yi);
//fvOptions.correct(Yi);

Yi.max(0.0);
Yt += Yi;
Yi.max(0.0);
Yt += Yi;
}
else
{
fvScalarMatrix YEqn
(
fvm::ddt(rho, Yi)
+ mvConvection->fvmDiv(phi, Yi)
- fvm::laplacian(DEff(), Yi)
==
parcels.SYi(i, Yi)
+ combustion->R(Yi)
//+ fvOptions(rho, Yi)
);

YEqn.relax();

//fvOptions.constrain(YEqn);

YEqn.solve("Yi");

//fvOptions.correct(Yi);

Yi.max(0.0);
Yt += Yi;
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions applications/solvers/dfSprayFoam/createFields.H
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ autoPtr<compressible::turbulenceModel> turbulence
)
);

const word turbName(mesh.objectRegistry::lookupObject<IOdictionary>("turbulenceProperties").lookup("simulationType"));
Info << "Turbulence Model Name is confirmed as "<< turbName << endl;

Info<< "Creating reaction model\n" << endl;
autoPtr<CombustionModel<basicThermo>> combustion
(
Expand Down

0 comments on commit b2fb349

Please sign in to comment.