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