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.
#2171 (Variable "total2sws" is used before it is defined (PISCES)) – NEMO

Opened 5 years ago

Closed 5 years ago

Last modified 2 years ago

#2171 closed Bug (fixed)

Variable "total2sws" is used before it is defined (PISCES)

Reported by: mathiot Owned by: systeam
Priority: low Milestone: 2018 release-4.0
Component: PISCES Version: trunk
Severity: minor Keywords: SED v4.0
Cc:

Description

Context

By looking in detail the compilation report, the variable total2SWS in sed_chem_cst (sedchem.F90) is used before to be defined.

Analysis

For ji == 1, total2SWS is not initialised, then used first to compute zckf (and other stuff), zckf is used later on to compute akf3s, then free2SWS and then total2SWS. For ji > 1, total2SWS computed at ji-1 will be used to compute zckf.

   SUBROUTINE sed_chem_cst
      ...
      REAL(wp) ::   total2free, free2SWS, total2SWS, SWS2total
      ...
      ! CHEMICAL CONSTANTS - DEEP OCEAN
      ! -------------------------------
      DO ji = 1, jpoce
         ...
         ! K1, K2 OF CARBONIC ACID, KB OF BORIC ACID, KW (H2O) (LIT.?)
         zak1    = 10**(zck1) * total2SWS
         zak2    = 10**(zck2) * total2SWS
         zakb    = EXP( zckb ) * total2SWS
         ...
         zckf    = zckf * total2SWS
         ...
         akf3s(ji) = zckf * EXP( zbuf1 * zcpexp + zbuf2 * zcpexp2 )
         ...
         ! CONVERT FROM DIFFERENT PH SCALES
         total2free  = 1.0/(1.0 + zst/aks3s(ji))
         free2SWS    = 1. + zst/aks3s(ji) + zft/akf3s(ji)
         total2SWS   = total2free * free2SWS
         SWS2total   = 1.0 / total2SWS
         ...
      END DO

Fix

No idea

Commit History (1)

ChangesetAuthorTimeChangeLog
10356cetlod2018-11-22T12:39:19+01:00

Bugfix in sediment model, see ticket #2171

Change History (3)

comment:1 Changed 5 years ago by cetlod

In 10356:

Error: Failed to load processor CommitTicketReference
No macro or processor named 'CommitTicketReference' found

comment:2 Changed 5 years ago by cetlod

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

comment:3 Changed 2 years ago by nemo

  • Keywords v4.0 added; removed
Note: See TracTickets for help on using tickets.