[361] | 1 | MODULE caldyn_hevi_mod |
---|
| 2 | USE icosa |
---|
| 3 | USE transfert_mod |
---|
[731] | 4 | USE caldyn_vars_mod |
---|
| 5 | USE caldyn_kernels_hevi_mod |
---|
[362] | 6 | USE caldyn_kernels_base_mod |
---|
[831] | 7 | USE compute_theta_mod, ONLY : compute_theta |
---|
[842] | 8 | USE compute_caldyn_kv_mod, ONLY : compute_caldyn_kv |
---|
[844] | 9 | USE compute_caldyn_Coriolis_mod, ONLY : compute_caldyn_Coriolis |
---|
[849] | 10 | USE compute_caldyn_slow_hydro_mod, ONLY : compute_caldyn_slow_hydro |
---|
[850] | 11 | USE compute_caldyn_slow_NH_mod, ONLY : compute_caldyn_slow_NH |
---|
[853] | 12 | USE compute_caldyn_solver_mod, ONLY : compute_caldyn_solver |
---|
[854] | 13 | USE compute_caldyn_fast_mod, ONLY : compute_caldyn_fast |
---|
[859] | 14 | USE compute_NH_geopot_mod, ONLY : compute_NH_geopot |
---|
[361] | 15 | IMPLICIT NONE |
---|
| 16 | PRIVATE |
---|
| 17 | PUBLIC caldyn_hevi |
---|
| 18 | |
---|
| 19 | CONTAINS |
---|
| 20 | |
---|
| 21 | SUBROUTINE caldyn_hevi(write_out,tau, f_phis, f_ps, f_mass, f_theta_rhodz, f_u, f_q, & |
---|
[366] | 22 | f_W, f_geopot, f_hflux, f_wflux, f_dps, f_dmass, f_dtheta_rhodz, & |
---|
| 23 | f_du_slow, f_du_fast, f_dPhi_slow, f_dPhi_fast, f_dW_slow, f_dW_fast) |
---|
[361] | 24 | USE icosa |
---|
| 25 | USE observable_mod |
---|
| 26 | USE disvert_mod, ONLY : caldyn_eta, eta_mass |
---|
| 27 | USE vorticity_mod |
---|
| 28 | USE kinetic_mod |
---|
| 29 | USE theta2theta_rhodz_mod |
---|
| 30 | USE wind_mod |
---|
| 31 | USE mpipara |
---|
| 32 | USE trace |
---|
| 33 | USE omp_para |
---|
| 34 | USE output_field_mod |
---|
| 35 | USE checksum_mod |
---|
[827] | 36 | USE compute_mod, ONLY : compute_pvort_only |
---|
[361] | 37 | IMPLICIT NONE |
---|
| 38 | LOGICAL,INTENT(IN) :: write_out |
---|
| 39 | REAL(rstd), INTENT(IN) :: tau |
---|
| 40 | TYPE(t_field),POINTER :: f_phis(:) |
---|
| 41 | TYPE(t_field),POINTER :: f_ps(:) |
---|
| 42 | TYPE(t_field),POINTER :: f_mass(:) |
---|
| 43 | TYPE(t_field),POINTER :: f_theta_rhodz(:) |
---|
| 44 | TYPE(t_field),POINTER :: f_u(:) |
---|
| 45 | TYPE(t_field),POINTER :: f_q(:) |
---|
[366] | 46 | TYPE(t_field),POINTER :: f_W(:) |
---|
[361] | 47 | TYPE(t_field),POINTER :: f_geopot(:) |
---|
| 48 | TYPE(t_field),POINTER :: f_hflux(:), f_wflux(:) |
---|
| 49 | TYPE(t_field) :: f_dps(:) |
---|
| 50 | TYPE(t_field) :: f_dmass(:) |
---|
| 51 | TYPE(t_field) :: f_dtheta_rhodz(:) |
---|
| 52 | TYPE(t_field) :: f_du_slow(:) |
---|
| 53 | TYPE(t_field) :: f_du_fast(:) |
---|
[366] | 54 | TYPE(t_field) :: f_dW_slow(:) |
---|
| 55 | TYPE(t_field) :: f_dW_fast(:) |
---|
| 56 | TYPE(t_field) :: f_dPhi_slow(:) |
---|
| 57 | TYPE(t_field) :: f_dPhi_fast(:) |
---|
[361] | 58 | |
---|
[562] | 59 | REAL(rstd),POINTER :: ps(:), dps(:), phis(:) |
---|
[387] | 60 | REAL(rstd),POINTER :: mass(:,:), theta_rhodz(:,:,:), dtheta_rhodz(:,:,:) |
---|
[366] | 61 | REAL(rstd),POINTER :: du(:,:), dW(:,:), dPhi(:,:), hflux(:,:), wflux(:,:) |
---|
[735] | 62 | REAL(rstd),POINTER :: u(:,:), w(:,:), qu(:,:), qv(:,:), Kv(:,:), hv(:,:) |
---|
[361] | 63 | |
---|
| 64 | ! temporary shared variable |
---|
[404] | 65 | REAL(rstd),POINTER :: theta(:,:,:) |
---|
[361] | 66 | REAL(rstd),POINTER :: pk(:,:) |
---|
| 67 | REAL(rstd),POINTER :: geopot(:,:) |
---|
| 68 | REAL(rstd),POINTER :: convm(:,:) |
---|
| 69 | REAL(rstd),POINTER :: wwuu(:,:) |
---|
[558] | 70 | REAL(rstd),POINTER :: F_el(:,:), gradPhi2(:,:), w_il(:,:) , W_etadot(:,:), pres(:,:), m_il(:,:) |
---|
[361] | 71 | INTEGER :: ind |
---|
| 72 | LOGICAL,SAVE :: first=.TRUE. |
---|
| 73 | !$OMP THREADPRIVATE(first) |
---|
| 74 | |
---|
| 75 | IF (first) THEN |
---|
| 76 | first=.FALSE. |
---|
| 77 | IF(caldyn_eta==eta_mass) THEN |
---|
| 78 | CALL init_message(f_ps,req_i1,req_ps) |
---|
| 79 | ELSE |
---|
| 80 | CALL init_message(f_mass,req_i1,req_mass) |
---|
| 81 | END IF |
---|
| 82 | CALL init_message(f_theta_rhodz,req_i1,req_theta_rhodz) |
---|
| 83 | CALL init_message(f_u,req_e1_vect,req_u) |
---|
| 84 | CALL init_message(f_qu,req_e1_scal,req_qu) |
---|
[734] | 85 | IF(caldyn_kinetic==kinetic_consistent) CALL init_message(f_Kv,req_z1_scal,req_Kv) |
---|
[366] | 86 | IF(.NOT.hydrostatic) THEN |
---|
| 87 | CALL init_message(f_geopot,req_i1,req_geopot) |
---|
| 88 | CALL init_message(f_w,req_i1,req_w) |
---|
| 89 | END IF |
---|
[361] | 90 | ENDIF |
---|
| 91 | |
---|
| 92 | CALL trace_start("caldyn") |
---|
| 93 | |
---|
| 94 | IF(caldyn_eta==eta_mass) THEN |
---|
| 95 | CALL send_message(f_ps,req_ps) ! COM00 |
---|
[362] | 96 | CALL wait_message(req_ps) ! COM00 |
---|
[361] | 97 | ELSE |
---|
| 98 | CALL send_message(f_mass,req_mass) ! COM00 |
---|
| 99 | CALL wait_message(req_mass) ! COM00 |
---|
| 100 | END IF |
---|
| 101 | CALL send_message(f_theta_rhodz,req_theta_rhodz) ! COM01 |
---|
| 102 | CALL wait_message(req_theta_rhodz) ! COM01 Moved from caldyn_pvort |
---|
[366] | 103 | |
---|
| 104 | IF(.NOT.hydrostatic) THEN |
---|
| 105 | CALL send_message(f_geopot,req_geopot) ! COM03 |
---|
| 106 | CALL wait_message(req_geopot) ! COM03 |
---|
| 107 | CALL send_message(f_w,req_w) ! COM04 |
---|
| 108 | CALL wait_message(req_w) ! COM04 |
---|
| 109 | END IF |
---|
[361] | 110 | |
---|
| 111 | DO ind=1,ndomain |
---|
| 112 | IF (.NOT. assigned_domain(ind)) CYCLE |
---|
| 113 | CALL swap_dimensions(ind) |
---|
| 114 | CALL swap_geometry(ind) |
---|
| 115 | ps=f_ps(ind) |
---|
| 116 | theta_rhodz=f_theta_rhodz(ind) |
---|
| 117 | mass=f_mass(ind) |
---|
| 118 | theta = f_theta(ind) |
---|
[404] | 119 | CALL compute_theta(ps,theta_rhodz, mass,theta) |
---|
[361] | 120 | pk = f_pk(ind) |
---|
[362] | 121 | geopot = f_geopot(ind) |
---|
[369] | 122 | du=f_du_fast(ind) |
---|
[366] | 123 | IF(hydrostatic) THEN |
---|
[369] | 124 | du(:,:)=0. |
---|
[404] | 125 | CALL compute_geopot(mass,theta, ps,pk,geopot) |
---|
[366] | 126 | ELSE |
---|
[562] | 127 | phis = f_phis(ind) |
---|
[366] | 128 | W = f_W(ind) |
---|
| 129 | dW = f_dW_fast(ind) |
---|
| 130 | dPhi = f_dPhi_fast(ind) |
---|
[558] | 131 | ! reuse buffers |
---|
| 132 | m_il = f_wil(ind) |
---|
| 133 | pres = f_gradPhi2(ind) |
---|
[562] | 134 | CALL compute_caldyn_solver(tau,phis, mass,theta,pk,geopot,W, m_il,pres, dPhi,dW,du) ! computes d(Phi,W,du)_fast and updates Phi,W |
---|
[366] | 135 | END IF |
---|
| 136 | u=f_u(ind) |
---|
[373] | 137 | CALL compute_caldyn_fast(tau,u,mass,theta,pk,geopot,du) ! computes du_fast and updates u |
---|
[361] | 138 | ENDDO |
---|
| 139 | |
---|
| 140 | CALL send_message(f_u,req_u) ! COM02 |
---|
| 141 | CALL wait_message(req_u) ! COM02 |
---|
| 142 | |
---|
| 143 | DO ind=1,ndomain |
---|
| 144 | IF (.NOT. assigned_domain(ind)) CYCLE |
---|
| 145 | CALL swap_dimensions(ind) |
---|
| 146 | CALL swap_geometry(ind) |
---|
| 147 | u=f_u(ind) |
---|
| 148 | mass=f_mass(ind) |
---|
| 149 | qu=f_qu(ind) |
---|
| 150 | qv=f_qv(ind) |
---|
[735] | 151 | hv=f_hv(ind) |
---|
| 152 | CALL compute_pvort_only(u,mass,qu,qv,hv) |
---|
[734] | 153 | IF(caldyn_kinetic==kinetic_consistent) THEN |
---|
| 154 | Kv=f_Kv(ind) |
---|
| 155 | CALL compute_caldyn_Kv(u,Kv) |
---|
| 156 | END IF |
---|
[361] | 157 | ENDDO |
---|
| 158 | |
---|
| 159 | CALL send_message(f_qu,req_qu) ! COM03 |
---|
[369] | 160 | CALL wait_message(req_qu) ! COM03 |
---|
[734] | 161 | |
---|
| 162 | IF(caldyn_kinetic==kinetic_consistent) THEN |
---|
[735] | 163 | CALL transfert_request(f_hv,req_z1_scal) |
---|
[734] | 164 | CALL send_message(f_Kv,req_Kv) |
---|
| 165 | CALL wait_message(req_Kv) |
---|
| 166 | END IF |
---|
| 167 | |
---|
[361] | 168 | DO ind=1,ndomain |
---|
| 169 | IF (.NOT. assigned_domain(ind)) CYCLE |
---|
| 170 | CALL swap_dimensions(ind) |
---|
| 171 | CALL swap_geometry(ind) |
---|
| 172 | u=f_u(ind) |
---|
| 173 | mass=f_mass(ind) |
---|
| 174 | theta = f_theta(ind) |
---|
| 175 | qu=f_qu(ind) |
---|
| 176 | hflux=f_hflux(ind) |
---|
| 177 | convm = f_dmass(ind) |
---|
| 178 | dtheta_rhodz=f_dtheta_rhodz(ind) |
---|
| 179 | du=f_du_slow(ind) |
---|
[377] | 180 | |
---|
[369] | 181 | IF(hydrostatic) THEN |
---|
[735] | 182 | hv=f_hv(ind) |
---|
[734] | 183 | Kv=f_Kv(ind) |
---|
[735] | 184 | CALL compute_caldyn_slow_hydro(u,mass,hv, hflux,Kv,du, .TRUE.) |
---|
[369] | 185 | ELSE |
---|
| 186 | W = f_W(ind) |
---|
| 187 | dW = f_dW_slow(ind) |
---|
| 188 | geopot = f_geopot(ind) |
---|
| 189 | dPhi = f_dPhi_slow(ind) |
---|
[558] | 190 | F_el = f_Fel(ind) |
---|
| 191 | gradPhi2 = f_gradPhi2(ind) |
---|
| 192 | w_il = f_wil(ind) |
---|
| 193 | CALL compute_caldyn_slow_NH(u,mass,geopot,W, F_el,gradPhi2,w_il, hflux,du,dPhi,dW) |
---|
[369] | 194 | END IF |
---|
[404] | 195 | CALL compute_caldyn_Coriolis(hflux,theta,qu, convm,dtheta_rhodz,du) |
---|
[361] | 196 | IF(caldyn_eta==eta_mass) THEN |
---|
| 197 | wflux=f_wflux(ind) |
---|
| 198 | wwuu=f_wwuu(ind) |
---|
| 199 | dps=f_dps(ind) |
---|
[373] | 200 | CALL compute_caldyn_vert(u,theta,mass,convm, wflux,wwuu, dps, dtheta_rhodz, du) |
---|
| 201 | IF(.NOT.hydrostatic) THEN |
---|
[559] | 202 | W_etadot=f_Wetadot(ind) |
---|
[558] | 203 | CALL compute_caldyn_vert_NH(mass,geopot,W,wflux, W_etadot, du,dPhi,dW) |
---|
[369] | 204 | END IF |
---|
[361] | 205 | END IF |
---|
| 206 | ENDDO |
---|
| 207 | |
---|
| 208 | !$OMP BARRIER |
---|
| 209 | ! CALL check_mass_conservation(f_ps,f_dps) |
---|
| 210 | CALL trace_end("caldyn_hevi") |
---|
| 211 | !!$OMP BARRIER |
---|
| 212 | |
---|
| 213 | END SUBROUTINE caldyn_hevi |
---|
| 214 | |
---|
| 215 | END MODULE caldyn_hevi_mod |
---|