diff --git a/.github/workflows/CPU_inferencce_validation.yml b/.github/workflows/CPU_inferencce_validation.yml index ea1732d9f..c77ed47f4 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 @@ -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 diff --git a/examples/df0DFoam/zeroD_cubicReactor/H2/pytorchIntegrator/inference.py b/examples/df0DFoam/zeroD_cubicReactor/H2/pytorchIntegrator/inference.py index d6946bce1..c49711b81 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(): 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 +// } 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