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.
crs.F90 in branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/OPA_SRC/CRS – NEMO

source: branches/2015/dev_r5003_MERCATOR6_CRS/NEMOGCM/NEMO/OPA_SRC/CRS/crs.F90 @ 6101

Last change on this file since 6101 was 6101, checked in by cbricaud, 8 years ago

correction of bugs from last update and improvments for CRS

  • Property svn:keywords set to Id
File size: 22.3 KB
Line 
1MODULE crs   
2   !!======================================================================
3   !!                         ***  MODULE crs_dom  ***
4   !!        Declare the coarse grid domain and other public variables
5   !!        then allocate them if needed.
6   !!======================================================================
7   !!  History     2012-06  Editing  (J. Simeon, G. Madec, C. Ethe, C. Calone) Original code
8   !!----------------------------------------------------------------------
9   USE par_oce 
10   USE dom_oce
11   USE in_out_manager
12   USE lbcnfd
13
14   IMPLICIT NONE
15   PUBLIC
16
17   
18   PUBLIC crs_dom_alloc  ! Called from crsini.F90
19   PUBLIC crs_dom_alloc1  ! Called from crsini.F90
20   PUBLIC crs_dom_alloc2  ! Called from crsini.F90
21   PUBLIC dom_grid_glo   
22   PUBLIC dom_grid_crs 
23
24      ! Domain variables
25      INTEGER  ::  jpiglo_crs ,   &             !: 1st dimension of global coarse grid domain
26                   jpjglo_crs                   !: 2nd dimension of global coarse grid domain
27      INTEGER  ::  jpi_crs ,   &                !: 1st dimension of local coarse grid domain
28                   jpj_crs                      !: 2nd dimension of local coarse grid domain
29      INTEGER  ::  jpi_full ,  &                !: 1st dimension of local parent grid domain
30                   jpj_full                     !: 2nd dimension of local parent grid domain
31
32      INTEGER  ::  nistr , njstr
33      INTEGER  ::  niend , njend
34
35      INTEGER  ::  jpi_crsm1, jpj_crsm1         !: loop indices     
36      INTEGER  ::  jpiglo_crsm1, jpjglo_crsm1   !: loop indices     
37      INTEGER  ::  nperio_full, nperio_crs      !: jperio of parent and coarse grids
38      INTEGER  ::  npolj_full, npolj_crs        !: north fold mark
39      INTEGER  ::  jpiglo_full, jpjglo_full     !: jpiglo / jpjglo
40      INTEGER  ::  npiglo, npjglo               !: jpjglo
41      INTEGER  ::  nlci_full, nlcj_full         !: i-, j-dimension of local or sub domain on parent grid
42      INTEGER  ::  nldi_full, nldj_full         !: starting indices of internal sub-domain on parent grid
43      INTEGER  ::  nlei_full, nlej_full         !: ending indices of internal sub-domain on parent grid
44      INTEGER  ::  nlci_crs, nlcj_crs           !: i-, j-dimension of local or sub domain on coarse grid
45      INTEGER  ::  nldi_crs, nldj_crs           !: starting indices of internal sub-domain on coarse grid
46      INTEGER  ::  nlei_crs, nlej_crs           !: ending indices of internal sub-domain on coarse grid
47
48      INTEGER  ::  narea_full, narea_crs        !: node
49      INTEGER  ::  jpnij_full, jpnij_crs        !: =jpni*jpnj, the pe decomposition
50      INTEGER  ::  jpim1_full, jpjm1_full       !:
51      INTEGER  ::  nimpp_full, njmpp_full       !: global position of point (1,1) of subdomain on parent grid
52      INTEGER  ::  nimpp_crs, njmpp_crs         !: set to 1,1 for now .  Valid only for monoproc
53      INTEGER  ::  nreci_full, nrecj_full
54      INTEGER  ::  nreci_crs, nrecj_crs
55      !cc
56      INTEGER ::   noea_full, nowe_full        !: index of the local neighboring processors in
57      INTEGER ::   noso_full, nono_full        !: east, west, south and north directions
58      INTEGER ::   npne_full, npnw_full        !: index of north east and north west processor
59      INTEGER ::   npse_full, npsw_full        !: index of south east and south west processor
60      INTEGER ::   nbne_full, nbnw_full        !: logical of north east & north west processor
61      INTEGER ::   nbse_full, nbsw_full        !: logical of south east & south west processor
62      INTEGER ::   nidom_full                  !: ???
63      INTEGER ::   nproc_full                  !:number for local processor
64      INTEGER ::   nbondi_full, nbondj_full    !: mark of i- and j-direction local boundaries
65      INTEGER ::   noea_crs, nowe_crs          !: index of the local neighboring processors in
66      INTEGER ::   noso_crs, nono_crs          !: east, west, south and north directions
67      INTEGER ::   npne_crs, npnw_crs          !: index of north east and north west processor
68      INTEGER ::   npse_crs, npsw_crs          !: index of south east and south west processor
69      INTEGER ::   nbne_crs, nbnw_crs          !: logical of north east & north west processor
70      INTEGER ::   nbse_crs, nbsw_crs          !: logical of south east & south west processor
71      INTEGER ::   nidom_crs                   !: ???
72      INTEGER ::   nproc_crs                   !:number for local processor
73      INTEGER ::   nbondi_crs, nbondj_crs      !: mark of i- and j-direction local boundaries
74     
75      INTEGER ::  nfsloop_full,nfeloop_full 
76      INTEGER ::  nfsloop_crs ,nfeloop_crs
77
78      INTEGER, DIMENSION(:), ALLOCATABLE :: mis_crs, mie_crs, mis2_crs, mie2_crs  ! starting and ending i-indices of parent subset
79      INTEGER, DIMENSION(:), ALLOCATABLE :: mjs_crs, mje_crs, mjs2_crs, mje2_crs ! starting and ending  j-indices of parent subset
80      INTEGER, DIMENSION(:), ALLOCATABLE :: mjg_crs, mig_crs
81      INTEGER, DIMENSION(:), ALLOCATABLE :: mi0_crs, mi1_crs, mj0_crs, mj1_crs
82      INTEGER  :: mxbinctr, mybinctr            ! central point in grid box
83      INTEGER, DIMENSION(:), ALLOCATABLE ::   nlcit_crs, nlcit_full  !: dimensions of every subdomain
84      INTEGER, DIMENSION(:), ALLOCATABLE ::   nldit_crs, nldit_full     !: first, last indoor index for each i-domain
85      INTEGER, DIMENSION(:), ALLOCATABLE ::   nleit_crs, nleit_full    !: first, last indoor index for each j-domain
86      INTEGER, DIMENSION(:), ALLOCATABLE ::   nimppt_crs, nimppt_full    !: first, last indoor index for each j-domain
87      INTEGER, DIMENSION(:), ALLOCATABLE ::   nlcjt_crs, nlcjt_full  !: dimensions of every subdomain
88      INTEGER, DIMENSION(:), ALLOCATABLE ::   nldjt_crs, nldjt_full     !: first, last indoor index for each i-domain
89      INTEGER, DIMENSION(:), ALLOCATABLE ::   nlejt_crs, nlejt_full    !: first, last indoor index for each j-domain
90      INTEGER, DIMENSION(:), ALLOCATABLE ::   njmppt_crs, njmppt_full    !: first, last indoor index for each j-domain
91
92      INTEGER, DIMENSION(:,:), ALLOCATABLE ::   nfiimpp_full
93      INTEGER, DIMENSION(:,:), ALLOCATABLE ::   nfiimpp_crs
94 
95      ! Masks
96      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE,SAVE :: tmask_crs, umask_crs, vmask_crs, fmask_crs
97      REAL(wp), DIMENSION(:,:)  , ALLOCATABLE,SAVE :: tmask_i_crs, rnfmsk_crs, tpol_crs, fpol_crs
98     
99  !    REAL(wp), DIMENSION(:,:),   ALLOCATABLE :: tmask_i_crs, tpol, fpol     
100
101      ! Scale factors
102      REAL(wp), DIMENSION(:,:),   ALLOCATABLE :: e1t_crs, e2t_crs, e1e2t_crs ! horizontal scale factors grid type T
103      REAL(wp), DIMENSION(:,:),   ALLOCATABLE :: e1u_crs, e2u_crs ! horizontal scale factors grid type U
104      REAL(wp), DIMENSION(:,:),   ALLOCATABLE :: e1v_crs, e2v_crs ! horizontal scale factors grid type V
105      REAL(wp), DIMENSION(:,:),   ALLOCATABLE :: e1f_crs, e2f_crs ! horizontal scale factors grid type F
106      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: e3t_crs, e3u_crs, e3v_crs, e3f_crs, e3w_crs
107      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: e3t_max_crs, e3u_max_crs, e3v_max_crs, e3f_max_crs, e3w_max_crs
108     
109      ! Surface
110      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: e1e2w_crs, e2e3u_crs, e1e3v_crs
111      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: e1e2w_msk, e2e3u_msk, e1e3v_msk
112                                                                  ! vertical scale factors
113      ! Coordinates
114      REAL(wp), DIMENSION(:,:),   ALLOCATABLE,SAVE :: gphit_crs, glamt_crs, gphif_crs, glamf_crs 
115      REAL(wp), DIMENSION(:,:),   ALLOCATABLE,SAVE :: gphiu_crs, glamu_crs, gphiv_crs, glamv_crs 
116      REAL(wp), DIMENSION(:,:),   ALLOCATABLE,SAVE :: ff_crs
117      INTEGER,  DIMENSION(:,:),   ALLOCATABLE,SAVE :: mbathy_crs, mbkt_crs, mbku_crs, mbkv_crs
118      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE,SAVE :: gdept_crs, gdepu_crs, gdepv_crs, gdepw_crs
119
120      ! Weights
121      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: facsurfv, facsurfu, facvol_t, facvol_w
122      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: ocean_volume_crs_t, ocean_volume_crs_w, bt_crs, r1_bt_crs
123      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: crs_surfu_wgt, crs_surfv_wgt, crs_surfw_wgt, crs_volt_wgt
124
125      ! CRS Namelist
126      INTEGER           :: nn_factx   = 3       !: reduction factor of x-dimension of the parent grid
127      INTEGER           :: nn_facty   = 3       !: reduction factor of y-dimension of the parent grid
128      INTEGER           :: nn_binref  = 0       !: 0 = binning starts north fold (equator could be asymmetric)
129                                                !: 1 = binning centers at equator (north fold my have artifacts)     
130                                                !:    for even reduction factors, equator placed in bin biased south
131      INTEGER           :: nn_msh_crs = 1       !: Organization of mesh mask output
132                                                !: 0 = no mesh mask output
133                                                !: 1 = unified mesh mask output
134                                                !: 2 = 2 separate mesh mask output
135                                                !: 3 = 3 separate mesh mask output
136      INTEGER           :: nn_crs_kz    =    0       !: type of Kz coarsening ( =0->VOL ; =1->MAX ; =2->MIN)
137      LOGICAL           :: ln_crs_wn    = .FALSE.    !: coarsening wn or computation using horizontal divergence
138      LOGICAL, PUBLIC   :: ln_crs_top = .FALSE.          !:coarsening online for the bio
139      !
140      INTEGER           :: nrestx, nresty       !: for determining odd or even reduction factor
141
142
143      ! Grid reduction factors
144      REAL(wp)     ::  rfactx_r                !: inverse of x-dim reduction factor
145      REAL(wp)     ::  rfacty_r                !: inverse of y-dim reduction factor
146      REAL(wp)     ::  rfactxy 
147
148      ! Physical and dynamical ocean fields for output or passing to TOP, time-mean fields
149      REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE      :: tsb_crs,tsn_crs,rab_crs_n
150      REAL(wp), DIMENSION(:,:,:)  , ALLOCATABLE      :: un_crs, vn_crs, wn_crs, rke_crs
151      REAL(wp), DIMENSION(:,:,:)  , ALLOCATABLE      :: ub_crs, vb_crs
152      REAL(wp), DIMENSION(:,:,:)  , ALLOCATABLE      :: hdivb_crs , hdivn_crs   
153      REAL(wp), DIMENSION(:,:)    , ALLOCATABLE      :: sshb_crs, sshn_crs , ssha_crs
154      REAL(wp), DIMENSION(:,:,:)  , ALLOCATABLE      :: rhop_crs,rhd_crs,rn2_crs,rb2_crs
155      REAL(wp), DIMENSION(:,:)    , ALLOCATABLE      :: gru_crs, grv_crs
156      REAL(wp), DIMENSION(:,:,:)  , ALLOCATABLE      :: gtsu_crs, gtsv_crs
157      !
158      ! Surface fluxes to pass to TOP
159      REAL(wp), PUBLIC, DIMENSION(:,:)  , ALLOCATABLE :: qsr_crs, fr_i_crs, wndm_crs
160      REAL(wp), PUBLIC, DIMENSION(:,:)  , ALLOCATABLE :: emp_crs, emp_b_crs, sfx_crs
161      REAL(wp), PUBLIC, DIMENSION(:,:)  , ALLOCATABLE :: fmmflx_crs
162      REAL(wp), PUBLIC, DIMENSION(:,:)  , ALLOCATABLE :: utau_crs, vtau_crs, taum_crs
163      REAL(wp), PUBLIC, DIMENSION(:,:)  , ALLOCATABLE :: rnf_crs
164
165      REAL(wp), PUBLIC, DIMENSION(:,:,:) , ALLOCATABLE ::   uslp_crs, wslpi_crs          !: i_slope at U- and W-points
166      REAL(wp), PUBLIC, DIMENSION(:,:,:) , ALLOCATABLE ::   vslp_crs, wslpj_crs          !: j-slope at V- and W-points
167
168      ! Horizontal diffusion
169#if defined key_traldf_c3d
170   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   ahtt_crs, ahtu_crs, ahtv_crs, ahtw_crs   !: ** 3D coefficients ** at T-,U-,V-,W-points
171#elif defined key_traldf_c2d
172   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   ahtt_crs, ahtu_crs, ahtv_crs, ahtw_crs   !: ** 2D coefficients ** at T-,U-,V-,W-points
173#elif defined key_traldf_c1d
174   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:)     ::   ahtt_crs, ahtu_crs, ahtv_crs, ahtw_crs   !: ** 1D coefficients ** at T-,U-,V-,W-points
175#else
176   REAL(wp), PUBLIC                                      ::   ahtt_crs, ahtu_crs, ahtv_crs, ahtw_crs   !: ** 0D coefficients ** at T-,U-,V-,W-points
177#endif
178
179      ! Vertical diffusion
180      REAL(wp), PUBLIC, ALLOCATABLE, DIMENSION(:,:,:)  ::  avt_crs           !: vert. diffusivity coef. [m2/s] at w-point for temp 
181      REAL(wp), PUBLIC, ALLOCATABLE, DIMENSION(:,:,:)  ::  en_crs            !: vert. diffusivity coef. [m2/s] at w-point for temp 
182      REAL(wp), PUBLIC, ALLOCATABLE, DIMENSION(:,:)    ::  avtb_2d_crs       !: vert. diffusivity coef. [m2/s] at w-point for temp 
183# if defined key_zdfddm
184      REAL(wp), PUBLIC, ALLOCATABLE, DIMENSION(:,:,:)  ::  avs_crs           !: salinity vertical diffusivity coeff. [m2/s] at w-point
185# endif
186
187      ! Mixing and Mixed Layer Depth
188      INTEGER,  PUBLIC, DIMENSION(:,:) , ALLOCATABLE ::  nmln_crs
189      REAL(wp), PUBLIC, DIMENSION(:,:) , ALLOCATABLE :: hmlp_crs , hmlpt_crs , hmld_crs
190
191      ! Direction of lateral diffusion
192
193
194   !! $Id$
195CONTAINS
196   
197   INTEGER FUNCTION crs_dom_alloc1()
198      !!-------------------------------------------------------------------
199      !!                     *** FUNCTION crs_dom_alloc ***
200      !!  ** Purpose :   Allocate public crs arrays 
201      !!-------------------------------------------------------------------
202      !! Local variables
203      INTEGER, DIMENSION(15) :: ierr
204
205      ierr(:) = 0
206
207      ! Set up bins for coarse grid, horizontal only.
208     ALLOCATE( mis2_crs(jpiglo_crs), mie2_crs(jpiglo_crs),  &
209       &       mjs2_crs(jpjglo_crs), mje2_crs(jpjglo_crs),  &
210       &       mi0_crs (jpiglo_crs), mi1_crs (jpiglo_crs),  &
211       &       mj0_crs (jpjglo_crs), mj1_crs (jpjglo_crs),  &
212       &       mig_crs (jpi_crs)   , mjg_crs (jpj_crs)   ,  STAT=ierr(1) ) 
213
214
215      ! Set up Mask and Mesh
216      ALLOCATE( tmask_crs(jpi_crs,jpj_crs,jpk) , fmask_crs(jpi_crs,jpj_crs,jpk) ,  &
217         &      umask_crs(jpi_crs,jpj_crs,jpk) , vmask_crs(jpi_crs,jpj_crs,jpk) , STAT=ierr(2))
218
219      ALLOCATE( tmask_i_crs(jpi_crs,jpj_crs)   , rnfmsk_crs(jpi_crs,jpj_crs), &
220      &         tpol_crs(jpiglo_crs,jpjglo_crs), fpol_crs(jpiglo_crs,jpjglo_crs), STAT=ierr(3) )
221
222      ALLOCATE( gphit_crs(jpi_crs,jpj_crs) , glamt_crs(jpi_crs,jpj_crs) , & 
223         &      gphiu_crs(jpi_crs,jpj_crs) , glamu_crs(jpi_crs,jpj_crs) , &
224         &      gphiv_crs(jpi_crs,jpj_crs) , glamv_crs(jpi_crs,jpj_crs) , &
225         &      gphif_crs(jpi_crs,jpj_crs) , glamf_crs(jpi_crs,jpj_crs) , &
226         &      ff_crs(jpi_crs,jpj_crs)    , STAT=ierr(4))
227
228      ALLOCATE( e1t_crs(jpi_crs,jpj_crs) , e2t_crs(jpi_crs,jpj_crs) , & 
229         &      e1u_crs(jpi_crs,jpj_crs) , e2u_crs(jpi_crs,jpj_crs) , & 
230         &      e1v_crs(jpi_crs,jpj_crs) , e2v_crs(jpi_crs,jpj_crs) , &
231         &      e1f_crs(jpi_crs,jpj_crs) , e2f_crs(jpi_crs,jpj_crs) , &
232         &      e1e2t_crs(jpi_crs,jpj_crs), STAT=ierr(5))
233
234      ALLOCATE( e3t_crs(jpi_crs,jpj_crs,jpk)    , e3w_crs(jpi_crs,jpj_crs,jpk)    , & 
235         &      e3u_crs(jpi_crs,jpj_crs,jpk)    , e3v_crs(jpi_crs,jpj_crs,jpk)    , &
236         &      e3f_crs(jpi_crs,jpj_crs,jpk)    , e1e2w_msk(jpi_crs,jpj_crs,jpk)  , & 
237         &      e2e3u_msk(jpi_crs,jpj_crs,jpk)  , e1e3v_msk(jpi_crs,jpj_crs,jpk)  , &
238         &      e1e2w_crs(jpi_crs,jpj_crs,jpk)  , e2e3u_crs(jpi_crs,jpj_crs,jpk)  , &
239         &      e1e3v_crs(jpi_crs,jpj_crs,jpk)  , e3t_max_crs(jpi_crs,jpj_crs,jpk), &
240         &      e3w_max_crs(jpi_crs,jpj_crs,jpk), e3u_max_crs(jpi_crs,jpj_crs,jpk), &
241         &      e3v_max_crs(jpi_crs,jpj_crs,jpk), STAT=ierr(6))
242
243
244      ALLOCATE( facsurfv(jpi_crs,jpj_crs,jpk), facsurfu(jpi_crs,jpj_crs,jpk) , & 
245         &      facvol_t(jpi_crs,jpj_crs,jpk), facvol_w(jpi_crs,jpj_crs,jpk) , &
246         &      ocean_volume_crs_t(jpi_crs,jpj_crs,jpk), ocean_volume_crs_w(jpi_crs,jpj_crs,jpk), &
247         &      bt_crs(jpi_crs,jpj_crs,jpk)  , r1_bt_crs(jpi_crs,jpj_crs,jpk) , STAT=ierr(7))
248
249
250      ALLOCATE( crs_surfu_wgt(jpi_crs,jpj_crs,jpk), crs_surfv_wgt(jpi_crs,jpj_crs,jpk) , & 
251         &      crs_surfw_wgt(jpi_crs,jpj_crs,jpk), crs_volt_wgt(jpi_crs,jpj_crs,jpk) , STAT=ierr(8))
252
253
254      ALLOCATE( mbathy_crs(jpi_crs,jpj_crs), mbkt_crs(jpi_crs,jpj_crs) , &
255         &      mbku_crs(jpi_crs,jpj_crs)  , mbkv_crs(jpi_crs,jpj_crs) , STAT=ierr(9))
256
257      ALLOCATE( gdept_crs(jpi_crs,jpj_crs,jpk), gdepu_crs(jpi_crs,jpj_crs,jpk) , &
258         &      gdepv_crs(jpi_crs,jpj_crs,jpk), gdepw_crs(jpi_crs,jpj_crs,jpk) , STAT=ierr(10) )
259
260
261      ALLOCATE( ub_crs(jpi_crs,jpj_crs,jpk) , vb_crs(jpi_crs,jpj_crs,jpk) , &
262         &      un_crs(jpi_crs,jpj_crs,jpk) , vn_crs(jpi_crs,jpj_crs,jpk)    ,  wn_crs(jpi_crs,jpj_crs,jpk) , &
263         &      hdivb_crs(jpi_crs,jpj_crs,jpk) , hdivn_crs(jpi_crs,jpj_crs,jpk) , &
264         &      rke_crs(jpi_crs,jpj_crs,jpk), rhop_crs(jpi_crs,jpj_crs,jpk)  , &
265         &      rb2_crs(jpi_crs,jpj_crs,jpk) ,rn2_crs(jpi_crs,jpj_crs,jpk) , &
266         &      rhd_crs(jpi_crs,jpj_crs,jpk)   , rab_crs_n(jpi_crs,jpj_crs,jpk,jpts) , &
267         &      avtb_2d_crs(jpi_crs,jpj_crs), &
268         &      gtsu_crs(jpi_crs,jpj_crs,jpts) ,gtsv_crs(jpi_crs,jpj_crs,jpts) , &
269                gru_crs(jpi_crs,jpj_crs) ,grv_crs(jpi_crs,jpj_crs) , STAT=ierr(11))
270
271     ALLOCATE( sshb_crs(jpi_crs,jpj_crs), sshn_crs(jpi_crs,jpj_crs),  ssha_crs(jpi_crs,jpj_crs), &
272         &     emp_crs (jpi_crs,jpj_crs), emp_b_crs(jpi_crs,jpj_crs), &
273         &     qsr_crs(jpi_crs ,jpj_crs), wndm_crs(jpi_crs,jpj_crs), utau_crs(jpi_crs,jpj_crs) , &
274         &     vtau_crs(jpi_crs,jpj_crs), taum_crs(jpi_crs,jpj_crs), rnf_crs(jpi_crs ,jpj_crs), &
275         &     fr_i_crs(jpi_crs,jpj_crs), sfx_crs(jpi_crs ,jpj_crs), fmmflx_crs(jpi_crs ,jpj_crs),  STAT=ierr(12)  )
276
277#if defined key_traldf_c3d
278      ALLOCATE( ahtt_crs(jpi_crs,jpj_crs,jpk) , ahtu_crs(jpi_crs,jpj_crs,jpk) , &
279              & ahtv_crs(jpi_crs,jpj_crs,jpk) , ahtw_crs(jpi_crs,jpj_crs,jpk) , STAT=ierr(13) )
280#elif defined key_traldf_c2d
281      ALLOCATE( ahtt_crs(jpi_crs,jpj_crs    ) , ahtu_crs(jpi_crs,jpj_crs    ) , &
282              & ahtv_crs(jpi_crs,jpj_crs    ) , ahtw_crs(jpi_crs,jpj_crs    ) , STAT=ierr(13) )
283#elif defined key_traldf_c1d
284      ALLOCATE( ahtt_crs(        jpk) , ahtu_crs(        jpk) , ahtv_crs(        jpk) , ahtw_crs(        jpk) , STAT=ierr(13) )
285#endif
286
287     ALLOCATE( tsn_crs(jpi_crs,jpj_crs,jpk,jpts), tsb_crs(jpi_crs,jpj_crs,jpk,jpts),  &
288               en_crs(jpi_crs,jpj_crs,jpk),   avt_crs(jpi_crs,jpj_crs,jpk),    &
289# if defined key_zdfddm
290         &      avs_crs(jpi_crs,jpj_crs,jpk),    &
291# endif
292         &      STAT=ierr(14) )
293
294      ALLOCATE( nmln_crs(jpi_crs,jpj_crs) , hmld_crs(jpi_crs,jpj_crs) , &
295         &      hmlp_crs(jpi_crs,jpj_crs) , hmlpt_crs(jpi_crs,jpj_crs) , STAT=ierr(15) )
296
297      crs_dom_alloc1 = MAXVAL(ierr)
298
299   END FUNCTION crs_dom_alloc1
300
301   INTEGER FUNCTION crs_dom_alloc()
302      !!-------------------------------------------------------------------
303      !!                     *** FUNCTION crs_dom_alloc ***
304      !!  ** Purpose :   Allocate public crs arrays 
305      !!-------------------------------------------------------------------
306      !! Local variables
307      INTEGER, DIMENSION(2) :: ierr
308
309      ierr(:) = 0
310         
311      ALLOCATE( nimppt_crs(jpnij) , nlcit_crs(jpnij) , nldit_crs(jpnij) , nleit_crs(jpnij), &
312       &  nimppt_full(jpnij) , nlcit_full(jpnij) , nldit_full(jpnij) , nleit_full(jpnij),   &
313                njmppt_crs(jpnij) , nlcjt_crs(jpnij) , nldjt_crs(jpnij) , nlejt_crs(jpnij), &
314       &  njmppt_full(jpnij) , nlcjt_full(jpnij) , nldjt_full(jpnij) , nlejt_full(jpnij)  , STAT=ierr(1) )
315
316      ALLOCATE( nfiimpp_full(jpni,jpnj) , nfiimpp_crs(jpni,jpnj) ,STAT=ierr(2) )
317
318      crs_dom_alloc = MAXVAL(ierr)
319
320   END FUNCTION crs_dom_alloc
321   
322   INTEGER FUNCTION crs_dom_alloc2()
323      !!-------------------------------------------------------------------
324      !!                     *** FUNCTION crs_dom_alloc ***
325      !!  ** Purpose :   Allocate public crs arrays 
326      !!-------------------------------------------------------------------
327      !! Local variables
328      INTEGER, DIMENSION(1) :: ierr
329
330      ierr(:) = 0
331     
332      !cbr ALLOCATE( mjs_crs(nlej_crs) , mje_crs(nlej_crs), mis_crs(nlei_crs) , mie_crs(nlei_crs), STAT=ierr(1) )
333      !cbr pk on alloue ac nlej_crs ??????
334      !cbrALLOCATE( mjs_crs(nlcj_crs) , mje_crs(nlcj_crs), mis_crs(nlci_crs) , mie_crs(nlci_crs), STAT=ierr(1) )
335      ALLOCATE( mjs_crs(jpj_crs) , mje_crs(jpj_crs), mis_crs(jpi_crs) , mie_crs(jpi_crs), STAT=ierr(1) )
336      crs_dom_alloc2 = MAXVAL(ierr)
337
338      END FUNCTION crs_dom_alloc2
339
340   SUBROUTINE dom_grid_glo
341      !!--------------------------------------------------------------------
342      !!                       ***  MODULE dom_grid_glo  ***
343      !!
344      !! ** Purpose : +Return back to parent grid domain
345      !!---------------------------------------------------------------------
346
347      !                         Return to parent grid domain
348      jpi    = jpi_full
349      jpj    = jpj_full
350      jpim1  = jpim1_full
351      jpjm1  = jpjm1_full
352      nperio = nperio_full
353
354      npolj  = npolj_full
355      jpiglo = jpiglo_full
356      jpjglo = jpjglo_full
357
358      nlci   = nlci_full
359      nlcj   = nlcj_full
360      nldi   = nldi_full
361      nldj   = nldj_full
362      nlei   = nlei_full
363      nlej   = nlej_full
364      nimpp  = nimpp_full
365      njmpp  = njmpp_full
366     
367      nlcit(:)  = nlcit_full(:)
368      nldit(:)  = nldit_full(:)
369      nleit(:)  = nleit_full(:)
370      nimppt(:) = nimppt_full(:)
371      nlcjt(:)  = nlcjt_full(:)
372      nldjt(:)  = nldjt_full(:)
373      nlejt(:)  = nlejt_full(:)
374      njmppt(:) = njmppt_full(:)
375
376      nfsloop = nfsloop_full
377      nfeloop = nfeloop_full
378
379      nfiimpp(:,:) = nfiimpp_full(:,:)
380
381   END SUBROUTINE dom_grid_glo
382
383   SUBROUTINE dom_grid_crs
384      !!--------------------------------------------------------------------
385      !!                       ***  MODULE dom_grid_crs  ***
386      !!
387      !! ** Purpose :  Save the parent grid information & Switch to coarse grid domain
388      !!---------------------------------------------------------------------
389      !
390      !                        Switch to coarse grid domain
391      jpi    = jpi_crs
392      jpj    = jpj_crs
393      jpim1  = jpi_crsm1
394      jpjm1  = jpj_crsm1
395      nperio = nperio_crs
396
397      npolj  = npolj_crs
398      jpiglo = jpiglo_crs
399      jpjglo = jpjglo_crs
400
401
402      nlci   = nlci_crs
403      nlcj   = nlcj_crs
404      nldi   = nldi_crs
405      nlei   = nlei_crs
406      nlej   = nlej_crs
407      nldj   = nldj_crs
408      nimpp  = nimpp_crs
409      njmpp  = njmpp_crs
410     
411      nlcit(:)  = nlcit_crs(:)
412      nldit(:)  = nldit_crs(:)
413      nleit(:)  = nleit_crs(:)
414      nimppt(:) = nimppt_crs(:)
415      nlcjt(:)  = nlcjt_crs(:)
416      nldjt(:)  = nldjt_crs(:)
417      nlejt(:)  = nlejt_crs(:)
418      njmppt(:) = njmppt_crs(:)
419
420      nfsloop = nfsloop_crs
421      nfeloop = nfeloop_crs
422
423      nfiimpp(:,:) = nfiimpp_crs(:,:)
424
425      !
426   END SUBROUTINE dom_grid_crs
427   
428     
429   !!======================================================================
430
431END MODULE crs
432
Note: See TracBrowser for help on using the repository browser.