Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing Error from the twoD_detonationH2 case with DNN #316

Open
WangS195 opened this issue Jul 7, 2023 · 8 comments
Open

Testing Error from the twoD_detonationH2 case with DNN #316

WangS195 opened this issue Jul 7, 2023 · 8 comments

Comments

@WangS195
Copy link

WangS195 commented Jul 7, 2023

Thanks to the DeepFlame team for answering my previous questions, please forgive me for asking another question.

I downloaded the DNN models and copied the HE04_Hydrogen_ESH2_GMS_sub_20221101 into /mechanisms.

image

Then I run the following code:

cd deepflame-dev/examples/dfHighSpeedFoam/twoD_detonationH2
./Allrun

The process will be terminated. the log.mpirun show:

image

whatever I keep the default settings

image

or modify the torchModel

image

This error always happens, and is similar to Issused#175.

However, I have downloaded the DNN, and there is no "inference.py" file in twoD_detonationH2.

Looking forward to your solutions! Thanks a lot!

@xiao312
Copy link
Collaborator

xiao312 commented Jul 9, 2023

Hi there! Thank you for reaching out and providing the details. To run DeepFlame with DNN, please follow these steps:

  • Ensure you have an inference.py file and a /mechanisms directory in your case directory. The inference.py file is essential as it reads in the DNN models. You can copy this file from the pytorchIntegrator examples available in /examples/df0Foam. No modifications to the file are needed.

  • For the /mechanisms file, it's recommended to create a soft link that points to $DF_ROOT/mechanisms instead of copying the entire directory. You can achieve this by running the following command: ln -nsf /your/path/to/mechanisms/file mechanisms.

  • Download the required DNN models into the $DF_ROOT/mechanisms directory. Make sure you have modified the TorchSettings in /constant/CanteraTorchProperties of your case directory correctly, as you mentioned.

Regarding your specific case, please note that the mechanism file named H2_Ja.yaml contains more species than the DNN model HE04_Hydrogen_ESH2_GMS_sub_20221101. To resolve this, try replacing H2_Ja.yaml with ES80_H2-7-16.yaml which can be found in $DF_ROOT/mechanisms/H2. After making this change, you should be able to run the twoD_detonationH2 case successfully.

Feel free to reach out if you have any further questions or need additional assistance. We're here to help!

@WangS195
Copy link
Author

Hi there! Thank you for reaching out and providing the details. To run DeepFlame with DNN, please follow these steps:

  • Ensure you have an inference.py file and a /mechanisms directory in your case directory. The inference.py file is essential as it reads in the DNN models. You can copy this file from the pytorchIntegrator examples available in /examples/df0Foam. No modifications to the file are needed.
  • For the /mechanisms file, it's recommended to create a soft link that points to $DF_ROOT/mechanisms instead of copying the entire directory. You can achieve this by running the following command: ln -nsf /your/path/to/mechanisms/file mechanisms.
  • Download the required DNN models into the $DF_ROOT/mechanisms directory. Make sure you have modified the TorchSettings in /constant/CanteraTorchProperties of your case directory correctly, as you mentioned.

Regarding your specific case, please note that the mechanism file named H2_Ja.yaml contains more species than the DNN model HE04_Hydrogen_ESH2_GMS_sub_20221101. To resolve this, try replacing H2_Ja.yaml with ES80_H2-7-16.yaml which can be found in $DF_ROOT/mechanisms/H2. After making this change, you should be able to run the twoD_detonationH2 case successfully.

Feel free to reach out if you have any further questions or need additional assistance. We're here to help!

Thank you very much for your careful guidance! I followed the above steps and ran the twoD_detonationH2 with DNN successfully! I appreciate you spending the time to help me to solve this problem.

However, I meet a new error😭. The initial phase of calculation is fine, but about Time = 7e-7, the process will be terminated. The log.mpirun as below:

