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

source: NEMO/branches/2018/dev_r10164_HPC09_ESIWACE_PREP_MERGE/src/SAS/nemogcm.F90 @ 10297

Last change on this file since 10297 was 10297, checked in by smasson, 5 years ago

dev_r10164_HPC09_ESIWACE_PREP_MERGE: action 2a: add report calls of mppmin/max/sum, see #2133

  • Property svn:keywords set to Id
File size: 23.4 KB
RevLine 
[3324]1MODULE nemogcm
2   !!======================================================================
3   !!                       ***  MODULE nemogcm   ***
[7646]4   !! StandAlone Surface module : surface fluxes + sea-ice + iceberg floats
[3324]5   !!======================================================================
[7646]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
[3324]10   !!----------------------------------------------------------------------
11
12   !!----------------------------------------------------------------------
[7646]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
[3324]18   !!----------------------------------------------------------------------
[7646]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)
[9200]23   USE closea         ! treatment of closed seas (for ln_closea)
[7646]24   USE usrdef_nam     ! user defined configuration
25   USE daymod         ! calendar
[8583]26   USE restart        ! open  restart file
[7646]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
[9019]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
[7646]34   !
35   USE lib_mpp        ! distributed memory computing
36   USE mppini         ! shared/distributed memory setting (mpp_init routine)
[9213]37   USE lbcnfd  , ONLY : isendto, nsndto, nfsloop, nfeloop   ! Setup of north fold exchanges
[7646]38   USE lib_fortran    ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined)
[3324]39#if defined key_iomput
[7646]40   USE xios           ! xIOserver
[3324]41#endif
[9781]42#if defined key_agrif && defined key_si3
43   USE agrif_ice_update ! ice update
44#endif
[3324]45
46   IMPLICIT NONE
47   PRIVATE
48
49   PUBLIC   nemo_gcm    ! called by model.F90
50   PUBLIC   nemo_init   ! needed by AGRIF
51
52   CHARACTER(lc) ::   cform_aaa="( /, 'AAAAAAAA', / ) "     ! flag for output listing
53
54   !!----------------------------------------------------------------------
[10068]55   !! NEMO/SAS 4.0 , NEMO Consortium (2018)
[5215]56   !! $Id$
[10068]57   !! Software governed by the CeCILL license (see ./LICENSE)
[3324]58   !!----------------------------------------------------------------------
59CONTAINS
60
61   SUBROUTINE nemo_gcm
62      !!----------------------------------------------------------------------
63      !!                     ***  ROUTINE nemo_gcm  ***
64      !!
[7646]65      !! ** Purpose :   NEMO solves the primitive equations on an orthogonal
[3324]66      !!              curvilinear mesh on the sphere.
67      !!
68      !! ** Method  : - model general initialization
69      !!              - launch the time-stepping (stp routine)
70      !!              - finalize the run by closing files and communications
71      !!
72      !! References : Madec, Delecluse, Imbard, and Levy, 1997:  internal report, IPSL.
73      !!              Madec, 2008, internal report, IPSL.
74      !!----------------------------------------------------------------------
[7646]75      INTEGER ::   istp   ! time step index
[3324]76      !!----------------------------------------------------------------------
77      !
78#if defined key_agrif
[9213]79      CALL Agrif_Init_Grids()      ! AGRIF: set the meshes
[3324]80#endif
81      !                            !-----------------------!
82      CALL nemo_init               !==  Initialisations  ==!
83      !                            !-----------------------!
84#if defined key_agrif
[5407]85      CALL Agrif_Declare_Var_dom   ! AGRIF: set the meshes for DOM
86      CALL Agrif_Declare_Var       !  "      "   "   "      "  DYN/TRA
87# if defined key_top
88      CALL Agrif_Declare_Var_top   !  "      "   "   "      "  TOP
89# endif
[9570]90# if defined key_si3
[9611]91      CALL Agrif_Declare_Var_ice   !  "      "   "   "      "  Sea ice
[7646]92# endif
[3324]93#endif
94      ! check that all process are still there... If some process have an error,
95      ! they will never enter in step and other processes will wait until the end of the cpu time!
[10297]96      IF( lk_mpp )   CALL mpp_max( 'nemogcm', nstop )
[3324]97
98      IF(lwp) WRITE(numout,cform_aaa)   ! Flag AAAAAAA
99
100      !                            !-----------------------!
101      !                            !==   time stepping   ==!
102      !                            !-----------------------!
103      istp = nit000
[9213]104      !
[7646]105#if defined key_agrif
[9213]106      !                                               !==  AGRIF time-stepping  ==!
[7646]107      CALL Agrif_Regrid()
[9213]108      !
[9781]109#if defined key_si3
110      ! Recursive update from highest nested level to lowest:
111      CALL Agrif_step_child_adj(Agrif_update_ice)
112#endif
113      !
[9213]114      DO WHILE( istp <= nitend .AND. nstop == 0 )
115         CALL stp
116         istp = istp + 1
117      END DO
118      !
119      IF( .NOT. Agrif_Root() ) THEN
120         CALL Agrif_ParentGrid_To_ChildGrid()
121         IF( ln_timing )   CALL timing_finalize
122         CALL Agrif_ChildGrid_To_ParentGrid()
123      ENDIF
124      !
[3324]125#else
[9213]126      !
127      IF( .NOT.ln_diurnal_only ) THEN                 !==  Standard time-stepping  ==!
128         !
129         DO WHILE( istp <= nitend .AND. nstop == 0 )
130            CALL stp        ( istp ) 
131            istp = istp + 1
[7646]132         END DO
[9213]133         !
134      ELSE                                            !==  diurnal SST time-steeping only  ==!
135         !
136         DO WHILE( istp <= nitend .AND. nstop == 0 )
137            CALL stp_diurnal( istp )   ! time step only the diurnal SST
138            istp = istp + 1
139         END DO
140         !
141      ENDIF
[5407]142      !
[9213]143#endif
144      !
[5407]145      IF( ln_icebergs )   CALL icb_end( nitend )
146
[3324]147      !                            !------------------------!
148      !                            !==  finalize the run  ==!
149      !                            !------------------------!
[7646]150      IF(lwp) WRITE(numout,cform_aaa)        ! Flag AAAAAAA
[3324]151      !
[7646]152      IF( nstop /= 0 .AND. lwp ) THEN        ! error print
[3324]153         WRITE(numout,cform_err)
[9213]154         WRITE(numout,*) '   ==>>>   nemo_gcm: a total of ', nstop, ' errors have been found'
155         WRITE(numout,*)
[3324]156      ENDIF
157      !
[9019]158      IF( ln_timing )   CALL timing_finalize
[3324]159      !
160      CALL nemo_closefile
[5407]161      !
[3769]162#if defined key_iomput
[9213]163                                    CALL xios_finalize  ! end mpp communications with xios
164      IF( lk_oasis     )            CALL cpl_finalize   ! end coupling and mpp communications with OASIS
[3769]165#else
[9213]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
[5407]168      ENDIF
[3769]169#endif
[3324]170      !
171   END SUBROUTINE nemo_gcm
172
173
174   SUBROUTINE nemo_init
175      !!----------------------------------------------------------------------
176      !!                     ***  ROUTINE nemo_init  ***
177      !!
178      !! ** Purpose :   initialization of the NEMO GCM
179      !!----------------------------------------------------------------------
[9213]180      INTEGER  ::   ji                 ! dummy loop indices
181      INTEGER  ::   ios, ilocal_comm   ! local integers
[7646]182      CHARACTER(len=120), DIMENSION(30) ::   cltxt, cltxt2, clnam
183      CHARACTER(len=80)                 ::   clname
[9213]184      !!
[7646]185      NAMELIST/namctl/ ln_ctl   , nn_print, nn_ictls, nn_ictle,   &
186         &             nn_isplt , nn_jsplt, nn_jctls, nn_jctle,   &
[9019]187         &             ln_timing, ln_diacfl
[9213]188      NAMELIST/namcfg/ ln_read_cfg, cn_domcfg, ln_closea, ln_write_cfg, cn_domcfg_out, ln_use_jattr
[3324]189      !!----------------------------------------------------------------------
[5407]190      !
[7646]191      cltxt  = ''
192      cltxt2 = ''
193      clnam  = '' 
194      cxios_context = 'nemo'
[3324]195      !
[4147]196      !                             ! Open reference namelist and configuration namelist files
[5407]197      IF( lk_oasis ) THEN
198         CALL ctl_opn( numnam_ref, 'namelist_sas_ref', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. )
199         CALL ctl_opn( numnam_cfg, 'namelist_sas_cfg', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. )
200         cxios_context = 'sas'
201         clname = 'output.namelist_sas.dyn'
202      ELSE
203         CALL ctl_opn( numnam_ref, 'namelist_ref', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. )
204         CALL ctl_opn( numnam_cfg, 'namelist_cfg', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. )
205         cxios_context = 'nemo'
206         clname = 'output.namelist.dyn'
207   ENDIF
[3324]208      !
[9213]209      REWIND( numnam_ref )              ! Namelist namctl in reference namelist
[4147]210      READ  ( numnam_ref, namctl, IOSTAT = ios, ERR = 901 )
[9169]211901   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namctl in reference namelist', .TRUE. )
[7646]212      REWIND( numnam_cfg )              ! Namelist namctl in confguration namelist
[4147]213      READ  ( numnam_cfg, namctl, IOSTAT = ios, ERR = 902 )
[9169]214902   IF( ios >  0 )   CALL ctl_nam ( ios , 'namctl in configuration namelist', .TRUE. )
[3324]215      !
[9213]216      REWIND( numnam_ref )              ! Namelist namcfg in reference namelist
[4147]217      READ  ( numnam_ref, namcfg, IOSTAT = ios, ERR = 903 )
[9169]218903   IF( ios /= 0 )   CALL ctl_nam ( ios , 'namcfg in reference namelist', .TRUE. )
[9213]219      REWIND( numnam_cfg )              ! Namelist namcfg in confguration namelist
[4147]220      READ  ( numnam_cfg, namcfg, IOSTAT = ios, ERR = 904 )
[9169]221904   IF( ios >  0 )   CALL ctl_nam ( ios , 'namcfg in configuration namelist', .TRUE. )   
[4290]222
[7646]223      !                             !--------------------------!
224      !                             !  Set global domain size  !   (control print return in cltxt2)
225      !                             !--------------------------!
226      IF( ln_read_cfg ) THEN              ! Read sizes in domain configuration file
227         CALL domain_cfg ( cltxt2,        cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio )
228         !
229      ELSE                                ! user-defined namelist
230         CALL usr_def_nam( cltxt2, clnam, cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio )
231      ENDIF
232      !
233      !
[3324]234      !                             !--------------------------------------------!
235      !                             !  set communicator & select the local node  !
[4624]236      !                             !  NB: mynode also opens output.namelist.dyn !
237      !                             !      on unit number numond on first proc   !
[3324]238      !                             !--------------------------------------------!
239#if defined key_iomput
240      IF( Agrif_Root() ) THEN
[5407]241         IF( lk_oasis ) THEN
242            CALL cpl_init( "sas", ilocal_comm )                          ! nemo local communicator given by oasis
243            CALL xios_initialize( "not used",local_comm=ilocal_comm )    ! send nemo communicator to xios
244         ELSE
[7646]245            CALL xios_initialize( "for_xios_mpi_id",return_comm=ilocal_comm )    ! nemo local communicator given by xios
[5407]246         ENDIF
[3324]247      ENDIF
[5407]248      narea = mynode ( cltxt, clname, numnam_ref, numnam_cfg, numond , nstop, ilocal_comm )  ! Nodes selection
[3324]249#else
[5407]250      IF( lk_oasis ) THEN
251         IF( Agrif_Root() ) THEN
252            CALL cpl_init( "sas", ilocal_comm )                          ! nemo local communicator given by oasis
253         ENDIF
254         narea = mynode( cltxt, clname, numnam_ref, numnam_cfg, numond , nstop, ilocal_comm )   ! Nodes selection (control print return in cltxt)
255      ELSE
256         ilocal_comm = 0
257         narea = mynode( cltxt, clname, numnam_ref, numnam_cfg, numond , nstop )                ! Nodes selection (control print return in cltxt)
258      ENDIF
[3324]259#endif
[7646]260
[3324]261      narea = narea + 1                                     ! mynode return the rank of proc (0 --> jpnij -1 )
262
[4624]263      lwm = (narea == 1)                                    ! control of output namelists
[3324]264      lwp = (narea == 1) .OR. ln_ctl                        ! control of all listing output print
265
[7646]266      IF(lwm) THEN               ! write merged namelists from earlier to output namelist
267         !                       ! now that the file has been opened in call to mynode.
268         !                       ! NB: nammpp has already been written in mynode (if lk_mpp_mpi)
[4624]269         WRITE( numond, namctl )
270         WRITE( numond, namcfg )
[7646]271         IF( .NOT.ln_read_cfg ) THEN
272            DO ji = 1, SIZE(clnam)
273               IF( TRIM(clnam(ji)) /= '' )   WRITE(numond, * ) clnam(ji)     ! namusr_def print
274            END DO
275         ENDIF
[4624]276      ENDIF
277
[3324]278      IF(lwp) THEN                            ! open listing units
279         !
[9213]280         IF( lk_oasis ) THEN   ;   CALL ctl_opn( numout,   'sas.output', 'REPLACE','FORMATTED','SEQUENTIAL', -1, 6, .FALSE., narea )
281         ELSE                  ;   CALL ctl_opn( numout, 'ocean.output', 'REPLACE','FORMATTED','SEQUENTIAL', -1, 6, .FALSE., narea )
[5407]282         ENDIF
[3324]283         !
284         WRITE(numout,*)
285         WRITE(numout,*) '   CNRS - NERC - Met OFFICE - MERCATOR-ocean - INGV - CMCC'
286         WRITE(numout,*) '                       NEMO team'
287         WRITE(numout,*) '            Ocean General Circulation Model'
[9213]288         WRITE(numout,*) '                NEMO version 4.0  (2017) '
[3331]289         WRITE(numout,*) '             StandAlone Surface version (SAS) '
[3324]290         WRITE(numout,*)
291         WRITE(numout,*)
[7646]292         DO ji = 1, SIZE(cltxt)
293            IF( TRIM(cltxt (ji)) /= '' )   WRITE(numout,*) cltxt(ji)    ! control print of mynode
[3324]294         END DO
[7646]295         WRITE(numout,*)
296         WRITE(numout,*)
297         DO ji = 1, SIZE(cltxt2)
298            IF( TRIM(cltxt2(ji)) /= '' )   WRITE(numout,*) cltxt2(ji)   ! control print of domain size
299         END DO
[3324]300         !
[7646]301         WRITE(numout,cform_aaa)                                        ! Flag AAAAAAA
302         !
[3324]303      ENDIF
[9436]304      !                                      ! Domain decomposition
305      CALL mpp_init                          ! MPP
[3324]306
[7646]307      ! Now we know the dimensions of the grid and numout has been set: we can allocate arrays
[3324]308      CALL nemo_alloc()
[9213]309
[3324]310      !                             !-------------------------------!
311      !                             !  NEMO general initialization  !
312      !                             !-------------------------------!
313
[7646]314      CALL nemo_ctl                          ! Control prints
[3324]315      !
[9213]316      !                                      ! General initialization
317      IF( ln_timing    )   CALL timing_init     ! timing
318      IF( ln_timing    )   CALL timing_start( 'nemo_init')
[3324]319
[9213]320                           CALL phy_cst         ! Physical constants
321                           CALL eos_init        ! Equation of seawater
[9367]322                           CALL dom_init('SAS') ! Domain
[9213]323      IF( ln_ctl      )    CALL prt_ctl_init    ! Print control
324     
325                           CALL day_init        ! model calendar (using both namelist and restart infos)
326      IF( ln_rstart )      CALL rst_read_open
[3324]327
[9213]328      !                                      ! external forcing
329                           CALL sbc_init        ! Forcings : surface module
[3324]330
[9019]331      ! ==> clem: open boundaries init. is mandatory for sea-ice because ice BDY is not decoupled from 
[5510]332      !           the environment of ocean BDY. Therefore bdy is called in both OPA and SAS modules.
333      !           This is not clean and should be changed in the future.
[9019]334                           CALL bdy_init
[5510]335      ! ==>
[9019]336                           CALL icb_init( rdt, nit000)   ! initialise icebergs instance
[3324]337      !
[9213]338      IF(lwp) WRITE(numout,cform_aaa)           ! Flag AAAAAAA
339      !
340      IF( ln_timing    )   CALL timing_stop( 'nemo_init')
341      !
[3324]342   END SUBROUTINE nemo_init
343
344
345   SUBROUTINE nemo_ctl
346      !!----------------------------------------------------------------------
347      !!                     ***  ROUTINE nemo_ctl  ***
348      !!
[9213]349      !! ** Purpose :   control print setting
[3324]350      !!
351      !! ** Method  : - print namctl information and check some consistencies
352      !!----------------------------------------------------------------------
353      !
354      IF(lwp) THEN                  ! control print
355         WRITE(numout,*)
[7646]356         WRITE(numout,*) 'nemo_ctl: Control prints'
[9213]357         WRITE(numout,*) '~~~~~~~~'
[3324]358         WRITE(numout,*) '   Namelist namctl'
359         WRITE(numout,*) '      run control (for debugging)     ln_ctl     = ', ln_ctl
360         WRITE(numout,*) '      level of print                  nn_print   = ', nn_print
361         WRITE(numout,*) '      Start i indice for SUM control  nn_ictls   = ', nn_ictls
362         WRITE(numout,*) '      End i indice for SUM control    nn_ictle   = ', nn_ictle
363         WRITE(numout,*) '      Start j indice for SUM control  nn_jctls   = ', nn_jctls
364         WRITE(numout,*) '      End j indice for SUM control    nn_jctle   = ', nn_jctle
365         WRITE(numout,*) '      number of proc. following i     nn_isplt   = ', nn_isplt
366         WRITE(numout,*) '      number of proc. following j     nn_jsplt   = ', nn_jsplt
[9019]367         WRITE(numout,*) '      timing by routine               ln_timing  = ', ln_timing
368         WRITE(numout,*) '      CFL diagnostics                 ln_diacfl  = ', ln_diacfl
[3324]369      ENDIF
370      !
371      nprint    = nn_print          ! convert DOCTOR namelist names into OLD names
372      nictls    = nn_ictls
373      nictle    = nn_ictle
374      njctls    = nn_jctls
375      njctle    = nn_jctle
376      isplt     = nn_isplt
377      jsplt     = nn_jsplt
[4147]378
379      IF(lwp) THEN                  ! control print
380         WRITE(numout,*)
381         WRITE(numout,*) '   Namelist namcfg'
[9213]382         WRITE(numout,*) '      read domain configuration file                ln_read_cfg      = ', ln_read_cfg
[7646]383         WRITE(numout,*) '         filename to be read                           cn_domcfg     = ', TRIM(cn_domcfg)
[9213]384         WRITE(numout,*) '         keep closed seas in the domain (if exist)     ln_closea     = ', ln_closea
385         WRITE(numout,*) '      create a configuration definition file        ln_write_cfg     = ', ln_write_cfg
[7646]386         WRITE(numout,*) '         filename to be written                        cn_domcfg_out = ', TRIM(cn_domcfg_out)
387         WRITE(numout,*) '      use file attribute if exists as i/p j-start   ln_use_jattr     = ', ln_use_jattr
[4147]388      ENDIF
[9213]389      IF( .NOT.ln_read_cfg )   ln_closea = .false.   ! dealing possible only with a domcfg file
390      !
[3324]391      !                             ! Parameter control
392      !
393      IF( ln_ctl ) THEN                 ! sub-domain area indices for the control prints
394         IF( lk_mpp .AND. jpnij > 1 ) THEN
395            isplt = jpni   ;   jsplt = jpnj   ;   ijsplt = jpni*jpnj   ! the domain is forced to the real split domain
396         ELSE
397            IF( isplt == 1 .AND. jsplt == 1  ) THEN
398               CALL ctl_warn( ' - isplt & jsplt are equal to 1',   &
399                  &           ' - the print control will be done over the whole domain' )
400            ENDIF
401            ijsplt = isplt * jsplt            ! total number of processors ijsplt
402         ENDIF
403         IF(lwp) WRITE(numout,*)'          - The total number of processors over which the'
404         IF(lwp) WRITE(numout,*)'            print control will be done is ijsplt : ', ijsplt
405         !
406         !                              ! indices used for the SUM control
407         IF( nictls+nictle+njctls+njctle == 0 )   THEN    ! print control done over the default area
[7646]408            lsp_area = .FALSE.
[3324]409         ELSE                                             ! print control done over a specific  area
410            lsp_area = .TRUE.
411            IF( nictls < 1 .OR. nictls > jpiglo )   THEN
412               CALL ctl_warn( '          - nictls must be 1<=nictls>=jpiglo, it is forced to 1' )
413               nictls = 1
414            ENDIF
415            IF( nictle < 1 .OR. nictle > jpiglo )   THEN
416               CALL ctl_warn( '          - nictle must be 1<=nictle>=jpiglo, it is forced to jpiglo' )
417               nictle = jpiglo
418            ENDIF
419            IF( njctls < 1 .OR. njctls > jpjglo )   THEN
420               CALL ctl_warn( '          - njctls must be 1<=njctls>=jpjglo, it is forced to 1' )
421               njctls = 1
422            ENDIF
423            IF( njctle < 1 .OR. njctle > jpjglo )   THEN
424               CALL ctl_warn( '          - njctle must be 1<=njctle>=jpjglo, it is forced to jpjglo' )
425               njctle = jpjglo
426            ENDIF
427         ENDIF
428      ENDIF
429      !
[9213]430      IF( 1._wp /= SIGN(1._wp,-0._wp)  )   CALL ctl_stop( 'nemo_ctl: The intrinsec SIGN function follows f2003 standard.',  &
431         &                                                'Compile with key_nosignedzero enabled' )
[5407]432      !
[9213]433#if defined key_agrif
434      IF( ln_timing )   CALL ctl_stop( 'AGRIF not implemented with ln_timing = true')
435#endif
436      !
[3324]437   END SUBROUTINE nemo_ctl
438
439
440   SUBROUTINE nemo_closefile
441      !!----------------------------------------------------------------------
442      !!                     ***  ROUTINE nemo_closefile  ***
443      !!
444      !! ** Purpose :   Close the files
445      !!----------------------------------------------------------------------
446      !
447      IF( lk_mpp )   CALL mppsync
448      !
449      CALL iom_close                                 ! close all input/output files managed by iom_*
450      !
[9213]451      IF( numstp          /= -1 )   CLOSE( numstp          )   ! time-step file     
[9267]452      IF( numrun          /= -1 )   CLOSE( numrun          )   ! run statistics file
[4147]453      IF( numnam_ref      /= -1 )   CLOSE( numnam_ref      )   ! oce reference namelist
454      IF( numnam_cfg      /= -1 )   CLOSE( numnam_cfg      )   ! oce configuration namelist
[4624]455      IF( lwm.AND.numond  /= -1 )   CLOSE( numond          )   ! oce output namelist
[4147]456      IF( numnam_ice_ref  /= -1 )   CLOSE( numnam_ice_ref  )   ! ice reference namelist
457      IF( numnam_ice_cfg  /= -1 )   CLOSE( numnam_ice_cfg  )   ! ice configuration namelist
[4624]458      IF( lwm.AND.numoni  /= -1 )   CLOSE( numoni          )   ! ice output namelist
[9213]459      IF( numevo_ice      /= -1 )   CLOSE( numevo_ice      )   ! ice variables (temp. evolution)
460      IF( numout          /=  6 )   CLOSE( numout          )   ! standard model output file
[3324]461      !
462      numout = 6                                     ! redefine numout in case it is used after this point...
463      !
464   END SUBROUTINE nemo_closefile
465
466
467   SUBROUTINE nemo_alloc
468      !!----------------------------------------------------------------------
469      !!                     ***  ROUTINE nemo_alloc  ***
470      !!
471      !! ** Purpose :   Allocate all the dynamic arrays of the OPA modules
472      !!
473      !! ** Method  :
474      !!----------------------------------------------------------------------
[9213]475      USE diawri    , ONLY : dia_wri_alloc
476      USE dom_oce   , ONLY : dom_oce_alloc
477      USE bdy_oce   , ONLY : ln_bdy, bdy_oce_alloc
[9019]478      USE oce       ! mandatory for sea-ice because needed for bdy arrays
[3324]479      !
[7646]480      INTEGER :: ierr
[3324]481      !!----------------------------------------------------------------------
482      !
[9213]483      ierr =        dia_wri_alloc()
484      ierr = ierr + dom_oce_alloc()          ! ocean domain
[9570]485      ierr = ierr + oce_alloc    ()          ! (tsn...) needed for agrif and/or SI3 and bdy
[9213]486      ierr = ierr + bdy_oce_alloc()          ! bdy masks (incl. initialization)
[3324]487      !
[10297]488      IF( lk_mpp    )   CALL mpp_sum( 'nemogcm', ierr )
[9213]489      IF( ierr /= 0 )   CALL ctl_stop( 'STOP', 'nemo_alloc: unable to allocate standard ocean arrays' )
[3324]490      !
491   END SUBROUTINE nemo_alloc
492
493   !!======================================================================
494END MODULE nemogcm
[9213]495
Note: See TracBrowser for help on using the repository browser.