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 branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC – NEMO

source: branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/trc.F90 @ 2690

Last change on this file since 2690 was 2690, checked in by gm, 13 years ago

dynamic mem: #785 ; homogeneization of the coding style associated with dyn allocation

  • Property svn:keywords set to Id
File size: 7.5 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   !!              -   !  1999-07  (M. Levy)  for LOBSTER1 or NPZD model
8   !!              -   !  2000-04  (O. Aumont, M.A. Foujols)  HAMOCC3 and P3ZD
9   !!   NEMO      1.0  !  2004-03  (C. Ethe)  Free form and module
10   !!----------------------------------------------------------------------
11#if defined key_top
12   !!----------------------------------------------------------------------
13   !!   'key_top'                                                TOP models
14   !!----------------------------------------------------------------------
15   USE par_oce
16   USE par_trc
17   
18   IMPLICIT NONE
19   PUBLIC
20
21   PUBLIC   trc_alloc   ! called by nemogcm.F90
22
23   !! passive tracers names and units (read in namelist)
24   !! --------------------------------------------------
25   CHARACTER(len=12), PUBLIC, DIMENSION(jptra) ::   ctrcnm     !: tracer name
26   CHARACTER(len=12), PUBLIC, DIMENSION(jptra) ::   ctrcun     !: tracer unit
27   CHARACTER(len=80), PUBLIC, DIMENSION(jptra) ::   ctrcnl     !: tracer long name
28   
29   
30   !! parameters for the control of passive tracers
31   !! --------------------------------------------------
32   INTEGER, PUBLIC                   ::   numnat   !: the number of the passive tracer NAMELIST
33   LOGICAL, PUBLIC, DIMENSION(jptra) ::   lutini   !:  initialisation from FILE or not (NAMELIST)
34   LOGICAL, PUBLIC, DIMENSION(jptra) ::   lutsav   !:  save the tracer or not
35
36   !! passive tracers fields (before,now,after)
37   !! --------------------------------------------------
38   REAL(wp), PUBLIC ::   trai                          !: initial total tracer
39   REAL(wp), PUBLIC ::   areatot                       !: total volume
40   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:,:)   ::   cvol   !: volume correction -degrad option-
41   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:,:,:) ::   trn    !: traceur concentration for now time step
42   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:,:,:) ::   tra    !: traceur concentration for next time step
43   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:,:,:) ::   trb    !: traceur concentration for before time step
44
45   !! interpolated gradient
46   !!-------------------------------------------------- 
47   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:,:) ::   gtru   !: hor. gradient at u-points at bottom ocean level
48   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:,:) ::   gtrv   !: hor. gradient at v-points at bottom ocean level
49   
50   !! passive tracers restart (input and output)
51   !! ------------------------------------------ 
52   LOGICAL          , PUBLIC ::  ln_rsttr        !: boolean term for restart i/o for passive tracers (namelist)
53   LOGICAL          , PUBLIC ::  lrst_trc        !: logical to control the trc restart write
54   INTEGER          , PUBLIC ::  nn_dttrc        !: frequency of step on passive tracers
55   INTEGER          , PUBLIC ::  nutwrs          !: output FILE for passive tracers restart
56   INTEGER          , PUBLIC ::  nutrst          !: logical unit for restart FILE for passive tracers
57   INTEGER          , PUBLIC ::  nn_rsttr        !: control of the time step ( 0 or 1 ) for pass. tr.
58   CHARACTER(len=50), PUBLIC ::  cn_trcrst_in    !: suffix of pass. tracer restart name (input)
59   CHARACTER(len=50), PUBLIC ::  cn_trcrst_out   !: suffix of pass. tracer restart name (output)
60   
61   !! information for outputs
62   !! --------------------------------------------------
63   INTEGER , PUBLIC ::   nn_writetrc   !: time step frequency for concentration outputs (namelist)
64   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   rdttrc        !: vertical profile of passive tracer time step
65   
66# if defined key_diatrc && ! defined key_iomput
67   !! additional 2D/3D outputs namelist
68   !! --------------------------------------------------
69   INTEGER         , PUBLIC                      ::   nn_writedia   !: frequency of additional arrays outputs(namelist)
70   CHARACTER(len= 8), PUBLIC, DIMENSION(jpdia2d) ::   ctrc2d      !: 2d output field name
71   CHARACTER(len= 8), PUBLIC, DIMENSION(jpdia2d) ::   ctrc2u      !: 2d output field unit   
72   CHARACTER(len= 8), PUBLIC, DIMENSION(jpdia3d) ::   ctrc3d      !: 3d output field name
73   CHARACTER(len= 8), PUBLIC, DIMENSION(jpdia3d) ::   ctrc3u      !: 3d output field unit
74   CHARACTER(len=80), PUBLIC, DIMENSION(jpdia2d) ::   ctrc2l      !: 2d output field long name
75   CHARACTER(len=80), PUBLIC, DIMENSION(jpdia3d) ::   ctrc3l      !: 3d output field long name
76
77   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,  :) ::   trc2d    !:  additional 2d outputs 
78   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   trc3d    !:  additional 3d outputs 
79# endif
80
81# if defined key_diabio || defined key_trdmld_trc
82   !                                                              !!*  namtop_XXX namelist *
83   INTEGER , PUBLIC                               ::   nn_writebio   !: time step frequency for biological outputs
84   CHARACTER(len=8 ), PUBLIC, DIMENSION(jpdiabio) ::   ctrbio      !: biological trends name     
85   CHARACTER(len=20), PUBLIC, DIMENSION(jpdiabio) ::   ctrbiu      !: biological trends unit   
86   CHARACTER(len=80), PUBLIC, DIMENSION(jpdiabio) ::   ctrbil      !: biological trends long name
87# endif
88# if defined key_diabio
89   !! Biological trends
90   !! -----------------
91   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) ::   trbio   !: biological trends
92# endif
93
94   
95   !! passive tracers data read and at given time_step
96   !! --------------------------------------------------
97# if defined key_dtatrc
98   INTEGER , PUBLIC, DIMENSION(jptra) ::   numtr   !: logical unit for passive tracers data
99# endif
100
101   !!----------------------------------------------------------------------
102   !! NEMO/TOP 3.3.1 , NEMO Consortium (2010)
103   !! $Id$
104   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
105   !!----------------------------------------------------------------------
106CONTAINS
107
108   INTEGER FUNCTION trc_alloc()
109      !!-------------------------------------------------------------------
110      !!                    *** ROUTINE trc_alloc ***
111      !!-------------------------------------------------------------------
112      USE lib_mpp, ONLY: ctl_warn
113      !!-------------------------------------------------------------------
114      !
115      ALLOCATE( cvol(jpi,jpj,jpk      ) ,                           &
116         &      trn (jpi,jpj,jpk,jptra) ,                           &
117         &      tra (jpi,jpj,jpk,jptra) ,                           &
118         &      trb (jpi,jpj,jpk,jptra) ,                           &
119         &      gtru(jpi,jpj    ,jptra) , gtrv(jpi,jpj,jptra) ,     &
120# if defined key_diatrc && ! defined key_iomput
121         &      trc2d(jpi,jpj,jpdia2d), trc3d(jpi,jpj,jpk,jpdia3d), &
122# endif
123# if defined key_diabio
124         &      trbio(jpi,jpj,jpk,jpdiabio),                        &
125#endif
126               rdttrc(jpk) ,  STAT=trc_alloc )     
127
128      IF( trc_alloc /= 0 )   CALL ctl_warn('trc_alloc: failed to allocate arrays')
129      !
130   END FUNCTION trc_alloc
131
132#else
133   !!----------------------------------------------------------------------
134   !!  Empty module :                                     No passive tracer
135   !!----------------------------------------------------------------------
136#endif
137
138   !!======================================================================
139END MODULE trc
Note: See TracBrowser for help on using the repository browser.