WTYPE=9 causes division by zero in lmd_swfrac.F

Bug reports, work arounds and fixes

Moderators: arango, robertson

Post Reply
Message
Author
stlaur
Posts: 30
Joined: Sun Jun 27, 2010 8:45 pm
Location: Old Dominion University

WTYPE=9 causes division by zero in lmd_swfrac.F

#1 Unread post by stlaur »

I would like to report a division by zero that occurs when WTYPE=9 and SOLAR_SOURCE are selected.

WTYPE=9 is defined in mod_scalars.F as:

Code: Select all

      real(r8), dimension(9) :: lmd_mu1 =                               &
     & (/ 0.35_r8, 0.6_r8,  1.0_r8,  1.5_r8, 1.4_r8,                    &
     &    0.42_r8, 0.37_r8, 0.33_r8, 0.0_r8 /)
Note that lmd_mu1 is 0.0_r8 for WTYPE=9.
The division by zero occurs in lmd_swfrac.F:

Code: Select all

fac1(i)=Zscale/lmd_mu1(Jindex)
For example, this is what gfortran (with -ffpe-trap=invalid,zero,overflow activated) reports on the first timestep:

Program received signal SIGFPE, Arithmetic exception.
0x0000000000a40422 in lmd_swfrac_tile (ng=1, tile=0, lbi=-3, ubi=8, lbj=-3, ubj=8, imins=-2, imaxs=7, jmins=-2,
jmaxs=7, zscale=-1, z=..., swdk=...) at lmd_swfrac.f90:123
123 fac1(i)=Zscale/lmd_mu1(Jindex)

ROMS runs perfectly fine when I select a different Jerlov water type.

Thanks for your time,
Pierre

User avatar
wilkin
Posts: 875
Joined: Mon Apr 28, 2003 5:44 pm
Location: Rutgers University
Contact:

Re: WTYPE=9 causes division by zero in lmd_swfrac.F

#2 Unread post by wilkin »

Here's the ticket for when that change was introduced:
https://www.myroms.org/projects/src/ticket/609
Maybe you can figure out what the parameters should be - probably a very small but finite value not zero.
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu

stlaur
Posts: 30
Joined: Sun Jun 27, 2010 8:45 pm
Location: Old Dominion University

Re: WTYPE=9 causes division by zero in lmd_swfrac.F

#3 Unread post by stlaur »

Maybe you can figure out what the parameters should be - probably a very small but finite value not zero
WTYPE=9 (dark coastal water) is absent from the original papers (e.g. Paulson & Simpson JPO 1977) but the following publication (attached) from:
https://publications.europa.eu/en/publi ... 45fd52242a

would suggest (see bottom of Table-2 in the document):

lmd_mu1( 9 ) = 0.00468592_r8

Pierre
Attachments
DOC_1.en.pdf
EU reference with irradiance fits for various Jerlov types
(466.28 KiB) Downloaded 274 times

Post Reply