Opened 6 years ago

Closed 6 years ago

#251 closed defect (fixed)

jsl bound exception in debug mode

Reported by: ajornet Owned by: somebody
Priority: minor Milestone: orchidee_1_9_6
Component: Physical processes Version: trunc
Keywords: hydrol, jsl Cc:

Description

If Orchidee is compiled in debug mode, there is a bound exception/warning in src_sechiba/hydrol.f90. Check the line below:

DO WHILE ( (mc(ji,jsl,jst) .EQ. mcs(njsc(ji))) .AND. (jsl > 0) )

When jsl is 0 at the end of the loop. In the last iteration jsl is evaluated in mc array. This triggers the exception. Is not sufficient to include jsl > 0 to avoid it neither change the evaluation order.

...
      DO ji = 1, kjpindex
          wtd_ns(ji,jst) = undef_sechiba ! in meters
          jsl=nslm
          DO WHILE ( (mc(ji,jsl,jst) .EQ. mcs(njsc(ji))) .AND. (jsl > 0) )
             wtd_ns(ji,jst) = zz(jsl)/mille ! in meters
             jsl=jsl-1   <-- jsl = 0 in the lastest iteration
          ENDDO
...

Change History (5)

comment:1 follow-up: Changed 6 years ago by ajornet

Fix suggested by Agnès:

       DO ji = 1, kjpindex
          wtd_ns(ji,jst) = undef_sechiba ! in meters
          jsl=nslm
          DO WHILE ( (mc(ji,jsl,jst) .EQ. mcs(njsc(ji))) .AND. (jsl > 1) )
             wtd_ns(ji,jst) = zz(jsl)/mille ! in meters
             jsl=jsl-1
          ENDDO
       ENDDO
Last edited 6 years ago by ajornet (previous) (diff)

comment:2 Changed 6 years ago by ajornet

Error message:

forrtl: severe (408): fort: (3): Subscript #2 of the array MC has value 0 which is less than the lower bound of 1

Image              PC                Routine            Line        Source             
orchidee_ol        0000000002B490F4  hydrol_mp_hydrol_        4993  hydrol.f90
orchidee_ol        0000000002921E03  hydrol_mp_hydrol_        1029  hydrol.f90
orchidee_ol        0000000000BB6DC3  sechiba_mp_sechib         777  sechiba.f90
orchidee_ol        0000000000664973  intersurf_mp_inte         631  intersurf.f90
orchidee_ol        0000000000556467  MAIN__                   1490  dim2_driver.f90
orchidee_ol        0000000000445836  Unknown               Unknown  Unknown
libc.so.6          00002B0CF0763D1D  Unknown               Unknown  Unknown
orchidee_ol        0000000000445729  Unknown               Unknown  Unknown

comment:3 in reply to: ↑ 1 Changed 6 years ago by aducharne

Replying to ajornet:

Fix suggested by Agnès:

       DO ji = 1, kjpindex
          wtd_ns(ji,jst) = undef_sechiba ! in meters
          jsl=nslm
          DO WHILE ( (mc(ji,jsl,jst) .EQ. mcs(njsc(ji))) .AND. (jsl > 1) )
             wtd_ns(ji,jst) = zz(jsl)/mille ! in meters
             jsl=jsl-1
          ENDDO
       ENDDO

This "do while" loop aims at identifying the water table depth.
It comes back to finding the deepest layer (i.e. with the largest jsl) which is saturated but for which the layer above is not.
So the loop starts at jsl =nslm, with decreasing jsl, OK, but we also want the loop to stop as soon as mc(jsl)=mcs and mc(jsl-1) < mcs

Without the while, you would diagnose a WTD at the surafce anytime you get an infiltration front, and this is not what we want.

Agnès

Last edited 6 years ago by aducharne (previous) (diff)

comment:4 Changed 6 years ago by jgipsl

Done in trunk rev [3617]

comment:5 Changed 6 years ago by aducharne

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.