2(}4ATY` ULYGCQU0U3RGGU

I used the ES80_H2-7-16.yaml as the mechanism file. the CanteraTorchProperties as below:

KV@X3E@ @J WLPDLXKOSHRY

I have not found a solution to this problem on the web.
Looking forward to your help, thanks again!

@xiao312
Copy link
Collaborator

xiao312 commented Jul 12, 2023

However, I meet a new error😭. The initial phase of calculation is fine, but about Time = 7e-7, the process will be terminated. The log.mpirun as below:

2(}4ATY` ULYGCQU0U3RGGU

This error message usually means that the computation has diverged, and there can be multiple reasons causing this issue.

@WangS195
Copy link
Author

Thank you for the reply. I will check the settings of each file and hope to solve this problem. Thanks again.🤗

@samjustme
Copy link

Hi there! Thank you for reaching out and providing the details. To run DeepFlame with DNN, please follow these steps:

  • Ensure you have an inference.py file and a /mechanisms directory in your case directory. The inference.py file is essential as it reads in the DNN models. You can copy this file from the pytorchIntegrator examples available in /examples/df0Foam. No modifications to the file are needed.
  • For the /mechanisms file, it's recommended to create a soft link that points to $DF_ROOT/mechanisms instead of copying the entire directory. You can achieve this by running the following command: ln -nsf /your/path/to/mechanisms/file mechanisms.
  • Download the required DNN models into the $DF_ROOT/mechanisms directory. Make sure you have modified the TorchSettings in /constant/CanteraTorchProperties of your case directory correctly, as you mentioned.

Regarding your specific case, please note that the mechanism file named H2_Ja.yaml contains more species than the DNN model HE04_Hydrogen_ESH2_GMS_sub_20221101. To resolve this, try replacing H2_Ja.yaml with ES80_H2-7-16.yaml which can be found in $DF_ROOT/mechanisms/H2. After making this change, you should be able to run the twoD_detonationH2 case successfully.
Feel free to reach out if you have any further questions or need additional assistance. We're here to help!

Thank you very much for your careful guidance! I followed the above steps and ran the twoD_detonationH2 with DNN successfully! I appreciate you spending the time to help me to solve this problem.

However, I meet a new error😭. The initial phase of calculation is fine, but about Time = 7e-7, the process will be terminated. The log.mpirun as below:

2(}4ATY` ULYGCQU0U3RGGU

I used the ES80_H2-7-16.yaml as the mechanism file. the CanteraTorchProperties as below:

KV@X3E@ @J WLPDLXKOSHRY

I have not found a solution to this problem on the web. Looking forward to your help, thanks again!

Hello, have you solved this issue? I have the same problem when using DNN models to solve the example case. Exactly, the failure occur almost the same time at '7.27e-7 s' and due to the same reason 'cantera calculation diverged'. This failure did not occurr when I just Allrun this example without DNN.
1690282995628

@WangS195
Copy link
Author

Hi there! Thank you for reaching out and providing the details. To run DeepFlame with DNN, please follow these steps:

  • Ensure you have an inference.py file and a /mechanisms directory in your case directory. The inference.py file is essential as it reads in the DNN models. You can copy this file from the pytorchIntegrator examples available in /examples/df0Foam. No modifications to the file are needed.
  • For the /mechanisms file, it's recommended to create a soft link that points to $DF_ROOT/mechanisms instead of copying the entire directory. You can achieve this by running the following command: ln -nsf /your/path/to/mechanisms/file mechanisms.
  • Download the required DNN models into the $DF_ROOT/mechanisms directory. Make sure you have modified the TorchSettings in /constant/CanteraTorchProperties of your case directory correctly, as you mentioned.

Regarding your specific case, please note that the mechanism file named H2_Ja.yaml contains more species than the DNN model HE04_Hydrogen_ESH2_GMS_sub_20221101. To resolve this, try replacing H2_Ja.yaml with ES80_H2-7-16.yaml which can be found in $DF_ROOT/mechanisms/H2. After making this change, you should be able to run the twoD_detonationH2 case successfully.
Feel free to reach out if you have any further questions or need additional assistance. We're here to help!

Thank you very much for your careful guidance! I followed the above steps and ran the twoD_detonationH2 with DNN successfully! I appreciate you spending the time to help me to solve this problem.
However, I meet a new error😭. The initial phase of calculation is fine, but about Time = 7e-7, the process will be terminated. The log.mpirun as below:
![2(}4ATYULYGCQU0U3RGGU](https://user-images.githubusercontent.com/94104367/252332804-c9bdccab-a688-4bc1-990d-35f04436b983.png) I used theES80_H2-7-16.yamlas the mechanism file. theCanteraTorchProperties` as below:
KV@X3E@ @J WLPDLXKOSHRY
I have not found a solution to this problem on the web. Looking forward to your help, thanks again!

