Opened 4 months ago

Last modified 5 weeks ago

#2447 new Defect

Wave variables not allocated

Reported by: jcastill Owned by: ayoung
Priority: low Milestone: 2020 WP
Component: MULTIPLE Version: trunk
Severity: minor Keywords: wave vertical mixing
Cc: mathiot, smasson

Description

Context

The code allows using some of the wave coupling variables when they are not allocated, which can lead to a segmentation fault or unpredictable behaviour if the namelist is not set appropriately (no warnings or errors are given in this respect)

Analysis

The variables hsw, wmp, ut0sd, vt0sd, and tsd2d are only allocated when ln_wave=true and ln_sdw=true in sbcwave.F90. These variables can be used in other pieces of code when these conditions are not met, and no checks are performed to ensure that the variables are allocated. In particular:

Variables wmp, ut0sd, vt0sd are used when ln_zdmosm=true and nn_osm_wave=2
Variables wnum and tsd2d are used when ln_zdfswm=true
Variable hsw is used in the previous cases, and when ln_zdfgls=true and nn_z0_met=3

Recommendation

It would be ideal to being able to use these wave variables for the different schemes of vertical physics independently of the use of Stokes drift (ln_sdw). Therefore, appropriate code should be written in the routine sbc_wave_init (sbcwave.F90) in order to allocate memory for these variables, and read their values from file (or check if these variables are obtained via coupling in sbccpl.F90), when they are used in vertical mixing schemes. The namelist parameters should be checked to make sure that when a particular vertical mixing scheme is used requiring a wave variable, this variable is read via a forcing file or via coupling, and provide an error otherwise.

Commit History (4)

ChangesetAuthorTimeChangeLog
13283ayoung2020-07-09T16:28:36+02:00

Merging changes from ticket #2447 (trunk). Additional namelist checks to prevent use of unallocated wave coupling variables. Fully sette tested.

13260ayoung2020-07-07T14:35:05+02:00

Merging changes from ticket #2447. Additional namelist checks to prevent use of unallocated wave coupling variables.

13253ayoung2020-07-06T10:39:32+02:00

Added checks for surface wave coupling options (Ticket #2447)

13188ayoung2020-07-01T11:02:35+02:00

Creating branch for ticket #2447

Change History (10)

comment:1 Changed 2 months ago by smasson

  • Cc smasson added

It looks quite a significant modification to be done here… Do we really want to put it in the r4.0-HEAD? or only on the trunk?
If we don't put it in the r4.0-HEAD could we, at least, add a stop to avoid the problem?

comment:2 Changed 6 weeks ago by ayoung

Hi Seb,
By "a stop", do you mean a check for the three conditions highlighted in the analysis?
i.e. exit if not (ln_wave=true and ln_sdw=true) and …
a) ln_zdmosm=true and nn_osm_wave=2
b) ln_zdfswm=true
c) ln_zdfgls=true and nn_z0_met=3

comment:3 Changed 6 weeks ago by ayoung

In 13188:

Creating branch for ticket #2447

comment:4 Changed 6 weeks ago by smasson

yes.
In the 4.0-HEAD, just call ctl_stop( 'STOP', 'blabla' ) to stop the model in all the cases that create the problem. We better stop properly than letting someone using non-allocated variables.
You can refer to tis ticket in the comments or the error message so we can get the full description of the problem.

comment:5 Changed 5 weeks ago by ayoung

In 13253:

