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/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/SAS – NEMO

source: NEMO/branches/2020/dev_r12558_HPC-08_epico_Extra_Halo/src/SAS/nemogcm.F90 @ 13181

Last change on this file since 13181 was 13176, checked in by smasson, 4 years ago

Extra_Halo: rewrite prtctl, supress nn_print, see #2366

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