Skip to content

Commit 0ad2411

Browse files
change hai to hei to support different energy type: ha hs ea (#556)
* change hai to hei to support different energy type: ha hs ea * change the energy type from ha to hs in df0DFoam dfBuoyancyFoam dfLowMachFoam dfSprayFoam * change the test benchmark of dfLowMachFoam_TGV and dfLowMachFoam_2DaachenBomb * change the test benchmark of dfLowMachFoam_TGV and dfLowMachFoam_2DaachenBomb * change the test benchmark of dfLowMachFoam_TGV and dfLowMachFoam_2DaachenBomb --------- Co-authored-by: OpenFOAMFans <[email protected]>
1 parent 26d1c7a commit 0ad2411

File tree

15 files changed

+182
-131
lines changed

15 files changed

+182
-131
lines changed

applications/solvers/df0DFoam/createFields.H

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Info<< "Reading thermophysical properties\n" << endl;
44

5-
CanteraMixture::setEnergyName("ha");
5+
CanteraMixture::setEnergyName("hs");
66
// fluidThermo* pThermo = new hePsiThermo<psiThermo, CanteraMixture>(mesh, word::null);
77
fluidThermo* pThermo = new heRhoThermo<rhoThermo, CanteraMixture>(mesh, word::null);
88
fluidThermo& thermo = *pThermo;

applications/solvers/dfBuoyancyFoam/createFields.H

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Info<< "Reading thermophysical properties\n" << endl;
33
//psiReactionThermo& thermo = pThermo();
44
//thermo.validate(args.executable(), "h", "e");
55

6-
CanteraMixture::setEnergyName("ha");
6+
CanteraMixture::setEnergyName("hs");
77
// fluidThermo* pThermo = new heRhoThermo<rhoThermo, CanteraMixture>(mesh, word::null);
88
fluidThermo* pThermo = new heRhoThermo<rhoThermo, dfSingleStepReactingMixture>(mesh, word::null);
99
fluidThermo& thermo = *pThermo;

applications/solvers/dfHighSpeedFoam/rhoYEqn.H

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if (!inviscid)
55
hDiffCorrFlux = Zero;
66
diffAlphaD = Zero;
77
sumYDiffError = Zero;
8-
8+
99
forAll(Y, i)
1010
{
1111
sumYDiffError += chemistry->rhoD(i)*fvc::grad(Y[i]);
@@ -45,7 +45,7 @@ time_monitor_corrDiff += double(end - start) / double(CLOCKS_PER_SEC);
4545
MPI_Initialized(&flag_mpi_init);
4646
if(flag_mpi_init) MPI_Barrier(PstreamGlobals::MPI_COMM_FOAM);
4747
end = std::clock();
48-
time_monitor_chem += double(end - start) / double(CLOCKS_PER_SEC);
48+
time_monitor_chem += double(end - start) / double(CLOCKS_PER_SEC);
4949

5050
volScalarField Yt(0.0*Y[0]);
5151

@@ -57,12 +57,12 @@ time_monitor_corrDiff += double(end - start) / double(CLOCKS_PER_SEC);
5757

5858
if (!inviscid)
5959
{
60-
hDiffCorrFlux += chemistry->hai(i)*(chemistry->rhoD(i)*fvc::grad(Yi) - Yi*sumYDiffError);
61-
diffAlphaD += fvc::laplacian(thermo.alpha()*chemistry->hai(i), Yi);
60+
hDiffCorrFlux += chemistry->hei(i)*(chemistry->rhoD(i)*fvc::grad(Yi) - Yi*sumYDiffError);
61+
diffAlphaD += fvc::laplacian(thermo.alpha()*chemistry->hei(i), Yi);
6262
}
6363

6464
// if (i != inertIndex)
65-
{
65+
{
6666
if((ddtSchemes == "RK2SSP") || (ddtSchemes == "RK3SSP"))
6767
{
6868
rhoYi_rhs = -fvc::div(rhoPhiYi[i]);
@@ -72,12 +72,12 @@ time_monitor_corrDiff += double(end - start) / double(CLOCKS_PER_SEC);
7272
rhoYi_rhs.ref() += chemistry->wrate(i);
7373
Info <<"max reaction rate "<< Yi.name() << " is " << max(chemistry->wrate(i)).value() << endl;
7474
}
75-
75+
7676

7777
rhoYi[i] = rkcoe1[nrk]*rhoYi_save[i]
7878
+ rkcoe2[nrk]*rhoYi[i]
7979
+ rkcoe3[nrk]*rhoYi_rhs*runTime.deltaT();
80-
80+
8181
Yi=rhoYi[i]/rho;
8282
Yi.max(0.0);
8383

@@ -86,10 +86,10 @@ time_monitor_corrDiff += double(end - start) / double(CLOCKS_PER_SEC);
8686
const surfaceScalarField phiUc = linearInterpolate(sumYDiffError) & mesh.Sf();
8787
tmp<volScalarField> DEff = chemistry->rhoD(i) + turbulence->mut()/Sct;
8888

89-
rhoYi_rhs =
89+
rhoYi_rhs =
9090
(
9191
turbName == "laminar"
92-
? (fvc::laplacian(DEff(), Yi) - fvc::div(phiUc,Yi,"div(phi,Yi_h)"))
92+
? (fvc::laplacian(DEff(), Yi) - fvc::div(phiUc,Yi,"div(phi,Yi_h)"))
9393
: fvc::laplacian(DEff(), Yi)
9494
);
9595

@@ -103,7 +103,7 @@ time_monitor_corrDiff += double(end - start) / double(CLOCKS_PER_SEC);
103103
Yi.correctBoundaryConditions();
104104
rhoYi[i] = rho*Yi;
105105

106-
}
106+
}
107107
else
108108
{
109109
// original convection term
@@ -115,12 +115,12 @@ time_monitor_corrDiff += double(end - start) / double(CLOCKS_PER_SEC);
115115
// combustion->R(Yi)
116116
// + parcels.SYi(i, Yi)
117117
// );
118-
118+
119119
solve
120120
(
121121
fvm::ddt(rhoYi[i])
122122
+ fvc::div(rhoPhiYi[i])
123-
==
123+
==
124124
chemistry->RR(i)
125125
+ parcels.SYi(i, rhoYi[i])
126126
);
@@ -134,11 +134,11 @@ time_monitor_corrDiff += double(end - start) / double(CLOCKS_PER_SEC);
134134
tmp<volScalarField> DEff = chemistry->rhoD(i) + turbulence->mut()/Sct;
135135

136136
// original term
137-
// YiEqn -=
137+
// YiEqn -=
138138
// (
139139
// turbName == "laminar"
140140
// ? (fvm::laplacian(DEff(), Yi) - mvConvection->fvmDiv(phiUc, Yi))
141-
// : fvm::laplacian(DEff(), Yi)
141+
// : fvm::laplacian(DEff(), Yi)
142142
// );
143143

144144

@@ -165,7 +165,7 @@ time_monitor_corrDiff += double(end - start) / double(CLOCKS_PER_SEC);
165165
// Yi.max(0.0);
166166
rhoYi[i] = rho*Yi;
167167

168-
}
168+
}
169169
Yt += Yi;
170170
}
171171
}

