CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

setting up a closed-loop interaction for active flow control

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 5, 2020, 08:21
Smile setting up a closed-loop interaction for active flow control
  #1
New Member
 
juxw28
Join Date: Jun 2020
Posts: 1
Rep Power: 0
juxw28 is on a distinguished road
Hi,

I would like to set up a closed-loop interaction in OpenFOAM to perform active flow control. The idea is to reproduce some recent results of active flow control using deep reinforcement learning:

https://www.researchgate.net/publica...e_flow_control

but using OpenFOAM instead of Fenics as a CFD solver. Changing to OpenFOAM as a solver should also give much better performance and allow to study more complex cases.

This means that one needs to implement the classical DRL framework:

- 1 prepare for the training, i.e. start the training agent, and the CFD framework
- 2 for each episode (i.e. individual simulation used for training):
- 2.1 perform a flow reset (i.e., read from pre-defined initial conditions)
- 2.2 for each agent action to be used for control:
- 2.2.1 provide a state estimate, i.e. pressure or velocity at a number of points, to the controlling agent
- 2.2.2 receive the action set by the controlling agent
- 2.2.3 for the number of numerical timesteps within one agent action:
- 2.2.3.1 get the instantaneous control value from an interpolation law and the current and previous action values
- 2.2.3.2 advance the simulation by 1 timestep, applying the control
- 2.2.3 provide to the controlling agent the value of the reward


For an explanation of why there should be an inner loop for converting actions to control, see the discussion here:

https://www.researchgate.net/publica...E_OPTIMIZATION

Are there any examples of an interaction in this kind that is already available / implemented, or anything similar? If not, is there a general way to implement this?

Also, wondering if this could be somehow interfaced with sockets, as this would allow easy interaction with the python code and naturally bridge between the controlling agent (usually written in Python) and the CFD, a bit like what is done there:

https://github.com/jerabaul29/Cylind...rolDRLParallel
juxw28 is offline   Reply With Quote

Old   October 7, 2020, 01:29
Lightbulb Interaction between python and openfoam
  #2
New Member
 
Shane.Tse
Join Date: Oct 2020
Posts: 1
Rep Power: 0
sy_Shane is on a distinguished road
Hi,juxw28,

Maybe we are working on the same trade.

I am in trouble for a long time.

I want to find a way to interactive simulation about RL(by python) and OpenFoam and I don't know how to write a sockets, as this would allow easy interaction with the python code and naturally bridge between the controlling agent (usually written in Python) and the CFD.

How about your progress now? If possible, could I beg you to share your idea?

Many thanks and best regards.
sy_Shane is offline   Reply With Quote

Old   October 7, 2020, 04:21
Default Maybe try a externalCoupled solution?
  #3
Senior Member
 
Carlos Rubio Abujas
Join Date: Jan 2018
Location: Spain
Posts: 127
Rep Power: 11
crubio.abujas is on a distinguished road
I've seen that in OF7 exists a PatchType called externalCoupledMixed where you can bind OpenFoam a boundary condition with an external software. I have never used this feature, but I think it may help both of you to handle this kind of software collaboration.

I think that the binding is made by file checking. When OpenFoam solves the patch it writes a patch_name.out (in a folder you shall specify or the folder "comms" by default) and waits you a file patch_name.in to be generated. So the idea is that the external code will be periodically checking the comms file and when any new patch_name.out is created, read it, process it, create a patch_name.in and keep waiting until the patch_name.out is updated again. There are some options to define the checkign periodicity, the waiting time and so on, so please check the source to be sure on how to setting this up.

This can be useful for any model that is solelly controlled by boundary conditions. If you have some sources in fvOptions I didin't found any way of doing the same, but for sure the same methodology can be applied.

I think there is an example in "heatTransfer/buoyantSimpleFoam/externalCoupledCavity" where this approach is used, so you can have a better understanting on how to use it.

I hope that help you!
crubio.abujas is offline   Reply With Quote

Reply

Tags
active flow control, close loop control, reinforcement learning


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Issues on the simulation of high-speed compressible flow within turbomachinery dowlee OpenFOAM Running, Solving & CFD 11 August 6, 2021 07:40
Numerical modelling of closed loop pulsating heat pipe with compressible flow sabrinacarson Main CFD Forum 2 December 1, 2019 14:25
Need help setting up chtMultiRegion OskarT OpenFOAM Pre-Processing 1 September 25, 2019 16:51
Simulating a forced external flow loop with 2 phases CeesH FLUENT 1 August 27, 2018 08:31
Pulsatile blood flow in closed loops Michael F. Wolf Main CFD Forum 3 July 1, 1999 17:37


All times are GMT -4. The time now is 21:50.