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.
agrif_user.F90 in branches/2013/dev_MERGE_2013/NEMOGCM/NEMO/NST_SRC – NEMO

source: branches/2013/dev_MERGE_2013/NEMOGCM/NEMO/NST_SRC/agrif_user.F90 @ 4331

Last change on this file since 4331 was 4331, checked in by davestorkey, 10 years ago

Remove references to OBC from agrif_user.F90 (ticket #1189).

  • Property svn:keywords set to Id
File size: 24.3 KB
Line 
1#if defined key_agrif
2!!----------------------------------------------------------------------
3!! NEMO/NST 3.4 , NEMO Consortium (2012)
4!! $Id$
5!! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
6!!----------------------------------------------------------------------
7SUBROUTINE agrif_user
8END SUBROUTINE agrif_user
9
10SUBROUTINE agrif_before_regridding
11END SUBROUTINE agrif_before_regridding
12
13SUBROUTINE Agrif_InitWorkspace
14   !!----------------------------------------------------------------------
15   !!                 *** ROUTINE Agrif_InitWorkspace ***
16   !!----------------------------------------------------------------------
17   USE par_oce
18   USE dom_oce
19   USE Agrif_Util
20   USE nemogcm
21   !
22   IMPLICIT NONE
23   !!----------------------------------------------------------------------
24   !
25   IF( .NOT. Agrif_Root() ) THEN
26      jpni = Agrif_Parent(jpni)
27      jpnj = Agrif_Parent(jpnj)
28      jpnij = Agrif_Parent(jpnij)
29      jpiglo  = nbcellsx + 2 + 2*nbghostcells
30      jpjglo  = nbcellsy + 2 + 2*nbghostcells
31      jpi     = ( jpiglo-2*jpreci + (jpni-1+0) ) / jpni + 2*jpreci
32      jpj     = ( jpjglo-2*jprecj + (jpnj-1+0) ) / jpnj + 2*jprecj
33      jpk     = jpkdta 
34      jpim1   = jpi-1 
35      jpjm1   = jpj-1 
36      jpkm1   = jpk-1                                         
37      jpij    = jpi*jpj 
38      jpidta  = jpiglo
39      jpjdta  = jpjglo
40      jpizoom = 1
41      jpjzoom = 1
42      nperio  = 0
43      jperio  = 0
44   ENDIF
45   !
46END SUBROUTINE Agrif_InitWorkspace
47
48
49SUBROUTINE Agrif_InitValues
50   !!----------------------------------------------------------------------
51   !!                 *** ROUTINE Agrif_InitValues ***
52   !!
53   !! ** Purpose :: Declaration of variables to be interpolated
54   !!----------------------------------------------------------------------
55   USE Agrif_Util
56   USE oce 
57   USE dom_oce
58   USE nemogcm
59   USE tradmp
60   USE bdy_par
61
62   IMPLICIT NONE
63   !!----------------------------------------------------------------------
64   ! 0. Initializations
65   !-------------------
66   IF( cp_cfg == 'orca' ) then
67      IF ( jp_cfg == 2 .OR. jp_cfg == 025 .OR. jp_cfg == 05 &
68  &                      .OR. jp_cfg == 4 ) THEN
69         jp_cfg = -1    ! set special value for jp_cfg on fine grids
70         cp_cfg = "default"
71      ENDIF
72   ENDIF
73   ! Specific fine grid Initializations
74   ! no tracer damping on fine grids
75   ln_tradmp = .FALSE.
76   ! no open boundary on fine grids
77   lk_bdy = .FALSE.
78
79
80   CALL nemo_init  ! Initializations of each fine grid
81
82   CALL agrif_nemo_init
83   CALL Agrif_InitValues_cont_dom
84# if ! defined key_offline
85   CALL Agrif_InitValues_cont
86# endif       
87# if defined key_top
88   CALL Agrif_InitValues_cont_top
89# endif     
90END SUBROUTINE Agrif_initvalues
91
92
93SUBROUTINE Agrif_InitValues_cont_dom
94   !!----------------------------------------------------------------------
95   !!                 *** ROUTINE Agrif_InitValues_cont ***
96   !!
97   !! ** Purpose ::   Declaration of variables to be interpolated
98   !!----------------------------------------------------------------------
99   USE Agrif_Util
100   USE oce 
101   USE dom_oce
102   USE nemogcm
103   USE sol_oce
104   USE in_out_manager
105   USE agrif_opa_update
106   USE agrif_opa_interp
107   USE agrif_opa_sponge
108   !
109   IMPLICIT NONE
110   !
111   !!----------------------------------------------------------------------
112
113   ! Declaration of the type of variable which have to be interpolated
114   !---------------------------------------------------------------------
115   CALL agrif_declare_var_dom
116   !
117END SUBROUTINE Agrif_InitValues_cont_dom
118
119
120SUBROUTINE agrif_declare_var_dom
121   !!----------------------------------------------------------------------
122   !!                 *** ROUTINE agrif_declarE_var ***
123   !!
124   !! ** Purpose :: Declaration of variables to be interpolated
125   !!----------------------------------------------------------------------
126   USE agrif_util
127   USE par_oce       !   ONLY : jpts
128   USE oce
129   IMPLICIT NONE
130   !!----------------------------------------------------------------------
131
132   ! 1. Declaration of the type of variable which have to be interpolated
133   !---------------------------------------------------------------------
134   CALL agrif_declare_variable((/1,2/),(/2,3/),(/'x','y'/),(/1,1/),(/jpi,jpj/),e1u_id)
135   CALL agrif_declare_variable((/2,1/),(/3,2/),(/'x','y'/),(/1,1/),(/jpi,jpj/),e2v_id)
136
137
138   ! 2. Type of interpolation
139   !-------------------------
140   Call Agrif_Set_bcinterp(e1u_id,interp1=Agrif_linear,interp2=AGRIF_ppm)
141   Call Agrif_Set_bcinterp(e2v_id,interp1=AGRIF_ppm,interp2=Agrif_linear)
142
143   ! 3. Location of interpolation
144   !-----------------------------
145   Call Agrif_Set_bc(e1u_id,(/0,0/))
146   Call Agrif_Set_bc(e2v_id,(/0,0/))
147
148   ! 5. Update type
149   !---------------
150   Call Agrif_Set_Updatetype(e1u_id,update1 = Agrif_Update_Copy, update2=Agrif_Update_Average)
151   Call Agrif_Set_Updatetype(e2v_id,update1 = Agrif_Update_Average, update2=Agrif_Update_Copy)
152
153END SUBROUTINE agrif_declare_var_dom
154
155
156# if ! defined key_offline
157
158SUBROUTINE Agrif_InitValues_cont
159   !!----------------------------------------------------------------------
160   !!                 *** ROUTINE Agrif_InitValues_cont ***
161   !!
162   !! ** Purpose ::   Declaration of variables to be interpolated
163   !!----------------------------------------------------------------------
164   USE Agrif_Util
165   USE oce 
166   USE dom_oce
167   USE nemogcm
168   USE sol_oce
169   USE in_out_manager
170   USE agrif_opa_update
171   USE agrif_opa_interp
172   USE agrif_opa_sponge
173   !
174   IMPLICIT NONE
175   !
176   REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE :: tabtstemp
177   REAL(wp), DIMENSION(:,:,:  ), ALLOCATABLE :: tabuvtemp
178   REAL(wp), DIMENSION(:,:    ), ALLOCATABLE :: tab2d
179   LOGICAL :: check_namelist
180   !!----------------------------------------------------------------------
181
182   ALLOCATE( tabtstemp(jpi, jpj, jpk, jpts) )
183   ALLOCATE( tabuvtemp(jpi, jpj, jpk)       )
184   ALLOCATE( tab2d(jpi, jpj)                )
185
186
187   ! 1. Declaration of the type of variable which have to be interpolated
188   !---------------------------------------------------------------------
189   CALL agrif_declare_var
190
191   ! 2. First interpolations of potentially non zero fields
192   !-------------------------------------------------------
193   Agrif_SpecialValue=0.
194   Agrif_UseSpecialValue = .TRUE.
195   Call Agrif_Bc_variable(tabtstemp,tsn_id,calledweight=1.,procname=interptsn)
196   Call Agrif_Bc_variable(tabtstemp,tsa_id,calledweight=1.,procname=interptsn)
197
198   Call Agrif_Bc_variable(tabuvtemp,un_id,calledweight=1.,procname=interpu)
199   Call Agrif_Bc_variable(tabuvtemp,vn_id,calledweight=1.,procname=interpv)
200   Call Agrif_Bc_variable(tabuvtemp,ua_id,calledweight=1.,procname=interpun)
201   Call Agrif_Bc_variable(tabuvtemp,va_id,calledweight=1.,procname=interpvn)
202
203   Call Agrif_Bc_variable(tab2d,unb_id,calledweight=1.,procname=interpunb)
204   Call Agrif_Bc_variable(tab2d,vnb_id,calledweight=1.,procname=interpvnb)
205   Call Agrif_Bc_variable(tab2d,sshn_id,calledweight=1.,procname=interpsshn)
206   Agrif_UseSpecialValue = .FALSE.
207
208   ! 3. Some controls
209   !-----------------
210   check_namelist = .true.
211
212   IF( check_namelist ) THEN
213
214      ! Check time steps           
215      IF( NINT(Agrif_Rhot()) * nint(rdt) /= Agrif_Parent(rdt) ) THEN
216         WRITE(*,*) 'incompatible time step between grids'
217         WRITE(*,*) 'parent grid value : ',Agrif_Parent(rdt)
218         WRITE(*,*) 'child  grid value : ',nint(rdt)
219         WRITE(*,*) 'value on parent grid should be : ',rdt*Agrif_Rhot()
220         STOP
221      ENDIF
222
223      ! Check run length
224      IF( Agrif_IRhot() * (Agrif_Parent(nitend)- &
225           Agrif_Parent(nit000)+1) .ne. (nitend-nit000+1) ) THEN
226         WRITE(*,*) 'incompatible run length between grids'
227         WRITE(*,*) 'parent grid value : ',(Agrif_Parent(nitend)- &
228              Agrif_Parent(nit000)+1),' time step'
229         WRITE(*,*) 'child  grid value : ', &
230              (nitend-nit000+1),' time step'
231         WRITE(*,*) 'value on child grid should be : ', &
232              Agrif_IRhot() * (Agrif_Parent(nitend)- &
233              Agrif_Parent(nit000)+1)
234         STOP
235      ENDIF
236
237      ! Check coordinates
238      IF( ln_zps ) THEN
239         ! check parameters for partial steps
240         IF( Agrif_Parent(e3zps_min) .ne. e3zps_min ) THEN
241            WRITE(*,*) 'incompatible e3zps_min between grids'
242            WRITE(*,*) 'parent grid :',Agrif_Parent(e3zps_min)
243            WRITE(*,*) 'child grid  :',e3zps_min
244            WRITE(*,*) 'those values should be identical'
245            STOP
246         ENDIF
247         IF( Agrif_Parent(e3zps_rat) /= e3zps_rat ) THEN
248            WRITE(*,*) 'incompatible e3zps_rat between grids'
249            WRITE(*,*) 'parent grid :',Agrif_Parent(e3zps_rat)
250            WRITE(*,*) 'child grid  :',e3zps_rat
251            WRITE(*,*) 'those values should be identical'                 
252            STOP
253         ENDIF
254      ENDIF
255   ENDIF
256
257   CALL Agrif_Update_tra(0)
258   CALL Agrif_Update_dyn(0)
259
260   nbcline = 0
261   !
262   DEALLOCATE(tabtstemp)
263   DEALLOCATE(tabuvtemp)
264   DEALLOCATE(tab2d)
265   !
266END SUBROUTINE Agrif_InitValues_cont
267
268
269SUBROUTINE agrif_declare_var
270   !!----------------------------------------------------------------------
271   !!                 *** ROUTINE agrif_declarE_var ***
272   !!
273   !! ** Purpose :: Declaration of variables to be interpolated
274   !!----------------------------------------------------------------------
275   USE agrif_util
276   USE par_oce       !   ONLY : jpts
277   USE oce
278   IMPLICIT NONE
279   !!----------------------------------------------------------------------
280
281   ! 1. Declaration of the type of variable which have to be interpolated
282   !---------------------------------------------------------------------
283   CALL agrif_declare_variable((/2,2,0,0/),(/3,3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,jpts/),tsn_id)
284   CALL agrif_declare_variable((/2,2,0,0/),(/3,3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,jpts/),tsa_id)
285   CALL agrif_declare_variable((/2,2,0,0/),(/3,3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,jpts/),tsb_id)
286
287   CALL agrif_declare_variable((/1,2,0/),(/2,3,0/),(/'x','y','N'/),(/1,1,1/),(/jpi,jpj,jpk/),un_id)
288   CALL agrif_declare_variable((/2,1,0/),(/3,2,0/),(/'x','y','N'/),(/1,1,1/),(/jpi,jpj,jpk/),vn_id)
289   CALL agrif_declare_variable((/1,2,0/),(/2,3,0/),(/'x','y','N'/),(/1,1,1/),(/jpi,jpj,jpk/),ua_id)
290   CALL agrif_declare_variable((/2,1,0/),(/3,2,0/),(/'x','y','N'/),(/1,1,1/),(/jpi,jpj,jpk/),va_id)
291
292   CALL agrif_declare_variable((/1,2/),(/2,3/),(/'x','y'/),(/1,1/),(/jpi,jpj/),unb_id)
293   CALL agrif_declare_variable((/2,1/),(/3,2/),(/'x','y'/),(/1,1/),(/jpi,jpj/),vnb_id)
294   CALL agrif_declare_variable((/2,2/),(/3,3/),(/'x','y'/),(/1,1/),(/jpi,jpj/),sshn_id)
295   CALL agrif_declare_variable((/2,2/),(/3,3/),(/'x','y'/),(/1,1/),(/jpi,jpj/),gcb_id)
296
297   ! 2. Type of interpolation
298   !-------------------------
299   CALL Agrif_Set_bcinterp(tsn_id,interp=AGRIF_linear)
300   CALL Agrif_Set_bcinterp(tsa_id,interp=AGRIF_linear)
301
302   Call Agrif_Set_bcinterp(un_id,interp1=Agrif_linear,interp2=AGRIF_ppm)
303   Call Agrif_Set_bcinterp(vn_id,interp1=AGRIF_ppm,interp2=Agrif_linear)
304
305   Call Agrif_Set_bcinterp(ua_id,interp1=Agrif_linear,interp2=AGRIF_ppm)
306   Call Agrif_Set_bcinterp(va_id,interp1=AGRIF_ppm,interp2=Agrif_linear)
307
308   CALL Agrif_Set_bcinterp(sshn_id,interp=AGRIF_linear)
309   Call Agrif_Set_bcinterp(unb_id,interp1=Agrif_linear,interp2=AGRIF_ppm)
310   Call Agrif_Set_bcinterp(vnb_id,interp1=AGRIF_ppm,interp2=Agrif_linear)
311
312   ! 3. Location of interpolation
313   !-----------------------------
314   Call Agrif_Set_bc(un_id,(/0,1/))
315   Call Agrif_Set_bc(vn_id,(/0,1/))
316
317   Call Agrif_Set_bc(sshn_id,(/0,1/))
318   Call Agrif_Set_bc(unb_id,(/0,1/))
319   Call Agrif_Set_bc(vnb_id,(/0,1/))
320
321   Call Agrif_Set_bc(tsn_id,(/0,1/))
322   Call Agrif_Set_bc(tsa_id,(/-3*Agrif_irhox(),0/))
323
324   Call Agrif_Set_bc(ua_id,(/-2*Agrif_irhox(),0/))
325   Call Agrif_Set_bc(va_id,(/-2*Agrif_irhox(),0/))
326
327   ! 5. Update type
328   !---------------
329   Call Agrif_Set_Updatetype(tsn_id, update = AGRIF_Update_Average)
330   Call Agrif_Set_Updatetype(tsb_id, update = AGRIF_Update_Average)
331
332   Call Agrif_Set_Updatetype(sshn_id, update = AGRIF_Update_Average)
333   Call Agrif_Set_Updatetype(gcb_id,update = AGRIF_Update_Average)
334
335   Call Agrif_Set_Updatetype(un_id,update1 = Agrif_Update_Copy, update2 = Agrif_Update_Average)
336   Call Agrif_Set_Updatetype(vn_id,update1 = Agrif_Update_Average, update2 = Agrif_Update_Copy)
337
338END SUBROUTINE agrif_declare_var
339# endif
340
341#  if defined key_lim2
342SUBROUTINE Agrif_InitValues_cont_lim2
343   !!----------------------------------------------------------------------
344   !!                 *** ROUTINE Agrif_InitValues_cont_lim2 ***
345   !!
346   !! ** Purpose :: Initialisation of variables to be interpolated for LIM2
347   !!----------------------------------------------------------------------
348   USE Agrif_Util
349   USE ice_2
350   USE agrif_ice
351   USE in_out_manager
352   USE agrif_lim2_update
353   USE agrif_lim2_interp
354   USE lib_mpp
355   !
356   IMPLICIT NONE
357   !
358   REAL(wp), DIMENSION(:,:)  , ALLOCATABLE :: zvel
359   REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: zadv
360   !!----------------------------------------------------------------------
361
362   ALLOCATE( zvel(jpi,jpj), zadv(jpi,jpj,7))
363
364   ! 1. Declaration of the type of variable which have to be interpolated
365   !---------------------------------------------------------------------
366   CALL agrif_declare_var_lim2
367
368   ! 2. First interpolations of potentially non zero fields
369   !-------------------------------------------------------
370   Agrif_SpecialValue=-9999.
371   Agrif_UseSpecialValue = .TRUE.
372   !     Call Agrif_Bc_variable(zadv ,adv_ice_id ,calledweight=1.,procname=interp_adv_ice )
373   !     Call Agrif_Bc_variable(zvel ,u_ice_id   ,calledweight=1.,procname=interp_u_ice   )
374   !     Call Agrif_Bc_variable(zvel ,v_ice_id   ,calledweight=1.,procname=interp_v_ice   )
375   Agrif_SpecialValue=0.
376   Agrif_UseSpecialValue = .FALSE.
377
378   ! 3. Some controls
379   !-----------------
380
381#   if ! defined key_lim2_vp
382   lim_nbstep = 1.
383   CALL agrif_rhg_lim2_load
384   CALL agrif_trp_lim2_load
385   lim_nbstep = 0.
386#   endif
387   !RB mandatory but why ???
388   !      IF( nbclineupdate /= nn_fsbc .AND. nn_ice == 2 )THEN
389   !         CALL ctl_warn ('With ice model on child grid, nbclineupdate is set to nn_fsbc')
390   !         nbclineupdate = nn_fsbc
391   !       ENDIF
392   CALL Agrif_Update_lim2(0)
393   !
394   DEALLOCATE( zvel, zadv )
395   !
396END SUBROUTINE Agrif_InitValues_cont_lim2
397
398SUBROUTINE agrif_declare_var_lim2
399   !!----------------------------------------------------------------------
400   !!                 *** ROUTINE agrif_declare_var_lim2 ***
401   !!
402   !! ** Purpose :: Declaration of variables to be interpolated for LIM2
403   !!----------------------------------------------------------------------
404   USE agrif_util
405   USE ice_2
406
407   IMPLICIT NONE
408   !!----------------------------------------------------------------------
409
410   ! 1. Declaration of the type of variable which have to be interpolated
411   !---------------------------------------------------------------------
412   CALL agrif_declare_variable((/2,2,0/),(/3,3,0/),(/'x','y','N'/),(/1,1,1/),(/jpi,jpj, 7/),adv_ice_id )
413#   if defined key_lim2_vp
414   CALL agrif_declare_variable((/1,1/),(/3,3/),(/'x','y'/),(/1,1/),(/jpi,jpj/),u_ice_id)
415   CALL agrif_declare_variable((/1,1/),(/3,3/),(/'x','y'/),(/1,1/),(/jpi,jpj/),v_ice_id)
416#   else
417   CALL agrif_declare_variable((/1,2/),(/2,3/),(/'x','y'/),(/1,1/),(/jpi,jpj/),u_ice_id)
418   CALL agrif_declare_variable((/2,1/),(/3,2/),(/'x','y'/),(/1,1/),(/jpi,jpj/),v_ice_id)
419#   endif
420
421   ! 2. Type of interpolation
422   !-------------------------
423   CALL Agrif_Set_bcinterp(adv_ice_id ,interp=AGRIF_linear)
424   Call Agrif_Set_bcinterp(u_ice_id,interp1=Agrif_linear,interp2=AGRIF_ppm)
425   Call Agrif_Set_bcinterp(v_ice_id,interp1=AGRIF_ppm,interp2=Agrif_linear)
426
427   ! 3. Location of interpolation
428   !-----------------------------
429   Call Agrif_Set_bc(adv_ice_id ,(/0,1/))
430   Call Agrif_Set_bc(u_ice_id,(/0,1/))
431   Call Agrif_Set_bc(v_ice_id,(/0,1/))
432
433   ! 5. Update type
434   !---------------
435   Call Agrif_Set_Updatetype(adv_ice_id , update = AGRIF_Update_Average)
436   Call Agrif_Set_Updatetype(u_ice_id,update1 = Agrif_Update_Copy, update2 = Agrif_Update_Average)
437   Call Agrif_Set_Updatetype(v_ice_id,update1 = Agrif_Update_Average, update2 = Agrif_Update_Copy)
438
439END SUBROUTINE agrif_declare_var_lim2
440#  endif
441
442
443# if defined key_top
444SUBROUTINE Agrif_InitValues_cont_top
445   !!----------------------------------------------------------------------
446   !!                 *** ROUTINE Agrif_InitValues_cont_top ***
447   !!
448   !! ** Purpose :: Declaration of variables to be interpolated
449   !!----------------------------------------------------------------------
450   USE Agrif_Util
451   USE oce 
452   USE dom_oce
453   USE nemogcm
454   USE par_trc
455   USE trc
456   USE in_out_manager
457   USE agrif_top_update
458   USE agrif_top_interp
459   USE agrif_top_sponge
460   !
461   IMPLICIT NONE
462   !
463   REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE :: tabtrtemp
464   LOGICAL :: check_namelist
465   !!----------------------------------------------------------------------
466
467   ALLOCATE( tabtrtemp(jpi,jpj,jpk,jptra) )
468
469
470   ! 1. Declaration of the type of variable which have to be interpolated
471   !---------------------------------------------------------------------
472   CALL agrif_declare_var_top
473
474   ! 2. First interpolations of potentially non zero fields
475   !-------------------------------------------------------
476   Agrif_SpecialValue=0.
477   Agrif_UseSpecialValue = .TRUE.
478   Call Agrif_Bc_variable(tabtrtemp,trn_id,calledweight=1.,procname=interptrn)
479   Call Agrif_Bc_variable(tabtrtemp,tra_id,calledweight=1.,procname=interptrn)
480   Agrif_UseSpecialValue = .FALSE.
481
482   ! 3. Some controls
483   !-----------------
484   check_namelist = .true.
485
486   IF( check_namelist ) THEN
487#  if defined offline     
488      ! Check time steps
489      IF( nint(Agrif_Rhot()) * nint(rdt) .ne. Agrif_Parent(rdt) ) THEN
490         WRITE(*,*) 'incompatible time step between grids'
491         WRITE(*,*) 'parent grid value : ',Agrif_Parent(rdt)
492         WRITE(*,*) 'child  grid value : ',nint(rdt)
493         WRITE(*,*) 'value on parent grid should be : ',rdt*Agrif_Rhot()
494         STOP
495      ENDIF
496
497      ! Check run length
498      IF( Agrif_IRhot() * (Agrif_Parent(nitend)- &
499           Agrif_Parent(nit000)+1) .ne. (nitend-nit000+1) ) THEN
500         WRITE(*,*) 'incompatible run length between grids'
501         WRITE(*,*) 'parent grid value : ',(Agrif_Parent(nitend)- &
502              Agrif_Parent(nit000)+1),' time step'
503         WRITE(*,*) 'child  grid value : ', &
504              (nitend-nit000+1),' time step'
505         WRITE(*,*) 'value on child grid should be : ', &
506              Agrif_IRhot() * (Agrif_Parent(nitend)- &
507              Agrif_Parent(nit000)+1)
508         STOP
509      ENDIF
510
511      ! Check coordinates
512      IF( ln_zps ) THEN
513         ! check parameters for partial steps
514         IF( Agrif_Parent(e3zps_min) .ne. e3zps_min ) THEN
515            WRITE(*,*) 'incompatible e3zps_min between grids'
516            WRITE(*,*) 'parent grid :',Agrif_Parent(e3zps_min)
517            WRITE(*,*) 'child grid  :',e3zps_min
518            WRITE(*,*) 'those values should be identical'
519            STOP
520         ENDIF
521         IF( Agrif_Parent(e3zps_rat) .ne. e3zps_rat ) THEN
522            WRITE(*,*) 'incompatible e3zps_rat between grids'
523            WRITE(*,*) 'parent grid :',Agrif_Parent(e3zps_rat)
524            WRITE(*,*) 'child grid  :',e3zps_rat
525            WRITE(*,*) 'those values should be identical'                 
526            STOP
527         ENDIF
528      ENDIF
529#  endif         
530      ! Check passive tracer cell
531      IF( nn_dttrc .ne. 1 ) THEN
532         WRITE(*,*) 'nn_dttrc should be equal to 1'
533      ENDIF
534   ENDIF
535
536!ch   CALL Agrif_Update_trc(0)
537   nbcline_trc = 0
538   !
539   DEALLOCATE(tabtrtemp)
540   !
541END SUBROUTINE Agrif_InitValues_cont_top
542
543
544SUBROUTINE agrif_declare_var_top
545   !!----------------------------------------------------------------------
546   !!                 *** ROUTINE agrif_declare_var_top ***
547   !!
548   !! ** Purpose :: Declaration of TOP variables to be interpolated
549   !!----------------------------------------------------------------------
550   USE agrif_util
551   USE dom_oce
552   USE trc
553
554   IMPLICIT NONE
555
556   ! 1. Declaration of the type of variable which have to be interpolated
557   !---------------------------------------------------------------------
558   CALL agrif_declare_variable((/2,2,0,0/),(/3,3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,jptra/),trn_id)
559   CALL agrif_declare_variable((/2,2,0,0/),(/3,3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,jptra/),trb_id)
560   CALL agrif_declare_variable((/2,2,0,0/),(/3,3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/jpi,jpj,jpk,jptra/),tra_id)
561
562   ! 2. Type of interpolation
563   !-------------------------
564   CALL Agrif_Set_bcinterp(trn_id,interp=AGRIF_linear)
565   CALL Agrif_Set_bcinterp(tra_id,interp=AGRIF_linear)
566
567   ! 3. Location of interpolation
568   !-----------------------------
569   Call Agrif_Set_bc(trn_id,(/0,1/))
570   Call Agrif_Set_bc(tra_id,(/-3*Agrif_irhox(),0/))
571
572   ! 5. Update type
573   !---------------
574   Call Agrif_Set_Updatetype(trn_id, update = AGRIF_Update_Average)
575   Call Agrif_Set_Updatetype(trb_id, update = AGRIF_Update_Average)
576
577
578END SUBROUTINE agrif_declare_var_top
579# endif
580
581SUBROUTINE Agrif_detect( kg, ksizex )
582   !!----------------------------------------------------------------------
583   !!   *** ROUTINE Agrif_detect ***
584   !!----------------------------------------------------------------------
585   USE Agrif_Types
586   !
587   INTEGER, DIMENSION(2) :: ksizex
588   INTEGER, DIMENSION(ksizex(1),ksizex(2)) :: kg 
589   !!----------------------------------------------------------------------
590   !
591   RETURN
592   !
593END SUBROUTINE Agrif_detect
594
595
596SUBROUTINE agrif_nemo_init
597   !!----------------------------------------------------------------------
598   !!                     *** ROUTINE agrif_init ***
599   !!----------------------------------------------------------------------
600   USE agrif_oce 
601   USE agrif_ice
602   USE in_out_manager
603   USE lib_mpp
604   IMPLICIT NONE
605   !
606   INTEGER  ::   ios                 ! Local integer output status for namelist read
607   NAMELIST/namagrif/ nn_cln_update, rn_sponge_tra, rn_sponge_dyn, ln_spc_dyn
608   !!----------------------------------------------------------------------
609   !
610      REWIND( numnam_ref )              ! Namelist namagrif in reference namelist : AGRIF zoom
611      READ  ( numnam_ref, namagrif, IOSTAT = ios, ERR = 901)
612901   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namagrif in reference namelist', lwp )
613
614      REWIND( numnam_cfg )              ! Namelist namagrif in configuration namelist : AGRIF zoom
615      READ  ( numnam_cfg, namagrif, IOSTAT = ios, ERR = 902 )
616902   IF( ios /= 0 ) CALL ctl_nam ( ios , 'namagrif in configuration namelist', lwp )
617      WRITE ( numond, namagrif )
618   !
619   IF(lwp) THEN                    ! control print
620      WRITE(numout,*)
621      WRITE(numout,*) 'agrif_nemo_init : AGRIF parameters'
622      WRITE(numout,*) '~~~~~~~~~~~~~~~'
623      WRITE(numout,*) '   Namelist namagrif : set AGRIF parameters'
624      WRITE(numout,*) '      baroclinic update frequency       nn_cln_update = ', nn_cln_update
625      WRITE(numout,*) '      sponge coefficient for tracers    rn_sponge_tra = ', rn_sponge_tra, ' s'
626      WRITE(numout,*) '      sponge coefficient for dynamics   rn_sponge_tra = ', rn_sponge_dyn, ' s'
627      WRITE(numout,*) '      use special values for dynamics   ln_spc_dyn    = ', ln_spc_dyn
628      WRITE(numout,*) 
629   ENDIF
630   !
631   ! convert DOCTOR namelist name into OLD names
632   nbclineupdate = nn_cln_update
633   visc_tra      = rn_sponge_tra
634   visc_dyn      = rn_sponge_dyn
635   !
636   IF( agrif_oce_alloc()  > 0 )   CALL ctl_warn('agrif sol_oce_alloc: allocation of arrays failed')
637# if defined key_lim2
638   IF( agrif_ice_alloc()  > 0 )   CALL ctl_stop('agrif agrif_ice_alloc: allocation of arrays failed')
639# endif
640   !
641END SUBROUTINE agrif_nemo_init
642
643# if defined key_mpp_mpi
644
645SUBROUTINE Agrif_InvLoc( indloc, nprocloc, i, indglob )
646   !!----------------------------------------------------------------------
647   !!                     *** ROUTINE Agrif_detect ***
648   !!----------------------------------------------------------------------
649   USE dom_oce
650   IMPLICIT NONE
651   !
652   INTEGER :: indglob, indloc, nprocloc, i
653   !!----------------------------------------------------------------------
654   !
655   SELECT CASE( i )
656   CASE(1)   ;   indglob = indloc + nimppt(nprocloc+1) - 1
657   CASE(2)   ;   indglob = indloc + njmppt(nprocloc+1) - 1 
658   CASE(3)   ;   indglob = indloc
659   CASE(4)   ;   indglob = indloc
660   END SELECT
661   !
662END SUBROUTINE Agrif_InvLoc
663
664# endif
665
666#else
667SUBROUTINE Subcalledbyagrif
668   !!----------------------------------------------------------------------
669   !!                   *** ROUTINE Subcalledbyagrif ***
670   !!----------------------------------------------------------------------
671   WRITE(*,*) 'Impossible to be here'
672END SUBROUTINE Subcalledbyagrif
673#endif
Note: See TracBrowser for help on using the repository browser.