Hi, I am working with ROMS and I am wondering what is the CFL criteria used in this model to calculate parameters as max_speed and dt???
Exist any documentation about this??
CFL condition

 Posts: 54
 Joined: Wed Jan 07, 2015 2:48 pm
 Location: University of California, Irvine
Re: CFL condition
From my understanding, the ROMS experts recommend a configuration such that your max Courant # is .8 to .85. You can check how ROMS computes these (3D and 2D) in Nonlinear/diag.F.
Best,
Best,
Re: CFL condition
There are several of them associated with different processes.
1. Barotropic mode. The easiest to predict and control  based on speed of
the external waves, c_g=sqrt(g*h) where h is local depth, then
Cg = c_g*dtfast*sqrt{1/dx^2 +1/dy^2} with dx and dy
evaluated locally; Cg_max=max{Cg} over all horizontal grid points.
This one is computed at the beginning of the run and reported by routine setup_grid2
and is is not monitored by diag thereafter. Its maximum allowed value depends on
the particular time stepping algorithm and should be 0.87 for generalized FB stepping
or 0.9something for LFAM3.
2. Internal wave speed. Essentially phase speed of the first baroclinic mode multiplied
by dt (slowmode time step) and by sqrt{1/dx^2 +1/dy^2} same as above. Once again,
this is not monitored by diag because it is difficult to evaluate the phase speed, but
one has to rely on oceanographic intuition to pick a reasonable value. Internal waves
(first baroclinic mode is the fastest) are typically faster than the fastest horizontal
advection speed, but is not too fast away from it. So internal phase speeds of about
2.5 m/sec is quite realistic.
3. Horizontal advection. The relevant number is Cu=dt*u/dx, however it should be
kept in mind that for a 3D finite volume advection algorithm where fluxes in all three
directions are applied simultaneously it is the combination off all three sets of fluxes
what controls stability. So the most natural way to interpret Courant number for the
3D advection algorithm is the fraction of water within the control volume which being
replaced in one time step. This CFL is monitored by diag.F (if proper CPP switches
are activated).
4. Vertical advection. This is the one which is hard to predict in advance, and typically
it becomes more and more restrictive as resolution becomes finer. This is both because
your solution becomes more vivid, and all currents are intensified as well as due to the
nature of hydrostatic equations (because hydrostatic pressure is computed individually
in each vertical column, each horizontal velocity "feels" the effect of the nearest neighbors
but not several grid intervals away as it would be in the case of nonhydrostatic model.
As the result any freetravelling nonlinear internal wave tends to from a sharp shocklike
front which has large vertical velocity. Eventually it becomes unrealisticly large if one
chooses smaller and smaller horizontal dx. The threshold to ensure that it does not
happen is the aspect ratio: thermocline depth / dx. As long as it is small
(say less than unity, but does not have to be vanishingly small), vertical velocity is
effectively averages over horizontal grid box area, and therefore cannot be large.
Conversely, pushing dx smaller an smaller beyond this threshold makes model violate
the applicability of hydrostatic approximation, and in practice result in unrealistically
large vertical velocities. (Viceversa, using nonhydrostatic code on a coarse grid such
that the above ratio is vanishingly small is plain waste of resources because the non
hydrostatic effects are essentially nonexisting on the scales resolved by such grid,
and in this sense it is the fact that horizontal resolution is finite is what makes
hydrostaticapproximation model applicable).
Vertical CFL is monitored by diag.F along with total advection CFL, and the latter
should be kept under some limit to ensure model stability. The actual limiting value
depends on the selection of advection algoritms and details of time stepping for 3D
mode. But in any case the criterion is about 1 or so (0.8 or 0.9 or whatever).
Another complication comes from the fact that finer grid means less smoothed
topography which translates into larger vertical velocities. Also having/not having
tides typically makes major difference in this regard.
Another complication comes from the fact that some modern versions of ROMS
have capability to circumvent vertical advection by monitoring overall 3D advective
CFL budget and split vertical velocity into two parts, W=We+Wi, in such a way that
We always stays within CFL allowed by the explicit advection scheme, and Wi is
the "excess" portion vertical velocity which is treated implicitly for both advection of
momentum and tracers equations. This offers some relief from vertical CFL.
Another complication comes from the fact that criteria 2 and 3 are actually add up
to each other rather than to be constrained separately, i.e., internal wave speed
must be increased by advection speed when considering stability budget.
5. Inertial period CFL. Because Coriolis term is treated explicitly it has its own
CFL
criterion. This is restrictive only if your time step is sufficiently large in absolute
sense, that is 1 hour or more; the relevant nondimensioal number f*dt
1. Barotropic mode. The easiest to predict and control  based on speed of
the external waves, c_g=sqrt(g*h) where h is local depth, then
Cg = c_g*dtfast*sqrt{1/dx^2 +1/dy^2} with dx and dy
evaluated locally; Cg_max=max{Cg} over all horizontal grid points.
This one is computed at the beginning of the run and reported by routine setup_grid2
and is is not monitored by diag thereafter. Its maximum allowed value depends on
the particular time stepping algorithm and should be 0.87 for generalized FB stepping
or 0.9something for LFAM3.
2. Internal wave speed. Essentially phase speed of the first baroclinic mode multiplied
by dt (slowmode time step) and by sqrt{1/dx^2 +1/dy^2} same as above. Once again,
this is not monitored by diag because it is difficult to evaluate the phase speed, but
one has to rely on oceanographic intuition to pick a reasonable value. Internal waves
(first baroclinic mode is the fastest) are typically faster than the fastest horizontal
advection speed, but is not too fast away from it. So internal phase speeds of about
2.5 m/sec is quite realistic.
3. Horizontal advection. The relevant number is Cu=dt*u/dx, however it should be
kept in mind that for a 3D finite volume advection algorithm where fluxes in all three
directions are applied simultaneously it is the combination off all three sets of fluxes
what controls stability. So the most natural way to interpret Courant number for the
3D advection algorithm is the fraction of water within the control volume which being
replaced in one time step. This CFL is monitored by diag.F (if proper CPP switches
are activated).
4. Vertical advection. This is the one which is hard to predict in advance, and typically
it becomes more and more restrictive as resolution becomes finer. This is both because
your solution becomes more vivid, and all currents are intensified as well as due to the
nature of hydrostatic equations (because hydrostatic pressure is computed individually
in each vertical column, each horizontal velocity "feels" the effect of the nearest neighbors
but not several grid intervals away as it would be in the case of nonhydrostatic model.
As the result any freetravelling nonlinear internal wave tends to from a sharp shocklike
front which has large vertical velocity. Eventually it becomes unrealisticly large if one
chooses smaller and smaller horizontal dx. The threshold to ensure that it does not
happen is the aspect ratio: thermocline depth / dx. As long as it is small
(say less than unity, but does not have to be vanishingly small), vertical velocity is
effectively averages over horizontal grid box area, and therefore cannot be large.
Conversely, pushing dx smaller an smaller beyond this threshold makes model violate
the applicability of hydrostatic approximation, and in practice result in unrealistically
large vertical velocities. (Viceversa, using nonhydrostatic code on a coarse grid such
that the above ratio is vanishingly small is plain waste of resources because the non
hydrostatic effects are essentially nonexisting on the scales resolved by such grid,
and in this sense it is the fact that horizontal resolution is finite is what makes
hydrostaticapproximation model applicable).
Vertical CFL is monitored by diag.F along with total advection CFL, and the latter
should be kept under some limit to ensure model stability. The actual limiting value
depends on the selection of advection algoritms and details of time stepping for 3D
mode. But in any case the criterion is about 1 or so (0.8 or 0.9 or whatever).
Another complication comes from the fact that finer grid means less smoothed
topography which translates into larger vertical velocities. Also having/not having
tides typically makes major difference in this regard.
Another complication comes from the fact that some modern versions of ROMS
have capability to circumvent vertical advection by monitoring overall 3D advective
CFL budget and split vertical velocity into two parts, W=We+Wi, in such a way that
We always stays within CFL allowed by the explicit advection scheme, and Wi is
the "excess" portion vertical velocity which is treated implicitly for both advection of
momentum and tracers equations. This offers some relief from vertical CFL.
Another complication comes from the fact that criteria 2 and 3 are actually add up
to each other rather than to be constrained separately, i.e., internal wave speed
must be increased by advection speed when considering stability budget.
5. Inertial period CFL. Because Coriolis term is treated explicitly it has its own
CFL
criterion. This is restrictive only if your time step is sufficiently large in absolute
sense, that is 1 hour or more; the relevant nondimensioal number f*dt
Re: CFL condition
Hi,
Thank you very much aryansafaie and shchepet, for your help.
aryansafaie: I will check that in diag.F, thanks.
shchepet: Thanks a lot for your explanation. I have clarified some doubts on this topic.
Best,
Thank you very much aryansafaie and shchepet, for your help.
aryansafaie: I will check that in diag.F, thanks.
shchepet: Thanks a lot for your explanation. I have clarified some doubts on this topic.
Best,