[3] | 1 | MODULE istate |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE istate *** |
---|
| 4 | !! Ocean state : initial state setting |
---|
| 5 | !!===================================================================== |
---|
[2104] | 6 | !! History : OPA ! 1989-12 (P. Andrich) Original code |
---|
| 7 | !! 5.0 ! 1991-11 (G. Madec) rewritting |
---|
| 8 | !! 6.0 ! 1996-01 (G. Madec) terrain following coordinates |
---|
| 9 | !! 8.0 ! 2001-09 (M. Levy, M. Ben Jelloul) istate_eel |
---|
| 10 | !! 8.0 ! 2001-09 (M. Levy, M. Ben Jelloul) istate_uvg |
---|
| 11 | !! NEMO 1.0 ! 2003-08 (G. Madec, C. Talandier) F90: Free form, modules + EEL R5 |
---|
| 12 | !! - ! 2004-05 (A. Koch-Larrouy) istate_gyre |
---|
| 13 | !! 2.0 ! 2006-07 (S. Masson) distributed restart using iom |
---|
| 14 | !! 3.3 ! 2010-10 (C. Ethe) merge TRC-TRA |
---|
[3294] | 15 | !! 3.4 ! 2011-04 (G. Madec) Merge of dtatem and dtasal & suppression of tb,tn/sb,sn |
---|
[7646] | 16 | !! 3.7 ! 2016-04 (S. Flavoni) introduce user defined initial state |
---|
[508] | 17 | !!---------------------------------------------------------------------- |
---|
[3] | 18 | |
---|
| 19 | !!---------------------------------------------------------------------- |
---|
| 20 | !! istate_init : initial state setting |
---|
| 21 | !! istate_uvg : initial velocity in geostropic balance |
---|
| 22 | !!---------------------------------------------------------------------- |
---|
[7646] | 23 | USE oce ! ocean dynamics and active tracers |
---|
| 24 | USE dom_oce ! ocean space and time domain |
---|
| 25 | USE daymod ! calendar |
---|
| 26 | USE dtatsd ! data temperature and salinity (dta_tsd routine) |
---|
| 27 | USE dtauvd ! data: U & V current (dta_uvd routine) |
---|
[593] | 28 | USE domvvl ! varying vertical mesh |
---|
[6140] | 29 | USE iscplrst ! ice sheet coupling |
---|
[7646] | 30 | USE wet_dry ! wetting and drying (needed for wad_istate) |
---|
| 31 | USE usrdef_istate ! User defined initial state |
---|
[4990] | 32 | ! |
---|
| 33 | USE in_out_manager ! I/O manager |
---|
| 34 | USE iom ! I/O library |
---|
[2715] | 35 | USE lib_mpp ! MPP library |
---|
[3680] | 36 | USE restart ! restart |
---|
[2715] | 37 | |
---|
[3] | 38 | IMPLICIT NONE |
---|
| 39 | PRIVATE |
---|
| 40 | |
---|
[508] | 41 | PUBLIC istate_init ! routine called by step.F90 |
---|
[3] | 42 | |
---|
| 43 | !! * Substitutions |
---|
| 44 | # include "vectopt_loop_substitute.h90" |
---|
| 45 | !!---------------------------------------------------------------------- |
---|
[9598] | 46 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
[888] | 47 | !! $Id$ |
---|
[10068] | 48 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
[3] | 49 | !!---------------------------------------------------------------------- |
---|
| 50 | CONTAINS |
---|
| 51 | |
---|
| 52 | SUBROUTINE istate_init |
---|
| 53 | !!---------------------------------------------------------------------- |
---|
| 54 | !! *** ROUTINE istate_init *** |
---|
| 55 | !! |
---|
[508] | 56 | !! ** Purpose : Initialization of the dynamics and tracer fields. |
---|
[3] | 57 | !!---------------------------------------------------------------------- |
---|
[7753] | 58 | INTEGER :: ji, jj, jk ! dummy loop indices |
---|
[9019] | 59 | !!gm see comment further down |
---|
| 60 | REAL(wp), ALLOCATABLE, DIMENSION(:,:,:,:) :: zuvd ! U & V data workspace |
---|
| 61 | !!gm end |
---|
[3294] | 62 | !!---------------------------------------------------------------------- |
---|
| 63 | ! |
---|
[5836] | 64 | IF(lwp) WRITE(numout,*) |
---|
[7646] | 65 | IF(lwp) WRITE(numout,*) 'istate_init : Initialization of the dynamics and tracers' |
---|
| 66 | IF(lwp) WRITE(numout,*) '~~~~~~~~~~~' |
---|
[3] | 67 | |
---|
[7646] | 68 | !!gm Why not include in the first call of dta_tsd ? |
---|
| 69 | !!gm probably associated with the use of internal damping... |
---|
[5836] | 70 | CALL dta_tsd_init ! Initialisation of T & S input data |
---|
[7646] | 71 | !!gm to be moved in usrdef of C1D case |
---|
| 72 | ! IF( lk_c1d ) CALL dta_uvd_init ! Initialization of U & V input data |
---|
| 73 | !!gm |
---|
[3] | 74 | |
---|
[7753] | 75 | rhd (:,:,: ) = 0._wp ; rhop (:,:,: ) = 0._wp ! set one for all to 0 at level jpk |
---|
| 76 | rn2b (:,:,: ) = 0._wp ; rn2 (:,:,: ) = 0._wp ! set one for all to 0 at levels 1 and jpk |
---|
| 77 | tsa (:,:,:,:) = 0._wp ! set one for all to 0 at level jpk |
---|
| 78 | rab_b(:,:,:,:) = 0._wp ; rab_n(:,:,:,:) = 0._wp ! set one for all to 0 at level jpk |
---|
[9453] | 79 | #if defined key_agrif |
---|
[9570] | 80 | ua (:,:,: ) = 0._wp ! used in agrif_oce_sponge at initialization |
---|
| 81 | va (:,:,: ) = 0._wp ! used in agrif_oce_sponge at initialization |
---|
[9453] | 82 | #endif |
---|
[7753] | 83 | |
---|
[15] | 84 | IF( ln_rstart ) THEN ! Restart from a file |
---|
[3] | 85 | ! ! ------------------- |
---|
[6140] | 86 | CALL rst_read ! Read the restart file |
---|
[7646] | 87 | IF (ln_iscpl) CALL iscpl_stp ! extrapolate restart to wet and dry |
---|
[6140] | 88 | CALL day_init ! model calendar (using both namelist and restart infos) |
---|
[7646] | 89 | ! |
---|
| 90 | ELSE ! Start from rest |
---|
[3] | 91 | ! ! --------------- |
---|
[7646] | 92 | numror = 0 ! define numror = 0 -> no restart file to read |
---|
| 93 | neuler = 0 ! Set time-step indicator at nit000 (euler forward) |
---|
| 94 | CALL day_init ! model calendar (using both namelist and restart infos) |
---|
| 95 | ! ! Initialization of ocean to zero |
---|
[508] | 96 | ! |
---|
[7646] | 97 | IF( ln_tsd_init ) THEN |
---|
| 98 | CALL dta_tsd( nit000, tsb ) ! read 3D T and S data at nit000 |
---|
| 99 | ! |
---|
[7753] | 100 | sshb(:,:) = 0._wp ! set the ocean at rest |
---|
[10499] | 101 | IF( ll_wd ) THEN |
---|
| 102 | sshb(:,:) = -ssh_ref ! Added in 30 here for bathy that adds 30 as Iterative test CEOD |
---|
| 103 | ! |
---|
| 104 | ! Apply minimum wetdepth criterion |
---|
| 105 | ! |
---|
| 106 | DO jj = 1,jpj |
---|
| 107 | DO ji = 1,jpi |
---|
| 108 | IF( ht_0(ji,jj) + sshb(ji,jj) < rn_wdmin1 ) THEN |
---|
| 109 | sshb(ji,jj) = tmask(ji,jj,1)*( rn_wdmin1 - (ht_0(ji,jj)) ) |
---|
| 110 | ENDIF |
---|
| 111 | END DO |
---|
| 112 | END DO |
---|
| 113 | ENDIF |
---|
[7753] | 114 | ub (:,:,:) = 0._wp |
---|
| 115 | vb (:,:,:) = 0._wp |
---|
[7646] | 116 | ! |
---|
| 117 | ELSE ! user defined initial T and S |
---|
| 118 | CALL usr_def_istate( gdept_b, tmask, tsb, ub, vb, sshb ) |
---|
[3] | 119 | ENDIF |
---|
[7753] | 120 | tsn (:,:,:,:) = tsb (:,:,:,:) ! set now values from to before ones |
---|
| 121 | sshn (:,:) = sshb(:,:) |
---|
| 122 | un (:,:,:) = ub (:,:,:) |
---|
| 123 | vn (:,:,:) = vb (:,:,:) |
---|
[7646] | 124 | |
---|
| 125 | !!gm POTENTIAL BUG : |
---|
| 126 | !!gm ISSUE : if sshb /= 0 then, in non linear free surface, the e3._n, e3._b should be recomputed |
---|
| 127 | !! as well as gdept and gdepw.... !!!!! |
---|
| 128 | !! ===>>>> probably a call to domvvl initialisation here.... |
---|
| 129 | |
---|
| 130 | |
---|
[6140] | 131 | ! |
---|
[7646] | 132 | !!gm to be moved in usrdef of C1D case |
---|
| 133 | ! IF ( ln_uvd_init .AND. lk_c1d ) THEN ! read 3D U and V data at nit000 |
---|
[9019] | 134 | ! ALLOCATE( zuvd(jpi,jpj,jpk,2) ) |
---|
[7646] | 135 | ! CALL dta_uvd( nit000, zuvd ) |
---|
| 136 | ! ub(:,:,:) = zuvd(:,:,:,1) ; un(:,:,:) = ub(:,:,:) |
---|
| 137 | ! vb(:,:,:) = zuvd(:,:,:,2) ; vn(:,:,:) = vb(:,:,:) |
---|
[9019] | 138 | ! DEALLOCATE( zuvd ) |
---|
[7646] | 139 | ! ENDIF |
---|
| 140 | ! |
---|
[6140] | 141 | !!gm This is to be changed !!!! |
---|
[7646] | 142 | ! ! - ML - sshn could be modified by istate_eel, so that initialization of e3t_b is done here |
---|
| 143 | ! IF( .NOT.ln_linssh ) THEN |
---|
| 144 | ! DO jk = 1, jpk |
---|
| 145 | ! e3t_b(:,:,jk) = e3t_n(:,:,jk) |
---|
| 146 | ! END DO |
---|
| 147 | ! ENDIF |
---|
[6140] | 148 | !!gm |
---|
[2148] | 149 | ! |
---|
[7646] | 150 | ENDIF |
---|
[4354] | 151 | ! |
---|
| 152 | ! Initialize "now" and "before" barotropic velocities: |
---|
[6140] | 153 | ! Do it whatever the free surface method, these arrays being eventually used |
---|
[4354] | 154 | ! |
---|
[7753] | 155 | un_b(:,:) = 0._wp ; vn_b(:,:) = 0._wp |
---|
| 156 | ub_b(:,:) = 0._wp ; vb_b(:,:) = 0._wp |
---|
[4354] | 157 | ! |
---|
[7646] | 158 | !!gm the use of umsak & vmask is not necessary below as un, vn, ub, vb are always masked |
---|
[4354] | 159 | DO jk = 1, jpkm1 |
---|
| 160 | DO jj = 1, jpj |
---|
| 161 | DO ji = 1, jpi |
---|
[6140] | 162 | un_b(ji,jj) = un_b(ji,jj) + e3u_n(ji,jj,jk) * un(ji,jj,jk) * umask(ji,jj,jk) |
---|
| 163 | vn_b(ji,jj) = vn_b(ji,jj) + e3v_n(ji,jj,jk) * vn(ji,jj,jk) * vmask(ji,jj,jk) |
---|
[4354] | 164 | ! |
---|
[6140] | 165 | ub_b(ji,jj) = ub_b(ji,jj) + e3u_b(ji,jj,jk) * ub(ji,jj,jk) * umask(ji,jj,jk) |
---|
| 166 | vb_b(ji,jj) = vb_b(ji,jj) + e3v_b(ji,jj,jk) * vb(ji,jj,jk) * vmask(ji,jj,jk) |
---|
[4354] | 167 | END DO |
---|
| 168 | END DO |
---|
| 169 | END DO |
---|
| 170 | ! |
---|
[7753] | 171 | un_b(:,:) = un_b(:,:) * r1_hu_n(:,:) |
---|
| 172 | vn_b(:,:) = vn_b(:,:) * r1_hv_n(:,:) |
---|
[4354] | 173 | ! |
---|
[7753] | 174 | ub_b(:,:) = ub_b(:,:) * r1_hu_b(:,:) |
---|
| 175 | vb_b(:,:) = vb_b(:,:) * r1_hv_b(:,:) |
---|
| 176 | ! |
---|
[3] | 177 | END SUBROUTINE istate_init |
---|
| 178 | |
---|
[7646] | 179 | !!====================================================================== |
---|
[3] | 180 | END MODULE istate |
---|