AMReX-Combustion / PeleLMeX

An adaptive mesh hydrodynamics simulation code for low Mach number reacting flows without level sub-cycling.
https://amrex-combustion.github.io/PeleLMeX/
BSD 3-Clause "New" or "Revised" License
29 stars 40 forks source link

Default value of active_control.velMax #232

Closed olivecha closed 1 year ago

olivecha commented 1 year ago

Upon adding active control to my simulation case, the inlet speed kept going to zero resulting in a flash-back.

I found out by looking at PeleLM.H that m_ctrl_velMax is set to zero by default, resulting in Vnew always being equal to zero:

225     Vnew = std::max(Vnew, 0.0);
227     Vnew = std::min(Vnew, m_ctrl_velMax);

I don't have an issue anymore with using active control as I know I can just supply a value to make my case work, but perhaps something should be changed either in the TripleFlame example:

active_control.velMax = 1.0               # Optional: limit inlet velocity

Or in the code by adding a condition for line 227 of PeleLMFlowControler.cpp (slow ?) or setting an arbitrary large default value in PeleLM.H (not good practice ?).

I would be appy to submit a pull request with the corresponding changes.

baperry2 commented 1 year ago

Good catch. As it stands, setting active_control.velMax is basically mandatory.

One solution would be to default m_ctrl_velMax to a negative number and then have a conditional to only apply the limit if the value of m_ctrl_velMax is positive (the control velocity must always be positive). No performance issue because this is not a pointwise operation.

Please do submit a pull request!