[3331] | 1 | MODULE step |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE step *** |
---|
| 4 | !! Time-stepping : manager of the ocean, tracer and ice time stepping |
---|
| 5 | !! version for standalone surface scheme |
---|
| 6 | !!====================================================================== |
---|
| 7 | !! History : OPA ! 1991-03 (G. Madec) Original code |
---|
[3362] | 8 | !! . ! . |
---|
| 9 | !! . ! . |
---|
| 10 | !! NEMO 3.5 ! 2012-03 (S. Alderson) |
---|
[3331] | 11 | !!---------------------------------------------------------------------- |
---|
| 12 | |
---|
| 13 | !!---------------------------------------------------------------------- |
---|
| 14 | !! stp : OPA system time-stepping |
---|
| 15 | !!---------------------------------------------------------------------- |
---|
| 16 | USE oce ! ocean dynamics and tracers variables |
---|
| 17 | USE dom_oce ! ocean space and time domain variables |
---|
| 18 | USE daymod ! calendar (day routine) |
---|
[6140] | 19 | USE sbc_oce ! surface boundary condition: fields |
---|
[3331] | 20 | USE sbcmod ! surface boundary condition (sbc routine) |
---|
| 21 | USE sbcrnf ! surface boundary condition: runoff variables |
---|
[6140] | 22 | USE sbccpl ! surface boundary condition: coupled interface |
---|
[3331] | 23 | USE eosbn2 ! equation of state (eos_bn2 routine) |
---|
| 24 | USE diawri ! Standard run outputs (dia_wri routine) |
---|
[7646] | 25 | USE bdy_oce , ONLY: ln_bdy |
---|
[9019] | 26 | USE bdydta ! mandatory for sea-ice |
---|
[6140] | 27 | USE stpctl ! time stepping control (stp_ctl routine) |
---|
| 28 | ! |
---|
| 29 | USE in_out_manager ! I/O manager |
---|
| 30 | USE prtctl ! Print control (prt_ctl routine) |
---|
| 31 | USE iom ! |
---|
| 32 | USE lbclnk ! |
---|
| 33 | USE timing ! Timing |
---|
| 34 | #if defined key_iomput |
---|
| 35 | USE xios |
---|
| 36 | #endif |
---|
[5510] | 37 | |
---|
[7646] | 38 | #if defined key_agrif |
---|
[9019] | 39 | USE agrif_oce, ONLY: lk_agrif_debug |
---|
[9570] | 40 | #if defined key_si3 |
---|
[9596] | 41 | USE agrif_ice_update |
---|
[7646] | 42 | #endif |
---|
[9510] | 43 | #endif |
---|
[7646] | 44 | |
---|
[3331] | 45 | IMPLICIT NONE |
---|
| 46 | PRIVATE |
---|
| 47 | |
---|
[6140] | 48 | PUBLIC stp ! called by nemogcm.F90 |
---|
[3331] | 49 | |
---|
| 50 | !!---------------------------------------------------------------------- |
---|
[9598] | 51 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
[5215] | 52 | !! $Id$ |
---|
[9598] | 53 | !! Software governed by the CeCILL licence (./LICENSE) |
---|
[3331] | 54 | !!---------------------------------------------------------------------- |
---|
| 55 | CONTAINS |
---|
| 56 | |
---|
| 57 | #if defined key_agrif |
---|
[7761] | 58 | RECURSIVE SUBROUTINE stp( ) |
---|
[3331] | 59 | INTEGER :: kstp ! ocean time-step index |
---|
| 60 | #else |
---|
| 61 | SUBROUTINE stp( kstp ) |
---|
| 62 | INTEGER, INTENT(in) :: kstp ! ocean time-step index |
---|
| 63 | #endif |
---|
| 64 | !!---------------------------------------------------------------------- |
---|
| 65 | !! *** ROUTINE stp *** |
---|
| 66 | !! |
---|
[3358] | 67 | !! ** Purpose : - Time stepping of SBC (surface boundary) |
---|
[3331] | 68 | !! |
---|
| 69 | !! ** Method : -1- Update forcings and data |
---|
[3358] | 70 | !! -2- Outputs and diagnostics |
---|
[3331] | 71 | !!---------------------------------------------------------------------- |
---|
| 72 | INTEGER :: indic ! error indicator if < 0 |
---|
| 73 | !! --------------------------------------------------------------------- |
---|
| 74 | |
---|
| 75 | #if defined key_agrif |
---|
| 76 | kstp = nit000 + Agrif_Nb_Step() |
---|
[7646] | 77 | IF ( lk_agrif_debug ) THEN |
---|
| 78 | IF ( Agrif_Root() .and. lwp) Write(*,*) '---' |
---|
| 79 | IF (lwp) Write(*,*) 'Grid Number',Agrif_Fixed(),' time step ',kstp, 'int tstep',Agrif_NbStepint() |
---|
| 80 | ENDIF |
---|
| 81 | |
---|
| 82 | IF ( kstp == (nit000 + 1) ) lk_agrif_fstep = .FALSE. |
---|
| 83 | |
---|
[3331] | 84 | # if defined key_iomput |
---|
[5407] | 85 | IF( Agrif_Nbstepint() == 0 ) CALL iom_swap( cxios_context ) |
---|
[3331] | 86 | # endif |
---|
| 87 | #endif |
---|
[7646] | 88 | indic = 0 ! although indic is not changed in stp_ctl |
---|
| 89 | ! need to keep the same interface |
---|
[5407] | 90 | IF( kstp == nit000 ) CALL iom_init( cxios_context ) ! iom_put initialization (must be done after nemo_init for AGRIF+XIOS+OASIS) |
---|
[3331] | 91 | IF( kstp /= nit000 ) CALL day( kstp ) ! Calendar (day was already called at nit000 in day_init) |
---|
[5407] | 92 | CALL iom_setkt( kstp - nit000 + 1, cxios_context ) ! tell iom we are at time step kstp |
---|
[3331] | 93 | |
---|
[9019] | 94 | ! ==> clem: open boundaries is mandatory for sea-ice because ice BDY is not decoupled from |
---|
[5510] | 95 | ! the environment of ocean BDY. Therefore bdy is called in both OPA and SAS modules. |
---|
| 96 | ! From SAS: ocean bdy data are wrong (but we do not care) and ice bdy data are OK. |
---|
| 97 | ! This is not clean and should be changed in the future. |
---|
[7646] | 98 | IF( ln_bdy ) CALL bdy_dta ( kstp, time_offset=+1 ) ! update dynamic & tracer data at open boundaries |
---|
[5510] | 99 | ! ==> |
---|
[3331] | 100 | CALL sbc ( kstp ) ! Sea Boundary Condition (including sea-ice) |
---|
| 101 | |
---|
| 102 | CALL dia_wri( kstp ) ! ocean model: outputs |
---|
| 103 | |
---|
[7646] | 104 | #if defined key_agrif |
---|
| 105 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
| 106 | ! AGRIF |
---|
| 107 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
| 108 | CALL Agrif_Integrate_ChildGrids( stp ) |
---|
[9510] | 109 | |
---|
| 110 | IF( Agrif_NbStepint() == 0 ) THEN ! AGRIF Update from zoom N to zoom 1 then to Parent |
---|
[9570] | 111 | #if defined key_si3 |
---|
[9781] | 112 | CALL Agrif_Update_ice( ) ! update sea-ice |
---|
[7646] | 113 | #endif |
---|
[9510] | 114 | ENDIF |
---|
| 115 | #endif |
---|
[7646] | 116 | |
---|
| 117 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
| 118 | ! Control |
---|
| 119 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
[3331] | 120 | CALL stp_ctl( kstp, indic ) |
---|
[7646] | 121 | IF( indic < 0 ) THEN |
---|
| 122 | CALL ctl_stop( 'step: indic < 0' ) |
---|
| 123 | CALL dia_wri_state( 'output.abort', kstp ) |
---|
| 124 | ENDIF |
---|
[9019] | 125 | IF( kstp == nit000 ) CALL iom_close( numror ) ! close input ocean restart file |
---|
[7646] | 126 | |
---|
[5407] | 127 | !>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
---|
| 128 | ! Coupled mode |
---|
| 129 | !<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
---|
| 130 | IF( lk_oasis ) CALL sbc_cpl_snd( kstp ) ! coupled mode : field exchanges if OASIS-coupled ice |
---|
| 131 | |
---|
[3769] | 132 | #if defined key_iomput |
---|
[9367] | 133 | IF( kstp == nitrst ) THEN |
---|
| 134 | IF(.NOT.lwxios) THEN |
---|
| 135 | CALL iom_close( numrow ) |
---|
| 136 | ELSE |
---|
| 137 | CALL iom_context_finalize( cwxios_context ) |
---|
| 138 | ENDIF |
---|
| 139 | lrst_oce = .FALSE. |
---|
| 140 | ENDIF |
---|
| 141 | IF( kstp == nitend .OR. indic < 0 ) THEN |
---|
[5407] | 142 | CALL iom_context_finalize( cxios_context ) ! needed for XIOS+AGRIF |
---|
| 143 | ENDIF |
---|
[3769] | 144 | #endif |
---|
[3331] | 145 | ! |
---|
[9019] | 146 | IF( ln_timing .AND. kstp == nit000 ) CALL timing_reset |
---|
[3331] | 147 | ! |
---|
| 148 | END SUBROUTINE stp |
---|
| 149 | |
---|
| 150 | !!====================================================================== |
---|
| 151 | END MODULE step |
---|