Closed JDFIJ closed 2 months ago
I was using Python 3.7. Can you let me know exactly which issues you're encountering?
I tried to run the code and I also got an error because of some mutable arguments in the dataclass TransformationKinetics. I made a small change to bainitemodel.py and now it's working for me. Could you please download the updated file, try again, and let me know if it's working? Thanks!
Thank you very much! I'll try running it and see how it goes. I'm currently using Python 3.12, which might not be fully compatible, so I'll give it a shot with Python 3.7 instead. Thanks again for your help!
(myenv37) E:\B\bainite-model-main (1)\bainite-model-main>python example2.py
Traceback (most recent call last):
File "example2.py", line 5, in
(myenv37) E:\B\bainite-model-main (1)\bainite-model-main>python example1.py
Traceback (most recent call last):
File "example1.py", line 3, in
= RESTART: E:\B\bainite-model-main (1)\bainite-model-main\Example2.py
Traceback (most recent call last):
File "E:\B\bainite-model-main (1)\bainite-model-main\Example2.py", line 23, in
Okay, I see! I made a few changes and tried again using Python 3.11. Now all three examples worked for me, and I guess they should also work for Python 3.12. Could you please try again and let me know if it works?
Hello, thank you very much for providing the revised version. I tried rerunning it, but the following issues still occurred:
The second example throws the following error:
File "E:\B\bainite-model-main new\bainite-model-main\bainitemodel.py", line 663, in residuals return experiment - model
ValueError: operands could not be broadcast together with shapes (2401,) (4,)
3. Third Example:
The third example runs, but the following warnings still appear during execution:
E:\B\bainite-model-main new\bainite-model-main\bainitemodel.py:477: RuntimeWarning: overflow encountered in scalar multiply
n_t_a = n_s_a * (f_sum / sub_unit_length) * (1 - f_a / f_a_max) * enrichment_factor if f_a_max > 0 else 0
E:\B\bainite-model-main new\bainite-model-main\bainitemodel.py:480: RuntimeWarning: overflow encountered in exp
dn_gb_dt = vibration_factor * n_t_gb * np.exp(- q_gb_t / (r * temp_kelvin))
E:\B\bainite-model-main new\bainite-model-main\bainitemodel.py:481: RuntimeWarning: overflow encountered in exp
dn_a_dt = vibration_factor * n_t_a * np.exp(- q_a_t / (r * temp_kelvin))
E:\B\bainite-model-main new\bainite-model-main\bainitemodel.py:462: RuntimeWarning: invalid value encountered in scalar add
f_sum = f_gb + f_a
This issue also appeared in the second error.
This is the result after the error occurred. There doesn’t seem to be a numerical difference between the two.
![image](https://github.com/user-attachments/assets/a4f40a4d-7378-4890-81e0-4ec870d53a74)
Good. I changed the second example, and it should be running now. There was an issue with Scipy, it wasn't solving correctly the ODEs. The warnings you got running Example 3 are normal, and they don't interfere with the result. Example 3 considers the same activation energy for the two prior austenite grain sizes, so the activation energy you find should indeed be the same. The example is running correctly.
This code here on GitHub sometimes cannot find a good fit. I'm using a different optimization approach right now that I plan on publishing here in October/November. If you get poor fitting or some weird results, email me at D.dosSantosAvila@tudelft.nl and I can share the new code I'm using with you.
Hello, thank you very much for providing this program. However, during the execution process, I encountered some issues. May I ask which version of Python you are using?