Hello, have you solved this issue? I have the same problem when using DNN models to solve the example case. Exactly, the failure occur almost the same time at '7.27e-7 s' and due to the same reason 'cantera calculation diverged'. This failure did not occurr when I just Allrun this example without DNN. 1690282995628

Sorry, I haven't found a solution to the problem.

@pkuLmq
Copy link
Collaborator

pkuLmq commented Aug 18, 2023

Sorry for the late response. DNN is curently not available for dfHighSpeedFoam, so variables are not be solved (You can see in the log.mpi that iterations are 0). That's why cantera throw error when calculating chemistry. You can only use cvode when using this solver.

@Sunny-DV
Copy link

Hi, I started with Cantera part first and left the GPU and DNN part for now. I successfully compiled the CanteraMixture, DfChemistryModel and dfCombustionModels. Then I compiled the dfLowMach solver, which I successfully compiled.
To check the solver, I ran the Sandia_Flame test case as shown in the example folder. When I run the test case without combustion, it works, but when I start the combustion, it diverges. I tried to debug the correctThermo class in dfChemsitryModel.C file for this and print the properties to check. My enthalpy shoots up, and T moves toward zero, and it crashes.

Cell 97 initial state:
  T = 300 K
  p = 99996.28124 Pa
  h = 1905.159602 J/kg
  rho = 1.156127501 kg/m3
Setting state HP with h = 1905.159602, p = 99996.28124
Cell 97 final state:
  T = 299.9967995 K
  rho = 1.156182832 kg/m3
  mu = 1.862304866e-05 Pa.s
  alpha = 2.620838624e-05 m2/s

Cell 98 initial state:
  T = 300 K
  p = 99996.19973 Pa
  h = 1905.092607 J/kg
  rho = 1.156125616 kg/m3
Setting state HP with h = 1905.092607, p = 99996.19973
Cell 98 final state:
  T = 299.9967332 K
  rho = 1.156182145 kg/m3
  mu = 1.862304552e-05 Pa.s
  alpha = 2.620838214e-05 m2/s

Cell 99 initial state:
  T = 300 K
  p = 99996.28619 Pa
  h = 1905.161515 J/kg
  rho = 1.156127613 kg/m3
Setting state HP with h = 1905.161515, p = 99996.28619
Cell 99 final state:
  T = 299.9968014 K
  rho = 1.156182882 kg/m3
  mu = 1.862304875e-05 Pa.s
  alpha = 2.620838636e-05 m2/s

Cell 100 initial state:
  T = 328.7688771 K
  p = 107629.273 Pa
  h = -1.665008485e+11 J/kg
  rho = 1.113539619 kg/m3
WARNING: Limiting enthalpy in cell 100 to -10000000 J/kg
Setting state HP with h = -10000000, p = 107629.273
Error in setState_HP for cell 100:
Current T = 2.475148488e-236 K
Target h = -10000000 J/kg

*******************************************************************************
CanteraError thrown by ThermoPhase::setState_HPorUV (HP):
No convergence in 500 iterations
	Target Enthalpy         = -10000000.0
	Current Pressure        = 107629.27300446866
	Starting Temperature    = 299.99680141871306
	Current Temperature     = 2.475148488414065e-236
	Current Enthalpy        = -338083.1731358889
	Current Delta T         = -4.95029697682813e-236
*******************************************************************************

Can you please help me what i am doing wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants