You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
do k=1,k1
if(zf(k)<zmat(1)) then
pb(k)=exp((log(ps)*lapserate(1)*rd+log(tsurf+zsurf*lapserate(1))*grav-&
log(tsurf+zf(k)*lapserate(1))*grav)/(lapserate(1)*rd))
tb(k)=tsurf+lapserate(1)*(zf(k)-zsurf)
else
j=1
do while(zf(k)>zmat(j)) !! bug here, ">" should be ">="
j=j+1
end do
tb(k)=tmat(j-1)+lapserate(j)*(zf(k)-zmat(j-1))
This code uses a table of temperature lapse rates lapserate(j) in different height intervals given by zmat(j) The problem occurs if any height level zf(k) equals zmat(1), which is defined as 11000. Then the else clause is run, the while loop is not executed, and j=1, which makes the final line access tmat(0) and zmat(0), which are undefined.
Fix: change the > sign in while() to >= , this ensures that after the while loop j is at least 2.
The text was updated successfully, but these errors were encountered:
Running DALES with ibas_prf=3 (the default) causes undefined behaviour (often a thermo crash) if the model has a vertical level at exactly 11000 m.
modstartup.f90, line 1305, initializing the
rhobf
profile whenibas_prf = 3
...
This code uses a table of temperature lapse rates
lapserate(j)
in different height intervals given byzmat(j)
The problem occurs if any height levelzf(k)
equalszmat(1)
, which is defined as 11000. Then theelse
clause is run, the while loop is not executed, andj=1
, which makes the final line accesstmat(0)
andzmat(0)
, which are undefined.Fix: change the > sign in
while()
to >= , this ensures that after the while loopj
is at least 2.The text was updated successfully, but these errors were encountered: