thw1021 / Cylinder2DFlowControlGeneral

Robust active flow control over a range of Reynolds numbers using artificial neural network trained through deep reinforcement learning
MIT License
29 stars 14 forks source link

About single_runner.py #10

Closed ruyigolden-cudgel closed 1 year ago

ruyigolden-cudgel commented 1 year ago

Hi, @thw1021 Thanks for your code helping me train my model! But I have a new question about _RobustDRLCylinder2DControl/singlerunner.py, in order to test the trained best-model, I run _single_runner.py_ and check the results folder which contains the visulazation of the with-controled flow filed. Then I noticed that the test enviroment for the best-model seems to start from the end of the simulated flow field, not from the moment the inlet enters the channel. And I check the script running informaion,it shows as follows:

fenics@181ce707f1c1:~/shared/test/RobustDRLCylinder2DControl$ python3 single_runner.py iUFL can be obtained from https://github.com/MiroK/ufl-interpreter Counter({400: 1}) -0.2 0.21 WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/resource_variable_ops.py:435: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version. Instructions for updating: Colocations handled automatically by placer. WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/math_ops.py:3066: to_int32 (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version. Instructions for updating: Use tf.cast instead. 2023-08-12 05:07:21.183809: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA 2023-08-12 05:07:21.255263: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2591995000 Hz 2023-08-12 05:07:21.275031: I tensorflow/compiler/xla/service/service.cc:150] XLA service 0x51a7f50 executing computations on platform Host. Devices: 2023-08-12 05:07:21.275202: I tensorflow/compiler/xla/service/service.cc:158] StreamExecutor device (0): , WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/training/saver.py:1266: checkpoint_exists (from tensorflow.python.training.checkpoint_management) is deprecated and will be removed in a future version. Instructions for updating: Use standard file APIs to check for files with this prefix. start simulation Counter({400: 2}) -0.2 0.21 Simu_A-15_M005_maxF008_NbAct400_lift | Ep N: 1, step: 0, Rec Area: 0.1185, drag: -0.4709, lift: -0.0460

According to the information, it seems like there is one episode skipped(im not pretty sure). And i check the _single_runner.py_ code, the line 11 “example_environment = resume_env(plot=False, dump=100, single_run=True)" and line 59 ‘’state = example_environment.reset()‘’**** show that enviroment should have been initiaed to the moment inlet coming. It's confusing and i have no idea. If I want to adjust the test environment to start at the moment when the incoming stream enters the channel, what should I do?

thw1021 commented 1 year ago

Hi @ruyigolden-cudgel

Thank you for your interest in our work.

Then I noticed that the test enviroment for the best-model seems to start from the end of the simulated flow field, not from the moment the inlet enters the channel.

As we have stated, we first perform the simulation without control (no training) until it converges. Then we start the training.

line 59 "state = example_environment.reset()" show that enviroment should have been initiaed to the moment inlet coming.

I cannot remember the details of the code. However, I am sure that the environment is the converged flow field (not the initial state).

Hope this helps.

ruyigolden-cudgel commented 1 year ago

So, you mean, in my case, my simulation without control has not been converged and I just use a non-converged flow simulation for training? And, as a result, when checking the best model by using _singlerunner.py, the _singlerunner.py just continues to run my simulation(also the code makes jets involve) rather than tests the model?

thw1021 commented 1 year ago

my simulation without control has not been converged and I just use a non-converged flow simulation for training

I am not sure about your case. But the training should start from a converged flow.

And, as a result, when checking the best model by using single_runner.py, the single_runner.py just continues to run my simulation(also the code makes jets involve) rather than tests the model?

Sorry, I cannot remember the details of the code. But during the test process, the best model is just loaded and let it determine how the jet would evolve.

ruyigolden-cudgel commented 1 year ago

ok, thanks!

ruyigolden-cudgel commented 1 year ago

Sorry, there is another thing i want to make sure. Does your test process of your case start at the moment flow entering the inlet?

thw1021 commented 1 year ago

Does your test process of your case start at the moment flow entering the inlet?

No. As I have stated, it should start from a converged flow filed.

ruyigolden-cudgel commented 1 year ago

Thanks!