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.
trc.F90 in NEMO/branches/2020/dev_r12985_TOP-04_IMMERSE_BGC_interface/src/TOP – NEMO

source: NEMO/branches/2020/dev_r12985_TOP-04_IMMERSE_BGC_interface/src/TOP/trc.F90 @ 13107

Last change on this file since 13107 was 13107, checked in by lovato, 4 years ago

add trcopt.F90 containing generalized module for vertical light propagation (ticket #2489)

  • Property svn:keywords set to Id
File size: 12.0 KB
Line 
1MODULE trc
2   !!======================================================================
3   !!                      ***  MODULE  trc  ***
4   !! Passive tracers   :  module for tracers defined
5   !!======================================================================
6   !! History :   OPA  !  1996-01  (M. Levy)  Original code
7   !!              -   !  2000-04  (O. Aumont, M.A. Foujols)  HAMOCC3 and P3ZD
8   !!   NEMO      1.0  !  2004-03  (C. Ethe)  Free form and module
9   !!----------------------------------------------------------------------
10   USE par_oce
11   USE par_trc
12   USE bdy_oce, only: jp_bdy, ln_bdy, nb_bdy, OBC_DATA
13   
14   IMPLICIT NONE
15   PUBLIC
16
17   PUBLIC   trc_alloc   ! called by nemogcm.F90
18
19   !                                     !!- logical units of passive tracers
20   INTEGER, PUBLIC ::   numont     = -1   !: reference passive tracer namelist output output.namelist.top
21   INTEGER, PUBLIC ::   numonr     = -1   !: reference passive tracer namelist output output.namelist.top
22   INTEGER, PUBLIC ::   numstr            !: tracer statistics
23   INTEGER, PUBLIC ::   numrtr            !: trc restart (read )
24   INTEGER, PUBLIC ::   numrtw            !: trc restart ( write )
25   CHARACTER(:), ALLOCATABLE, PUBLIC ::   numnat_ref   !: character buffer for reference passive tracer namelist_top_ref
26   CHARACTER(:), ALLOCATABLE, PUBLIC ::   numnat_cfg   !: character buffer for configuration specific passive tracer namelist_top_cfg
27   CHARACTER(:), ALLOCATABLE, PUBLIC ::   numtrc_ref   !: character buffer for reference passive tracer namelist_trc_ref
28   CHARACTER(:), ALLOCATABLE, PUBLIC ::   numtrc_cfg   !: character buffer for configuration specific passive tracer namelist_trc_cfg
29
30   !! passive tracers fields (before,now,after)
31   !! --------------------------------------------------
32   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)       ::  trai           !: initial total tracer
33   REAL(wp), PUBLIC                                        ::  areatot        !: total volume
34   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:  ) ::  cvol           !: volume correction -degrad option-
35   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:,:) ::  tr           !: tracer concentration
36   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:  ) ::  sbc_trc_b      !: Before sbc fluxes for tracers
37   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:  ) ::  sbc_trc        !: Now sbc fluxes for tracers
38
39   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:  ) ::  trc_i          !: prescribed tracer concentration in sea ice for SBC
40   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:  ) ::  trc_o          !: prescribed tracer concentration in ocean for SBC
41   INTEGER             , PUBLIC                            ::  nn_ice_tr      !: handling of sea ice tracers
42
43   !! interpolated gradient
44   !!-------------------------------------------------- 
45   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::  gtru           !: hor. gradient at u-points at bottom ocean level
46   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::  gtrv           !: hor. gradient at v-points at bottom ocean level
47   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::  gtrui          !: hor. gradient at u-points at top    ocean level
48   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:)   ::  gtrvi          !: hor. gradient at v-points at top    ocean level
49   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)     ::  qsr_mean        !: daily mean qsr
50   
51   !! passive tracers  (input and output)
52   !! ------------------------------------------ 
53   LOGICAL             , PUBLIC ::   ln_rsttr           !: boolean term for restart i/o for passive tracers (namelist)
54   LOGICAL             , PUBLIC ::   lrst_trc           !: logical to control the trc restart write
55   INTEGER             , PUBLIC ::   nn_writetrc        !: time step frequency for concentration outputs (namelist)
56   INTEGER             , PUBLIC ::   nutwrs             !: output FILE for passive tracers restart
57   INTEGER             , PUBLIC ::   nutrst             !: logical unit for restart FILE for passive tracers
58   INTEGER             , PUBLIC ::   nn_rsttr           !: control of the time step ( 0 or 1 ) for pass. tr.
59   CHARACTER(len = 80) , PUBLIC ::   cn_trcrst_in       !: suffix of pass. tracer restart name (input)
60   CHARACTER(len = 256), PUBLIC ::   cn_trcrst_indir    !: restart input directory
61   CHARACTER(len = 80) , PUBLIC ::   cn_trcrst_out      !: suffix of pass. tracer restart name (output)
62   CHARACTER(len = 256), PUBLIC ::   cn_trcrst_outdir   !: restart output directory
63   REAL(wp)            , PUBLIC ::   rDt_trc            !: = 2*rn_Dt except at nit000 (=rn_Dt) if l_1st_euler=.true.
64   LOGICAL             , PUBLIC ::   ln_top_euler       !: boolean term for euler integration
65   LOGICAL             , PUBLIC ::   ln_trcdta          !: Read inputs data from files
66   LOGICAL             , PUBLIC ::   ln_trcbc           !: Enable surface, lateral or open boundaries conditions
67   LOGICAL             , PUBLIC ::   ln_trcdmp          !: internal damping flag
68   LOGICAL             , PUBLIC ::   ln_trcdmp_clo      !: internal damping flag on closed seas
69   INTEGER             , PUBLIC ::   nittrc000          !: first time step of passive tracers model
70   LOGICAL             , PUBLIC ::   l_trcdm2dc         !: Diurnal cycle for TOP
71
72   !! Information for the ice module for tracers
73   !! ------------------------------------------
74   TYPE, PUBLIC ::   TRC_I_NML         !: Ice tracer namelist structure
75         REAL(wp)         :: trc_ratio    ! ice-ocean trc ratio
76         REAL(wp)         :: trc_prescr   ! prescribed ice trc cc
77         CHARACTER(len=2) :: ctrc_o       ! choice of ocean trc cc
78   END TYPE
79   !
80   REAL(wp)        , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   trc_ice_ratio    !: ice-ocean tracer ratio
81   REAL(wp)        , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   trc_ice_prescr   !: prescribed ice trc cc
82   CHARACTER(len=2), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   cn_trc_o         !: choice of ocean tracer cc
83
84   !! Information for the optics module
85   !! ---------------------------------
86   INTEGER , ALLOCATABLE, SAVE, DIMENSION(:,:)   ::  neln       !: number of T-levels + 1 in the euphotic layer
87   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::  heup       !: euphotic layer depth
88   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:)   ::  heup_01    !: Absolute euphotic layer depth
89   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  etot       !: par (photosynthetic available radiation)
90   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::  etot_ndcy  !: PAR over 24h in case of diurnal cycle
91
92
93   !! information for outputs
94   !! --------------------------------------------------
95   TYPE, PUBLIC ::   PTRACER        !: Passive tracer type
96      CHARACTER(len=20) ::   clsname   ! short name
97      CHARACTER(len=80) ::   cllname   ! long name
98      CHARACTER(len=20) ::   clunit    ! unit
99      LOGICAL           ::   llinit    ! read in a file or not
100      LOGICAL           ::   llsbc     ! read in a file or not
101      LOGICAL           ::   llcbc     ! read in a file or not
102      LOGICAL           ::   llobc     ! read in a file or not
103   END TYPE PTRACER
104   !
105   CHARACTER(len=20), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   ctrcnm   !: tracer name
106   CHARACTER(len=80), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   ctrcln   !: trccer field long name
107   CHARACTER(len=20), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   ctrcun   !: tracer unit
108   !
109   TYPE, PUBLIC ::   DIAG         !: Passive trcacer ddditional diagnostic type
110      CHARACTER(len=20) ::   sname   ! short name
111      CHARACTER(len=80) ::   lname   ! long name
112      CHARACTER(len=20) ::   units   ! unit
113   END TYPE DIAG
114   !
115   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   trc3d   !: 3D diagnostics for tracers
116   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   trc2d   !: 2D diagnostics for tracers
117
118   !! information for inputs
119   !! --------------------------------------------------
120   LOGICAL , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   ln_trc_ini    !: Initialisation from data input file
121   LOGICAL , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   ln_trc_obc    !: Use open boundary condition data
122   LOGICAL , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   ln_trc_sbc    !: Use surface boundary condition data
123   LOGICAL , PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   ln_trc_cbc    !: Use coastal boundary condition data
124   LOGICAL , PUBLIC                                  ::   ln_rnf_ctl    !: remove runoff dilution on tracers
125   REAL(wp), PUBLIC                                  ::   rn_sbc_time   !: Time scaling factor for SBC data (seconds in a day)
126   REAL(wp), PUBLIC                                  ::   rn_cbc_time   !: Time scaling factor for CBC data (seconds in a day)
127   LOGICAL , PUBLIC                                  ::   lltrcbc       !: Applying one of the boundary conditions
128   !
129   CHARACTER(len=20), PUBLIC, DIMENSION(jp_bdy) :: cn_trc_dflt   ! Default OBC condition for all tracers
130   CHARACTER(len=20), PUBLIC, DIMENSION(jp_bdy) :: cn_trc        ! Choice of boundary condition for tracers
131   INTEGER,           PUBLIC, DIMENSION(jp_bdy) :: nn_trcdmp_bdy !: =T Tracer damping
132   !
133   ! Vertical axis used in the sediment module
134   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   profsed
135!$AGRIF_DO_NOT_TREAT
136   ! External data structure of BDY for TOP. Available elements: cn_obc, ll_trc, trcnow, dmp
137   TYPE(OBC_DATA), PUBLIC, ALLOCATABLE, DIMENSION(:,:), TARGET ::   trcdta_bdy   !: bdy external data (local process)
138!$AGRIF_END_DO_NOT_TREAT
139   !
140   !! Substitutions
141#include "do_loop_substitute.h90"
142   !!----------------------------------------------------------------------
143   !! NEMO/TOP 4.0 , NEMO Consortium (2018)
144   !! $Id$
145   !! Software governed by the CeCILL license (see ./LICENSE)
146   !!----------------------------------------------------------------------
147CONTAINS
148
149   INTEGER FUNCTION trc_alloc()
150      !!-------------------------------------------------------------------
151      !!                    *** ROUTINE trc_alloc ***
152      !!-------------------------------------------------------------------
153      USE lib_mpp, ONLY: ctl_stop
154      !!-------------------------------------------------------------------
155      INTEGER :: ierr(4)
156      !!-------------------------------------------------------------------
157      ierr(:) = 0
158      !
159      ALLOCATE( tr(jpi,jpj,jpk,jptra,jpt)                                             ,       & 
160         &      trc_i(jpi,jpj,jptra)  , trc_o(jpi,jpj,jptra)                          ,       &
161         &      gtru (jpi,jpj,jptra)  , gtrv (jpi,jpj,jptra)                          ,       &
162         &      gtrui(jpi,jpj,jptra)  , gtrvi(jpi,jpj,jptra)                          ,       &
163         &      trc_ice_ratio(jptra)  , trc_ice_prescr(jptra) , cn_trc_o(jptra)       ,       &
164         &      neln(jpi,jpj)         , heup(jpi,jpj)         , heup_01(jpi,jpj)      ,       &
165         &      etot(jpi,jpj,jpk)     , etot_ndcy(jpi,jpj,jpk),                               &
166         &      sbc_trc_b(jpi,jpj,jptra), sbc_trc(jpi,jpj,jptra)                      ,       & 
167         &      cvol(jpi,jpj,jpk)     , trai(jptra)           , qsr_mean(jpi,jpj)     ,       &
168         &      ctrcnm(jptra)         , ctrcln(jptra)         , ctrcun(jptra)         ,       &
169         &      ln_trc_ini(jptra)     ,                                                       &
170         &      ln_trc_sbc(jptra)     , ln_trc_cbc(jptra)     , ln_trc_obc(jptra)     ,       &
171         &      STAT = ierr(1)  )
172      !
173      IF( ln_bdy       )   ALLOCATE( trcdta_bdy(jptra, jp_bdy)  , STAT = ierr(2) )
174      !
175      IF (jp_dia3d > 0 )   ALLOCATE( trc3d(jpi,jpj,jpk,jp_dia3d), STAT = ierr(3) )
176      !
177      IF (jp_dia2d > 0 )   ALLOCATE( trc2d(jpi,jpj,jpk,jp_dia2d), STAT = ierr(4) )
178      !
179      trc_alloc = MAXVAL( ierr )
180      IF( trc_alloc /= 0 )   CALL ctl_stop( 'STOP', 'trc_alloc: failed to allocate arrays' )
181      !
182   END FUNCTION trc_alloc
183
184   !!======================================================================
185END MODULE trc
Note: See TracBrowser for help on using the repository browser.