From ee51fcb2df0485f52b843b56de35049d605488b9 Mon Sep 17 00:00:00 2001 From: JX278 Date: Wed, 8 Nov 2023 18:13:29 +0800 Subject: [PATCH 1/9] add the testing network to the df0D case --- .github/workflows/CPU_inferencce_validation.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/CPU_inferencce_validation.yml b/.github/workflows/CPU_inferencce_validation.yml index ea1732d9f..81dee08ec 100644 --- a/.github/workflows/CPU_inferencce_validation.yml +++ b/.github/workflows/CPU_inferencce_validation.yml @@ -52,6 +52,8 @@ jobs: && cp -r flareFGM_Table_Download/SandiaD/flare.tbl examples/dfLowMachFoam/2DSandiaD_flareFGM/ && git clone https://github.com/intelligent-algorithm-team/intelligent-combustion.git && 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 + && wget --content-disposition https://aisquare.oss-us-east-1.aliyuncs.com/data/models/e4161381-fdc9-4523-a709-19004e3f9b13 + && cp Temporary_Chemical.pt ./test/pytorchIntegrator/ && . configure.sh --use_pytorch && source ./bashrc && . install.sh && cd test && ./Allrun && conda deactivate " From a71e61eeb6707a02f3a8cabc5bc507526521efa8 Mon Sep 17 00:00:00 2001 From: JX278 <113102069+JX278@users.noreply.github.com> Date: Wed, 8 Nov 2023 19:46:08 +0800 Subject: [PATCH 2/9] Update Allrun --- examples/df0DFoam/zeroD_cubicReactor/H2/pytorchIntegrator/Allrun | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/df0DFoam/zeroD_cubicReactor/H2/pytorchIntegrator/Allrun b/examples/df0DFoam/zeroD_cubicReactor/H2/pytorchIntegrator/Allrun index c0cebc861..548c49eba 100755 --- a/examples/df0DFoam/zeroD_cubicReactor/H2/pytorchIntegrator/Allrun +++ b/examples/df0DFoam/zeroD_cubicReactor/H2/pytorchIntegrator/Allrun @@ -6,6 +6,7 @@ cd ${0%/*} || exit 1 # Run from this directory application=df0DFoam +wget --content-disposition https://aisquare.oss-us-east-1.aliyuncs.com/data/models/e4161381-fdc9-4523-a709-19004e3f9b13 runApplication blockMesh runApplication decomposePar runApplication mpirun -np 4 --allow-run-as-root $application -parallel From f376d01f880b126289df455070e4e6666b0e4bb2 Mon Sep 17 00:00:00 2001 From: JX278 <113102069+JX278@users.noreply.github.com> Date: Thu, 9 Nov 2023 11:31:33 +0800 Subject: [PATCH 3/9] Update CPU_inferencce_validation.yml --- .github/workflows/CPU_inferencce_validation.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/CPU_inferencce_validation.yml b/.github/workflows/CPU_inferencce_validation.yml index 81dee08ec..ea1732d9f 100644 --- a/.github/workflows/CPU_inferencce_validation.yml +++ b/.github/workflows/CPU_inferencce_validation.yml @@ -52,8 +52,6 @@ jobs: && cp -r flareFGM_Table_Download/SandiaD/flare.tbl examples/dfLowMachFoam/2DSandiaD_flareFGM/ && git clone https://github.com/intelligent-algorithm-team/intelligent-combustion.git && 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 - && wget --content-disposition https://aisquare.oss-us-east-1.aliyuncs.com/data/models/e4161381-fdc9-4523-a709-19004e3f9b13 - && cp Temporary_Chemical.pt ./test/pytorchIntegrator/ && . configure.sh --use_pytorch && source ./bashrc && . install.sh && cd test && ./Allrun && conda deactivate " From 8ae09aaf4d8cbe5eec7a4cbdd486e7525f3c3a08 Mon Sep 17 00:00:00 2001 From: JX278 <113102069+JX278@users.noreply.github.com> Date: Thu, 9 Nov 2023 13:09:53 +0800 Subject: [PATCH 4/9] Update inference.py --- .../zeroD_cubicReactor/H2/pytorchIntegrator/inference.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/df0DFoam/zeroD_cubicReactor/H2/pytorchIntegrator/inference.py b/examples/df0DFoam/zeroD_cubicReactor/H2/pytorchIntegrator/inference.py index d6946bce1..83e10b40d 100644 --- a/examples/df0DFoam/zeroD_cubicReactor/H2/pytorchIntegrator/inference.py +++ b/examples/df0DFoam/zeroD_cubicReactor/H2/pytorchIntegrator/inference.py @@ -118,8 +118,10 @@ def forward(self, x): model0= NN_MLP(layers) model1= NN_MLP(layers) model2= NN_MLP(layers) - - state_dict = (torch.load('Temporary_Chemical.pt'))['state_dict'] + if torch.cuda.is_available()==False: + state_dict = (torch.load('Temporary_Chemical.pt'),map_location='cpu')['state_dict'] + else: + state_dict = (torch.load('Temporary_Chemical.pt'))['state_dict'] new_state_dict = {} for k, v in state_dict.items(): From bf25abf9969c4a3924e640b3ffb80b5696cc3476 Mon Sep 17 00:00:00 2001 From: JX278 <113102069+JX278@users.noreply.github.com> Date: Thu, 9 Nov 2023 13:10:58 +0800 Subject: [PATCH 5/9] Update inference.py --- .../zeroD_cubicReactor/H2/pytorchIntegrator/inference.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/df0DFoam/zeroD_cubicReactor/H2/pytorchIntegrator/inference.py b/examples/df0DFoam/zeroD_cubicReactor/H2/pytorchIntegrator/inference.py index 83e10b40d..c49711b81 100644 --- a/examples/df0DFoam/zeroD_cubicReactor/H2/pytorchIntegrator/inference.py +++ b/examples/df0DFoam/zeroD_cubicReactor/H2/pytorchIntegrator/inference.py @@ -119,7 +119,7 @@ def forward(self, x): model1= NN_MLP(layers) model2= NN_MLP(layers) if torch.cuda.is_available()==False: - state_dict = (torch.load('Temporary_Chemical.pt'),map_location='cpu')['state_dict'] + state_dict = (torch.load('Temporary_Chemical.pt',map_location='cpu'))['state_dict'] else: state_dict = (torch.load('Temporary_Chemical.pt'))['state_dict'] From c6d5653a5e3135b56e77e32056106227b4dc36a6 Mon Sep 17 00:00:00 2001 From: JX278 Date: Sat, 18 Nov 2023 17:37:21 +0800 Subject: [PATCH 6/9] switch off the network tesing --- .../H2/pytorchIntegrator/Allrun | 1 - test/CMakeLists.txt | 2 +- test/corrtest.cpp | 16 ++++++++-------- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/examples/df0DFoam/zeroD_cubicReactor/H2/pytorchIntegrator/Allrun b/examples/df0DFoam/zeroD_cubicReactor/H2/pytorchIntegrator/Allrun index 548c49eba..c0cebc861 100755 --- a/examples/df0DFoam/zeroD_cubicReactor/H2/pytorchIntegrator/Allrun +++ b/examples/df0DFoam/zeroD_cubicReactor/H2/pytorchIntegrator/Allrun @@ -6,7 +6,6 @@ cd ${0%/*} || exit 1 # Run from this directory application=df0DFoam -wget --content-disposition https://aisquare.oss-us-east-1.aliyuncs.com/data/models/e4161381-fdc9-4523-a709-19004e3f9b13 runApplication blockMesh runApplication decomposePar runApplication mpirun -np 4 --allow-run-as-root $application -parallel diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b68207e01..67ea36ed3 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -12,7 +12,7 @@ set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) FetchContent_MakeAvailable(googletest) -file(COPY ./pytorchIntegrator/postProcessing/probes/0/T DESTINATION 0DH2) + file(COPY ./oneD_detonationH2/postProcessing/minMax/0/fieldMinMax.dat DESTINATION 1Ddetonation) file(COPY ./dfLowMachFoam/twoD_reactingTGV/H2/cvodeSolver/postProcessing/sample/0.0005/data_T.xy DESTINATION 2DTGV/5) diff --git a/test/corrtest.cpp b/test/corrtest.cpp index c8dd47cc9..a6472d520 100644 --- a/test/corrtest.cpp +++ b/test/corrtest.cpp @@ -13,8 +13,8 @@ float readTGV(int k, string file); float readHighSpeed(); float v = readHighSpeed(); -float H2maxT = readmaxTH2(); -float H2midT = readmidTH2(); +// float H2maxT = readmaxTH2(); +// float H2midT = readmidTH2(); float TGV500 = readTGV(806,"2DTGV/5/data_T.xy"); @@ -32,12 +32,12 @@ float T4 = readSandia(4,"2DSandia/data_T.xy"); float T5 = readSandia(5,"2DSandia/data_T.xy"); float T6 = readSandia(6,"2DSandia/data_T.xy"); -TEST(corrtest,df0DFoam_H2){ - EXPECT_FLOAT_EQ(H2maxT,2588.48); // compare the maximum temperature of H2 case - EXPECT_FLOAT_EQ(H2midT,1021.41); // compare the temperature of H2 case at the maximum gradient when t = 0.000245s - //EXPECT_FLOAT_EQ(H2maxT,2586.21); // compare the maximum temperature of H2 case - //EXPECT_FLOAT_EQ(H2midT,1020.71); // compare the temperature of H2 case at the maximum gradient when t = 0.000245s -} +// TEST(corrtest,df0DFoam_H2){ +// EXPECT_FLOAT_EQ(H2maxT,2588.48); // compare the maximum temperature of H2 case +// EXPECT_FLOAT_EQ(H2midT,1021.41); // compare the temperature of H2 case at the maximum gradient when t = 0.000245s +// //EXPECT_FLOAT_EQ(H2maxT,2586.21); // compare the maximum temperature of H2 case +// //EXPECT_FLOAT_EQ(H2midT,1020.71); // compare the temperature of H2 case at the maximum gradient when t = 0.000245s +// } From 6efd6634f80446d10437318ee681a71841de3f16 Mon Sep 17 00:00:00 2001 From: JX278 <113102069+JX278@users.noreply.github.com> Date: Mon, 20 Nov 2023 22:41:06 +0800 Subject: [PATCH 7/9] Delete test/pytorchIntegrator --- test/pytorchIntegrator | 1 - 1 file changed, 1 deletion(-) delete mode 120000 test/pytorchIntegrator diff --git a/test/pytorchIntegrator b/test/pytorchIntegrator deleted file mode 120000 index 16c363624..000000000 --- a/test/pytorchIntegrator +++ /dev/null @@ -1 +0,0 @@ -../examples/df0DFoam/zeroD_cubicReactor/H2/pytorchIntegrator/ \ No newline at end of file From 3975c3c1f2c6b61ad2c32713daf2fa72595a888a Mon Sep 17 00:00:00 2001 From: JX278 <113102069+JX278@users.noreply.github.com> Date: Tue, 19 Dec 2023 21:37:15 +0800 Subject: [PATCH 8/9] Update CPU_inferencce_validation.yml --- .github/workflows/CPU_inferencce_validation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CPU_inferencce_validation.yml b/.github/workflows/CPU_inferencce_validation.yml index ea1732d9f..04568f507 100644 --- a/.github/workflows/CPU_inferencce_validation.yml +++ b/.github/workflows/CPU_inferencce_validation.yml @@ -31,7 +31,7 @@ jobs: . ~/miniconda3/etc/profile.d/conda.sh conda create -n libcantera python=3.8 conda activate libcantera - conda install -c cantera libcantera-devel + conda install -c cantera libcantera-devel=2.6 conda install pytorch pybind11 conda install --channel https://conda.anaconda.org/zhaofeng-shu33 easydict git clone https://github.com/deepmodeling/deepflame-dev.git From d4d6999d2912f65842adcb4bcc51c8b7bb1308db Mon Sep 17 00:00:00 2001 From: JX278 <113102069+JX278@users.noreply.github.com> Date: Tue, 19 Dec 2023 21:52:27 +0800 Subject: [PATCH 9/9] Update CPU_inferencce_validation.yml --- .github/workflows/CPU_inferencce_validation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CPU_inferencce_validation.yml b/.github/workflows/CPU_inferencce_validation.yml index 04568f507..c77ed47f4 100644 --- a/.github/workflows/CPU_inferencce_validation.yml +++ b/.github/workflows/CPU_inferencce_validation.yml @@ -52,7 +52,7 @@ jobs: && cp -r flareFGM_Table_Download/SandiaD/flare.tbl examples/dfLowMachFoam/2DSandiaD_flareFGM/ && git clone https://github.com/intelligent-algorithm-team/intelligent-combustion.git && 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 - && . configure.sh --use_pytorch && source ./bashrc && . install.sh + && . configure.sh && source ./bashrc && . install.sh && cd test && ./Allrun && conda deactivate " - name: test