New URL for NEMO forge!   http://forge.nemo-ocean.eu

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.
#940 (Uninitialized flag for rotation in structure FLD of fld_read) – NEMO

Opened 12 years ago

Closed 11 years ago

#940 closed Bug (fixed)

Uninitialized flag for rotation in structure FLD of fld_read

Reported by: vichi Owned by: smasson
Priority: normal Milestone:
Component: OCE Version: v3.4
Severity: Keywords:
Cc:

Description

This was very difficult to find and it took me 4 days of parallel debugging. It may also affect all previous versions of NEMO using fld_read. The problem occurred when using the standard ORCA2_LIM and standard CORE forcings with a large change in memory layout as when we plug in the biogeochemical model BFM.

The model hangs in fld_read for MPI communications when doing the rotation of the wind components. It happens that some processes enter the fld_rot routine to rotate the wind  and the FLD structure field %rot is .false. (i.e. need rotation) while others have %rot=.true. (i.e. field already rotated)

Therefore the mpp_sum in geo2ocean.F90|angle hangs waiting for all processes. I think this occurs because fld_rot is called twice in fld_read, once after fld_init and again after fld_get. However, the field %rotn is reset only in fld_get and never initialized, therefore the first time is called can have any value.

The thing can be easily solved (now that I know it!) by adding a line in fld_fill

sdf(jf)%rotn    = .FALSE.

but I wonder why fld_rot is called in the initialization phase without any field being effectively read.

Commit History (0)

(No commits)

Change History (2)

comment:1 Changed 11 years ago by smasson

  • Owner changed from NEMO team to smasson

comment:2 Changed 11 years ago by smasson

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

You are right, if time interp = false and you want to rotate the fields, you are calling fld_rot just after fld_init but the field was read yet -> sdf(jf)%rotn is not defined.
Your bugfix is the good idea but we need to define

         sdf(jf)%rotn    = .TRUE.

so fld_rot will not do anything until we pass through fld_get.

Done in changeset:3578

Note: See TracTickets for help on using tickets.