[12] | 1 | MODULE etat0_mod |
---|
[199] | 2 | USE icosa |
---|
[344] | 3 | IMPLICIT NONE |
---|
[199] | 4 | PRIVATE |
---|
| 5 | |
---|
[149] | 6 | CHARACTER(len=255),SAVE :: etat0_type |
---|
[186] | 7 | !$OMP THREADPRIVATE(etat0_type) |
---|
[12] | 8 | |
---|
[199] | 9 | REAL(rstd) :: etat0_temp |
---|
| 10 | |
---|
| 11 | PUBLIC :: etat0, etat0_type |
---|
| 12 | |
---|
[17] | 13 | CONTAINS |
---|
| 14 | |
---|
[366] | 15 | SUBROUTINE etat0(f_ps,f_mass,f_phis,f_theta_rhodz,f_u, f_geopot,f_w, f_q) |
---|
[192] | 16 | USE mpipara, ONLY : is_mpi_root |
---|
[159] | 17 | USE disvert_mod |
---|
[345] | 18 | ! Generic interface |
---|
[344] | 19 | USE etat0_dcmip1_mod, ONLY : getin_etat0_dcmip1=>getin_etat0 |
---|
| 20 | USE etat0_dcmip2_mod, ONLY : getin_etat0_dcmip2=>getin_etat0 |
---|
[346] | 21 | USE etat0_dcmip4_mod, ONLY : getin_etat0_dcmip4=>getin_etat0 |
---|
[203] | 22 | USE etat0_dcmip5_mod, ONLY : getin_etat0_dcmip5=>getin_etat0 |
---|
[377] | 23 | USE etat0_bubble_mod, ONLY : getin_etat0_bubble=>getin_etat0 |
---|
[204] | 24 | USE etat0_williamson_mod, ONLY : getin_etat0_williamson=>getin_etat0 |
---|
[327] | 25 | USE etat0_temperature_mod, ONLY: getin_etat0_temperature=>getin_etat0 |
---|
[345] | 26 | ! Ad hoc interfaces |
---|
[54] | 27 | USE etat0_academic_mod, ONLY : etat0_academic=>etat0 |
---|
[149] | 28 | USE etat0_heldsz_mod, ONLY : etat0_heldsz=>etat0 |
---|
[325] | 29 | USE etat0_venus_mod, ONLY : etat0_venus=>etat0 |
---|
[266] | 30 | USE etat0_start_file_mod, ONLY : etat0_start_file=>etat0 |
---|
[149] | 31 | |
---|
[54] | 32 | IMPLICIT NONE |
---|
[17] | 33 | TYPE(t_field),POINTER :: f_ps(:) |
---|
[159] | 34 | TYPE(t_field),POINTER :: f_mass(:) |
---|
[17] | 35 | TYPE(t_field),POINTER :: f_phis(:) |
---|
| 36 | TYPE(t_field),POINTER :: f_theta_rhodz(:) |
---|
| 37 | TYPE(t_field),POINTER :: f_u(:) |
---|
[366] | 38 | TYPE(t_field),POINTER :: f_geopot(:) |
---|
| 39 | TYPE(t_field),POINTER :: f_w(:) |
---|
[17] | 40 | TYPE(t_field),POINTER :: f_q(:) |
---|
[186] | 41 | |
---|
[159] | 42 | REAL(rstd),POINTER :: ps(:), mass(:,:) |
---|
[366] | 43 | LOGICAL :: autoinit_mass, autoinit_geopot, collocated |
---|
[159] | 44 | INTEGER :: ind,i,j,ij,l |
---|
| 45 | |
---|
| 46 | ! most etat0 routines set ps and not mass |
---|
| 47 | ! in that case and if caldyn_eta == eta_lag |
---|
| 48 | ! the initial distribution of mass is taken to be the same |
---|
| 49 | ! as what the mass coordinate would dictate |
---|
[366] | 50 | ! however if etat0_XXX defines mass then the flag autoinit_mass must be set to .FALSE. |
---|
[159] | 51 | ! otherwise mass will be overwritten |
---|
[366] | 52 | autoinit_mass = (caldyn_eta == eta_lag) |
---|
[159] | 53 | |
---|
[17] | 54 | etat0_type='jablonowsky06' |
---|
| 55 | CALL getin("etat0",etat0_type) |
---|
| 56 | |
---|
[345] | 57 | !------------------- Generic interface --------------------- |
---|
[344] | 58 | collocated=.TRUE. |
---|
[17] | 59 | SELECT CASE (TRIM(etat0_type)) |
---|
[199] | 60 | CASE ('isothermal') |
---|
| 61 | CALL getin_etat0_isothermal |
---|
[327] | 62 | CASE ('temperature_profile') |
---|
| 63 | CALL getin_etat0_temperature |
---|
[203] | 64 | CASE ('jablonowsky06') |
---|
[344] | 65 | CASE ('dcmip1') |
---|
| 66 | CALL getin_etat0_dcmip1 |
---|
| 67 | CASE ('dcmip2_mountain','dcmip2_schaer_noshear','dcmip2_schaer_shear') |
---|
| 68 | CALL getin_etat0_dcmip2 |
---|
[345] | 69 | CASE ('dcmip3') |
---|
[346] | 70 | CASE ('dcmip4') |
---|
| 71 | CALL getin_etat0_dcmip4 |
---|
[344] | 72 | CASE ('dcmip5') |
---|
[203] | 73 | CALL getin_etat0_dcmip5 |
---|
[377] | 74 | CASE ('bubble') |
---|
| 75 | CALL getin_etat0_bubble |
---|
[168] | 76 | CASE ('williamson91.6') |
---|
[366] | 77 | autoinit_mass=.FALSE. |
---|
[204] | 78 | CALL getin_etat0_williamson |
---|
[344] | 79 | CASE DEFAULT |
---|
| 80 | collocated=.FALSE. |
---|
[366] | 81 | autoinit_mass = .FALSE. |
---|
[344] | 82 | END SELECT |
---|
| 83 | |
---|
[345] | 84 | !------------------- Ad hoc interfaces -------------------- |
---|
[344] | 85 | SELECT CASE (TRIM(etat0_type)) |
---|
[266] | 86 | CASE ('start_file') |
---|
| 87 | CALL etat0_start_file(f_ps,f_phis,f_theta_rhodz,f_u, f_q) |
---|
[54] | 88 | CASE ('academic') |
---|
| 89 | CALL etat0_academic(f_ps,f_phis,f_theta_rhodz,f_u, f_q) |
---|
[170] | 90 | CASE ('held_suarez') |
---|
| 91 | PRINT *,"Held & Suarez (1994) test case" |
---|
[149] | 92 | CALL etat0_heldsz(f_ps,f_phis,f_theta_rhodz,f_u, f_q) |
---|
[325] | 93 | CASE ('venus') |
---|
| 94 | CALL etat0_venus(f_ps, f_phis, f_theta_rhodz, f_u, f_q) |
---|
| 95 | PRINT *, "Venus (Lebonnois et al., 2012) test case" |
---|
[62] | 96 | CASE DEFAULT |
---|
[344] | 97 | IF(collocated) THEN |
---|
[366] | 98 | CALL etat0_collocated(f_phis,f_ps,f_mass,f_theta_rhodz,f_u, f_geopot,f_W, f_q) |
---|
[344] | 99 | ELSE |
---|
| 100 | PRINT*, 'Bad selector for variable etat0 <',etat0_type, & |
---|
[377] | 101 | '> options are <isothermal>, <temperature_profile>, <held_suarez>, & |
---|
| 102 | &<bubble>, <venus>, <jablonowsky06>, <academic>, <dcmip[1-4]> ' |
---|
[344] | 103 | STOP |
---|
| 104 | END IF |
---|
[54] | 105 | END SELECT |
---|
[159] | 106 | |
---|
[186] | 107 | ! !$OMP BARRIER |
---|
[366] | 108 | IF(autoinit_mass) THEN |
---|
[159] | 109 | DO ind=1,ndomain |
---|
[186] | 110 | IF (.NOT. assigned_domain(ind)) CYCLE |
---|
[159] | 111 | CALL swap_dimensions(ind) |
---|
| 112 | CALL swap_geometry(ind) |
---|
| 113 | mass=f_mass(ind); ps=f_ps(ind) |
---|
[366] | 114 | CALL compute_rhodz(.TRUE., ps, mass) ! initialize mass distribution using ps |
---|
[159] | 115 | END DO |
---|
| 116 | END IF |
---|
[366] | 117 | |
---|
[54] | 118 | END SUBROUTINE etat0 |
---|
[199] | 119 | |
---|
[366] | 120 | SUBROUTINE etat0_collocated(f_phis,f_ps,f_mass,f_theta_rhodz,f_u, f_geopot,f_W, f_q) |
---|
[295] | 121 | USE theta2theta_rhodz_mod |
---|
[199] | 122 | IMPLICIT NONE |
---|
| 123 | TYPE(t_field),POINTER :: f_ps(:) |
---|
| 124 | TYPE(t_field),POINTER :: f_mass(:) |
---|
| 125 | TYPE(t_field),POINTER :: f_phis(:) |
---|
| 126 | TYPE(t_field),POINTER :: f_theta_rhodz(:) |
---|
| 127 | TYPE(t_field),POINTER :: f_u(:) |
---|
[366] | 128 | TYPE(t_field),POINTER :: f_geopot(:) |
---|
| 129 | TYPE(t_field),POINTER :: f_W(:) |
---|
[199] | 130 | TYPE(t_field),POINTER :: f_q(:) |
---|
| 131 | |
---|
[321] | 132 | TYPE(t_field),POINTER,SAVE :: f_temp(:) |
---|
[199] | 133 | REAL(rstd),POINTER :: ps(:) |
---|
| 134 | REAL(rstd),POINTER :: mass(:,:) |
---|
| 135 | REAL(rstd),POINTER :: phis(:) |
---|
| 136 | REAL(rstd),POINTER :: theta_rhodz(:,:) |
---|
[295] | 137 | REAL(rstd),POINTER :: temp(:,:) |
---|
[199] | 138 | REAL(rstd),POINTER :: u(:,:) |
---|
[366] | 139 | REAL(rstd),POINTER :: geopot(:,:) |
---|
| 140 | REAL(rstd),POINTER :: W(:,:) |
---|
[199] | 141 | REAL(rstd),POINTER :: q(:,:,:) |
---|
| 142 | INTEGER :: ind |
---|
| 143 | |
---|
[321] | 144 | CALL allocate_field(f_temp,field_t,type_real,llm,name='temp') |
---|
| 145 | |
---|
[199] | 146 | DO ind=1,ndomain |
---|
| 147 | IF (.NOT. assigned_domain(ind)) CYCLE |
---|
| 148 | CALL swap_dimensions(ind) |
---|
| 149 | CALL swap_geometry(ind) |
---|
| 150 | ps=f_ps(ind) |
---|
| 151 | mass=f_mass(ind) |
---|
| 152 | phis=f_phis(ind) |
---|
| 153 | theta_rhodz=f_theta_rhodz(ind) |
---|
[295] | 154 | temp=f_temp(ind) |
---|
[199] | 155 | u=f_u(ind) |
---|
[366] | 156 | geopot=f_geopot(ind) |
---|
| 157 | w=f_w(ind) |
---|
[199] | 158 | q=f_q(ind) |
---|
[295] | 159 | |
---|
[366] | 160 | IF( TRIM(etat0_type)=='williamson91.6' ) THEN |
---|
| 161 | CALL compute_etat0_collocated(ps,mass, phis, theta_rhodz, u, geopot, W, q) |
---|
[295] | 162 | ELSE |
---|
[366] | 163 | CALL compute_etat0_collocated(ps,mass, phis, temp, u, geopot, W, q) |
---|
[295] | 164 | ENDIF |
---|
[199] | 165 | ENDDO |
---|
[295] | 166 | |
---|
| 167 | IF( TRIM(etat0_type)/='williamson91.6' ) CALL temperature2theta_rhodz(f_ps,f_temp,f_theta_rhodz) |
---|
| 168 | |
---|
[321] | 169 | CALL deallocate_field(f_temp) |
---|
[295] | 170 | |
---|
[199] | 171 | END SUBROUTINE etat0_collocated |
---|
| 172 | |
---|
[366] | 173 | SUBROUTINE compute_etat0_collocated(ps,mass,phis,temp_i,u, geopot,W, q) |
---|
[199] | 174 | USE wind_mod |
---|
[366] | 175 | USE disvert_mod |
---|
[203] | 176 | USE etat0_jablonowsky06_mod, ONLY : compute_jablonowsky06 => compute_etat0 |
---|
[344] | 177 | USE etat0_dcmip1_mod, ONLY : compute_dcmip1 => compute_etat0 |
---|
| 178 | USE etat0_dcmip2_mod, ONLY : compute_dcmip2 => compute_etat0 |
---|
[345] | 179 | USE etat0_dcmip3_mod, ONLY : compute_dcmip3 => compute_etat0 |
---|
[346] | 180 | USE etat0_dcmip4_mod, ONLY : compute_dcmip4 => compute_etat0 |
---|
[203] | 181 | USE etat0_dcmip5_mod, ONLY : compute_dcmip5 => compute_etat0 |
---|
[377] | 182 | USE etat0_bubble_mod, ONLY : compute_bubble => compute_etat0 |
---|
[204] | 183 | USE etat0_williamson_mod, ONLY : compute_w91_6 => compute_etat0 |
---|
[327] | 184 | USE etat0_temperature_mod, ONLY: compute_etat0_temperature => compute_etat0 |
---|
[199] | 185 | IMPLICIT NONE |
---|
| 186 | REAL(rstd),INTENT(INOUT) :: ps(iim*jjm) |
---|
| 187 | REAL(rstd),INTENT(INOUT) :: mass(iim*jjm,llm) |
---|
| 188 | REAL(rstd),INTENT(OUT) :: phis(iim*jjm) |
---|
[295] | 189 | REAL(rstd),INTENT(OUT) :: temp_i(iim*jjm,llm) |
---|
[199] | 190 | REAL(rstd),INTENT(OUT) :: u(3*iim*jjm,llm) |
---|
[366] | 191 | REAL(rstd),INTENT(OUT) :: W(iim*jjm,llm+1) |
---|
| 192 | REAL(rstd),INTENT(OUT) :: geopot(iim*jjm,llm+1) |
---|
[199] | 193 | REAL(rstd),INTENT(OUT) :: q(iim*jjm,llm,nqtot) |
---|
| 194 | |
---|
| 195 | REAL(rstd) :: ulon_i(iim*jjm,llm) |
---|
| 196 | REAL(rstd) :: ulat_i(iim*jjm,llm) |
---|
| 197 | |
---|
| 198 | REAL(rstd) :: ps_e(3*iim*jjm) |
---|
| 199 | REAL(rstd) :: mass_e(3*iim*jjm,llm) |
---|
| 200 | REAL(rstd) :: phis_e(3*iim*jjm) |
---|
| 201 | REAL(rstd) :: temp_e(3*iim*jjm,llm) |
---|
[366] | 202 | REAL(rstd) :: geopot_e(3*iim*jjm,llm+1) |
---|
[199] | 203 | REAL(rstd) :: ulon_e(3*iim*jjm,llm) |
---|
| 204 | REAL(rstd) :: ulat_e(3*iim*jjm,llm) |
---|
| 205 | REAL(rstd) :: q_e(3*iim*jjm,llm,nqtot) |
---|
| 206 | |
---|
| 207 | INTEGER :: l,i,j,ij |
---|
[366] | 208 | REAL :: p_ik, v_ik, mass_ik |
---|
| 209 | LOGICAL :: autoinit_mass, autoinit_NH |
---|
[199] | 210 | |
---|
[366] | 211 | ! For NH geopotential and vertical momentum must be initialized. |
---|
[377] | 212 | ! Unless autoinit_NH is set to .FALSE. , they will be initialized |
---|
[366] | 213 | ! to hydrostatic geopotential and zero |
---|
| 214 | autoinit_mass = .TRUE. |
---|
| 215 | autoinit_NH = .NOT. hydrostatic |
---|
| 216 | w(:,:) = 0 |
---|
| 217 | |
---|
[353] | 218 | !$OMP BARRIER |
---|
| 219 | |
---|
[199] | 220 | SELECT CASE (TRIM(etat0_type)) |
---|
| 221 | CASE ('isothermal') |
---|
[201] | 222 | CALL compute_etat0_isothermal(iim*jjm, phis, ps, temp_i, ulon_i, ulat_i, q) |
---|
| 223 | CALL compute_etat0_isothermal(3*iim*jjm, phis_e, ps_e, temp_e, ulon_e, ulat_e, q_e) |
---|
[327] | 224 | CASE ('temperature_profile') |
---|
| 225 | CALL compute_etat0_temperature(iim*jjm, phis, ps, temp_i, ulon_i, ulat_i, q) |
---|
| 226 | CALL compute_etat0_temperature(3*iim*jjm, phis_e, ps_e, temp_e, ulon_e, ulat_e, q_e) |
---|
[201] | 227 | CASE('jablonowsky06') |
---|
| 228 | CALL compute_jablonowsky06(iim*jjm,lon_i,lat_i, phis, ps, temp_i, ulon_i, ulat_i) |
---|
| 229 | CALL compute_jablonowsky06(3*iim*jjm,lon_e,lat_e, phis_e, ps_e, temp_e, ulon_e, ulat_e) |
---|
[344] | 230 | CASE('dcmip1') |
---|
| 231 | CALL compute_dcmip1(iim*jjm,lon_i,lat_i, phis, ps, temp_i, ulon_i, ulat_i, q) |
---|
| 232 | CALL compute_dcmip1(3*iim*jjm,lon_e,lat_e, phis_e, ps_e, temp_e, ulon_e, ulat_e, q_e) |
---|
| 233 | CASE ('dcmip2_mountain','dcmip2_schaer_noshear','dcmip2_schaer_shear') |
---|
| 234 | CALL compute_dcmip2(iim*jjm,lon_i,lat_i, phis, ps, temp_i, ulon_i, ulat_i) |
---|
| 235 | CALL compute_dcmip2(3*iim*jjm,lon_e,lat_e, phis_e, ps_e, temp_e, ulon_e, ulat_e) |
---|
[345] | 236 | CASE('dcmip3') |
---|
[366] | 237 | CALL compute_dcmip3(iim*jjm,lon_i,lat_i, phis, ps, temp_i, ulon_i, ulat_i, geopot, q) |
---|
| 238 | CALL compute_dcmip3(3*iim*jjm,lon_e,lat_e, phis_e, ps_e, temp_e, ulon_e, ulat_e, geopot_e, q_e) |
---|
| 239 | autoinit_NH = .FALSE. ! compute_dcmip3 initializes geopot |
---|
[346] | 240 | CASE('dcmip4') |
---|
| 241 | CALL compute_dcmip4(iim*jjm,lon_i,lat_i, phis, ps, temp_i, ulon_i, ulat_i, q) |
---|
| 242 | CALL compute_dcmip4(3*iim*jjm,lon_e,lat_e, phis_e, ps_e, temp_e, ulon_e, ulat_e, q_e) |
---|
[203] | 243 | CASE('dcmip5') |
---|
| 244 | CALL compute_dcmip5(iim*jjm,lon_i,lat_i, phis, ps, temp_i, ulon_i, ulat_i, q) |
---|
| 245 | CALL compute_dcmip5(3*iim*jjm,lon_e,lat_e, phis_e, ps_e, temp_e, ulon_e, ulat_e, q_e) |
---|
[377] | 246 | CASE('bubble') |
---|
| 247 | CALL compute_bubble(iim*jjm,lon_i,lat_i, phis, ps, temp_i, ulon_i, ulat_i, geopot, q) |
---|
| 248 | CALL compute_bubble(3*iim*jjm,lon_e,lat_e, phis_e, ps_e, temp_e, ulon_e, ulat_e, geopot_e, q_e) |
---|
| 249 | ! autoinit_NH = .FALSE. ! compute_bubble initializes geopot |
---|
[204] | 250 | CASE('williamson91.6') |
---|
[295] | 251 | CALL compute_w91_6(iim*jjm,lon_i,lat_i, phis, mass(:,1), temp_i(:,1), ulon_i(:,1), ulat_i(:,1)) |
---|
[204] | 252 | CALL compute_w91_6(3*iim*jjm,lon_e,lat_e, phis_e, mass_e(:,1), temp_e(:,1), ulon_e(:,1), ulat_e(:,1)) |
---|
[366] | 253 | autoinit_mass = .FALSE. ! do not overwrite mass |
---|
[199] | 254 | END SELECT |
---|
| 255 | |
---|
[366] | 256 | IF(autoinit_mass) CALL compute_rhodz(.TRUE., ps, mass) ! initialize mass distribution using ps |
---|
| 257 | IF(autoinit_NH) THEN |
---|
| 258 | geopot(:,1) = phis(:) ! surface geopotential |
---|
| 259 | DO l = 1, llm |
---|
| 260 | DO ij=1,iim*jjm |
---|
| 261 | ! hybrid pressure coordinate |
---|
| 262 | p_ik = ptop + mass_ak(l) + mass_bk(l)*ps(ij) |
---|
| 263 | mass_ik = (mass_dak(l) + mass_dbk(l)*ps(ij))/g |
---|
| 264 | ! v=R.T/p, R=kappa*cpp |
---|
| 265 | v_ik = kappa*cpp*temp_i(ij,l)/p_ik |
---|
| 266 | geopot(ij,l+1) = geopot(ij,l) + mass_ik*v_ik*g |
---|
| 267 | END DO |
---|
| 268 | END DO |
---|
| 269 | END IF |
---|
| 270 | |
---|
[353] | 271 | !$OMP BARRIER |
---|
| 272 | |
---|
[201] | 273 | CALL compute_wind_perp_from_lonlat_compound(ulon_e, ulat_e, u) |
---|
[199] | 274 | |
---|
[201] | 275 | END SUBROUTINE compute_etat0_collocated |
---|
| 276 | |
---|
[199] | 277 | !----------------------------- Resting isothermal state -------------------------------- |
---|
| 278 | |
---|
| 279 | SUBROUTINE getin_etat0_isothermal |
---|
[201] | 280 | etat0_temp=300 |
---|
| 281 | CALL getin("etat0_isothermal_temp",etat0_temp) |
---|
[199] | 282 | END SUBROUTINE getin_etat0_isothermal |
---|
| 283 | |
---|
| 284 | SUBROUTINE compute_etat0_isothermal(ngrid, phis, ps, temp, ulon, ulat, q) |
---|
| 285 | IMPLICIT NONE |
---|
| 286 | INTEGER, INTENT(IN) :: ngrid |
---|
| 287 | REAL(rstd),INTENT(OUT) :: phis(ngrid) |
---|
| 288 | REAL(rstd),INTENT(OUT) :: ps(ngrid) |
---|
| 289 | REAL(rstd),INTENT(OUT) :: temp(ngrid,llm) |
---|
| 290 | REAL(rstd),INTENT(OUT) :: ulon(ngrid,llm) |
---|
| 291 | REAL(rstd),INTENT(OUT) :: ulat(ngrid,llm) |
---|
| 292 | REAL(rstd),INTENT(OUT) :: q(ngrid,llm,nqtot) |
---|
| 293 | phis(:)=0 |
---|
| 294 | ps(:)=preff |
---|
| 295 | temp(:,:)=etat0_temp |
---|
| 296 | ulon(:,:)=0 |
---|
| 297 | ulat(:,:)=0 |
---|
| 298 | q(:,:,:)=0 |
---|
| 299 | END SUBROUTINE compute_etat0_isothermal |
---|
| 300 | |
---|
[12] | 301 | END MODULE etat0_mod |
---|