Added checks for surface wave coupling options (Ticket #2447)

comment:6 Changed 5 weeks ago by ayoung


./sette_rpt.sh (script will wait all nemo_sette run are done)



Current code is : NEMO/branches/2020/ticket2447 @ r13253 ( last change @ r13253 )

SETTE validation report generated for :

NEMO/branches/2020/ticket2447 @ r13253 (last changed revision)

on XC40_METO_IFORT arch file

!!———————-1st pass—————————!!

!——restart——!

WGYRE_PISCES_ST run.stat restartability passed : 13253
WGYRE_PISCES_ST tracer.stat restartability passed : 13253
WORCA2_ICE_PISCES_ST run.stat restartability passed : 13253
WORCA2_ICE_PISCES_ST tracer.stat restartability passed : 13253
WORCA2_OFF_PISCES_ST tracer.stat restartability passed : 13253
WAMM12_ST run.stat restartability passed : 13253
WORCA2_SAS_ICE_ST run.stat restartability passed : 13253
WAGRIF_DEMO_ST run.stat restartability passed : 13253
WSPITZ12_ST run.stat restartability passed : 13253
WISOMIP_ST run.stat restartability passed : 13253
WOVERFLOW_ST run.stat restartability passed : 13253
WLOCK_EXCHANGE_ST run.stat restartability passed : 13253
WVORTEX_ST run.stat restartability passed : 13253
WICE_AGRIF_ST run.stat restartability passed : 13253

!——repro——!

WGYRE_PISCES_ST run.stat reproducibility passed : 13253
WGYRE_PISCES_ST tracer.stat reproducibility passed : 13253
WORCA2_ICE_PISCES_ST run.stat reproducibility passed : 13253
WORCA2_ICE_PISCES_ST tracer.stat reproducibility passed : 13253
WORCA2_OFF_PISCES_ST tracer.stat reproducibility passed : 13253
WAMM12_ST run.stat reproducibility passed : 13253
WORCA2_SAS_ICE_ST run.stat reproducibility passed : 13253
WORCA2_ICE_OBS_ST run.stat reproducibility passed : 13253
WAGRIF_DEMO_ST run.stat reproducibility passed : 13253
WSPITZ12_ST run.stat reproducibility passed : 13253
WISOMIP_ST run.stat reproducibility passed : 13253
WVORTEX_ST run.stat reproducibility passed : 13253
WICE_AGRIF_ST run.stat reproducibility passed : 13253

!——agrif check——!

ORCA2 AGRIF vs ORCA2 NOAGRIF run.stat unchanged - passed : 13253 13253

!——result comparison check——!

check result differences between :
VALID directory : /projects/jmmp/ayoung/tickets/ticket2447/NEMO_VALIDATION at rev 13253
and
REFERENCE directory : /projects/jmmp/ayoung/tickets/HEAD_ref/NEMO_VALIDATION at rev 13137

WGYRE_PISCES_ST run.stat files are identical
WGYRE_PISCES_ST tracer.stat files are identical
WORCA2_ICE_PISCES_ST run.stat files are identical
WORCA2_ICE_PISCES_ST tracer.stat files are identical
WORCA2_OFF_PISCES_ST tracer.stat files are identical
WAMM12_ST run.stat files are identical
WISOMIP_ST run.stat files are identical
WORCA2_SAS_ICE_ST run.stat files are identical
WAGRIF_DEMO_ST run.stat files are identical
WSPITZ12_ST run.stat files are identical
WISOMIP_ST run.stat files are identical
WVORTEX_ST run.stat files are identical
WICE_AGRIF_ST run.stat files are identical

!!———————-2nd pass—————————!!

!——restart——!

!——repro——!

!——agrif check——!

!——result comparison check——!

check result differences between :
VALID directory : /projects/jmmp/ayoung/tickets/ticket2447/NEMO_VALIDATION at rev 13253
and
REFERENCE directory : /projects/jmmp/ayoung/tickets/HEAD_ref/NEMO_VALIDATION at rev 13137

comment:7 Changed 5 weeks ago by andmirek

The changes made in the branch look OK to me.

But, because the changes didn't address all recommendations (in fact prevent only user from running configuration with the settings which may cause problem) shouldn't the new ticket be opened to address the rest of recommendations?

comment:8 Changed 5 weeks ago by ayoung

In 13260:

Merging changes from ticket #2447. Additional namelist checks to prevent use of unallocated wave coupling variables.

comment:9 Changed 5 weeks ago by ayoung

  • Version changed from 4.0-HEAD to trunk

comment:10 Changed 5 weeks ago by ayoung

In 13283:

Merging changes from ticket #2447 (trunk). Additional namelist checks to prevent use of unallocated wave coupling variables. Fully sette tested.

Note: See TracTickets for help on using tickets.