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/trunk/src/SAS – NEMO

source: NEMO/trunk/src/SAS/nemogcm.F90 @ 14834

Last change on this file since 14834 was 14834, checked in by hadcv, 3 years ago

#2600: Merge in dev_r14273_HPC-02_Daley_Tiling

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