Changeset 133
- Timestamp:
- 02/11/13 12:47:36 (11 years ago)
- Location:
- codes/icosagcm/trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
codes/icosagcm/trunk/src/advect_tracer.f90
r132 r133 32 32 33 33 END SUBROUTINE init_advect_tracer 34 35 SUBROUTINE advect_tracer_rhodz(f_ps, f_rhodz)36 USE icosa37 USE advect_mod38 USE disvert_mod39 USE mpipara40 IMPLICIT NONE41 TYPE(t_field),POINTER :: f_ps(:) ! surface pressure, IN42 TYPE(t_field),POINTER :: f_rhodz(:) ! mass, OUT43 REAL(rstd),POINTER :: rhodz(:,:)44 REAL(rstd),POINTER :: ps(:)45 INTEGER :: ind46 47 DO ind=1,ndomain48 CALL swap_dimensions(ind)49 CALL swap_geometry(ind)50 rhodz=f_rhodz(ind)51 ps=f_ps(ind)52 CALL compute_rhodz(ps,rhodz)53 END DO54 END SUBROUTINE advect_tracer_rhodz55 56 SUBROUTINE compute_rhodz(ps, rhodz)57 USE icosa58 USE disvert_mod59 REAL(rstd), INTENT(IN) :: ps(iim*jjm)60 REAL(rstd), INTENT(OUT) :: rhodz(iim*jjm,llm)61 INTEGER :: l,i,j,ij62 DO l = 1, llm63 DO j=jj_begin-1,jj_end+164 DO i=ii_begin-1,ii_end+165 ij=(j-1)*iim+i66 rhodz(ij,l) = (ap(l) - ap(l+1) + (bp(l)-bp(l+1))*ps(ij))/g67 ENDDO68 ENDDO69 ENDDO70 END SUBROUTINE compute_rhodz71 34 72 35 SUBROUTINE advect_tracer(f_ps,f_u,f_q) -
codes/icosagcm/trunk/src/caldyn_gcm.f90
r132 r133 41 41 SELECT CASE(TRIM(def)) 42 42 CASE('lmdz') 43 caldyn_exner= 143 caldyn_exner=lmdz 44 44 CASE('direct') 45 caldyn_exner= 245 caldyn_exner=direct 46 46 CASE DEFAULT 47 47 IF (is_mpi_root) PRINT*,'Bad selector for variable caldyn_exner : <', TRIM(def),'> options are <lmdz>, <direct>' … … 53 53 SELECT CASE(TRIM(def)) 54 54 CASE('lmdz') 55 caldyn_hydrostat= 155 caldyn_hydrostat=lmdz 56 56 CASE('direct') 57 caldyn_hydrostat= 257 caldyn_hydrostat=direct 58 58 CASE DEFAULT 59 59 IF (is_mpi_root) PRINT*,'Bad selector for variable caldyn_hydrostat : <', TRIM(def),'> options are <lmdz>, <direct>' … … 304 304 REAL(rstd),ALLOCATABLE,SAVE :: Fe(:,:), Ftheta(:,:) ! mass flux, theta flux 305 305 REAL(rstd),ALLOCATABLE,SAVE :: convm(:,:) ! mass flux convergence 306 REAL(rstd),ALLOCATABLE,SAVE :: w(:,:) ! vertical velocity306 REAL(rstd),ALLOCATABLE,SAVE :: w(:,:) ! vertical mass flux 307 307 REAL(rstd),ALLOCATABLE,SAVE :: berni(:,:) ! Bernouilli function 308 308 -
codes/icosagcm/trunk/src/exner.f90
r121 r133 2 2 3 3 INTEGER :: caldyn_exner 4 INTEGER, PARAMETER :: lmdz=3, direct=4 4 5 5 6 CONTAINS … … 45 46 REAL(rstd) :: delta 46 47 47 IF(caldyn_exner == 1) THEN ! LMD-Z style calculation of Exner pressure48 IF(caldyn_exner == lmdz) THEN ! LMD-Z style calculation of Exner pressure 48 49 !! Compute Alpha and Beta 49 50 -
codes/icosagcm/trunk/src/timeloop_gcm.f90
r132 r133 1 1 MODULE timeloop_gcm_mod 2 2 3 PRIVATE 4 5 PUBLIC :: timeloop 6 7 INTEGER, PARAMETER :: euler=1, rk4=2, mlf=3 8 3 9 CONTAINS 4 10 … … 24 30 TYPE(t_field),POINTER :: f_du(:),f_dum1(:),f_dum2(:) 25 31 TYPE(t_field),POINTER :: f_dtheta_rhodz(:),f_dtheta_rhodzm1(:),f_dtheta_rhodzm2(:) 32 TYPE(t_field),POINTER :: f_hflux(:), f_wflux(:), f_hfluxt(:), f_wfluxt(:) 26 33 27 34 REAL(rstd),POINTER :: phis(:) … … 29 36 REAL(rstd),POINTER :: ps(:) ,psm1(:), psm2(:) 30 37 REAL(rstd),POINTER :: u(:,:) , um1(:,:), um2(:,:) 31 REAL(rstd),POINTER :: theta_rhodz(:,:) , theta_rhodzm1(:,:), theta_rhodzm2(:,:)38 REAL(rstd),POINTER :: rhodz(:,:), theta_rhodz(:,:) , theta_rhodzm1(:,:), theta_rhodzm2(:,:) 32 39 REAL(rstd),POINTER :: dps(:), dpsm1(:), dpsm2(:) 33 40 REAL(rstd),POINTER :: du(:,:), dum1(:,:), dum2(:,:) 34 41 REAL(rstd),POINTER :: dtheta_rhodz(:,:),dtheta_rhodzm1(:,:),dtheta_rhodzm2(:,:) 42 REAL(rstd),POINTER :: hflux(:,:),wflux(:,:),hfluxt(:,:),wfluxt(:,:) 35 43 36 44 ! REAL(rstd) :: dt, run_length 37 45 INTEGER :: ind 38 INTEGER :: it,i,j,n, nb_stage, stage, matsuno_period 39 CHARACTER(len=255) :: scheme 46 INTEGER :: it,i,j,n, nb_stage, stage, matsuno_period, scheme 47 CHARACTER(len=255) :: scheme_name 40 48 ! INTEGER :: itaumax 41 49 ! REAL(rstd) ::write_period … … 70 78 CALL allocate_field(f_q,field_t,type_real,llm,nqtot) 71 79 CALL allocate_field(f_rhodz,field_t,type_real,llm) 72 73 scheme='runge_kutta' 74 CALL getin('scheme',scheme) 75 76 SELECT CASE (TRIM(scheme)) 80 CALL allocate_field(f_hflux,field_u,type_real,llm) ! instantaneous mass fluxes 81 CALL allocate_field(f_wflux,field_t,type_real,llm+1) ! computed by caldyn 82 CALL allocate_field(f_hfluxt,field_u,type_real,llm) ! mass "fluxes" accumulated in time 83 CALL allocate_field(f_wfluxt,field_t,type_real,llm+1) 84 85 scheme_name='runge_kutta' 86 CALL getin('scheme',scheme_name) 87 88 SELECT CASE (TRIM(scheme_name)) 77 89 CASE('euler') 90 scheme=euler 78 91 nb_stage=1 79 92 CASE ('runge_kutta') 93 scheme=rk4 80 94 nb_stage=4 81 95 CASE ('leapfrog_matsuno') 96 scheme=mlf 82 97 matsuno_period=5 83 98 CALL getin('matsuno_period',matsuno_period) … … 88 103 CALL allocate_field(f_um2,field_u,type_real,llm) 89 104 CASE default 90 PRINT*,'Bad selector for variable scheme : <', TRIM(scheme ), &105 PRINT*,'Bad selector for variable scheme : <', TRIM(scheme_name), & 91 106 ' > options are <euler>, <runge_kutta>, <leapfrog_matsuno>' 92 107 STOP … … 120 135 CALL transfert_request(f_q,req_i1) 121 136 122 CALL advect_tracer_rhodz(f_ps, f_rhodz) ! save rhodz for transport scheme before dynamics update ps 137 DO ind=1,ndomain 138 CALL swap_dimensions(ind) 139 CALL swap_geometry(ind) 140 hfluxt=f_hfluxt(ind); hfluxt=0. ! clear accumulated fluxes 141 wfluxt=f_hfluxt(ind); wfluxt=0. 142 rhodz=f_rhodz(ind); ps=f_ps(ind) 143 CALL compute_rhodz(ps,rhodz) ! save rhodz for transport scheme before dynamics update ps 144 END DO 123 145 124 146 DO it=0,itaumax … … 135 157 ! CALL caldyn((stage==1) .AND. (MOD(it,itau_out)==0), & 136 158 ! f_phis,f_ps,f_theta_rhodz,f_u, f_q, & 137 ! f_ Fe, f_W, f_dps, f_dtheta_rhodz, f_du)159 ! f_hflux, f_wflux, f_dps, f_dtheta_rhodz, f_du) 138 160 CALL caldyn((stage==1) .AND. (MOD(it,itau_out)==0), & 139 161 f_phis,f_ps,f_theta_rhodz,f_u, f_q, & 140 162 f_dps, f_dtheta_rhodz, f_du) 141 SELECT CASE (TRIM(scheme)) 142 CASE('euler') 143 CALL euler_scheme(.TRUE.) 144 145 CASE ('runge_kutta') 163 SELECT CASE (scheme) 164 CASE(euler) 165 CALL euler_scheme(.TRUE.) 166 CASE (rk4) 146 167 CALL rk_scheme(stage) 147 148 CASE ('leapfrog_matsuno') 168 CASE (mlf) 149 169 CALL leapfrog_matsuno_scheme(stage) 150 170 … … 155 175 ! CALL dissip(f_u,f_du,f_ps,f_phis, f_theta_rhodz,f_dtheta_rhodz) 156 176 ! CALL adam_bashforth_scheme 157 CASE default 158 ! PRINT*,'Bad selector for variable scheme : <', TRIM(scheme), & 159 ! ' > options are <euler>, <runge_kutta>, <leapfrog>, <leapfrog_matsuno>, <adam_bashforth>' 160 PRINT*,'Bad selector for variable scheme : <', TRIM(scheme), & 161 ' > options are <euler>, <runge_kutta>, <leapfrog_matsuno>' 177 CASE DEFAULT 162 178 STOP 163 164 179 END SELECT 165 180 END DO … … 168 183 CALL euler_scheme(.FALSE.) 169 184 170 ! CALL advect_tracer(f_Fe,f_W,f_u, f_q,f_rhodz) ! update q and rhodz after RK step 185 IF(MOD(it+1,itau_adv)==0) THEN 186 ! CALL advect_tracer(f_hfluxt,f_wfluxt,f_u, f_q,f_rhodz) ! update q and rhodz after RK step 187 DO ind=1,ndomain 188 hfluxt=f_hfluxt(ind) 189 wfluxt=f_hfluxt(ind) 190 hfluxt=0. ! clear accumulated fluxes 191 wfluxt=0. 192 END DO 193 END IF 194 171 195 ! CALL physics(it,f_phis, f_ps, f_theta_rhodz, f_u, f_q) 172 196 ENDDO … … 183 207 ps=f_ps(ind) ; dps=f_dps(ind) ; 184 208 ps(:)=ps(:)+dt*dps(:) 209 hflux=f_hflux(ind); hfluxt=f_hfluxt(ind) 210 wflux=f_hflux(ind); wfluxt=f_wfluxt(ind) 211 CALL accumulate_fluxes(hflux,wflux,hfluxt,wfluxt,dt) 185 212 END IF 186 213 u=f_u(ind) ; theta_rhodz=f_theta_rhodz(ind) … … 189 216 theta_rhodz(:,:)=theta_rhodz(:,:)+dt*dtheta_rhodz(:,:) 190 217 ENDDO 191 218 192 219 END SUBROUTINE Euler_scheme 193 220 … … 212 239 u(:,:)=um1(:,:)+tau*du(:,:) 213 240 theta_rhodz(:,:)=theta_rhodzm1(:,:)+tau*dtheta_rhodz(:,:) 241 IF(stage==nb_stage) THEN ! accumulate mass fluxes at last stage 242 hflux=f_hflux(ind); hfluxt=f_hfluxt(ind) 243 wflux=f_hflux(ind); wfluxt=f_wfluxt(ind) 244 CALL accumulate_fluxes(hflux,wflux,hfluxt,wfluxt,dt) 245 END IF 214 246 END DO 215 216 247 END SUBROUTINE RK_scheme 217 248 … … 318 349 319 350 END SUBROUTINE timeloop 351 352 SUBROUTINE compute_rhodz(ps, rhodz) 353 USE icosa 354 USE disvert_mod 355 REAL(rstd), INTENT(IN) :: ps(iim*jjm) 356 REAL(rstd), INTENT(OUT) :: rhodz(iim*jjm,llm) 357 INTEGER :: l,i,j,ij 358 DO l = 1, llm 359 DO j=jj_begin-1,jj_end+1 360 DO i=ii_begin-1,ii_end+1 361 ij=(j-1)*iim+i 362 rhodz(ij,l) = (ap(l) - ap(l+1) + (bp(l)-bp(l+1))*ps(ij))/g 363 ENDDO 364 ENDDO 365 ENDDO 366 END SUBROUTINE compute_rhodz 367 368 SUBROUTINE accumulate_fluxes(hflux,wflux,hfluxt,wfluxt,tau) 369 USE icosa 370 REAL(rstd), INTENT(IN) :: hflux(3*iim*jjm,llm), wflux(iim*jjm,llm+1) 371 REAL(rstd), INTENT(INOUT) :: hfluxt(3*iim*jjm,llm), wfluxt(iim*jjm,llm+1) 372 REAL(rstd), INTENT(IN) :: tau 373 hfluxt = hfluxt + tau*hflux 374 wfluxt = wfluxt + tau*wflux 375 END SUBROUTINE accumulate_fluxes 320 376 321 377 END MODULE timeloop_gcm_mod
Note: See TracChangeset
for help on using the changeset viewer.