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_r13312_AGRIF-03-04_jchanut_vinterp_tstep/src/SAS – NEMO

source: NEMO/branches/2020/dev_r13312_AGRIF-03-04_jchanut_vinterp_tstep/src/SAS/nemogcm.F90 @ 14055

Last change on this file since 14055 was 14055, checked in by cetlod, 4 years ago

dev_r13312_AGRIF-03-04_jchanut_trunk : merge in revision 14046 of trunk

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