Changeset 714 for codes/icosagcm/devel/src/physics/physics.f90
- Timestamp:
- 08/03/18 16:53:37 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
codes/icosagcm/devel/src/physics/physics.f90
r584 r714 1 1 MODULE physics_mod 2 2 USE icosa 3 3 USE field_mod 4 4 USE physics_interface_mod 5 USE omp_para 6 IMPLICIT NONE 5 7 PRIVATE 6 8 … … 14 16 TYPE(t_field),POINTER,SAVE :: f_p(:), f_pk(:) 15 17 TYPE(t_field),POINTER,SAVE :: f_temp(:) 18 TYPE(t_field),POINTER,SAVE :: f_du_phys(:) 16 19 17 20 CHARACTER(LEN=255),SAVE :: physics_type 18 21 !$OMP THREADPRIVATE(physics_type) 19 22 20 PUBLIC :: physics, init_physics 23 PUBLIC :: physics, init_physics, zero_du_phys 21 24 22 25 CONTAINS … … 25 28 USE mpipara 26 29 USE etat0_mod 27 USE icosa28 USE physics_interface_mod29 30 USE physics_dcmip_mod, ONLY : init_physics_dcmip=>init_physics 30 31 USE physics_dcmip2016_mod, ONLY : init_physics_dcmip2016=>init_physics … … 32 33 USE physics_lmdz_generic_mod, ONLY : init_physics_lmdz_generic=>init_physics 33 34 USE physics_external_mod, ONLY : init_physics_external=>init_physics 34 IMPLICIT NONE35 35 36 36 physics_inout%dt_phys = dt*itau_physics … … 84 84 END SELECT 85 85 86 CALL allocate_field(f_du_phys,field_u,type_real,llm, name='du_phys') 87 86 88 IF(is_mpi_root) PRINT *, 'phys_type = ',phys_type 87 89 END SUBROUTINE init_physics 88 90 91 SUBROUTINE zero_du_phys() 92 REAL(rstd), DIMENSION(:,:), POINTER :: du 93 INTEGER :: ind 94 DO ind=1,ndomain 95 IF (.NOT. assigned_domain(ind)) CYCLE 96 CALL swap_dimensions(ind) 97 CALL swap_geometry(ind) 98 du=f_du_phys(ind) 99 du(:,ll_begin:ll_end) = 0. 100 END DO 101 END SUBROUTINE zero_du_phys 102 103 SUBROUTINE add_du_phys(coef, f_u) 104 REAL(rstd), INTENT(IN) :: coef ! -1 before physics, +1 after physics 105 TYPE(t_field),POINTER :: f_u(:) ! velocity field before/after call to physics 106 REAL(rstd), DIMENSION(:,:), POINTER :: u, du 107 INTEGER :: ind 108 DO ind=1,ndomain 109 IF (.NOT. assigned_domain(ind)) CYCLE 110 CALL swap_dimensions(ind) 111 CALL swap_geometry(ind) 112 du=f_du_phys(ind) 113 u=f_u(ind) 114 du(:,ll_begin:ll_end) = du(:,ll_begin:ll_end) + coef*u(:,ll_begin:ll_end) 115 END DO 116 END SUBROUTINE add_du_phys 117 89 118 SUBROUTINE physics(it,f_phis, f_ps, f_theta_rhodz, f_ue, f_wflux, f_q) 90 USE icosa91 USE physics_interface_mod92 119 USE physics_lmdz_generic_mod, ONLY : physics_lmdz_generic => physics 93 120 USE physics_external_mod, ONLY : physics_external => physics … … 96 123 USE etat0_heldsz_mod 97 124 USE etat0_venus_mod, ONLY : phys_venus => physics 98 IMPLICIT NONE99 125 INTEGER, INTENT(IN) :: it 100 126 TYPE(t_field),POINTER :: f_phis(:) … … 109 135 TYPE(t_physics_inout) :: args 110 136 111 IF(MOD(it,itau_physics)==0) THEN 112 137 IF(MOD(it,itau_physics)==0 .AND. phys_type/=phys_none) THEN 138 139 ! as a result of the the two calls to add_du_phys, 140 ! du_phys increases by u(after physics) - u (before physics) 141 CALL add_du_phys(-1., f_ue) 142 113 143 SELECT CASE(phys_type) 114 CASE (phys_none)115 ! No physics, do nothing116 144 CASE(phys_HS94) 117 145 CALL held_suarez(f_ps,f_theta_rhodz,f_ue) … … 129 157 CALL transfert_request(f_ue,req_e0_vect) 130 158 CALL transfert_request(f_q,req_i0) 159 160 CALL add_du_phys(1., f_ue) 131 161 END IF 132 162 133 163 IF (mod(it,itau_out)==0 ) THEN 164 CALL write_physics_tendencies 165 CALL zero_du_phys 134 166 SELECT CASE(phys_type) 135 167 CASE (phys_DCMIP) … … 142 174 END SUBROUTINE physics 143 175 176 SUBROUTINE write_physics_tendencies 177 USE observable_mod, ONLY : f_buf_ulon, f_buf_ulat 178 USE wind_mod 179 USE output_field_mod 180 CALL transfert_request(f_du_phys,req_e1_vect) 181 CALL un2ulonlat(f_du_phys, f_buf_ulon, f_buf_ulat, (1./(dt*itau_out))) 182 CALL output_field("dulon_phys",f_buf_ulon) 183 CALL output_field("dulat_phys",f_buf_ulat) 184 END SUBROUTINE write_physics_tendencies 185 144 186 SUBROUTINE physics_column(it, f_phis, f_ps, f_theta_rhodz, f_ue, f_q) 145 USE icosa146 USE physics_interface_mod147 187 USE physics_dcmip_mod, ONLY : full_physics_dcmip => full_physics 148 188 USE physics_dcmip2016_mod, ONLY : full_physics_dcmip2016 => full_physics 149 189 USE theta2theta_rhodz_mod 150 190 USE mpipara 151 USE omp_para152 191 USE checksum_mod 153 IMPLICIT NONE154 192 TYPE(t_field),POINTER :: f_phis(:) 155 193 TYPE(t_field),POINTER :: f_ps(:) … … 229 267 230 268 SUBROUTINE pack_physics(info, phis, ps, temp, ue, q, p, pk, ulon, ulat ) 231 USE icosa232 269 USE wind_mod 233 270 USE pression_mod 234 271 USE theta2theta_rhodz_mod 235 USE physics_interface_mod236 272 USE exner_mod 237 USE omp_para238 IMPLICIT NONE239 273 TYPE(t_pack_info) :: info 240 274 REAL(rstd) :: phis(iim*jjm) … … 272 306 273 307 SUBROUTINE unpack_physics(info, ps,temp, q, dulon, dulat) 274 USE icosa275 USE physics_interface_mod276 308 USE theta2theta_rhodz_mod 277 USE omp_para278 IMPLICIT NONE279 309 TYPE(t_pack_info) :: info 280 310 REAL(rstd) :: ps(iim*jjm) … … 303 333 304 334 SUBROUTINE compute_update_velocity(dulon, dulat, ue) 305 USE icosa306 USE physics_interface_mod307 335 USE wind_mod 308 USE omp_para309 IMPLICIT NONE310 336 REAL(rstd) :: dulon(iim*jjm,llm) 311 337 REAL(rstd) :: dulat(iim*jjm,llm)
Note: See TracChangeset
for help on using the changeset viewer.