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/UKMO/dev_r12745_HPC-02_Daley_Tiling_trial_public/src/SAS – NEMO

source: NEMO/branches/UKMO/dev_r12745_HPC-02_Daley_Tiling_trial_public/src/SAS/nemogcm.F90 @ 12958

Last change on this file since 12958 was 12958, checked in by hadcv, 4 years ago

Merge in trunk changes to r12933

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