Modification in COARE 3.5 source code
shunohishi opened this issue · comments
Dear Dr. L. Brodeau,
I found that ztmp0=0 might induce zeta_u=NaN in the following code in mod_blk_coare.f90:
zeta_u = (1.-ztmp1) * (ztmp0/(1.+ztmp2/(-zu/(zi0*0.004*Beta0**3)))) &
& + ztmp1 * (ztmp0*(1. + 27./9.*ztmp2/ztmp0))
I suggest to replace from the latter part
ztmp1 * (ztmp0*(1. + 27./9.*ztmp2/ztmp0))
to
ztmp1 * (ztmp0 + 27./9.*ztmp2)
This problem would be dependent on fortran compiler,
because it occurs after changing my compiler.
Best regards,
Shun Ohishi
Hello,
First, mod_blk_coare.f90
does not exist any longer... You seem to be using a very old version of the code and I strongly encourage you to update to the current version! >> git pull
!
But otherwise you are completely right, it was bad coding, and this actually even helped me to spot and fix a bug. I just committed the changes, it affects these modules: mod_blk_ecmwf.f90, mod_blk_coare3p0.f90, mod_blk_coare3p6.f90.
Cheers, /laurent
Hi,
I found another bug in the former part in the same sentence, but the cause is not clear.
zeta_u = (1.-ztmp1) * (ztmp0/(1.+ztmp2/(-zu/(zi0*0.004*Beta0**3)))) &
should be replaced as
zeta_u = (1.-ztmp1) * (ztmp0*zu/(zu-ztmp2*zi0*0.004*Beta0**3)) &
Thanks,
Shun Ohishi