Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

(RESOLVED) Printing out cfl values

This post was from a previous version of the WRF&MPAS-A Support Forum. New replies have been disabled and if you have follow up questions related to this post, then please start a new thread from the forum home page.

Hello dear WRF community,

I want to ask if someone know easy way to print out maximum cfl value for each time step (to rsl.out.0000 file probably)?

Thank you,
best regards,
Ivan Toman
 
Hi Ivan,
It looks like this variable is something that is currently only used when you are also using adaptive time-step. If you are using that, then you could probably go into either dyn_em/adapt_timestep_em.F, or dyn_em/solve_em.F and put in a print statement for this purpose. You may have to do some finagling to get it to print out every time step.
 
Thank you,
I'm replying late because I put my hands onto this just today. For future reference, if someone is interested in simple solution, here it is.

File dyn_em/adapt_timestep_em.F, around line 150, after this block

Code:
     if (grid%stepping_to_time) then
        max_vert_cfl = grid%last_max_vert_cfl
        max_horiz_cfl = grid%last_max_horiz_cfl
     else
        max_vert_cfl = grid%max_vert_cfl
        max_horiz_cfl = grid%max_horiz_cfl
     endif
i've put just
Code:
print *, "max_vcfl =", max_vert_cfl, " max_hcfl =", max_horiz_cfl

Works great, both vertical and horizontal maximum cfl within domain are printed out. It should be really a feature, possibly controllable through namelist, because having this information one can very easy know what is going on in model and why it crashes and it is very easy to adjust vertical and horizontal cfl targets for adaptive time step and make model as fast as possible and as stable as possible at the same time.

Also, I suggest, near the end of that file to change:

Code:
factor = ( target_cfl - 0.5 * (max_cfl - target_cfl) ) / max_cfl

to
Code:
factor = ( target_cfl - 1.5 * (max_cfl - target_cfl) ) / max_cfl

or even more, for much better stability. I found that 0.5 does not reduce time step agressively enough when maximum cfl increases above target cfl values and thus, reduction in time step might not be fast enough to prevent blow up of cfl and subsequent model crash. All this apply to adaptive time step only, of course.

Bye,
Ivan
 
Ivan,
Thank you so much for taking the time to come back and post your method of doing this! This will potentially be useful for someone else in the future.
 
Top