Opened 5 years ago
Closed 4 years ago
#2447 closed Defect (fixed)
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)
Changeset | Author | Time | ChangeLog |
---|---|---|---|
13283 | ayoung | 2020-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. |
13260 | ayoung | 2020-07-07T14:35:05+02:00 | Merging changes from ticket #2447. Additional namelist checks to prevent use of unallocated wave coupling variables. |
13253 | ayoung | 2020-07-06T10:39:32+02:00 | Added checks for surface wave coupling options (Ticket #2447) |
13188 | ayoung | 2020-07-01T11:02:35+02:00 | Creating branch for ticket #2447 |
Change History (11)
comment:1 Changed 5 years ago by smasson
- Cc smasson added
comment:2 Changed 5 years 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 5 years ago by ayoung
In 13188:
comment:4 Changed 5 years 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 years ago by ayoung
In 13253:
comment:6 Changed 5 years 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 years 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 years ago by ayoung
In 13260:
comment:9 Changed 5 years ago by ayoung
- Version changed from v4.0.* to trunk
comment:10 Changed 5 years ago by ayoung
In 13283:
comment:11 Changed 4 years ago by mathiot
- Resolution set to fixed
- Status changed from new to closed
Already fixed in 13260 in v4 and 13283 in trunk.
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?