Changeset 366 for codes/icosagcm/trunk/src/etat0.f90
- Timestamp:
- 10/30/15 15:41:06 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
codes/icosagcm/trunk/src/etat0.f90
r353 r366 13 13 CONTAINS 14 14 15 SUBROUTINE etat0(f_ps,f_mass,f_phis,f_theta_rhodz,f_u, f_ q)15 SUBROUTINE etat0(f_ps,f_mass,f_phis,f_theta_rhodz,f_u, f_geopot,f_w, f_q) 16 16 USE mpipara, ONLY : is_mpi_root 17 17 USE disvert_mod … … 35 35 TYPE(t_field),POINTER :: f_theta_rhodz(:) 36 36 TYPE(t_field),POINTER :: f_u(:) 37 TYPE(t_field),POINTER :: f_geopot(:) 38 TYPE(t_field),POINTER :: f_w(:) 37 39 TYPE(t_field),POINTER :: f_q(:) 38 40 39 41 REAL(rstd),POINTER :: ps(:), mass(:,:) 40 LOGICAL :: init_mass, collocated42 LOGICAL :: autoinit_mass, autoinit_geopot, collocated 41 43 INTEGER :: ind,i,j,ij,l 42 44 … … 45 47 ! the initial distribution of mass is taken to be the same 46 48 ! as what the mass coordinate would dictate 47 ! however if etat0_XXX defines mass then the flag init_mass must be set to .FALSE.49 ! however if etat0_XXX defines mass then the flag autoinit_mass must be set to .FALSE. 48 50 ! otherwise mass will be overwritten 49 init_mass = (caldyn_eta == eta_lag)51 autoinit_mass = (caldyn_eta == eta_lag) 50 52 51 53 etat0_type='jablonowsky06' … … 70 72 CALL getin_etat0_dcmip5 71 73 CASE ('williamson91.6') 72 init_mass=.FALSE.74 autoinit_mass=.FALSE. 73 75 CALL getin_etat0_williamson 74 76 CASE DEFAULT 75 77 collocated=.FALSE. 78 autoinit_mass = .FALSE. 76 79 END SELECT 77 80 … … 90 93 CASE DEFAULT 91 94 IF(collocated) THEN 92 CALL etat0_collocated(f_phis,f_ps,f_mass,f_theta_rhodz,f_u, f_ q)95 CALL etat0_collocated(f_phis,f_ps,f_mass,f_theta_rhodz,f_u, f_geopot,f_W, f_q) 93 96 ELSE 94 97 PRINT*, 'Bad selector for variable etat0 <',etat0_type, & … … 98 101 END SELECT 99 102 100 IF(init_mass) THEN ! initialize mass distribution using ps101 103 ! !$OMP BARRIER 104 IF(autoinit_mass) THEN 102 105 DO ind=1,ndomain 103 106 IF (.NOT. assigned_domain(ind)) CYCLE … … 105 108 CALL swap_geometry(ind) 106 109 mass=f_mass(ind); ps=f_ps(ind) 107 CALL compute_rhodz(.TRUE., ps, mass) 110 CALL compute_rhodz(.TRUE., ps, mass) ! initialize mass distribution using ps 108 111 END DO 109 112 END IF 110 113 111 114 END SUBROUTINE etat0 112 115 113 SUBROUTINE etat0_collocated(f_phis,f_ps,f_mass,f_theta_rhodz,f_u, f_ q)116 SUBROUTINE etat0_collocated(f_phis,f_ps,f_mass,f_theta_rhodz,f_u, f_geopot,f_W, f_q) 114 117 USE theta2theta_rhodz_mod 115 118 IMPLICIT NONE … … 119 122 TYPE(t_field),POINTER :: f_theta_rhodz(:) 120 123 TYPE(t_field),POINTER :: f_u(:) 124 TYPE(t_field),POINTER :: f_geopot(:) 125 TYPE(t_field),POINTER :: f_W(:) 121 126 TYPE(t_field),POINTER :: f_q(:) 122 127 … … 128 133 REAL(rstd),POINTER :: temp(:,:) 129 134 REAL(rstd),POINTER :: u(:,:) 135 REAL(rstd),POINTER :: geopot(:,:) 136 REAL(rstd),POINTER :: W(:,:) 130 137 REAL(rstd),POINTER :: q(:,:,:) 131 138 INTEGER :: ind … … 143 150 temp=f_temp(ind) 144 151 u=f_u(ind) 152 geopot=f_geopot(ind) 153 w=f_w(ind) 145 154 q=f_q(ind) 146 155 147 IF( TRIM(etat0_type)=='williamson91.6' ) THEN 148 CALL compute_etat0_collocated(ps,mass, phis, theta_rhodz, u, q)156 IF( TRIM(etat0_type)=='williamson91.6' ) THEN 157 CALL compute_etat0_collocated(ps,mass, phis, theta_rhodz, u, geopot, W, q) 149 158 ELSE 150 CALL compute_etat0_collocated(ps,mass, phis, temp, u, q)159 CALL compute_etat0_collocated(ps,mass, phis, temp, u, geopot, W, q) 151 160 ENDIF 152 161 ENDDO … … 158 167 END SUBROUTINE etat0_collocated 159 168 160 SUBROUTINE compute_etat0_collocated(ps,mass, phis, temp_i, u, q)169 SUBROUTINE compute_etat0_collocated(ps,mass,phis,temp_i,u, geopot,W, q) 161 170 USE wind_mod 171 USE disvert_mod 162 172 USE etat0_jablonowsky06_mod, ONLY : compute_jablonowsky06 => compute_etat0 163 173 USE etat0_dcmip1_mod, ONLY : compute_dcmip1 => compute_etat0 … … 174 184 REAL(rstd),INTENT(OUT) :: temp_i(iim*jjm,llm) 175 185 REAL(rstd),INTENT(OUT) :: u(3*iim*jjm,llm) 186 REAL(rstd),INTENT(OUT) :: W(iim*jjm,llm+1) 187 REAL(rstd),INTENT(OUT) :: geopot(iim*jjm,llm+1) 176 188 REAL(rstd),INTENT(OUT) :: q(iim*jjm,llm,nqtot) 177 189 … … 183 195 REAL(rstd) :: phis_e(3*iim*jjm) 184 196 REAL(rstd) :: temp_e(3*iim*jjm,llm) 197 REAL(rstd) :: geopot_e(3*iim*jjm,llm+1) 185 198 REAL(rstd) :: ulon_e(3*iim*jjm,llm) 186 199 REAL(rstd) :: ulat_e(3*iim*jjm,llm) … … 188 201 189 202 INTEGER :: l,i,j,ij 203 REAL :: p_ik, v_ik, mass_ik 204 LOGICAL :: autoinit_mass, autoinit_NH 205 206 ! For NH geopotential and vertical momentum must be initialized. 207 ! Unless autoinit_mass is set to .FALSE. , they will be initialized 208 ! to hydrostatic geopotential and zero 209 autoinit_mass = .TRUE. 210 autoinit_NH = .NOT. hydrostatic 211 w(:,:) = 0 190 212 191 213 !$OMP BARRIER … … 208 230 CALL compute_dcmip2(3*iim*jjm,lon_e,lat_e, phis_e, ps_e, temp_e, ulon_e, ulat_e) 209 231 CASE('dcmip3') 210 CALL compute_dcmip3(iim*jjm,lon_i,lat_i, phis, ps, temp_i, ulon_i, ulat_i, q) 211 CALL compute_dcmip3(3*iim*jjm,lon_e,lat_e, phis_e, ps_e, temp_e, ulon_e, ulat_e, q_e) 232 CALL compute_dcmip3(iim*jjm,lon_i,lat_i, phis, ps, temp_i, ulon_i, ulat_i, geopot, q) 233 CALL compute_dcmip3(3*iim*jjm,lon_e,lat_e, phis_e, ps_e, temp_e, ulon_e, ulat_e, geopot_e, q_e) 234 autoinit_NH = .FALSE. ! compute_dcmip3 initializes geopot 212 235 CASE('dcmip4') 213 236 CALL compute_dcmip4(iim*jjm,lon_i,lat_i, phis, ps, temp_i, ulon_i, ulat_i, q) … … 219 242 CALL compute_w91_6(iim*jjm,lon_i,lat_i, phis, mass(:,1), temp_i(:,1), ulon_i(:,1), ulat_i(:,1)) 220 243 CALL compute_w91_6(3*iim*jjm,lon_e,lat_e, phis_e, mass_e(:,1), temp_e(:,1), ulon_e(:,1), ulat_e(:,1)) 244 autoinit_mass = .FALSE. ! do not overwrite mass 221 245 END SELECT 246 247 IF(autoinit_mass) CALL compute_rhodz(.TRUE., ps, mass) ! initialize mass distribution using ps 248 IF(autoinit_NH) THEN 249 geopot(:,1) = phis(:) ! surface geopotential 250 DO l = 1, llm 251 DO ij=1,iim*jjm 252 ! hybrid pressure coordinate 253 p_ik = ptop + mass_ak(l) + mass_bk(l)*ps(ij) 254 mass_ik = (mass_dak(l) + mass_dbk(l)*ps(ij))/g 255 ! v=R.T/p, R=kappa*cpp 256 v_ik = kappa*cpp*temp_i(ij,l)/p_ik 257 geopot(ij,l+1) = geopot(ij,l) + mass_ik*v_ik*g 258 END DO 259 END DO 260 END IF 222 261 223 262 !$OMP BARRIER
Note: See TracChangeset
for help on using the changeset viewer.