Opened 6 years ago

Closed 4 years ago

Last modified 4 years ago

#203 closed Defect (fixed)

inconsistency / bug in verttransform_gfs.f90

Reported by: shachinger Owned by: pesei
Priority: major Milestone: FLEXPART 10
Component: FP coding/compilation Version: FLEXPART 9.2
Keywords: Cc:

Description (last modified by pesei)

Dear all,

in FLEXPART 9.2 I stumbled upon what is most probably a bug, and it is still present in the FLEXPART git dev branch.

Comparing verttransform.f90 (now seems to be verttransform_ecmwf.f90) to verttransform_gfs.f90, around line 500, one notices pieces of code which probably should be identical, but they aren't:

for ECMWF it looks like:

     if (vv(nx/2-1,0,iz,n).lt.0.) then
        ddpol=atan(uu(nx/2-1,0,iz,n)/ &
      else if (vv(nx/2-1,0,iz,n).gt.0.) then
        ddpol=pi+atan(uu(nx/2-1,0,iz,n)/ &

(+ + xlonr)

whereas for GFS:

    if(vv(nx/2-1,0,iz,n).lt.0.) then
     elseif (vv(nx/2-1,0,iz,n).gt.0.) then

(+ - xlonr)

I would thus propose changes as you can see in the attached picture (i.e. changing to "+ +" in the GFS version, and modifying the infinity case to be consistent with both approaches to the limit).

Unfortunately, I am neither an atmospheric transport expert nor do I have an idea anymore why I fixed it this way (I looked into that like several months ago, and I think I did a comparison with corresponding code pieces in FLEXTRA).

However, I think I write this here now as "as is" and some more expert people maybe check and fix this. Thanks very much!



Change History (5)

comment:1 Changed 6 years ago by shachinger

Now, looking at the changes I did back then again, it seems also that my modification to the infinity case in verttransform.f90 (ECMWF) version may fix some bug there. Please check the consistency of all these infinity cases. Thanks!


comment:2 Changed 6 years ago by pesei

  • Component changed from FP physics/numerics to FP coding/compilation
  • Description modified (diff)
  • Milestone set to FLEXPART 10
  • Summary changed from inconsitency/bug in verttransform_gfs.f90 to inconsistency / bug in verttransform_gfs.f90

Many thanks, we'll look at it!

comment:3 Changed 5 years ago by pesei

  • Owner set to pesei
  • Status changed from new to accepted

comment:4 Changed 4 years ago by pesei

  • Resolution set to fixed
  • Status changed from accepted to closed
  • Version changed from FLEXPART 10.2 to FLEXPART 9.2

In v10.4, this has been unified to + xlonr. Also, all the git versions in branch maser have already that. Thus this has been fixed somewhere on the transition from v9 to v10. It should be noted as a bug_correction (let's start a wiki page FpBugCorrections, and write with underscore so we can more easily search for this term).

comment:5 Changed 4 years ago by pesei

This is also an example of code duplication that should be eliminated. Let's start a list on this as well, but better as a ticket.

Note: See TracTickets for help on using tickets.
hosted by ZAMG