Skip to content

Commit 9e95820

Browse files
authored
Merge branch 'master' into GPU
2 parents 0d54b4b + aca64be commit 9e95820

202 files changed

Lines changed: 6866 additions & 2031 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/CPU_inferencce_validation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ jobs:
5050
&& ls $PWD
5151
&& ls flareFGM_Table_Download
5252
&& cp -r flareFGM_Table_Download/SandiaD/flare.tbl examples/dfLowMachFoam/2DSandiaD_flareFGM/
53-
&& git clone https://github.com/deepcombustion/deepcombustion.git
54-
&& cp -r deepcombustion/DeePCK/Model/HE04_Hydrogen_ESH2_GMS_sub_20221101/ mechanisms/ && source ~/miniconda3/etc/profile.d/conda.sh && conda activate libcantera && source /opt/openfoam7/etc/bashrc
53+
&& git clone https://github.com/intelligent-algorithm-team/intelligent-combustion.git
54+
&& cp -r intelligent-combustion/DeePCK/Model/HE04_Hydrogen_ESH2_GMS_sub_20221101/ mechanisms/ && source ~/miniconda3/etc/profile.d/conda.sh && conda activate libcantera && source /opt/openfoam7/etc/bashrc
5555
&& . configure.sh --use_pytorch && source ./bashrc && . install.sh
5656
&& cd test && ./Allrun && conda deactivate "
5757

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "submodules/libROUNDSchemes"]
2+
path = submodules/libROUNDSchemes
3+
url = https://github.com/advanCFD/libROUNDSchemes.git
4+
[submodule "submodules/WENOEXT"]
5+
path = submodules/WENOEXT
6+
url = https://github.com/WENO-OF/WENOEXT.git

README.md

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