applications/solvers/dfLowMachFoam/YEqn.H

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
const surfaceScalarField phiUc = linearInterpolate(sumYDiffError) & mesh.Sf();
3030
start1 = std::clock();
3131
time_monitor_YEqn += double(end1 - start1) / double(CLOCKS_PER_SEC);
32-
time_monitor_YEqn_solve += double(end1 - start1) / double(CLOCKS_PER_SEC);
32+
time_monitor_YEqn_solve += double(end1 - start1) / double(CLOCKS_PER_SEC);
3333

3434

3535

@@ -41,7 +41,7 @@
4141
if (!splitting)
4242
{
4343
std::chrono::steady_clock::time_point start = std::chrono::steady_clock::now();
44-
44+
4545
#ifdef ODE_GPU_SOLVER
4646
scalar dt = runTime.deltaTValue();
4747

@@ -88,8 +88,8 @@
8888
forAll(Y, i)
8989
{
9090
volScalarField& Yi = Y[i];
91-
hDiffCorrFlux += chemistry->hai(i)*(chemistry->rhoD(i)*fvc::grad(Yi) - Yi*sumYDiffError);
92-
diffAlphaD += fvc::laplacian(thermo.alpha()*chemistry->hai(i), Yi);
91+
hDiffCorrFlux += chemistry->hei(i)*(chemistry->rhoD(i)*fvc::grad(Yi) - Yi*sumYDiffError);
92+
diffAlphaD += fvc::laplacian(thermo.alpha()*chemistry->hei(i), Yi);
9393
if (i != inertIndex)
9494
{
9595
start1 = std::clock();
@@ -111,7 +111,7 @@
111111
: (fvm::laplacian(DEff(), Yi) + parcels.SYi(i, Yi) + combustion->R(Yi))
112112
)
113113
);
114-
114+
115115
end1 = std::clock();
116116
time_monitor_YEqn_mtxAssembly += double(end1 - start1) / double(CLOCKS_PER_SEC);
117117
// YiEqn.relax();

applications/solvers/dfLowMachFoam/YEqn_GPU.H

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ if(flag_mpi_init) MPI_Barrier(PstreamGlobals::MPI_COMM_FOAM);
4242
forAll(Y, i)
4343
{
4444
volScalarField& Yi = Y[i];
45-
hDiffCorrFlux += chemistry->hai(i)*(chemistry->rhoD(i)*fvc::grad(Yi) - Yi*sumYDiffError);
46-
diffAlphaD += fvc::laplacian(thermo.alpha()*chemistry->hai(i), Yi);
45+
hDiffCorrFlux += chemistry->hei(i)*(chemistry->rhoD(i)*fvc::grad(Yi) - Yi*sumYDiffError);
46+
diffAlphaD += fvc::laplacian(thermo.alpha()*chemistry->hei(i), Yi);
4747
if (i != inertIndex)
4848
{
4949
start1 = std::clock();
@@ -84,7 +84,7 @@ if(flag_mpi_init) MPI_Barrier(PstreamGlobals::MPI_COMM_FOAM);
8484
)
8585
);
8686
#endif
87-
87+
8888
end1 = std::clock();
8989
time_monitor_YEqn_mtxAssembly += double(end1 - start1) / double(CLOCKS_PER_SEC);
9090
// YiEqn.relax();
@@ -243,5 +243,5 @@ if(flag_mpi_init) MPI_Barrier(PstreamGlobals::MPI_COMM_FOAM);
243243
DEBUG_TRACE;
244244

245245
fflush(stderr);
246-
246+
247247
}

