Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Obukhov length calculation fails #24

Closed
fjansson opened this issue Feb 14, 2017 · 2 comments
Closed

Obukhov length calculation fails #24

fjansson opened this issue Feb 14, 2017 · 2 comments

Comments

@fjansson
Copy link
Contributor

I'm trying to run a simulation with zero-flux boundary conditions at the ground. This seems to be possible, by choosing flux boundary conditions (isurf=4) and setting the temperature and qt fluxes to 0. However, this causes the Obukhov length calculation to fail, before the first time step has been completed.

To reproduce:
Fresh clone of dales master branch, compiled in DEBUG mode.
cases/example
in namoptions.001, set wtsurf=0 and wqsurf=0.
isurf=4 is already set, meaning flux boundary conditions at the ground.
Running this results in:

.....
&NAMCAPE
 LCAPE=F,
 DTAV=  60.000000000000000     ,
 /
Note: The following floating-point exceptions are signalling: IEEE_INVALID_FLAG IEEE_DIVIDE_BY_ZERO IEEE_UNDERFLOW_FLAG IEEE_DENORMAL
STOP Obukhov length calculation does not converge!

The stop occurs in subroutine getobl(), in modsurface.f90, line 1307 (i.e. the second convergence check).
The reason may be that on line 1280, Rib gets set to 0 since thv = thvs, which seems to happen when the boundary fluxes are set to 0.
The case Rib = 0 is then not handled in the if:s that follow on 1285, should it be?

@fjansson
Copy link
Contributor Author

Some more details on the Obukhov length.
Rib in the code is the bulk Richardson number, eq (29) in Heus et al 2010. If the theta_l gradient at the ground is 0, Rib is also 0.

Rib = 0 corresponds to an infinite Obukhov length L. According to Wikipedia, an infinite L is expected at dawn and dusk, when the ground heat flux passes through 0.

There is already a cap for L in the code: if (abs(L)>1e6) L = sign(1.0e6,L) (modsurface.f90, line 1316).
I propose to set L=1e6 also if Rib == 0 (or perhaps if abs(Rib) is smaller than some threshold)

As a workaround, I'm specifying a tiny but non-zero flux for now.

@fjansson
Copy link
Contributor Author

fjansson commented Jun 5, 2019

Fixed in version 4.2, commit cd92f73

@fjansson fjansson closed this as completed Jun 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant