[354] | 1 | MODULE observable_mod |
---|
| 2 | USE icosa |
---|
[732] | 3 | USE caldyn_vars_mod |
---|
[603] | 4 | USE diagflux_mod |
---|
| 5 | USE output_field_mod |
---|
[354] | 6 | IMPLICIT NONE |
---|
| 7 | PRIVATE |
---|
| 8 | |
---|
[374] | 9 | TYPE(t_field),POINTER, SAVE :: f_buf_i(:), & |
---|
[579] | 10 | f_buf_Fel(:), f_buf_uh(:), & ! horizontal velocity, different from prognostic velocity if NH |
---|
[598] | 11 | f_buf_ulon(:), f_buf_ulat(:) |
---|
[354] | 12 | TYPE(t_field),POINTER, SAVE :: f_buf_v(:), f_buf_s(:), f_buf_p(:) |
---|
[397] | 13 | TYPE(t_field),POINTER, SAVE :: f_pmid(:) |
---|
[354] | 14 | |
---|
| 15 | ! temporary shared variable for caldyn |
---|
| 16 | TYPE(t_field),POINTER, SAVE :: f_theta(:) |
---|
| 17 | |
---|
[714] | 18 | PUBLIC init_observable, write_output_fields_basic, & |
---|
| 19 | f_theta, f_buf_i, f_buf_ulon, f_buf_ulat |
---|
[413] | 20 | |
---|
[354] | 21 | CONTAINS |
---|
| 22 | |
---|
| 23 | SUBROUTINE init_observable |
---|
| 24 | CALL allocate_field(f_buf_i, field_t,type_real,llm,name="buffer_i") |
---|
| 25 | CALL allocate_field(f_buf_p, field_t,type_real,llm+1) |
---|
| 26 | CALL allocate_field(f_buf_ulon,field_t,type_real,llm, name="buf_ulon") |
---|
| 27 | CALL allocate_field(f_buf_ulat,field_t,type_real,llm, name="buf_ulat") |
---|
[374] | 28 | CALL allocate_field(f_buf_uh, field_u,type_real,llm, name="buf_uh") |
---|
[579] | 29 | CALL allocate_field(f_buf_Fel, field_u,type_real,llm+1, name="buf_F_el") |
---|
[374] | 30 | CALL allocate_field(f_buf_v, field_z,type_real,llm, name="buf_v") |
---|
| 31 | CALL allocate_field(f_buf_s, field_t,type_real, name="buf_s") |
---|
[354] | 32 | |
---|
[404] | 33 | CALL allocate_field(f_theta, field_t,type_real,llm,nqdyn, name='theta') ! potential temperature |
---|
| 34 | CALL allocate_field(f_pmid, field_t,type_real,llm, name='pmid') ! mid layer pressure |
---|
[354] | 35 | END SUBROUTINE init_observable |
---|
[413] | 36 | |
---|
| 37 | SUBROUTINE write_output_fields_basic(init, f_phis, f_ps, f_mass, f_geopot, f_theta_rhodz, f_u, f_W, f_q) |
---|
[482] | 38 | USE xios_mod |
---|
[413] | 39 | USE disvert_mod |
---|
[354] | 40 | USE wind_mod |
---|
| 41 | USE omp_para |
---|
[397] | 42 | USE time_mod |
---|
[482] | 43 | USE xios_mod |
---|
[397] | 44 | USE earth_const |
---|
| 45 | USE pression_mod |
---|
| 46 | USE vertical_interp_mod |
---|
| 47 | USE theta2theta_rhodz_mod |
---|
| 48 | USE omega_mod |
---|
[728] | 49 | USE kinetic_mod |
---|
| 50 | |
---|
[413] | 51 | LOGICAL, INTENT(IN) :: init |
---|
| 52 | INTEGER :: l |
---|
[397] | 53 | REAL :: scalar(1) |
---|
| 54 | REAL :: mid_ap(llm) |
---|
| 55 | REAL :: mid_bp(llm) |
---|
| 56 | |
---|
[413] | 57 | TYPE(t_field),POINTER :: f_phis(:), f_ps(:), f_mass(:), f_geopot(:), f_theta_rhodz(:), f_u(:), f_W(:), f_q(:) |
---|
| 58 | ! IF (is_master) PRINT *,'CALL write_output_fields_basic' |
---|
[403] | 59 | |
---|
[417] | 60 | CALL transfert_request(f_ps,req_i1) |
---|
| 61 | |
---|
[413] | 62 | IF(init) THEN |
---|
[579] | 63 | IF(is_master) PRINT *, 'Creating output files ...' |
---|
[413] | 64 | scalar(1)=dt |
---|
[470] | 65 | IF (is_omp_master) CALL xios_send_field("timestep", scalar) |
---|
[413] | 66 | scalar(1)=preff |
---|
[470] | 67 | IF (is_omp_master) CALL xios_send_field("preff", scalar) |
---|
| 68 | IF (is_omp_master) CALL xios_send_field("ap",ap) |
---|
| 69 | IF (is_omp_master) CALL xios_send_field("bp",bp) |
---|
[413] | 70 | DO l=1,llm |
---|
| 71 | mid_ap(l)=(ap(l)+ap(l+1))/2 |
---|
| 72 | mid_bp(l)=(bp(l)+bp(l+1))/2 |
---|
| 73 | ENDDO |
---|
[470] | 74 | IF (is_omp_master) CALL xios_send_field("mid_ap",mid_ap) |
---|
| 75 | IF (is_omp_master) CALL xios_send_field("mid_bp",mid_bp) |
---|
[413] | 76 | |
---|
| 77 | CALL output_field("phis",f_phis) |
---|
[579] | 78 | CALL output_field("Ai",geom%Ai) |
---|
| 79 | IF(is_master) PRINT *, '... done creating output files. Writing initial condition ...' |
---|
[413] | 80 | END IF |
---|
| 81 | |
---|
| 82 | IF(nqdyn>1) THEN |
---|
| 83 | CALL divide_by_mass(2, f_mass, f_theta_rhodz, f_buf_i) |
---|
| 84 | IF(init) THEN |
---|
| 85 | CALL output_field("dyn_q_init",f_buf_i) |
---|
| 86 | ELSE |
---|
| 87 | CALL output_field("dyn_q",f_buf_i) |
---|
| 88 | END IF |
---|
| 89 | END IF |
---|
| 90 | |
---|
[529] | 91 | CALL divide_by_mass(1, f_mass, f_theta_rhodz, f_buf_i) |
---|
| 92 | IF(init) THEN |
---|
| 93 | CALL output_field("theta_init",f_buf_i) |
---|
| 94 | ELSE |
---|
| 95 | CALL output_field("theta",f_buf_i) |
---|
| 96 | END IF |
---|
[434] | 97 | |
---|
[529] | 98 | CALL pression_mid(f_ps, f_pmid) |
---|
| 99 | CALL diagnose_temperature(f_pmid, f_q, f_buf_i) ! f_buf_i : IN = theta, out = T |
---|
| 100 | |
---|
[413] | 101 | IF(init) THEN |
---|
| 102 | CALL output_field("temp_init",f_buf_i) |
---|
| 103 | ELSE |
---|
| 104 | CALL output_field("temp",f_buf_i) |
---|
[436] | 105 | CALL vertical_interp(f_pmid,f_buf_i,f_buf_s,85000.) |
---|
[413] | 106 | CALL output_field("t850",f_buf_s) |
---|
[436] | 107 | CALL vertical_interp(f_pmid,f_buf_i,f_buf_s,50000.) |
---|
[413] | 108 | CALL output_field("t500",f_buf_s) |
---|
[436] | 109 | CALL vertical_interp(f_pmid,f_buf_i,f_buf_s,preff) |
---|
[413] | 110 | CALL output_field("SST",f_buf_s) |
---|
| 111 | END IF |
---|
[397] | 112 | |
---|
[374] | 113 | CALL progonostic_vel_to_horiz(f_geopot, f_ps, f_mass, f_u, f_W, f_buf_uh, f_buf_i) |
---|
| 114 | CALL transfert_request(f_buf_uh,req_e1_vect) |
---|
| 115 | CALL un2ulonlat(f_buf_uh, f_buf_ulon, f_buf_ulat) |
---|
[413] | 116 | IF(init) THEN |
---|
| 117 | CALL output_field("uz_init",f_buf_i) |
---|
| 118 | CALL output_field("ulon_init",f_buf_ulon) |
---|
| 119 | CALL output_field("ulat_init",f_buf_ulat) |
---|
| 120 | CALL output_field("p_init",f_pmid) |
---|
| 121 | CALL output_field("ps_init",f_ps) |
---|
| 122 | CALL output_field("mass_init",f_mass) |
---|
| 123 | CALL output_field("geopot_init",f_geopot) |
---|
| 124 | CALL output_field("q_init",f_q) |
---|
[579] | 125 | IF(is_master) PRINT *, 'Done writing initial condition ...' |
---|
[413] | 126 | ELSE |
---|
| 127 | CALL output_field("uz",f_buf_i) |
---|
| 128 | CALL output_field("ulon",f_buf_ulon) |
---|
| 129 | CALL output_field("ulat",f_buf_ulat) |
---|
| 130 | CALL output_field("p",f_pmid) |
---|
| 131 | CALL output_field("ps",f_ps) |
---|
| 132 | CALL output_field("mass",f_mass) |
---|
| 133 | CALL output_field("geopot",f_geopot) |
---|
| 134 | CALL output_field("q",f_q) |
---|
[397] | 135 | |
---|
[413] | 136 | ! CALL output_field("exner",f_pk) |
---|
| 137 | ! CALL output_field("pv",f_qv) |
---|
| 138 | |
---|
[436] | 139 | CALL vertical_interp(f_pmid,f_buf_ulon,f_buf_s,85000.) |
---|
[413] | 140 | CALL output_field("u850",f_buf_s) |
---|
[436] | 141 | CALL vertical_interp(f_pmid,f_buf_ulon,f_buf_s,50000.) |
---|
[413] | 142 | CALL output_field("u500",f_buf_s) |
---|
| 143 | |
---|
[436] | 144 | CALL vertical_interp(f_pmid,f_buf_ulat,f_buf_s,85000.) |
---|
[413] | 145 | CALL output_field("v850",f_buf_s) |
---|
[436] | 146 | CALL vertical_interp(f_pmid,f_buf_ulat,f_buf_s,50000.) |
---|
[413] | 147 | CALL output_field("v500",f_buf_s) |
---|
[397] | 148 | |
---|
[436] | 149 | CALL vertical_interp(f_pmid,f_buf_i,f_buf_s,85000.) |
---|
[413] | 150 | CALL output_field("w850",f_buf_s) |
---|
[436] | 151 | CALL vertical_interp(f_pmid,f_buf_i,f_buf_s,50000.) |
---|
[413] | 152 | CALL output_field("w500",f_buf_s) |
---|
[397] | 153 | |
---|
[413] | 154 | CALL w_omega(f_ps, f_u, f_buf_i) |
---|
| 155 | CALL output_field("omega",f_buf_i) |
---|
[436] | 156 | CALL vertical_interp(f_pmid,f_buf_i,f_buf_s,85000.) |
---|
[413] | 157 | CALL output_field("omega850",f_buf_s) |
---|
[436] | 158 | CALL vertical_interp(f_pmid,f_buf_i,f_buf_s,50000.) |
---|
[413] | 159 | CALL output_field("omega500",f_buf_s) |
---|
| 160 | END IF |
---|
[397] | 161 | |
---|
[728] | 162 | CALL kinetic(f_u, f_buf_i) |
---|
| 163 | IF(init) THEN |
---|
| 164 | CALL output_field("kinetic_trisk_init",f_buf_i) |
---|
| 165 | ELSE |
---|
| 166 | CALL output_field("kinetic_trisk",f_buf_i) |
---|
| 167 | END IF |
---|
| 168 | |
---|
| 169 | CALL kinetic_new(f_u, f_buf_v, f_buf_i) |
---|
| 170 | IF(init) THEN |
---|
| 171 | CALL output_field("kinetic_init",f_buf_i) |
---|
| 172 | ELSE |
---|
| 173 | CALL output_field("kinetic",f_buf_i) |
---|
| 174 | END IF |
---|
| 175 | |
---|
[588] | 176 | IF(.NOT. init) THEN |
---|
| 177 | IF(diagflux_on) THEN |
---|
[594] | 178 | CALL flux_centered_lonlat(1./(itau_out*dt) , f_massfluxt, f_buf_ulon, f_buf_ulat) |
---|
[592] | 179 | CALL output_field("mass_t", f_masst) |
---|
| 180 | CALL output_field("massflux_lon",f_buf_ulon) |
---|
| 181 | CALL output_field("massflux_lat",f_buf_ulat) |
---|
[595] | 182 | |
---|
[603] | 183 | CALL output_energyflux(f_ulont, f_ulonfluxt, "ulon_t", "ulonflux_lon", "ulonflux_lat") |
---|
| 184 | CALL output_energyflux(f_thetat, f_thetafluxt, "theta_t", "thetaflux_lon", "thetaflux_lat") |
---|
| 185 | CALL output_energyflux(f_epot, f_epotfluxt, "epot_t", "epotflux_lon", "epotflux_lat") |
---|
| 186 | CALL output_energyflux(f_ekin, f_ekinfluxt, "ekin_t", "ekinflux_lon", "ekinflux_lat") |
---|
| 187 | CALL output_energyflux(f_enthalpy, f_enthalpyfluxt, "enthalpy_t", "enthalpyflux_lon", "enthalpyflux_lat") |
---|
[595] | 188 | |
---|
[594] | 189 | CALL qflux_centered_lonlat(1./(itau_out*dt) , f_qfluxt, f_qfluxt_lon, f_qfluxt_lat) |
---|
| 190 | CALL output_field("qmass_t", f_qmasst) |
---|
[588] | 191 | CALL output_field("qflux_lon",f_qfluxt_lon) |
---|
| 192 | CALL output_field("qflux_lat",f_qfluxt_lat) |
---|
| 193 | CALL zero_qfluxt ! restart accumulating fluxes |
---|
| 194 | END IF |
---|
| 195 | END IF |
---|
[354] | 196 | END SUBROUTINE write_output_fields_basic |
---|
[603] | 197 | |
---|
| 198 | SUBROUTINE output_energyflux(f_energy, f_flux, name_energy, name_fluxlon, name_fluxlat) |
---|
| 199 | TYPE(t_field), POINTER :: f_energy(:), f_flux(:) |
---|
| 200 | CHARACTER(*), INTENT(IN) :: name_energy, name_fluxlon, name_fluxlat |
---|
| 201 | CALL transfert_request(f_flux,req_e1_vect) |
---|
| 202 | CALL flux_centered_lonlat(1./(itau_out*dt) , f_flux, f_buf_ulon, f_buf_ulat) |
---|
| 203 | CALL output_field(name_energy, f_energy) |
---|
| 204 | CALL output_field(name_fluxlon, f_buf_ulon) |
---|
| 205 | CALL output_field(name_fluxlat, f_buf_ulat) |
---|
| 206 | END SUBROUTINE output_energyflux |
---|
[354] | 207 | |
---|
[428] | 208 | !------------------- Conversion from prognostic to observable variables ------------------ |
---|
[354] | 209 | |
---|
[374] | 210 | SUBROUTINE progonostic_vel_to_horiz(f_geopot, f_ps, f_rhodz, f_u, f_W, f_uh, f_uz) |
---|
| 211 | USE disvert_mod |
---|
| 212 | TYPE(t_field), POINTER :: f_geopot(:), f_ps(:), f_rhodz(:), & |
---|
| 213 | f_u(:), f_W(:), f_uz(:), & ! IN |
---|
| 214 | f_uh(:) ! OUT |
---|
[579] | 215 | REAL(rstd),POINTER :: geopot(:,:), ps(:), rhodz(:,:), u(:,:), W(:,:), uh(:,:), uz(:,:), F_el(:,:) |
---|
[374] | 216 | INTEGER :: ind |
---|
| 217 | |
---|
| 218 | DO ind=1,ndomain |
---|
| 219 | IF (.NOT. assigned_domain(ind)) CYCLE |
---|
| 220 | CALL swap_dimensions(ind) |
---|
| 221 | CALL swap_geometry(ind) |
---|
| 222 | geopot = f_geopot(ind) |
---|
| 223 | rhodz = f_rhodz(ind) |
---|
| 224 | u = f_u(ind) |
---|
| 225 | W = f_W(ind) |
---|
| 226 | uh = f_uh(ind) |
---|
[579] | 227 | F_el = f_buf_Fel(ind) |
---|
[374] | 228 | IF(caldyn_eta==eta_mass) THEN |
---|
| 229 | ps=f_ps(ind) |
---|
| 230 | CALL compute_rhodz(.TRUE., ps, rhodz) |
---|
| 231 | END IF |
---|
| 232 | uz = f_uz(ind) |
---|
[579] | 233 | !$OMP BARRIER |
---|
| 234 | CALL compute_prognostic_vel_to_horiz(geopot,rhodz,u,W, F_el, uh,uz) |
---|
| 235 | !$OMP BARRIER |
---|
[374] | 236 | END DO |
---|
| 237 | END SUBROUTINE progonostic_vel_to_horiz |
---|
[354] | 238 | |
---|
[579] | 239 | SUBROUTINE compute_prognostic_vel_to_horiz(Phi, rhodz, u, W, F_el, uh, uz) |
---|
[374] | 240 | USE omp_para |
---|
| 241 | REAL(rstd), INTENT(IN) :: Phi(iim*jjm,llm+1) |
---|
| 242 | REAL(rstd), INTENT(IN) :: rhodz(iim*jjm,llm) |
---|
| 243 | REAL(rstd), INTENT(IN) :: u(3*iim*jjm,llm) |
---|
| 244 | REAL(rstd), INTENT(IN) :: W(iim*jjm,llm+1) |
---|
| 245 | REAL(rstd), INTENT(OUT) :: uh(3*iim*jjm,llm) |
---|
| 246 | REAL(rstd), INTENT(OUT) :: uz(iim*jjm,llm) |
---|
| 247 | INTEGER :: ij,l |
---|
| 248 | REAL(rstd) :: F_el(3*iim*jjm,llm+1) |
---|
| 249 | REAL(rstd) :: uu_right, uu_lup, uu_ldown, W_el, DePhil |
---|
[377] | 250 | ! NB : u and uh are not in DEC form, they are normal components |
---|
| 251 | ! => we must divide by de |
---|
[374] | 252 | IF(hydrostatic) THEN |
---|
| 253 | uh(:,:)=u(:,:) |
---|
| 254 | uz(:,:)=0. |
---|
| 255 | ELSE |
---|
| 256 | DO l=ll_begin, ll_endp1 ! compute on l levels (interfaces) |
---|
| 257 | DO ij=ij_begin_ext, ij_end_ext |
---|
| 258 | ! Compute on edge 'right' |
---|
| 259 | W_el = .5*( W(ij,l)+W(ij+t_right,l) ) |
---|
| 260 | DePhil = ne_right*(Phi(ij+t_right,l)-Phi(ij,l)) |
---|
[377] | 261 | F_el(ij+u_right,l) = DePhil*W_el/de(ij+u_right) |
---|
[374] | 262 | ! Compute on edge 'lup' |
---|
| 263 | W_el = .5*( W(ij,l)+W(ij+t_lup,l) ) |
---|
| 264 | DePhil = ne_lup*(Phi(ij+t_lup,l)-Phi(ij,l)) |
---|
[377] | 265 | F_el(ij+u_lup,l) = DePhil*W_el/de(ij+u_lup) |
---|
[374] | 266 | ! Compute on edge 'ldown' |
---|
| 267 | W_el = .5*( W(ij,l)+W(ij+t_ldown,l) ) |
---|
| 268 | DePhil = ne_ldown*(Phi(ij+t_ldown,l)-Phi(ij,l)) |
---|
[377] | 269 | F_el(ij+u_ldown,l) = DePhil*W_el/de(ij+u_ldown) |
---|
[374] | 270 | END DO |
---|
| 271 | END DO |
---|
| 272 | |
---|
[579] | 273 | ! We need a barrier here because we compute F_el above and do a vertical average below |
---|
| 274 | !$OMP BARRIER |
---|
| 275 | |
---|
[374] | 276 | DO l=ll_begin, ll_end ! compute on k levels (full levels) |
---|
| 277 | DO ij=ij_begin_ext, ij_end_ext |
---|
[377] | 278 | ! w = vertical momentum = g^-2*dPhi/dt = uz/g |
---|
[374] | 279 | uz(ij,l) = (.5*g)*(W(ij,l)+W(ij,l+1))/rhodz(ij,l) |
---|
| 280 | ! uh = u-w.grad(Phi) = u - uz.grad(z) |
---|
| 281 | uh(ij+u_right,l) = u(ij+u_right,l) - (F_el(ij+u_right,l)+F_el(ij+u_right,l+1)) / (rhodz(ij,l)+rhodz(ij+t_right,l)) |
---|
| 282 | uh(ij+u_lup,l) = u(ij+u_lup,l) - (F_el(ij+u_lup,l)+F_el(ij+u_lup,l+1)) / (rhodz(ij,l)+rhodz(ij+t_lup,l)) |
---|
| 283 | uh(ij+u_ldown,l) = u(ij+u_ldown,l) - (F_el(ij+u_ldown,l)+F_el(ij+u_ldown,l+1)) / (rhodz(ij,l)+rhodz(ij+t_ldown,l)) |
---|
| 284 | END DO |
---|
| 285 | END DO |
---|
| 286 | |
---|
| 287 | END IF |
---|
| 288 | END SUBROUTINE compute_prognostic_vel_to_horiz |
---|
| 289 | |
---|
[529] | 290 | SUBROUTINE diagnose_temperature(f_pmid,f_q,f_temp) |
---|
[434] | 291 | USE icosa |
---|
| 292 | USE pression_mod |
---|
| 293 | IMPLICIT NONE |
---|
[529] | 294 | TYPE(t_field), POINTER :: f_pmid(:) ! IN |
---|
[434] | 295 | TYPE(t_field), POINTER :: f_q(:) ! IN |
---|
[529] | 296 | TYPE(t_field), POINTER :: f_temp(:) ! INOUT |
---|
[434] | 297 | |
---|
[529] | 298 | REAL(rstd), POINTER :: pmid(:,:) |
---|
[434] | 299 | REAL(rstd), POINTER :: q(:,:,:) |
---|
| 300 | REAL(rstd), POINTER :: temp(:,:) |
---|
| 301 | INTEGER :: ind |
---|
| 302 | |
---|
| 303 | DO ind=1,ndomain |
---|
| 304 | IF (.NOT. assigned_domain(ind)) CYCLE |
---|
| 305 | CALL swap_dimensions(ind) |
---|
| 306 | CALL swap_geometry(ind) |
---|
[529] | 307 | pmid=f_pmid(ind) |
---|
[434] | 308 | q=f_q(ind) |
---|
| 309 | temp=f_temp(ind) |
---|
[529] | 310 | CALL compute_diagnose_temp(pmid,q,temp) |
---|
[434] | 311 | END DO |
---|
| 312 | END SUBROUTINE diagnose_temperature |
---|
| 313 | |
---|
[529] | 314 | SUBROUTINE compute_diagnose_temp(pmid,q,temp) |
---|
[434] | 315 | USE omp_para |
---|
| 316 | USE pression_mod |
---|
[529] | 317 | REAL(rstd),INTENT(IN) :: pmid(iim*jjm,llm) |
---|
| 318 | REAL(rstd),INTENT(IN) :: q(iim*jjm,llm,nqtot) |
---|
| 319 | REAL(rstd),INTENT(INOUT) :: temp(iim*jjm,llm) |
---|
[434] | 320 | |
---|
| 321 | REAL(rstd) :: Rd, p_ik, theta_ik, temp_ik, qv, chi, Rmix |
---|
| 322 | INTEGER :: ij,l |
---|
| 323 | |
---|
| 324 | Rd = kappa*cpp |
---|
| 325 | DO l=ll_begin,ll_end |
---|
| 326 | DO ij=ij_begin,ij_end |
---|
[529] | 327 | p_ik = pmid(ij,l) |
---|
| 328 | theta_ik = temp(ij,l) |
---|
[434] | 329 | qv = q(ij,l,1) ! water vaper mixing ratio = mv/md |
---|
| 330 | SELECT CASE(caldyn_thermo) |
---|
| 331 | CASE(thermo_theta) |
---|
| 332 | temp_ik = theta_ik*((p_ik/preff)**kappa) |
---|
| 333 | CASE(thermo_entropy) |
---|
| 334 | temp_ik = Treff*exp((theta_ik + Rd*log(p_ik/preff))/cpp) |
---|
| 335 | CASE(thermo_moist) |
---|
| 336 | Rmix = Rd+qv*Rv |
---|
| 337 | chi = ( theta_ik + Rmix*log(p_ik/preff) ) / (cpp + qv*cppv) ! log(T/Treff) |
---|
| 338 | temp_ik = Treff*exp(chi) |
---|
| 339 | END SELECT |
---|
| 340 | IF(physics_thermo==thermo_fake_moist) temp_ik=temp_ik/(1+0.608*qv) |
---|
| 341 | temp(ij,l)=temp_ik |
---|
| 342 | END DO |
---|
| 343 | END DO |
---|
| 344 | END SUBROUTINE compute_diagnose_temp |
---|
| 345 | |
---|
[354] | 346 | SUBROUTINE Tv2T(f_Tv, f_q, f_T) |
---|
| 347 | TYPE(t_field), POINTER :: f_TV(:) |
---|
| 348 | TYPE(t_field), POINTER :: f_q(:) |
---|
| 349 | TYPE(t_field), POINTER :: f_T(:) |
---|
| 350 | |
---|
| 351 | REAL(rstd),POINTER :: Tv(:,:), q(:,:,:), T(:,:) |
---|
| 352 | INTEGER :: ind |
---|
| 353 | |
---|
| 354 | DO ind=1,ndomain |
---|
| 355 | IF (.NOT. assigned_domain(ind)) CYCLE |
---|
| 356 | CALL swap_dimensions(ind) |
---|
| 357 | CALL swap_geometry(ind) |
---|
| 358 | Tv=f_Tv(ind) |
---|
| 359 | T=f_T(ind) |
---|
[434] | 360 | SELECT CASE(physics_thermo) |
---|
| 361 | CASE(thermo_dry) |
---|
| 362 | T=Tv |
---|
| 363 | CASE(thermo_fake_moist) |
---|
| 364 | q=f_q(ind) |
---|
| 365 | T=Tv/(1+0.608*q(:,:,1)) |
---|
| 366 | END SELECT |
---|
[354] | 367 | END DO |
---|
| 368 | END SUBROUTINE Tv2T |
---|
[413] | 369 | |
---|
| 370 | SUBROUTINE divide_by_mass(iq, f_mass, f_theta_rhodz, f_theta) |
---|
| 371 | INTEGER, INTENT(IN) :: iq |
---|
| 372 | TYPE(t_field), POINTER :: f_mass(:), f_theta_rhodz(:), f_theta(:) |
---|
| 373 | REAL(rstd), POINTER :: mass(:,:), theta_rhodz(:,:,:), theta(:,:) |
---|
| 374 | INTEGER :: ind |
---|
| 375 | DO ind=1,ndomain |
---|
| 376 | IF (.NOT. assigned_domain(ind)) CYCLE |
---|
| 377 | CALL swap_dimensions(ind) |
---|
| 378 | CALL swap_geometry(ind) |
---|
| 379 | mass=f_mass(ind) |
---|
| 380 | theta_rhodz=f_theta_rhodz(ind) |
---|
| 381 | theta=f_theta(ind) |
---|
| 382 | theta(:,:) = theta_rhodz(:,:,iq) / mass(:,:) |
---|
| 383 | END DO |
---|
| 384 | END SUBROUTINE divide_by_mass |
---|
| 385 | |
---|
[354] | 386 | END MODULE observable_mod |
---|