1919
DeepFlame is a deep learning empowered computational fluid dynamics package for single or multiphase, laminar or turbulent, reacting flows at all speeds. It aims to provide an open-source platform to combine the individual strengths of [OpenFOAM](https://openfoam.org), [Cantera](https://cantera.org), and [PyTorch](https://pytorch.org/) libraries for deep learning assisted reacting flow simulations. It also has the scope to leverage the next-generation heterogenous supercomputing and AI acceleration infrastructures such as GPU and FPGA.
2020

21-
The deep learning algorithms and models used in the DeepFlame tutorial examples are developed and trained independently by our collaborators team – [DeepCombustion](https://github.com/deepcombustion/deepcombustion). Please refer to their website for detailed information.
21+
The deep learning algorithms and models used in the DeepFlame tutorial examples are developed and trained independently by our collaborators team – [Intelligent Combustion](https://github.com/intelligent-algorithm-team/intelligent-combustion.git). Please refer to their website for detailed information.
2222

2323
## Documentation
2424
Detailed guide for installation and tutorials is available on [our documentation website](https://deepflame.deepmodeling.com).

applications/solvers/df0DFoam/createFields.H

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

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

5-
fluidThermo* pThermo = new hePsiThermo<psiThermo, CanteraMixture>(mesh, word::null);
5+
// fluidThermo* pThermo = new hePsiThermo<psiThermo, CanteraMixture>(mesh, word::null);
6+
fluidThermo* pThermo = new heRhoThermo<rhoThermo, CanteraMixture>(mesh, word::null);
67
fluidThermo& thermo = *pThermo;
78

8-
thermo.validate(args.executable(), "ha");
9+
// thermo.validate(args.executable(), "ha");
910

1011
volScalarField& p = thermo.p();
1112

@@ -93,6 +94,8 @@ dfChemistryModel<basicThermo> chemistry(thermo);
9394
PtrList<volScalarField>& Y = chemistry.Y();
9495
const word inertSpecie(chemistry.lookup("inertSpecie"));
9596
const label inertIndex(chemistry.species()[inertSpecie]);
97+
chemistry.setEnergyName("ha");
98+
chemistry.updateEnergy();
9699

97100
forAll(Y, i)
98101
{

applications/solvers/df0DFoam/df0DFoam.C

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ Description
2727
\*---------------------------------------------------------------------------*/
2828
#include "dfChemistryModel.H"
2929
#include "CanteraMixture.H"
30-
#include "hePsiThermo.H"
30+
// #include "hePsiThermo.H"
31+
#include "heRhoThermo.H"
3132

3233
#ifdef USE_PYTORCH
3334
#include <pybind11/embed.h>

applications/solvers/dfHighSpeedFoam/createFields.H

Lines changed: 45 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

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

5-
psiThermo* pThermo = new hePsiThermo<psiThermo, CanteraMixture>(mesh, word::null);
6-
psiThermo& thermo = *pThermo;
5+
// psiThermo* pThermo = new hePsiThermo<psiThermo, CanteraMixture>(mesh, word::null);
6+
// psiThermo& thermo = *pThermo;
7+
rhoThermo* pThermo = new heRhoThermo<rhoThermo, CanteraMixture>(mesh, word::null);
8+
rhoThermo& thermo = *pThermo;
79

810
//move from creatFieldRefs.H to createFields.H
911
//p needed to be created before e
@@ -27,7 +29,7 @@ dictionary thermoDict
2729
)
2830
);
2931

30-
bool inviscid(thermoDict.lookup("inviscid"));
32+
bool inviscid(thermoDict.lookupOrDefault("inviscid",false));
3133

3234
Info<< "Reading field U\n" << endl;
3335
volVectorField U
@@ -56,9 +58,6 @@ volScalarField rho
5658
thermo.rho()
5759
);
5860

59-
volScalarField e = thermo.he() - p/rho;
60-
volScalarField& ha = thermo.he();
61-
6261
volVectorField rhoU
6362
(
6463
IOobject
@@ -72,19 +71,6 @@ volVectorField rhoU
7271
rho*U
7372
);
7473

75-
volScalarField rhoE
76-
(
77-
IOobject
78-
(
79-
"rhoE",
80-
runTime.timeName(),
81-
mesh,
82-
IOobject::NO_READ,
83-
IOobject::NO_WRITE
84-
),
85-
rho*(e + 0.5*magSqr(U))
86-
);
87-
8874
surfaceScalarField pos
8975
(
9076
IOobject
@@ -135,6 +121,24 @@ dfChemistryModel<basicThermo>* chemistry = combustion->chemistry();
135121
PtrList<volScalarField>& Y = chemistry->Y();
136122
const word inertSpecie(chemistry->lookup("inertSpecie"));
137123
const label inertIndex(chemistry->species()[inertSpecie]);
124+
chemistry->setEnergyName("ea");
125+
chemistry->updateEnergy();
126+
127+
volScalarField& ea = thermo.he();
128+
volScalarField ha = ea + p/rho;
129+
130+
volScalarField rhoE
131+
(
132+
IOobject
133+
(
134+
"rhoE",
135+
runTime.timeName(),
136+
mesh,
137+
IOobject::NO_READ,
138+
IOobject::NO_WRITE
139+
),
140+
rho*(ea + 0.5*magSqr(U))
141+
);
138142

139143
chemistry->correctThermo();
140144
Info<< "At initial time, min/max(T) = " << min(T).value() << ", " << max(T).value() << endl;
@@ -145,6 +149,28 @@ forAll(Y, i)
145149
}
146150
fields.add(thermo.he());
147151

152+
const label nspecies(chemistry->species().size());
153+
PtrList<volScalarField> rhoYi(nspecies);
154+
forAll(rhoYi,i)
155+
{
156+
rhoYi.set
157+
(
158+
i,
159+
new volScalarField
160+
(
161+
IOobject
162+
(
163+
"rhoYi" + Y[i].name(),
164+
runTime.timeName(),
165+
mesh,
166+
IOobject::NO_READ,
167+
IOobject::NO_WRITE
168+
),
169+
rho*Y[i]
170+
)
171+
);
172+
}
173+
148174
const scalar Sct = chemistry->lookupOrDefault("Sct", 1.);
149175
volScalarField diffAlphaD
150176
(

applications/solvers/dfHighSpeedFoam/dfHighSpeedFoam.C

Lines changed: 71 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ Description
3232

3333
#include "dfChemistryModel.H"
3434
#include "CanteraMixture.H"
35-
#include "hePsiThermo.H"
35+
// #include "hePsiThermo.H"
36+
#include "heRhoThermo.H"
3637

3738
#ifdef USE_PYTORCH
3839
#include <pybind11/embed.h>
@@ -47,7 +48,8 @@ Description
4748

4849
#include "fvCFD.H"
4950
#include "dynamicFvMesh.H"
50-
#include "psiThermo.H"
51+
// #include "psiThermo.H"
52+
#include "rhoThermo.H"
5153
#include "turbulentFluidThermoModel.H"
5254
#include "fixedRhoFvPatchScalarField.H"
5355
#include "directionInterpolate.H"
@@ -130,15 +132,57 @@ int main(int argc, char *argv[])
130132
surfaceScalarField rho_pos(interpolate(rho, pos));
131133
surfaceScalarField rho_neg(interpolate(rho, neg));
132134

135+
PtrList<surfaceScalarField> rhoYi_pos(nspecies);
136+
PtrList<surfaceScalarField> rhoYi_neg(nspecies);
137+
forAll(rhoYi_pos,i)
138+
{
139+
rhoYi_pos.set
140+
(
141+
i,
142+
new surfaceScalarField
143+
(
144+
IOobject
145+
(
146+
"rhoYi_pos" + Y[i].name(),
147+
runTime.timeName(),
148+
mesh,
149+
IOobject::NO_READ,
150+
IOobject::NO_WRITE
151+
),
152+
interpolate(rhoYi[i], pos,"Yi")
153+
)
154+
);
155+
}
156+
157+
forAll(rhoYi_neg,i)
158+
{
159+
rhoYi_neg.set
160+
(
161+
i,
162+
new surfaceScalarField
163+
(
164+
IOobject
165+
(
166+
"rhoYi_neg" + Y[i].name(),
167+
runTime.timeName(),
168+
mesh,
169+
IOobject::NO_READ,
170+
IOobject::NO_WRITE
171+
),
172+
interpolate(rhoYi[i], neg,"Yi")
173+
)
174+
);
175+
}
176+
133177
surfaceVectorField rhoU_pos(interpolate(rhoU, pos, U.name()));
134178
surfaceVectorField rhoU_neg(interpolate(rhoU, neg, U.name()));
135179

136180
volScalarField rPsi("rPsi", 1.0/psi);
137181
surfaceScalarField rPsi_pos(interpolate(rPsi, pos, T.name()));
138182
surfaceScalarField rPsi_neg(interpolate(rPsi, neg, T.name()));
139183

140-
surfaceScalarField e_pos(interpolate(e, pos, T.name()));
141-
surfaceScalarField e_neg(interpolate(e, neg, T.name()));
184+
surfaceScalarField ea_pos(interpolate(ea, pos, T.name()));
185+
surfaceScalarField ea_neg(interpolate(ea, neg, T.name()));
142186

143187
surfaceVectorField U_pos("U_pos", rhoU_pos/rho_pos);
144188
surfaceVectorField U_neg("U_neg", rhoU_neg/rho_neg);
@@ -215,6 +259,27 @@ int main(int argc, char *argv[])
215259

216260
phi = aphiv_pos*rho_pos + aphiv_neg*rho_neg;
217261

262+
PtrList<surfaceScalarField> phiYi(nspecies);
263+
forAll(phiYi,i)
264+
{
265+
phiYi.set
266+
(
267+
i,
268+
new surfaceScalarField
269+
(
270+
IOobject
271+
(
272+
"phiYi_" + Y[i].name(),
273+
runTime.timeName(),
274+
mesh,
275+
IOobject::NO_READ,
276+
IOobject::NO_WRITE
277+
),
278+
aphiv_pos*rhoYi_pos[i] + aphiv_neg*rhoYi_neg[i]
279+
)
280+
);
281+
}
282+
218283
surfaceVectorField phiUp
219284
(
220285
(aphiv_pos*rhoU_pos + aphiv_neg*rhoU_neg)
@@ -224,8 +289,8 @@ int main(int argc, char *argv[])
224289
surfaceScalarField phiEp
225290
(
226291
"phiEp",
227-
aphiv_pos*(rho_pos*(e_pos + 0.5*magSqr(U_pos)) + p_pos)
228-
+ aphiv_neg*(rho_neg*(e_neg + 0.5*magSqr(U_neg)) + p_neg)
292+
aphiv_pos*(rho_pos*(ea_pos + 0.5*magSqr(U_pos)) + p_pos)
293+
+ aphiv_neg*(rho_neg*(ea_neg + 0.5*magSqr(U_neg)) + p_neg)
229294
+ aSf*p_pos - aSf*p_neg
230295
);
231296

applications/solvers/dfHighSpeedFoam/rhoEEqn.H

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,31 @@ solve
1515
- fvc::div(sigmaDotU)
1616
);
1717

18-
e = rhoE/rho - 0.5*magSqr(U);
19-
e.correctBoundaryConditions();
18+
ea = rhoE/rho - 0.5*magSqr(U);
19+
ea.correctBoundaryConditions();
2020

21-
ha = e + p/rho;
21+
ha = ea + p/rho;
2222
chemistry->correctThermo(); // before this, we must update ha = e + p/rho
2323

24-
rhoE.boundaryFieldRef() == rho.boundaryField()*(e.boundaryField() + 0.5*magSqr(U.boundaryField()));
24+
rhoE.boundaryFieldRef() == rho.boundaryField()*(ea.boundaryField() + 0.5*magSqr(U.boundaryField()));
2525

2626
if (!inviscid)
2727
{
2828
fvScalarMatrix eEqn
2929
(
30-
fvm::ddt(rho, e) - fvc::ddt(rho, e)
30+
fvm::ddt(rho, ea) - fvc::ddt(rho, ea)
3131
// alpha in deepflame is considered to calculate h by default (kappa/Cp), so multiply gamma to correct alpha
32-
- fvm::laplacian(turbulence->alphaEff()*thermo.gamma(), e)
32+
- fvm::laplacian(turbulence->alphaEff()*thermo.gamma(), ea)
3333
+ diffAlphaD
3434
==
3535
fvc::div(hDiffCorrFlux)
3636
);
3737

38-
eEqn.solve("e");
38+
eEqn.solve("ea");
3939

40-
ha = e + p/rho;
40+
ha = ea + p/rho;
4141
chemistry->correctThermo();
42-
rhoE = rho*(e + 0.5*magSqr(U));
42+
rhoE = rho*(ea + 0.5*magSqr(U));
4343
}
4444

4545
Info<< "min/max(T) = "

0 commit comments

Comments
 (0)