[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 |
---|
[6579] | 16 | !! 3.7 ! 2016-04 (S. Flavoni) change configuration's interface: |
---|
| 17 | !! read file or CALL usr_def module to compute initial state (example given for GYRE) |
---|
[508] | 18 | !!---------------------------------------------------------------------- |
---|
[3] | 19 | |
---|
| 20 | !!---------------------------------------------------------------------- |
---|
| 21 | !! istate_init : initial state setting |
---|
| 22 | !! istate_uvg : initial velocity in geostropic balance |
---|
| 23 | !!---------------------------------------------------------------------- |
---|
| 24 | USE oce ! ocean dynamics and active tracers |
---|
| 25 | USE dom_oce ! ocean space and time domain |
---|
[4245] | 26 | USE c1d ! 1D vertical configuration |
---|
[2104] | 27 | USE daymod ! calendar |
---|
| 28 | USE eosbn2 ! eq. of state, Brunt Vaisala frequency (eos routine) |
---|
[5836] | 29 | USE ldftra ! lateral physics: ocean active tracers |
---|
[3] | 30 | USE zdf_oce ! ocean vertical physics |
---|
| 31 | USE phycst ! physical constants |
---|
[3294] | 32 | USE dtatsd ! data temperature and salinity (dta_tsd routine) |
---|
[4245] | 33 | USE dtauvd ! data: U & V current (dta_uvd routine) |
---|
[593] | 34 | USE domvvl ! varying vertical mesh |
---|
[6140] | 35 | USE iscplrst ! ice sheet coupling |
---|
[6596] | 36 | USE usrdef ! User defined routine |
---|
[4990] | 37 | ! |
---|
| 38 | USE in_out_manager ! I/O manager |
---|
| 39 | USE iom ! I/O library |
---|
[2715] | 40 | USE lib_mpp ! MPP library |
---|
[3680] | 41 | USE restart ! restart |
---|
[3294] | 42 | USE wrk_nemo ! Memory allocation |
---|
| 43 | USE timing ! Timing |
---|
[2715] | 44 | |
---|
[3] | 45 | IMPLICIT NONE |
---|
| 46 | PRIVATE |
---|
| 47 | |
---|
[508] | 48 | PUBLIC istate_init ! routine called by step.F90 |
---|
[6579] | 49 | !SF PUBLIC ini_read ! subroutine ini_read |
---|
[3] | 50 | |
---|
| 51 | !! * Substitutions |
---|
| 52 | # include "vectopt_loop_substitute.h90" |
---|
| 53 | !!---------------------------------------------------------------------- |
---|
[4990] | 54 | !! NEMO/OPA 3.7 , NEMO Consortium (2014) |
---|
[888] | 55 | !! $Id$ |
---|
[2715] | 56 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
[3] | 57 | !!---------------------------------------------------------------------- |
---|
| 58 | CONTAINS |
---|
| 59 | |
---|
| 60 | SUBROUTINE istate_init |
---|
| 61 | !!---------------------------------------------------------------------- |
---|
| 62 | !! *** ROUTINE istate_init *** |
---|
| 63 | !! |
---|
[508] | 64 | !! ** Purpose : Initialization of the dynamics and tracer fields. |
---|
[3] | 65 | !!---------------------------------------------------------------------- |
---|
[5163] | 66 | INTEGER :: ji, jj, jk ! dummy loop indices |
---|
| 67 | REAL(wp), POINTER, DIMENSION(:,:,:,:) :: zuvd ! U & V data workspace |
---|
[3294] | 68 | !!---------------------------------------------------------------------- |
---|
| 69 | ! |
---|
[4990] | 70 | IF( nn_timing == 1 ) CALL timing_start('istate_init') |
---|
[3294] | 71 | ! |
---|
[3] | 72 | |
---|
[5836] | 73 | IF(lwp) WRITE(numout,*) |
---|
[508] | 74 | IF(lwp) WRITE(numout,*) 'istate_ini : Initialization of the dynamics and tracers' |
---|
| 75 | IF(lwp) WRITE(numout,*) '~~~~~~~~~~' |
---|
[3] | 76 | |
---|
[6579] | 77 | !SF initialisation of T & S with data file |
---|
[5836] | 78 | CALL dta_tsd_init ! Initialisation of T & S input data |
---|
| 79 | IF( lk_c1d ) CALL dta_uvd_init ! Initialization of U & V input data |
---|
[3] | 80 | |
---|
[5163] | 81 | rhd (:,:,: ) = 0._wp ; rhop (:,:,: ) = 0._wp ! set one for all to 0 at level jpk |
---|
| 82 | rn2b (:,:,: ) = 0._wp ; rn2 (:,:,: ) = 0._wp ! set one for all to 0 at levels 1 and jpk |
---|
| 83 | tsa (:,:,:,:) = 0._wp ! set one for all to 0 at level jpk |
---|
| 84 | rab_b(:,:,:,:) = 0._wp ; rab_n(:,:,:,:) = 0._wp ! set one for all to 0 at level jpk |
---|
[3294] | 85 | |
---|
[15] | 86 | IF( ln_rstart ) THEN ! Restart from a file |
---|
[3] | 87 | ! ! ------------------- |
---|
[6140] | 88 | CALL rst_read ! Read the restart file |
---|
| 89 | IF (ln_iscpl) CALL iscpl_stp ! extraloate restart to wet and dry |
---|
| 90 | CALL day_init ! model calendar (using both namelist and restart infos) |
---|
[3] | 91 | ELSE |
---|
| 92 | ! ! Start from rest |
---|
| 93 | ! ! --------------- |
---|
[6579] | 94 | numror = 0 ! define numror = 0 -> no restart file to read |
---|
| 95 | neuler = 0 ! Set time-step indicator at nit000 (euler forward) |
---|
| 96 | CALL day_init ! model calendar (using both namelist and restart infos) |
---|
| 97 | ! ! Initialization of ocean to zero |
---|
[3294] | 98 | ! before fields ! now fields |
---|
| 99 | sshb (:,:) = 0._wp ; sshn (:,:) = 0._wp |
---|
| 100 | ub (:,:,:) = 0._wp ; un (:,:,:) = 0._wp |
---|
| 101 | vb (:,:,:) = 0._wp ; vn (:,:,:) = 0._wp |
---|
[5836] | 102 | hdivn(:,:,:) = 0._wp |
---|
[508] | 103 | ! |
---|
[6579] | 104 | IF( ln_tsd_init ) THEN ! read 3D T and S data at nit000 |
---|
| 105 | CALL dta_tsd( nit000, tsb ) |
---|
| 106 | ELSE ! user defined initial T and S |
---|
| 107 | CALL usr_def_ini( tsb ) |
---|
[3] | 108 | ENDIF |
---|
[6579] | 109 | tsn(:,:,:,:) = tsb(:,:,:,:) ! set now to before values |
---|
[6140] | 110 | ! |
---|
[6579] | 111 | IF ( ln_uvd_init .AND. lk_c1d ) THEN ! read 3D U and V data at nit000 |
---|
| 112 | CALL wrk_alloc( jpi,jpj,jpk,2, zuvd ) |
---|
| 113 | CALL dta_uvd( nit000, zuvd ) |
---|
| 114 | ub(:,:,:) = zuvd(:,:,:,1) ; un(:,:,:) = ub(:,:,:) |
---|
| 115 | vb(:,:,:) = zuvd(:,:,:,2) ; vn(:,:,:) = vb(:,:,:) |
---|
| 116 | CALL wrk_dealloc( jpi,jpj,jpk,2, zuvd ) |
---|
| 117 | ENDIF |
---|
| 118 | ! |
---|
[6140] | 119 | !!gm This is to be changed !!!! |
---|
| 120 | ! - ML - sshn could be modified by istate_eel, so that initialization of e3t_b is done here |
---|
| 121 | IF( .NOT.ln_linssh ) THEN |
---|
[2148] | 122 | DO jk = 1, jpk |
---|
[6140] | 123 | e3t_b(:,:,jk) = e3t_n(:,:,jk) |
---|
[5836] | 124 | END DO |
---|
[2148] | 125 | ENDIF |
---|
[6140] | 126 | !!gm |
---|
[2148] | 127 | ! |
---|
[6579] | 128 | ENDIF |
---|
[4354] | 129 | ! |
---|
| 130 | ! Initialize "now" and "before" barotropic velocities: |
---|
[6140] | 131 | ! Do it whatever the free surface method, these arrays being eventually used |
---|
[4354] | 132 | ! |
---|
[5836] | 133 | un_b(:,:) = 0._wp ; vn_b(:,:) = 0._wp |
---|
| 134 | ub_b(:,:) = 0._wp ; vb_b(:,:) = 0._wp |
---|
[4354] | 135 | ! |
---|
[6596] | 136 | !!gm the use of umsak & vmask is not necessary below as un, vn, ub, vb are always masked |
---|
[4354] | 137 | DO jk = 1, jpkm1 |
---|
| 138 | DO jj = 1, jpj |
---|
| 139 | DO ji = 1, jpi |
---|
[6140] | 140 | un_b(ji,jj) = un_b(ji,jj) + e3u_n(ji,jj,jk) * un(ji,jj,jk) * umask(ji,jj,jk) |
---|
| 141 | vn_b(ji,jj) = vn_b(ji,jj) + e3v_n(ji,jj,jk) * vn(ji,jj,jk) * vmask(ji,jj,jk) |
---|
[4354] | 142 | ! |
---|
[6140] | 143 | ub_b(ji,jj) = ub_b(ji,jj) + e3u_b(ji,jj,jk) * ub(ji,jj,jk) * umask(ji,jj,jk) |
---|
| 144 | vb_b(ji,jj) = vb_b(ji,jj) + e3v_b(ji,jj,jk) * vb(ji,jj,jk) * vmask(ji,jj,jk) |
---|
[4354] | 145 | END DO |
---|
| 146 | END DO |
---|
| 147 | END DO |
---|
| 148 | ! |
---|
[6140] | 149 | un_b(:,:) = un_b(:,:) * r1_hu_n(:,:) |
---|
| 150 | vn_b(:,:) = vn_b(:,:) * r1_hv_n(:,:) |
---|
[4354] | 151 | ! |
---|
[6140] | 152 | ub_b(:,:) = ub_b(:,:) * r1_hu_b(:,:) |
---|
| 153 | vb_b(:,:) = vb_b(:,:) * r1_hv_b(:,:) |
---|
[4354] | 154 | ! |
---|
[4990] | 155 | IF( nn_timing == 1 ) CALL timing_stop('istate_init') |
---|
[3294] | 156 | ! |
---|
[3] | 157 | END SUBROUTINE istate_init |
---|
| 158 | |
---|
[6596] | 159 | !!====================================================================== |
---|
[3] | 160 | END MODULE istate |
---|