Opened 8 months ago

Closed 8 months ago

#2345 closed Enhancement (fixed)

Avoid a division by zero when applying the volume control along BDYs

Reported by: ctlod Owned by: systeam
Priority: low Milestone:
Component: BDY Version: release-4.0
Severity: minor Keywords:
Cc: Review: failed
MP ready?: no
Progress: Unspecified



A division by zero may occur when using the BDYs (ln_bdy=TRUE) and activating the volume control (ln_vol=TRUE).
This is happening when the nn_write is set to zero (by default when using key_iomput).
The line concerned is line 152 in the bdyvol.F90 module : IF( MOD( kt, nn_write ) == 0 .AND. ( kc == 1 ) ) THEN


In the release 3.6, the nn_write value was forced to the value of nn_itend when nn_write = 0. This was done in the domain.F90 module.
This control no more exist in this new release.
So either such behaviour is re-added or the user must think about setting nn_write to a value different from zero in his namelist_cfg.
I guess that forcing nn_write to nn_itend should be the best way to proceed.

Commit History (1)


trunk: minor bugfix in bdyvol, see #2345

Change History (4)

comment:1 Changed 8 months ago by ctlod

Wait a minute …. it's not so clear, I am coming back ….

comment:2 Changed 8 months ago by ctlod

Ok, I got it.

The code which forces nn_write to nn_itend if it's initial value is zero still exist in domain.F90 in this release 4.0 but it is now under the control of the key_iomput cpp key.
So when using the cpp key key_iomput, no modification is applied to nn_write.
Just remove the cpp conditioning line 378 in domain.F90:
#if ! defined key_iomput

IF( nn_write == -1 ) CALL ctl_warn( 'nn_write = -1 —> no output files will be done' )
IF ( nn_write == 0 ) THEN

WRITE(ctmp1,*) 'nn_write = ', nn_write, ' it is forced to ', nitend
CALL ctl_warn( ctmp1 )
nn_write = nitend



comment:3 Changed 8 months ago by smasson

In 12148:

trunk: minor bugfix in bdyvol, see #2345

comment:4 Changed 8 months ago by smasson

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