New URL for NEMO forge!

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
#860 (Unallocated arrays qrp and erp sometimes passed from dia_wri to histwrite) – NEMO

Opened 13 years ago

Closed 12 years ago

#860 closed Bug (fixed)

Unallocated arrays qrp and erp sometimes passed from dia_wri to histwrite

Reported by: spickles Owned by: gm
Priority: low Milestone:
Component: OCE Version: v3.4
Severity: Keywords:


Under some circumstances, dia_wri() will pass the arrays qrp and erp to histwrite() while these are still in an unallocated state.

I found the problem using the GYRE test case after building nemo 3.3.1 with the PGI compilers and the "-Mbounds -Mchkptr" (and -g) flags. This results in the run-time error:
0: Null pointer for qrp (/home/n04/n04/spickles/nemo_ref/nemo_3.3.1/NEMOGCM/CONFIG/GYRE/BLD/ppsrc/nemo/diawri.f90: 412)

Now, qrp and erp are allocated in subroutine sbc_ssr() of SBC/sbcssr.F90 during the first timestep, but this is only called (from sbc() of sbcmod.F90) if ln_ssr is set. Hence, if ln_ssr is not set, the use of qrp and erp in dia_wri() will (at best) result in rubbish data being output.

I do not know the best way to fix this. If these fields are always required in the output, then presumably the arrays should be allocated and initialised whether or not ln_ssr is set. If, however, the fields are not always required, then the conditions under which dia_wri() calls histtwrite() for qrp and erp need correcting.

Commit History (1)


trunk: #860 : Unallocated arrays qrp and erp sometimes passed from dia_wri: fixed

Change History (3)

comment:1 Changed 12 years ago by gm

  • Owner changed from NEMO team to gm

comment:2 Changed 12 years ago by vichi

  • Version changed from v3.3 to v3.4

comment:3 Changed 12 years ago by gm

  • Resolution set to fixed
  • Status changed from new to closed

When ln_ssr=false and key_iom is not defined, diawri.F90 and diawri_dimg.h90 use qrp and erp whereas they are never allocated.

The solution is (1)  to add test using ln_ssr as well as nn_sstr/=0 and nn_sssr/=0

and (2) create a sbc_ssr_init routine called by sbc_init which performs the allocation in the general  initialisation phase

This has been done, see Changeset 3690

Note: See TracTickets for help on using tickets.