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