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 @ 2607

Last change on this file since 2607 was 2607, checked in by trackstand2, 13 years ago

Made module arrays allocatable and added calls to _alloc()s in nemo_alloc()

  • Property svn:keywords set to Id
File size: 7.6 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, ALLOCATABLE, SAVE, DIMENSION (:,:,:) :: cvol   !: volume correction -degrad option-
39   REAL(wp), PUBLIC ::   trai                          !: initial total tracer
40   REAL(wp), PUBLIC ::   areatot                       !: total volume
41
42   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:,:,:) ::   trn   !: traceur concentration for actual time step
43   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:,:,:) ::   tra   !: traceur concentration for next time step
44   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:,:,:) ::   trb   !: traceur concentration for before time step
45
46   !! interpolated gradient
47   !!-------------------------------------------------- 
48   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:,:) ::   gtru   !: horizontal gradient at u-points at bottom ocean level
49   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:,:) ::   gtrv   !: horizontal gradient at v-points at bottom ocean level
50   
51   !! passive tracers restart (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_dttrc      !: frequency of step on passive tracers
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=50), PUBLIC ::  cn_trcrst_in  !: suffix of pass. tracer restart name (input)
60   CHARACTER(len=50), PUBLIC ::  cn_trcrst_out !: suffix of pass. tracer restart name (output)
61   
62   !! information for outputs
63   !! --------------------------------------------------
64   INTEGER , PUBLIC ::   nn_writetrc   !: time step frequency for concentration outputs (namelist)
65   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:) ::   rdttrc        !: vertical profile of passive tracer time step
66   
67# if defined key_diatrc && ! defined key_iomput
68   !! additional 2D/3D outputs namelist
69   !! --------------------------------------------------
70   INTEGER , PUBLIC                               ::   nn_writedia   !: frequency of additional arrays outputs(namelist)
71   CHARACTER(len= 8), PUBLIC, DIMENSION (jpdia2d) ::   ctrc2d      !: 2d output field name
72   CHARACTER(len= 8), PUBLIC, DIMENSION (jpdia2d) ::   ctrc2u      !: 2d output field unit   
73   CHARACTER(len= 8), PUBLIC, DIMENSION (jpdia3d) ::   ctrc3d      !: 3d output field name
74   CHARACTER(len= 8), PUBLIC, DIMENSION (jpdia3d) ::   ctrc3u      !: 3d output field unit
75   CHARACTER(len=80), PUBLIC, DIMENSION (jpdia2d) ::   ctrc2l      !: 2d output field long name
76   CHARACTER(len=80), PUBLIC, DIMENSION (jpdia3d) ::   ctrc3l      !: 3d output field long name
77
78   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:,  :) ::   trc2d    !:  additional 2d outputs 
79   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION (:,:,:,:) ::   trc3d    !:  additional 3d outputs 
80   
81# endif
82
83#if defined key_diabio || defined key_trdmld_trc
84   !                                                              !!*  namtop_XXX namelist *
85   INTEGER , PUBLIC                               ::   nn_writebio   !: time step frequency for biological outputs
86   CHARACTER(len=8 ), PUBLIC, DIMENSION(jpdiabio) ::   ctrbio      !: biological trends name     
87   CHARACTER(len=20), PUBLIC, DIMENSION(jpdiabio) ::   ctrbiu      !: biological trends unit   
88   CHARACTER(len=80), PUBLIC, DIMENSION(jpdiabio) ::   ctrbil      !: biological trends long name
89#endif
90# if defined key_diabio
91   !! Biological trends
92   !! -----------------
93   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:,:) :: trbio   !: biological trends
94# endif
95
96   
97   !! passive tracers data read and at given time_step
98   !! --------------------------------------------------
99# if defined key_dtatrc
100   INTEGER , PUBLIC, DIMENSION(jptra) ::   numtr   !: logical unit for passive tracers data
101# endif
102
103#else
104   !!----------------------------------------------------------------------
105   !!  Empty module :                                     No passive tracer
106   !!----------------------------------------------------------------------
107#endif
108
109   !!----------------------------------------------------------------------
110   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
111   !! $Id$
112   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
113   !!======================================================================
114#if defined key_top
115CONTAINS
116
117   FUNCTION trc_alloc()
118      !!-------------------------------------------------------------------
119      !!                    *** ROUTINE trc_alloc ***
120      !!-------------------------------------------------------------------
121      USE in_out_manager, ONLY: ctl_warn
122      !
123      INTEGER :: trc_alloc
124      !!-------------------------------------------------------------------
125
126      ALLOCATE(cvol(jpi,jpj,jpk),                                  &
127               trn(jpi,jpj,jpk,jptra),                             &
128               tra(jpi,jpj,jpk,jptra),                             &
129               trb(jpi,jpj,jpk,jptra),                             &
130               gtru(jpi,jpj,jptra), gtrv(jpi,jpj,jptra),           &
131               rdttrc(jpk),                                        &
132# if defined key_diatrc && ! defined key_iomput
133               trc2d(jpi,jpj,jpdia2d), trc3d(jpi,jpj,jpk,jpdia3d), &
134#endif
135# if defined key_diabio
136               trbio(jpi,jpj,jpk,jpdiabio),                        &
137#endif
138               Stat=trc_alloc)
139
140      IF(trc_alloc /= 0)THEN
141         CALL ctl_warn('trc_alloc: failed to allocate arrays.')
142      END IF
143
144   END FUNCTION trc_alloc
145#endif
146
147END MODULE trc
Note: See TracBrowser for help on using the repository browser.