applications/solvers/dfLowMachFoam/createFields.H

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
Info<< "Reading thermophysical properties\n" << endl;
55

6-
CanteraMixture::setEnergyName("ha");
6+
CanteraMixture::setEnergyName("hs");
77
// fluidThermo* pThermo = new hePsiThermo<psiThermo, CanteraMixture>(mesh, word::null);
88
fluidThermo* pThermo = new heRhoThermo<rhoThermo, CanteraMixture>(mesh, word::null);
99
fluidThermo& thermo = *pThermo;

applications/solvers/dfSprayFoam/YEqn.H

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ const surfaceScalarField phiUc = linearInterpolate(sumYDiffError) & mesh.Sf();
2626
forAll(Y, i)
2727
{
2828
volScalarField& Yi = Y[i];
29-
hDiffCorrFlux += chemistry->hai(i)*(chemistry->rhoD(i)*fvc::grad(Yi) - Yi*sumYDiffError);
30-
diffAlphaD += fvc::laplacian(thermo.alpha()*chemistry->hai(i), Yi);
29+
hDiffCorrFlux += chemistry->hei(i)*(chemistry->rhoD(i)*fvc::grad(Yi) - Yi*sumYDiffError);
30+
diffAlphaD += fvc::laplacian(thermo.alpha()*chemistry->hei(i), Yi);
3131

3232
if (i != inertIndex)
3333
{
3434
tmp<volScalarField> DEff = chemistry->rhoD(i) + turbulence->mut()/Sct;
35-
35+
3636
fvScalarMatrix YEqn
3737
(
3838
turbName == "laminar"
@@ -69,7 +69,7 @@ const surfaceScalarField phiUc = linearInterpolate(sumYDiffError) & mesh.Sf();
6969

7070
Yi.max(0.0);
7171
Yt += Yi;
72-
72+
7373
}
7474
}
7575

applications/solvers/dfSprayFoam/createFields.H

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Info<< "Reading thermophysical properties\n" << endl;
44

5-
CanteraMixture::setEnergyName("ha");
5+
CanteraMixture::setEnergyName("hs");
66
// fluidThermo* pThermo = new hePsiThermo<psiThermo, CanteraMixture>(mesh, word::null);
77
fluidThermo* pThermo = new heRhoThermo<rhoThermo, CanteraMixture>(mesh, word::null);
88
fluidThermo& thermo = *pThermo;

src/design.UML

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ class dfChemistryModel<ThermoType>{
204204
-scalar absTol_
205205
-PtrList<volScalarField>& Y_
206206
-PtrList<volScalarField> rhoD_;
207-
-PtrList<volScalarField> hai_;
207+
-PtrList<volScalarField> hei_;
208208
-mutable scalarList yTemp_
209209
-mutable scalarList dTemp_;
210210
-mutable scalarList hrtTemp_;
@@ -238,7 +238,7 @@ class dfChemistryModel<ThermoType>{
238238
+PtrList<volScalarField>& Y()
239239
+const hashedWordList& species() const
240240
+const volScalarField& rhoD(const label i) const
241-
+volScalarField& hai(const label i)
241+
+volScalarField& hei(const label i)
242242
+void correctThermo()
243243
}
244244
@enduml

src/design.svg

Lines changed: 38 additions & 38 deletions
Loading

0 commit comments

Comments
 (0)