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.
nemogcm.F90 in NEMO/branches/2019/dev_r11514_HPC-02_single-core-extrahalo/src/SAS – NEMO

source: NEMO/branches/2019/dev_r11514_HPC-02_single-core-extrahalo/src/SAS/nemogcm.F90 @ 11719

Last change on this file since 11719 was 11719, checked in by francesca, 5 years ago

add extra halo support- ticket #2009

  • Property svn:keywords set to Id
File size: 27.7 KB
Line 
1MODULE nemogcm
2   !!======================================================================
3   !!                       ***  MODULE nemogcm   ***
4   !! StandAlone Surface module : surface fluxes + sea-ice + iceberg floats
5   !!======================================================================
6   !! History :  3.6  ! 2011-11  (S. Alderson, G. Madec) original code
7   !!             -   ! 2013-06  (I. Epicoco, S. Mocavero, CMCC) nemo_northcomms: setup avoiding MPI communication
8   !!             -   ! 2014-12  (G. Madec) remove KPP scheme and cross-land advection (cla)
9   !!            4.0  ! 2016-10  (G. Madec, S. Flavoni)  domain configuration / user defined interface
10   !!----------------------------------------------------------------------
11
12   !!----------------------------------------------------------------------
13   !!   nemo_gcm      : solve ocean dynamics, tracer, biogeochemistry and/or sea-ice
14   !!   nemo_init     : initialization of the NEMO system
15   !!   nemo_ctl      : initialisation of the contol print
16   !!   nemo_closefile: close remaining open files
17   !!   nemo_alloc    : dynamical allocation
18   !!----------------------------------------------------------------------
19   USE step_oce       ! module used in the ocean time stepping module
20   USE sbc_oce        ! surface boundary condition: ocean
21   USE phycst         ! physical constant                  (par_cst routine)
22   USE domain         ! domain initialization   (dom_init & dom_cfg routines)
23   USE closea         ! treatment of closed seas (for ln_closea)
24   USE usrdef_nam     ! user defined configuration
25   USE daymod         ! calendar
26   USE restart        ! open  restart file
27   USE step           ! NEMO time-stepping                 (stp     routine)
28   USE cpl_oasis3     !
29   USE sbcssm         !
30   USE icbini         ! handle bergs, initialisation
31   USE icbstp         ! handle bergs, calving, themodynamics and transport
32   USE bdyini         ! open boundary cond. setting       (bdy_init routine). mandatory for sea-ice
33   USE bdydta         ! open boundary cond. setting   (bdy_dta_init routine). mandatory for sea-ice
34   !
35   USE lib_mpp        ! distributed memory computing
36   USE mppini         ! shared/distributed memory setting (mpp_init routine)
37   USE lbcnfd  , ONLY : isendto, nsndto  ! Setup of north fold exchanges
38   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)
39#if defined key_iomput
40   USE xios           ! xIOserver
41#endif
42#if defined key_agrif && defined key_si3
43   USE agrif_ice_update ! ice update
44#endif
45   USE halo_mng
46
47   IMPLICIT NONE
48   PRIVATE
49
50   PUBLIC   nemo_gcm    ! called by model.F90
51   PUBLIC   nemo_init   ! needed by AGRIF
52
53   CHARACTER(lc) ::   cform_aaa="( /, 'AAAAAAAA', / ) "     ! flag for output listing
54
55   !!----------------------------------------------------------------------
56   !! NEMO/SAS 4.0 , NEMO Consortium (2018)
57   !! $Id$
58   !! Software governed by the CeCILL license (see ./LICENSE)
59   !!----------------------------------------------------------------------
60CONTAINS
61
62   SUBROUTINE nemo_gcm
63      !!----------------------------------------------------------------------
64      !!                     ***  ROUTINE nemo_gcm  ***
65      !!
66      !! ** Purpose :   NEMO solves the primitive equations on an orthogonal
67      !!              curvilinear mesh on the sphere.
68      !!
69      !! ** Method  : - model general initialization
70      !!              - launch the time-stepping (stp routine)
71      !!              - finalize the run by closing files and communications
72      !!
73      !! References : Madec, Delecluse, Imbard, and Levy, 1997:  internal report, IPSL.
74      !!              Madec, 2008, internal report, IPSL.
75      !!----------------------------------------------------------------------
76      INTEGER ::   istp   ! time step index
77      !!----------------------------------------------------------------------
78      !
79#if defined key_agrif
80      CALL Agrif_Init_Grids()      ! AGRIF: set the meshes
81#endif
82      !                            !-----------------------!
83      CALL nemo_init               !==  Initialisations  ==!
84      !                            !-----------------------!
85#if defined key_agrif
86      CALL Agrif_Declare_Var_dom   ! AGRIF: set the meshes for DOM
87      CALL Agrif_Declare_Var       !  "      "   "   "      "  DYN/TRA
88# if defined key_top
89      CALL Agrif_Declare_Var_top   !  "      "   "   "      "  TOP
90# endif
91# if defined key_si3
92      CALL Agrif_Declare_Var_ice   !  "      "   "   "      "  Sea ice
93# endif
94#endif
95      ! check that all process are still there... If some process have an error,
96      ! they will never enter in step and other processes will wait until the end of the cpu time!
97      CALL mpp_max( 'nemogcm', nstop )
98
99      IF(lwp) WRITE(numout,cform_aaa)   ! Flag AAAAAAA
100
101      !                            !-----------------------!
102      !                            !==   time stepping   ==!
103      !                            !-----------------------!
104      istp = nit000
105      !
106#if defined key_agrif
107      !                                               !==  AGRIF time-stepping  ==!
108      CALL Agrif_Regrid()
109      !
110#if defined key_si3
111      ! Recursive update from highest nested level to lowest:
112      CALL Agrif_step_child_adj(Agrif_update_ice)
113#endif
114      !
115      DO WHILE( istp <= nitend .AND. nstop == 0 )
116         CALL stp
117         istp = istp + 1
118      END DO
119      !
120      IF( .NOT. Agrif_Root() ) THEN
121         CALL Agrif_ParentGrid_To_ChildGrid()
122         IF( ln_timing )   CALL timing_finalize
123         CALL Agrif_ChildGrid_To_ParentGrid()
124      ENDIF
125      !
126#else
127      !
128      IF( .NOT.ln_diurnal_only ) THEN                 !==  Standard time-stepping  ==!
129         !
130         DO WHILE( istp <= nitend .AND. nstop == 0 )
131            CALL stp        ( istp ) 
132            istp = istp + 1
133         END DO
134         !
135      ELSE                                            !==  diurnal SST time-steeping only  ==!
136         !
137         DO WHILE( istp <= nitend .AND. nstop == 0 )
138            CALL stp_diurnal( istp )   ! time step only the diurnal SST
139            istp = istp + 1
140         END DO
141         !
142      ENDIF
143      !
144#endif
145      !
146      IF( ln_icebergs )   CALL icb_end( nitend )
147
148      !                            !------------------------!
149      !                            !==  finalize the run  ==!
150      !                            !------------------------!
151      IF(lwp) WRITE(numout,cform_aaa)        ! Flag AAAAAAA
152      !
153      IF( nstop /= 0 .AND. lwp ) THEN        ! error print
154         WRITE(ctmp1,*) '   ==>>>   nemo_gcm: a total of ', nstop, ' errors have been found'
155         CALL ctl_stop( ctmp1 )
156      ENDIF
157      !
158      IF( ln_timing )   CALL timing_finalize
159      !
160      CALL nemo_closefile
161      !
162#if defined key_iomput
163                                    CALL xios_finalize  ! end mpp communications with xios
164      IF( lk_oasis     )            CALL cpl_finalize   ! end coupling and mpp communications with OASIS
165#else
166      IF    ( lk_oasis ) THEN   ;   CALL cpl_finalize   ! end coupling and mpp communications with OASIS
167      ELSEIF( lk_mpp   ) THEN   ;   CALL mppstop        ! end mpp communications
168      ENDIF
169#endif
170      !
171      IF(lwm) THEN
172         IF( nstop == 0 ) THEN   ;   STOP 0
173         ELSE                    ;   STOP 123
174         ENDIF
175      ENDIF
176      !
177   END SUBROUTINE nemo_gcm
178
179
180   SUBROUTINE nemo_init
181      !!----------------------------------------------------------------------
182      !!                     ***  ROUTINE nemo_init  ***
183      !!
184      !! ** Purpose :   initialization of the NEMO GCM
185      !!----------------------------------------------------------------------
186      INTEGER ::   ios, ilocal_comm   ! local integers
187      !!
188      NAMELIST/namctl/ ln_ctl   , sn_cfctl, nn_print, nn_ictls, nn_ictle,   &
189         &             nn_isplt , nn_jsplt, nn_jctls, nn_jctle,             &
190         &             ln_timing, ln_diacfl
191      NAMELIST/namcfg/ ln_read_cfg, cn_domcfg, ln_closea, ln_write_cfg, cn_domcfg_out, ln_use_jattr
192      !!----------------------------------------------------------------------
193      !
194      IF( lk_oasis ) THEN   ;   cxios_context = 'sas'
195      ELSE                  ;   cxios_context = 'nemo'
196      ENDIF
197      nn_hls = 1
198      !
199      !                             !-------------------------------------------------!
200      !                             !     set communicator & select the local rank    !
201      !                             !  must be done as soon as possible to get narea  !
202      !                             !-------------------------------------------------!
203      !
204#if defined key_iomput
205      IF( Agrif_Root() ) THEN
206         IF( lk_oasis ) THEN
207            CALL cpl_init( "sas", ilocal_comm )                                  ! nemo local communicator given by oasis
208            CALL xios_initialize( "not used",local_comm=ilocal_comm )            ! send nemo communicator to xios
209         ELSE
210            CALL xios_initialize( "for_xios_mpi_id",return_comm=ilocal_comm )    ! nemo local communicator given by xios
211         ENDIF
212      ENDIF
213      CALL mpp_start( ilocal_comm )
214#else
215      IF( lk_oasis ) THEN
216         IF( Agrif_Root() ) THEN
217            CALL cpl_init( "sas", ilocal_comm )             ! nemo local communicator given by oasis
218         ENDIF
219         CALL mpp_start( ilocal_comm )
220      ELSE
221         CALL mpp_start( )
222      ENDIF
223#endif
224      !
225      narea = mpprank + 1                                   ! mpprank: the rank of proc (0 --> mppsize -1 )
226      lwm = (narea == 1)                ! control of output namelists
227      !
228      !                             !---------------------------------------------------------------!
229      !                             ! Open output files, reference and configuration namelist files !
230      !                             !---------------------------------------------------------------!
231      !
232      ! open ocean.output as soon as possible to get all output prints (including errors messages)
233      IF( lk_oasis ) THEN
234         IF( lwm )   CALL ctl_opn(     numout,              'sas.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
235         ! open reference and configuration namelist files
236                     CALL ctl_opn( numnam_ref,        'namelist_sas_ref',     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
237                     CALL ctl_opn( numnam_cfg,        'namelist_sas_cfg',     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
238         IF( lwm )   CALL ctl_opn(     numond, 'output.namelist_sas.dyn', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
239      ELSE
240         IF( lwm )   CALL ctl_opn(     numout,            'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
241         ! open reference and configuration namelist files
242                     CALL ctl_opn( numnam_ref,            'namelist_ref',     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
243                     CALL ctl_opn( numnam_cfg,            'namelist_cfg',     'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
244         IF( lwm )   CALL ctl_opn(     numond,     'output.namelist.dyn', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
245      ENDIF
246      ! open /dev/null file to be able to supress output write easily
247                     CALL ctl_opn(     numnul,               '/dev/null', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. )
248      !
249      !                             !--------------------!
250      !                             ! Open listing units !  -> need ln_ctl from namctl to define lwp
251      !                             !--------------------!
252      !
253      REWIND( numnam_ref )              ! Namelist namctl in reference namelist
254      READ  ( numnam_ref, namctl, IOSTAT = ios, ERR = 901 )
255901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namctl in reference namelist' )
256      REWIND( numnam_cfg )              ! Namelist namctl in confguration namelist
257      READ  ( numnam_cfg, namctl, IOSTAT = ios, ERR = 902 )
258902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namctl in configuration namelist' )
259      !
260      lwp = (narea == 1) .OR. ln_ctl    ! control of all listing output print
261      !
262      IF(lwp) THEN                      ! open listing units
263         !
264         IF( .NOT. lwm ) THEN           ! alreay opened for narea == 1
265            IF(lk_oasis) THEN   ;   CALL ctl_opn( numout,   'sas.output','REPLACE','FORMATTED','SEQUENTIAL',-1,-1, .FALSE., narea )
266            ELSE                ;   CALL ctl_opn( numout, 'ocean.output','REPLACE','FORMATTED','SEQUENTIAL',-1,-1, .FALSE., narea )
267            ENDIF
268         ENDIF
269         !
270         WRITE(numout,*)
271         WRITE(numout,*) '   CNRS - NERC - Met OFFICE - MERCATOR-ocean - CMCC'
272         WRITE(numout,*) '                       NEMO team'
273         WRITE(numout,*) '            Ocean General Circulation Model'
274         WRITE(numout,*) '                NEMO version 4.0  (2019) '
275         WRITE(numout,*) '             StandAlone Surface version (SAS) '
276         WRITE(numout,*) "           ._      ._      ._      ._      ._    "
277         WRITE(numout,*) "       _.-._)`\_.-._)`\_.-._)`\_.-._)`\_.-._)`\_ "
278         WRITE(numout,*)
279         WRITE(numout,*) "           o         _,           _,             "
280         WRITE(numout,*) "            o      .' (        .-' /             "
281         WRITE(numout,*) "           o     _/..._'.    .'   /              "
282         WRITE(numout,*) "      (    o .-'`      ` '-./  _.'               "
283         WRITE(numout,*) "       )    ( o)           ;= <_         (       "
284         WRITE(numout,*) "      (      '-.,\\__ __.-;`\   '.        )      "
285         WRITE(numout,*) "       )  )       \) |`\ \)  '.   \      (   (   "
286         WRITE(numout,*) "      (  (           \_/       '-._\      )   )  "
287         WRITE(numout,*) "       )  ) jgs                    `     (   (   "
288         WRITE(numout,*) "     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ "
289         WRITE(numout,*)
290         WRITE(numout,*)
291         !
292         WRITE(numout,cform_aaa)                                        ! Flag AAAAAAA
293         !
294      ENDIF
295     !
296      ! finalize the definition of namctl variables
297      IF( sn_cfctl%l_config ) THEN
298         ! Activate finer control of report outputs
299         ! optionally switch off output from selected areas (note this only
300         ! applies to output which does not involve global communications)
301         IF( ( narea < sn_cfctl%procmin .OR. narea > sn_cfctl%procmax  ) .OR. &
302           & ( MOD( narea - sn_cfctl%procmin, sn_cfctl%procincr ) /= 0 ) )    &
303           &   CALL nemo_set_cfctl( sn_cfctl, .FALSE., .FALSE. )
304      ELSE
305         ! Use ln_ctl to turn on or off all options.
306         CALL nemo_set_cfctl( sn_cfctl, ln_ctl, .TRUE. )
307      ENDIF
308      !
309      IF(lwm) WRITE( numond, namctl )
310      !
311      !                             !------------------------------------!
312      !                             !  Set global domain size parameters !
313      !                             !------------------------------------!
314      !
315      REWIND( numnam_ref )              ! Namelist namcfg in reference namelist
316      READ  ( numnam_ref, namcfg, IOSTAT = ios, ERR = 903 )
317903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namcfg in reference namelist' )
318      REWIND( numnam_cfg )              ! Namelist namcfg in confguration namelist
319      READ  ( numnam_cfg, namcfg, IOSTAT = ios, ERR = 904 )
320904   IF( ios >  0 )   CALL ctl_nam ( ios , 'namcfg in configuration namelist' )   
321      !
322      IF( ln_read_cfg ) THEN            ! Read sizes in domain configuration file
323         CALL domain_cfg ( cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio )
324      ELSE                              ! user-defined namelist
325         CALL usr_def_nam( cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio )
326      ENDIF
327      !
328      IF(lwm)   WRITE( numond, namcfg )
329      !
330      !                             !-----------------------------------------!
331      !                             ! mpp parameters and domain decomposition !
332      !                             !-----------------------------------------!
333      CALL mpp_init
334
335      CALL halo_mng_init()
336      ! Now we know the dimensions of the grid and numout has been set: we can allocate arrays
337      CALL nemo_alloc()
338
339      !                             !-------------------------------!
340      !                             !  NEMO general initialization  !
341      !                             !-------------------------------!
342
343      CALL nemo_ctl                          ! Control prints
344      !
345      !                                      ! General initialization
346      IF( ln_timing    )   CALL timing_init     ! timing
347      IF( ln_timing    )   CALL timing_start( 'nemo_init')
348
349                           CALL phy_cst         ! Physical constants
350                           CALL eos_init        ! Equation of seawater
351                           CALL dom_init('SAS') ! Domain
352      IF( ln_ctl      )    CALL prt_ctl_init    ! Print control
353     
354                           CALL day_init        ! model calendar (using both namelist and restart infos)
355      IF( ln_rstart )      CALL rst_read_open
356
357      !                                      ! external forcing
358                           CALL sbc_init        ! Forcings : surface module
359
360      ! ==> clem: open boundaries init. is mandatory for sea-ice because ice BDY is not decoupled from 
361      !           the environment of ocean BDY. Therefore bdy is called in both OPA and SAS modules.
362      !           This is not clean and should be changed in the future.
363                           CALL bdy_init
364      ! ==>
365                           CALL icb_init( rdt, nit000)   ! initialise icebergs instance
366      !
367      IF(lwp) WRITE(numout,cform_aaa)           ! Flag AAAAAAA
368      !
369      IF( ln_timing    )   CALL timing_stop( 'nemo_init')
370      !
371   END SUBROUTINE nemo_init
372
373
374   SUBROUTINE nemo_ctl
375      !!----------------------------------------------------------------------
376      !!                     ***  ROUTINE nemo_ctl  ***
377      !!
378      !! ** Purpose :   control print setting
379      !!
380      !! ** Method  : - print namctl information and check some consistencies
381      !!----------------------------------------------------------------------
382      !
383      IF(lwp) THEN                  ! control print
384         WRITE(numout,*)
385         WRITE(numout,*) 'nemo_ctl: Control prints'
386         WRITE(numout,*) '~~~~~~~~'
387         WRITE(numout,*) '   Namelist namctl'
388         WRITE(numout,*) '      run control (for debugging)     ln_ctl     = ', ln_ctl
389         WRITE(numout,*) '       finer control over o/p sn_cfctl%l_config  = ', sn_cfctl%l_config
390         WRITE(numout,*) '                              sn_cfctl%l_runstat = ', sn_cfctl%l_runstat
391         WRITE(numout,*) '                              sn_cfctl%l_trcstat = ', sn_cfctl%l_trcstat
392         WRITE(numout,*) '                              sn_cfctl%l_oceout  = ', sn_cfctl%l_oceout
393         WRITE(numout,*) '                              sn_cfctl%l_layout  = ', sn_cfctl%l_layout
394         WRITE(numout,*) '                              sn_cfctl%l_mppout  = ', sn_cfctl%l_mppout
395         WRITE(numout,*) '                              sn_cfctl%l_mpptop  = ', sn_cfctl%l_mpptop
396         WRITE(numout,*) '                              sn_cfctl%procmin   = ', sn_cfctl%procmin 
397         WRITE(numout,*) '                              sn_cfctl%procmax   = ', sn_cfctl%procmax 
398         WRITE(numout,*) '                              sn_cfctl%procincr  = ', sn_cfctl%procincr 
399         WRITE(numout,*) '                              sn_cfctl%ptimincr  = ', sn_cfctl%ptimincr 
400         WRITE(numout,*) '      level of print                  nn_print   = ', nn_print
401         WRITE(numout,*) '      Start i indice for SUM control  nn_ictls   = ', nn_ictls
402         WRITE(numout,*) '      End i indice for SUM control    nn_ictle   = ', nn_ictle
403         WRITE(numout,*) '      Start j indice for SUM control  nn_jctls   = ', nn_jctls
404         WRITE(numout,*) '      End j indice for SUM control    nn_jctle   = ', nn_jctle
405         WRITE(numout,*) '      number of proc. following i     nn_isplt   = ', nn_isplt
406         WRITE(numout,*) '      number of proc. following j     nn_jsplt   = ', nn_jsplt
407         WRITE(numout,*) '      timing by routine               ln_timing  = ', ln_timing
408         WRITE(numout,*) '      CFL diagnostics                 ln_diacfl  = ', ln_diacfl
409      ENDIF
410      !
411      nprint    = nn_print          ! convert DOCTOR namelist names into OLD names
412      nictls    = nn_ictls
413      nictle    = nn_ictle
414      njctls    = nn_jctls
415      njctle    = nn_jctle
416      isplt     = nn_isplt
417      jsplt     = nn_jsplt
418
419      IF(lwp) THEN                  ! control print
420         WRITE(numout,*)
421         WRITE(numout,*) '   Namelist namcfg'
422         WRITE(numout,*) '      read domain configuration file                ln_read_cfg      = ', ln_read_cfg
423         WRITE(numout,*) '         filename to be read                           cn_domcfg     = ', TRIM(cn_domcfg)
424         WRITE(numout,*) '         keep closed seas in the domain (if exist)     ln_closea     = ', ln_closea
425         WRITE(numout,*) '      create a configuration definition file        ln_write_cfg     = ', ln_write_cfg
426         WRITE(numout,*) '         filename to be written                        cn_domcfg_out = ', TRIM(cn_domcfg_out)
427         WRITE(numout,*) '      use file attribute if exists as i/p j-start   ln_use_jattr     = ', ln_use_jattr
428      ENDIF
429      IF( .NOT.ln_read_cfg )   ln_closea = .false.   ! dealing possible only with a domcfg file
430      !
431      !                             ! Parameter control
432      !
433      IF( ln_ctl ) THEN                 ! sub-domain area indices for the control prints
434         IF( lk_mpp .AND. jpnij > 1 ) THEN
435            isplt = jpni   ;   jsplt = jpnj   ;   ijsplt = jpni*jpnj   ! the domain is forced to the real split domain
436         ELSE
437            IF( isplt == 1 .AND. jsplt == 1  ) THEN
438               CALL ctl_warn( ' - isplt & jsplt are equal to 1',   &
439                  &           ' - the print control will be done over the whole domain' )
440            ENDIF
441            ijsplt = isplt * jsplt            ! total number of processors ijsplt
442         ENDIF
443         IF(lwp) WRITE(numout,*)'          - The total number of processors over which the'
444         IF(lwp) WRITE(numout,*)'            print control will be done is ijsplt : ', ijsplt
445         !
446         !                              ! indices used for the SUM control
447         IF( nictls+nictle+njctls+njctle == 0 )   THEN    ! print control done over the default area
448            lsp_area = .FALSE.
449         ELSE                                             ! print control done over a specific  area
450            lsp_area = .TRUE.
451            IF( nictls < 1 .OR. nictls > jpiglo )   THEN
452               CALL ctl_warn( '          - nictls must be 1<=nictls>=jpiglo, it is forced to 1' )
453               nictls = 1
454            ENDIF
455            IF( nictle < 1 .OR. nictle > jpiglo )   THEN
456               CALL ctl_warn( '          - nictle must be 1<=nictle>=jpiglo, it is forced to jpiglo' )
457               nictle = jpiglo
458            ENDIF
459            IF( njctls < 1 .OR. njctls > jpjglo )   THEN
460               CALL ctl_warn( '          - njctls must be 1<=njctls>=jpjglo, it is forced to 1' )
461               njctls = 1
462            ENDIF
463            IF( njctle < 1 .OR. njctle > jpjglo )   THEN
464               CALL ctl_warn( '          - njctle must be 1<=njctle>=jpjglo, it is forced to jpjglo' )
465               njctle = jpjglo
466            ENDIF
467         ENDIF
468      ENDIF
469      !
470      IF( 1._wp /= SIGN(1._wp,-0._wp)  )   CALL ctl_stop( 'nemo_ctl: The intrinsec SIGN function follows f2003 standard.',  &
471         &                                                'Compile with key_nosignedzero enabled:',   &
472         &                                                '--> add -Dkey_nosignedzero to the definition of %CPP in your arch file' )
473      !
474#if defined key_agrif
475      IF( ln_timing )   CALL ctl_stop( 'AGRIF not implemented with ln_timing = true')
476#endif
477      !
478   END SUBROUTINE nemo_ctl
479
480
481   SUBROUTINE nemo_closefile
482      !!----------------------------------------------------------------------
483      !!                     ***  ROUTINE nemo_closefile  ***
484      !!
485      !! ** Purpose :   Close the files
486      !!----------------------------------------------------------------------
487      !
488      IF( lk_mpp )   CALL mppsync
489      !
490      CALL iom_close                                 ! close all input/output files managed by iom_*
491      !
492      IF( numstp          /= -1 )   CLOSE( numstp          )   ! time-step file     
493      IF( numrun          /= -1 )   CLOSE( numrun          )   ! run statistics file
494      IF( numnam_ref      /= -1 )   CLOSE( numnam_ref      )   ! oce reference namelist
495      IF( numnam_cfg      /= -1 )   CLOSE( numnam_cfg      )   ! oce configuration namelist
496      IF( lwm.AND.numond  /= -1 )   CLOSE( numond          )   ! oce output namelist
497      IF( numnam_ice_ref  /= -1 )   CLOSE( numnam_ice_ref  )   ! ice reference namelist
498      IF( numnam_ice_cfg  /= -1 )   CLOSE( numnam_ice_cfg  )   ! ice configuration namelist
499      IF( lwm.AND.numoni  /= -1 )   CLOSE( numoni          )   ! ice output namelist
500      IF( numevo_ice      /= -1 )   CLOSE( numevo_ice      )   ! ice variables (temp. evolution)
501      IF( numout          /=  6 )   CLOSE( numout          )   ! standard model output file
502      !
503      numout = 6                                     ! redefine numout in case it is used after this point...
504      !
505   END SUBROUTINE nemo_closefile
506
507
508   SUBROUTINE nemo_alloc
509      !!----------------------------------------------------------------------
510      !!                     ***  ROUTINE nemo_alloc  ***
511      !!
512      !! ** Purpose :   Allocate all the dynamic arrays of the OPA modules
513      !!
514      !! ** Method  :
515      !!----------------------------------------------------------------------
516      USE diawri    , ONLY : dia_wri_alloc
517      USE dom_oce   , ONLY : dom_oce_alloc
518      USE bdy_oce   , ONLY : ln_bdy, bdy_oce_alloc
519      USE oce       ! mandatory for sea-ice because needed for bdy arrays
520      !
521      INTEGER :: ierr
522      !!----------------------------------------------------------------------
523      !
524      ierr =        dia_wri_alloc()
525      ierr = ierr + dom_oce_alloc()          ! ocean domain
526      ierr = ierr + oce_alloc    ()          ! (tsn...) needed for agrif and/or SI3 and bdy
527      ierr = ierr + bdy_oce_alloc()          ! bdy masks (incl. initialization)
528      !
529      CALL mpp_sum( 'nemogcm', ierr )
530      IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'nemo_alloc: unable to allocate standard ocean arrays' )
531      !
532   END SUBROUTINE nemo_alloc
533
534   SUBROUTINE nemo_set_cfctl(sn_cfctl, setto, for_all )
535      !!----------------------------------------------------------------------
536      !!                     ***  ROUTINE nemo_set_cfctl  ***
537      !!
538      !! ** Purpose :   Set elements of the output control structure to setto.
539      !!                for_all should be .false. unless all areas are to be
540      !!                treated identically.
541      !!
542      !! ** Method  :   Note this routine can be used to switch on/off some
543      !!                types of output for selected areas but any output types
544      !!                that involve global communications (e.g. mpp_max, glob_sum)
545      !!                should be protected from selective switching by the
546      !!                for_all argument
547      !!----------------------------------------------------------------------
548      LOGICAL :: setto, for_all
549      TYPE(sn_ctl) :: sn_cfctl
550      !!----------------------------------------------------------------------
551      IF( for_all ) THEN
552         sn_cfctl%l_runstat = setto
553         sn_cfctl%l_trcstat = setto
554      ENDIF
555      sn_cfctl%l_oceout  = setto
556      sn_cfctl%l_layout  = setto
557      sn_cfctl%l_mppout  = setto
558      sn_cfctl%l_mpptop  = setto
559   END SUBROUTINE nemo_set_cfctl
560
561   !!======================================================================
562END MODULE nemogcm
563
Note: See TracBrowser for help on using the repository browser.