Skip to content

Commit 353eee2

Browse files
committed
Merge branch 'master' into github-actions-selfhosted-runner
2 parents bc76de9 + 52b8a91 commit 353eee2

36 files changed

+2123
-10
lines changed

Allwmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@ wmake applications/solvers/dfLowMachFoam
2525
wmake applications/solvers/dfHighSpeedFoam
2626
wmake applications/solvers/dfSprayFoam
2727
wmake applications/solvers/dfBuoyancyFoam
28+
wmake applications/solvers/dfSteadyFoam
2829

2930
wmake applications/utilities/flameSpeed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ The neural network models used in the tutorial examples can be found at– [AIS
2727
Detailed guide for installation and tutorials is available on [our documentation website](https://deepflame.deepmodeling.com).
2828

2929
## Features
30+
New in v1.6 (2025/5/30):
31+
- Add a new solver, dfSteadyFoam, a steady-state compressible flow solver. It supports turbulence and uses the SIMPLE algorithm to efficiently compute steady solutions
32+
- Extend energy model to support sensible enthalpy (hs) in addition to absolute enthalpy (ha) and internal energy (ea). Furthermore, T, h and cp can now be computed independently of Cantera, improving flexibility and removing external dependencies. `CANTERA_THERMO` is added in bashrc to control method to calculate h, cp and update T. `CANTERA_THERMO=1`(current default) means using Cantera and `CANTERA_THERMO=0` means using deepflame.
33+
- Improve install.sh by displaying system architecture (e.g., x86_64) after build for clearer platform information
34+
- Switch to sphinx-book-theme and update documentation build environment (Ubuntu 24.04, Python 3.12) for better appearance and compatibility
35+
- Add 2D Riemann problem example case
36+
3037
New in v1.5 (2025/1/8):
3138
- Provide a new boundary condition, totalFlowRateAdvectiveDiffusion (adopted from OpenFOAM v7), which accounts for diffusion effects at the boundary
3239
- Develop a new solver, `dfBuoyancyFoam`(adopted from fireFoam in OpenFOAM v7), a transient, compressible solver designed to model turbulent reacting flows incorporating buoyancy effects
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
cmake_minimum_required(VERSION 3.5)
2+
project(dfLowMachFoam LANGUAGES CXX)
3+
FIND_PACKAGE(MPI REQUIRED)
4+
FIND_PACKAGE(OpenMP REQUIRED)
5+
FIND_PACKAGE(CUDA REQUIRED)
6+
7+
# Check valid thirdParty
8+
if(DEFINED ENV{WM_PROJECT_DIR})
9+
MESSAGE(STATUS "OpenFOAM: " $ENV{WM_PROJECT_DIR})
10+
else()
11+
message(FATAL_ERROR "OpenFOAM is not sourced")
12+
endif(DEFINED ENV{WM_PROJECT_DIR})
13+
14+
if(DEFINED ENV{CANTERA_ROOT})
15+
MESSAGE(STATUS "libcantera: " $ENV{CANTERA_ROOT})
16+
SET(CANTERA_ROOT $ENV{CANTERA_ROOT})
17+
else()
18+
message(FATAL_ERROR "libcantera directory is not specified")
19+
endif(DEFINED ENV{CANTERA_ROOT})
20+
21+
# define variables
22+
SET(OpenFOAM_LIB_DIR $ENV{FOAM_LIBBIN})
23+
SET(OpenFOAM_SRC $ENV{FOAM_SRC})
24+
25+
SET(DF_ROOT $ENV{DF_ROOT})
26+
SET(DF_SRC $ENV{DF_SRC})
27+
SET(SRC_ORIG $ENV{SRC_ORIG})
28+
29+
# set compilation options
30+
SET(CMAKE_EXE_LINKER_FLAGS "-fuse-ld=bfd -Xlinker --add-needed -Xlinker --no-as-needed")
31+
SET (CMAKE_C_FLAGS ${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS})
32+
SET (CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS})
33+
34+
SET(CMAKE_C_COMPILER g++)
35+
SET(PATH_LIB_OPENMPI "openmpi-system") # Foundation version
36+
SET(EXE_COMPILE_OPTION "-std=c++14 -m64 -Dlinux64 -DWM_ARCH_OPTION=64
37+
-DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor
38+
-Wno-unused-parameter -Wno-invalid-offsetof -Wno-attributes -O3
39+
-DNoRepository -ftemplate-depth-100
40+
-Wno-unused-variable -Wno-unused-but-set-variable -Wno-old-style-cast -DOMPI_SKIP_MPICXX
41+
-pthread -fPIC")
42+
add_definitions("${EXE_COMPILE_OPTION}")
43+
44+
# add header files
45+
FUNCTION(R_SEARCH search_path return_list)
46+
FILE(GLOB_RECURSE new_list ${search_path}/*.H)
47+
SET(dir_list "")
48+
FOREACH(file_path ${new_list})
49+
GET_FILENAME_COMPONENT(dir_path ${file_path} PATH)
50+
SET(dir_list ${dir_list} ${dir_path})
51+
ENDFOREACH()
52+
LIST(REMOVE_DUPLICATES dir_list)
53+
SET(${return_list} ${dir_list} PARENT_SCOPE)
54+
ENDFUNCTION(R_SEARCH)
55+
56+
R_SEARCH(${DF_SRC}/dfCombustionModels dfcombustion_inc)
57+
R_SEARCH(${DF_SRC}/dfCanteraMixture dfcantera_inc)
58+
R_SEARCH(${DF_SRC}/lagrangian/intermediate dflagrangianinter_inc)
59+
R_SEARCH(${DF_SRC}/lagrangian/spray dflagrangianspray_inc)
60+
R_SEARCH(${DF_SRC}/lagrangian/turbulence dflagrangianturb_inc)
61+
R_SEARCH(${DF_SRC}/dfChemistryModel dfchemistry_inc)
62+
R_SEARCH(${DF_SRC}/thermophysicalModels/thermophysicalProperties dfthermophysicalprop_inc)
63+
R_SEARCH(${DF_SRC}/thermophysicalModels/thermophysicalProperties dfthermophysicalprop_inc)
64+
R_SEARCH(${DF_SRC}/thermophysicalModels/basic dfthermophysicalbasic_inc)
65+
R_SEARCH(${DF_SRC}/thermophysicalModels/SLGThermo dfthermophysicalslg_inc)
66+
R_SEARCH(${DF_SRC}/TurbulenceModels dfturbulence_inc)
67+
R_SEARCH(${DF_SRC}/dynamicMesh dfnewdynamic_inc)
68+
R_SEARCH(${DF_SRC}/dynamicFvMesh dffvdynamic_inc)
69+
70+
include_directories(
71+
${OpenFOAM_SRC}/finiteVolume/lnInclude
72+
${OpenFOAM_SRC}/OSspecific/POSIX/lnInclude
73+
${OpenFOAM_SRC}/OpenFOAM/lnInclude
74+
${OpenFOAM_SRC}/transportModels/compressible/lnInclude
75+
${OpenFOAM_SRC}/thermophysicalModels/basic/lnInclude
76+
${OpenFOAM_SRC}/TurbulenceModels/turbulenceModels/lnInclude
77+
${OpenFOAM_SRC}/TurbulenceModels/compressible/lnInclude
78+
${OpenFOAM_SRC}/finiteVolume/cfdTools
79+
${OpenFOAM_SRC}/finiteVolume/lnInclude
80+
${OpenFOAM_SRC}/meshTools/lnInclude
81+
${OpenFOAM_SRC}/sampling/lnInclude
82+
${OpenFOAM_SRC}/dynamicFvMesh/lnInclude
83+
${OpenFOAM_SRC}/Pstream/mpi
84+
${dfcantera_inc}
85+
${dfchemistry_inc}
86+
${dfcombustion_inc}
87+
${CANTERA_ROOT}/include
88+
${MPI_INCLUDE_PATH}
89+
${PROJECT_SOURCE_DIR}
90+
${CUDA_INCLUDE_DIRS}
91+
/home/runze/AmgX/AMGX/include
92+
/home/runze/deepflame-dev/src_gpu
93+
)
94+
95+
# add execution
96+
add_executable(${PROJECT_NAME} ${PROJECT_SOURCE_DIR}/dfLowMachFoam.C)
97+
98+
target_link_libraries(${PROJECT_NAME}
99+
$ENV{FOAM_LIBBIN}/libfiniteVolume.so libmeshTools.so libcompressibleTransportModels.so
100+
libturbulenceModels.so libsampling.so libOpenFOAM.so
101+
${CANTERA_ROOT}/lib/libcantera_shared.so.2
102+
${DF_ROOT}/lib/libdfChemistryModel.so
103+
${DF_ROOT}/lib/libdfCanteraMixture.so
104+
${DF_ROOT}/lib/libdfFluidThermophysicalModels.so
105+
${DF_ROOT}/lib/libdfCombustionModels.so
106+
$ENV{FOAM_LIBBIN}/openmpi-system/libPstream.so
107+
${MPI_LIBRARIES}
108+
${CUDA_LIBRARIES}
109+
/home/runze/AmgX/AMGX/build/libamgxsh.so
110+
/home/runze/deepflame-dev/src_gpu/build/libdfMatrix.so
111+
)
112+
113+
if(DEFINED ENV{PYTHON_INC_DIR})
114+
add_definitions(-DUSE_PYTORCH)
115+
# https://pybind11.readthedocs.io/en/stable/advanced/embedding.html
116+
find_package(pybind11)
117+
target_link_libraries(${PROJECT_NAME} pybind11::embed)
118+
endif()
119+
120+
# install
121+
set(CMAKE_INSTALL_PREFIX ${DF_ROOT})
122+
install(TARGETS ${PROJECT_NAME} DESTINATION bin)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
volScalarField& he = thermo.he();
3+
4+
fvScalarMatrix EEqn
5+
(
6+
7+
fvm::div(phi, he)
8+
+ (
9+
he.name() == "e"
10+
? fvc::div(phi, volScalarField("Ekp", 0.5*magSqr(U) + p/rho))
11+
: fvc::div(phi, volScalarField("K", 0.5*magSqr(U)))
12+
)
13+
- fvm::laplacian(turbulence->alphaEff(), he)
14+
==
15+
combustion->Qdot()
16+
+ fvOptions(rho, he)
17+
);
18+
19+
EEqn.relax();
20+
21+
fvOptions.constrain(EEqn);
22+
23+
EEqn.solve("hs");
24+
// EEqn.solve("ha");
25+
26+
fvOptions.correct(he);
27+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dfSteadyFoam.C
2+
3+
EXE = $(DF_APPBIN)/dfSteadyFoam
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
-include $(GENERAL_RULES)/mplibType
2+
3+
EXE_INC = -std=c++14 \
4+
-g \
5+
-fopenmp \
6+
-Wno-unused-variable \
7+
-Wno-unused-but-set-variable \
8+
-Wno-old-style-cast \
9+
-I. \
10+
$(PFLAGS) $(PINC) \
11+
$(if $(LIBTORCH_ROOT),-DUSE_LIBTORCH,) \
12+
$(if $(PYTHON_INC_DIR),-DUSE_PYTORCH,) \
13+
-I$(FOAM_APP)/solvers/lagrangian/reactingParcelFoam \
14+
-I$(FOAM_APP)/solvers/compressible/rhoSimpleFoam \
15+
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
16+
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
17+
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
18+
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
19+
-I$(FOAM_APP)/solvers/lagrangian/reactingParcelFoam \
20+
-I$(LIB_SRC)/finiteVolume/cfdTools \
21+
-I$(LIB_SRC)/finiteVolume/lnInclude \
22+
-I$(LIB_SRC)/meshTools/lnInclude \
23+
-I$(LIB_SRC)/sampling/lnInclude \
24+
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
25+
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
26+
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
27+
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
28+
-I$(DF_SRC)/lagrangian/intermediate/lnInclude \
29+
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
30+
-I$(DF_SRC)/lagrangian/spray/lnInclude \
31+
-I$(LIB_SRC)/lagrangian/spray/lnInclude \
32+
-I$(LIB_SRC)/lagrangian/distributionModels/lnInclude \
33+
-I$(DF_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude \
34+
-I$(LIB_SRC)/thermophysicalModels/thermophysicalProperties/lnInclude \
35+
-I$(DF_SRC)/thermophysicalModels/SLGThermo/lnInclude \
36+
-I$(LIB_SRC)/Pstream/mpi \
37+
-I$(DF_SRC)/dfCanteraMixture/lnInclude \
38+
-I$(DF_SRC)/dfChemistryModel/lnInclude \
39+
-I$(DF_SRC)/dfCombustionModels/lnInclude \
40+
-I$(CANTERA_ROOT)/include \
41+
$(if $(LIBTORCH_ROOT),-I$(LIBTORCH_ROOT)/include,) \
42+
$(if $(LIBTORCH_ROOT),-I$(LIBTORCH_ROOT)/include/torch/csrc/api/include,) \
43+
$(PYTHON_INC_DIR) \
44+
$(if $(AMGX_DIR), -I$(DF_ROOT)/src_gpu,) \
45+
$(if $(AMGX_DIR), -I/usr/local/cuda/include,) \
46+
$(if $(AMGX_DIR), -I$(AMGX_DIR)/include,) \
47+
$(if $(ODE_GPU_SOLVER), -I$(OPENCC_PATH)/include,) \
48+
$(if $(ODE_GPU_SOLVER), -DODE_GPU_SOLVER,)
49+
50+
EXE_LIBS = \
51+
-lcompressibleTransportModels \
52+
-lturbulenceModels \
53+
-llagrangian \
54+
-lregionModels \
55+
-ldfSurfaceFilmModels \
56+
-lfiniteVolume \
57+
-ltopoChangerFvMesh \
58+
-lmeshTools \
59+
-lsampling \
60+
-L$(DF_LIBBIN) \
61+
-ldfFluidThermophysicalModels \
62+
-ldfCompressibleTurbulenceModels \
63+
-ldfThermophysicalProperties \
64+
-ldfSLGThermo \
65+
-ldfLagrangianIntermediate \
66+
-ldfLagrangianTurbulence \
67+
-ldfLagrangianSpray \
68+
-ldfCanteraMixture \
69+
-ldfChemistryModel \
70+
-ldfCombustionModels \
71+
$(CANTERA_ROOT)/lib/libcantera.so \
72+
$(if $(LIBTORCH_ROOT),$(LIBTORCH_ROOT)/lib/libtorch.so,) \
73+
$(if $(LIBTORCH_ROOT),$(LIBTORCH_ROOT)/lib/libc10.so,) \
74+
$(if $(LIBTORCH_ROOT),-rdynamic,) \
75+
$(if $(LIBTORCH_ROOT),-lpthread,) \
76+
$(if $(LIBTORCH_ROOT),$(DF_SRC)/dfChemistryModel/DNNInferencer/build/libDNNInferencer.so,) \
77+
$(if $(PYTHON_LIB_DIR),$(PYTHON_LIB_DIR),) \
78+
$(if $(AMGX_DIR), /usr/local/cuda/lib64/libcudart.so,) \
79+
$(if $(AMGX_DIR), /usr/local/cuda/lib64/libnccl.so,) \
80+
$(if $(AMGX_DIR), $(DF_ROOT)/src_gpu/build/libdfMatrix.so,) \
81+
$(if $(AMGX_DIR), $(AMGX_DIR)/build/libamgxsh.so,) \
82+
$(if $(ODE_GPU_SOLVER), $(ODE_GPU_SOLVER)/lib/libopencc.so,)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Solve the Momentum equation
2+
3+
MRF.correctBoundaryVelocity(U);
4+
5+
tmp<fvVectorMatrix> tUEqn
6+
(
7+
fvm::div(phi, U)
8+
+ MRF.DDt(rho, U)
9+
+ turbulence->divDevRhoReff(U)
10+
==
11+
fvOptions(rho, U)
12+
);
13+
fvVectorMatrix& UEqn = tUEqn.ref();
14+
15+
UEqn.relax();
16+
17+
fvOptions.constrain(UEqn);
18+
19+
solve(UEqn == -fvc::grad(p));
20+
21+
fvOptions.correct(U);
22+
23+
24+
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
// should only for CPUSolver
2+
3+
tmp<fv::convectionScheme<scalar>> mvConvection
4+
(
5+
fv::convectionScheme<scalar>::New
6+
(
7+
mesh,
8+
fields,
9+
phi,
10+
mesh.divScheme("div(phi,Yi_h)")
11+
)
12+
);
13+
14+
15+
label flag_mpi_init;
16+
MPI_Initialized(&flag_mpi_init);
17+
if(flag_mpi_init) MPI_Barrier(PstreamGlobals::MPI_COMM_FOAM);
18+
19+
{
20+
21+
combustion->correct();
22+
23+
//label flag_mpi_init;
24+
//MPI_Initialized(&flag_mpi_init);
25+
if(flag_mpi_init) MPI_Barrier(PstreamGlobals::MPI_COMM_FOAM);
26+
27+
28+
volScalarField Yt(0.0*Y[0]);
29+
forAll(Y, i)
30+
{
31+
if (i != inertIndex)
32+
{
33+
volScalarField& Yi = Y[i];
34+
35+
fvScalarMatrix YiEqn
36+
(
37+
mvConvection->fvmDiv(phi, Yi)
38+
- fvm::laplacian(turbulence->muEff(), Yi)
39+
==
40+
combustion->R(Yi)
41+
+ fvOptions(rho, Yi)
42+
);
43+
44+
YiEqn.relax();
45+
46+
fvOptions.constrain(YiEqn);
47+
48+
YiEqn.solve("Yi");
49+
50+
fvOptions.correct(Yi);
51+
52+
Yi.max(0.0);
53+
Yt += Yi;
54+
}
55+
}
56+
57+
Y[inertIndex] = scalar(1) - Yt;
58+
Y[inertIndex].max(0.0);
59+
}

0 commit comments

Comments
 (0)