RAMP for DT control
Motivation Every now and then, we have a simulation with a quick transient event that we want to capture with good time resolution (sprinkler activation, blower activation, aircraft impact, covid sneeze,..). If the event is preceeded or followed by long period of relatively low-velocity flow, e.g. wind field generation, controlling DT will increase the simulation time of the whole run. We want to set time dependent control of maximum time step.
Idea: &TIME T_END = 100, DT = 0.1 RAMP_DT = 'MY_RAMP' / &RAMP ID='MY_RAMP' T = 0.00, F = 1.0 / &RAMP ID='MY_RAMP' T = 9.90, F = 1.0 / &RAMP ID='MY_RAMP' T = 10.0, F = 0.1 / &RAMP ID='MY_RAMP' T = 11.0, F = 0.1 / &RAMP ID='MY_RAMP' T = 11.1, F = 1.0 /
Simo,
Have you tried simply setting RESTRICT_TIME_STEP=F? Also, I think you may be arguing more for control over CFL_MAX, not DT.
Let's say the intial period is proceeding with a time step of 0.1 s. If I want to introduce a transient effect that lasts only 0.1 s, the event would be over before CFL kicks in to reduce DT. (A bit extreme example but you get the point.)
Instead, I as a user want to make sure that DT is a fraction of 0.1 s at the moment when that event starts.
OK, I see your point.
Currently, it is possible to deal with this using the flow field intialization or restarts. Doable, but troublesome sometimes.
This seems like a good idea that won't have any impact on a typical user.
In the write up I think we need to caution users to make sure that the ramp span and number of interpolation points don't wipe out the time period with the smaller DT. As an extreme case take Simo's RAMP. If we had N_INTERPOLATION_POINTS=5, then the interpolated values would sit at 2.22,4.44,8.88,11.1 s and we would never see the DT when doing a lookup.
Also when determining the next time step I think we would want the query to be something like MINVAL(RP%INTERPOLATED_DATA(X:Y)) where X and Y are the interpolated independent points at the beginning and end of the timestep. That way we don't skip over a brief drop if the current timestep is large enough.
If the event involves particles, you can set PARTICLE_CFL=T on the MISC line. This is F by default. It limits the time step for the whole simulation based on the particle speed.
Say I have a simulation where starting at 2 s, I have a surface that experiences a millisecond injection, but at 1.999 s my time step is 0.01 s. I would never see that injection as the ramp would be evaluated at 1.999 and 2.009 and skip over 2.000 to 2.001 in the ramp. If we had Simo's suggested feature at 1.999 we would look and see that we needed a smaller timestep in the interval 1.999 to 2.009 and adjust accordingly.
I think Randy recently added something like this. I will assign to him and ask for a comment.
Randy added RAMP_TIME where you specify only T and the difference in T gives the timesteps. I think this is a partial solution to this issue. This was added so when comparing FDS detailed chemistry to cantera for simple batch reactors can ensure FDS takes the exact same timesteps as cantera. However, for a more typical simulation like Simo's, you would need as many RAMP lines as total timesteps in the simulation which could be 10s of thousands.
Given that this is an old issue, let's see if Simo still needs it.
I think the correct solution to this would be to have a DT_CTRL that would be checked during CHECK_STABILITY.
@rmcdermo you are envisioning something like a DT_CTRL_ID on &TIME. Then if it is specified, the numerical output of CTRL_ID be used as the maximum timestep? That would be pretty easy to add.
I don't have it worked out in my mind, but something that would detect jumping over the setpoint time and then, yes, only step at the injection frequency until you get past this. I think this could be done with some kind of DT restriction that gets turned on and off by the CTRL.
Actually, I think Simo has the right approach. With a DT_RAMP_ID, then the RAMP can be a TIME RAMP by default. But with the RAMP inputs of DEVC_ID,CTRL_ID,DEVC_DEP_ID, and CTRL_DEP_ID you could change the independent or dependent part of the RAMP to be whatever you wanted and with control functions that could be something fairly complex. Then in the RAMP_TIME_IF in CHECK_STABILITY you would have at the end of the if block:
IF (DT_RAMP_INDEX > 0) DT = MIN(DT,EVALUATE_RAMP....) ENDIF RAMP_TIME_IF
I added this if you want to review @rmcdermo