Changeset 592
- Timestamp:
- 10/17/17 23:11:14 (7 years ago)
- Location:
- codes/icosagcm/devel/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
codes/icosagcm/devel/src/diagnostics/diagflux.f90
r590 r592 4 4 SAVE 5 5 6 TYPE(t_field),POINTER :: f_qfluxt(:), f_qfluxt_lon(:), f_qfluxt_lat(:) ! time-integrated flux of scalars and its reconstruction at cell centers 6 TYPE(t_field),POINTER :: & 7 f_masst(:), f_qmasst(:), & ! time-integrated mass, tracer mass, 8 f_massfluxt(:), f_qfluxt(:), & ! mass flux and tracer flux 9 f_qfluxt_lon(:), f_qfluxt_lat(:) ! scalar flux reconstructed cell centers 7 10 LOGICAL :: diagflux_on 8 11 !$OMP THREADPRIVATE(diagflux_on) … … 15 18 CALL getin("diagflux", diagflux_on) 16 19 IF(diagflux_on) THEN 20 CALL allocate_field(f_masst, field_t,type_real,llm, name="masst") 21 CALL allocate_field(f_qmasst, field_t,type_real,llm,nqtot, name="qmasst") 22 CALL allocate_field(f_massfluxt, field_u,type_real,llm, name="massfluxt") 17 23 CALL allocate_field(f_qfluxt, field_u,type_real,llm,nqtot, name="qfluxt") 18 24 CALL allocate_field(f_qfluxt_lon, field_t,type_real,llm,nqtot, name="qfluxt_lon") … … 20 26 CALL zero_qfluxt 21 27 ELSE 28 CALL allocate_field(f_masst, field_t,type_real,0, name="masst") 29 CALL allocate_field(f_qmasst, field_t,type_real,llm,0, name="qmasst") 30 CALL allocate_field(f_massfluxt, field_u,type_real,0, name="massfluxt") 22 31 CALL allocate_field(f_qfluxt, field_u,type_real,llm,0, name="qfluxt") 23 32 CALL allocate_field(f_qfluxt_lon, field_t,type_real,llm,0, name="qfluxt_lon") … … 30 39 USE omp_para 31 40 INTEGER :: ind 32 REAL(rstd), POINTER :: qfluxt(:,:,:)41 REAL(rstd), POINTER :: buf2(:,:),buf3(:,:,:) 33 42 DO ind=1,ndomain 34 43 IF (.NOT. assigned_domain(ind)) CYCLE 35 44 CALL swap_dimensions(ind) 36 qfluxt=f_qfluxt(ind) 37 qfluxt(:,ll_begin:ll_end,:)=0. 45 buf2=f_masst(ind) 46 buf2(:,ll_begin:ll_end)=0. 47 buf2=f_massfluxt(ind) 48 buf2(:,ll_begin:ll_end)=0. 49 buf3=f_qmasst(ind) 50 buf3(:,ll_begin:ll_end,:)=0. 51 buf3=f_qfluxt(ind) 52 buf3(:,ll_begin:ll_end,:)=0. 38 53 END DO 39 54 END SUBROUTINE zero_qfluxt 40 55 41 SUBROUTINE flux_centered_lonlat(scale, f_ flux, f_flux_lon, f_flux_lat)56 SUBROUTINE flux_centered_lonlat(scale, f_massflux, f_flux, f_massflux_lon, f_massflux_lat, f_flux_lon, f_flux_lat) 42 57 REAL(rstd), INTENT(IN) :: scale 43 TYPE(t_field),POINTER :: f_flux(:), f_flux_lon(:), f_flux_lat(:) 44 REAL(rstd), POINTER :: flux(:,:,:), flux_lon(:,:,:), flux_lat(:,:,:) 58 TYPE(t_field),POINTER :: f_flux(:), f_flux_lon(:), f_flux_lat(:), & 59 f_massflux(:), f_massflux_lon(:), f_massflux_lat(:) 60 REAL(rstd), POINTER :: flux(:,:,:), flux_lon(:,:,:), flux_lat(:,:,:), & 61 massflux(:,:), massflux_lon(:,:), massflux_lat(:,:) 45 62 INTEGER :: ind, itrac 46 63 DO ind=1,ndomain … … 54 71 CALL compute_flux_centered_lonlat(scale, flux(:,:,itrac), flux_lon(:,:,itrac), flux_lat(:,:,itrac)) 55 72 END DO 73 massflux=f_massflux(ind) 74 massflux_lon=f_massflux_lon(ind) 75 massflux_lat=f_massflux_lat(ind) 76 CALL compute_flux_centered_lonlat(scale, massflux, massflux_lon, massflux_lat) 56 77 END DO 57 78 END SUBROUTINE flux_centered_lonlat -
codes/icosagcm/devel/src/diagnostics/observable.f90
r588 r592 163 163 IF(.NOT. init) THEN 164 164 IF(diagflux_on) THEN 165 CALL flux_centered_lonlat(1./(itau_out*dt) , f_qfluxt, f_qfluxt_lon, f_qfluxt_lat) 165 CALL output_field("mass_t", f_masst) 166 CALL output_field("qmass_t", f_qmasst) 167 CALL flux_centered_lonlat(1./(itau_out*dt) , f_massfluxt, f_qfluxt, & 168 f_buf_ulon, f_buf_ulat, f_qfluxt_lon, f_qfluxt_lat) 169 CALL output_field("massflux_lon",f_buf_ulon) 170 CALL output_field("massflux_lat",f_buf_ulat) 166 171 CALL output_field("qflux_lon",f_qfluxt_lon) 167 172 CALL output_field("qflux_lat",f_qfluxt_lat) -
codes/icosagcm/devel/src/time/timeloop_gcm.f90
r584 r592 182 182 REAL(rstd),POINTER :: rhodz(:,:), mass(:,:), ps(:) 183 183 184 INTEGER :: ind185 INTEGER :: i t,i,j,l,n, stage186 LOGICAL :: fluxt_zero(ndomain) ! set to .TRUE. to start accumulating fluxes in time184 REAL(rstd) :: adv_over_out ! ratio itau_adv/itau_out 185 INTEGER :: ind, it,i,j,l,n, stage 186 LOGICAL :: fluxt_zero(ndomain) ! set to .TRUE. to start accumulating mass fluxes in time 187 187 LOGICAL, PARAMETER :: check_rhodz=.FALSE. 188 188 INTEGER :: start_clock, stop_clock, rate_clock … … 211 211 212 212 IF(positive_theta) CALL copy_theta_to_q(f_theta_rhodz,f_rhodz,f_q) 213 IF(diagflux_on) THEN 214 adv_over_out = itau_adv*(1./itau_out) 215 ELSE 216 adv_over_out = 0. 217 END IF 213 218 214 219 CALL check_conserve(f_ps,f_dps,f_u,f_theta_rhodz,f_phis,itau0) … … 299 304 300 305 IF(MOD(it,itau_adv)==0) THEN 301 CALL advect_tracer(diagflux_on, f_hfluxt,f_wfluxt,f_u, f_q,f_rhodz,f_qfluxt) ! update q and rhodz after RK step 306 CALL advect_tracer(f_hfluxt,f_wfluxt,f_u, f_q,f_rhodz, & ! update q and rhodz after RK step 307 adv_over_out, f_masst,f_qmasst,f_massfluxt, f_qfluxt) ! accumulate mass and fluxes if diagflux_on 302 308 fluxt_zero=.TRUE. 303 309 ! FIXME : check that rhodz is consistent with ps -
codes/icosagcm/devel/src/transport/advect_tracer.f90
r583 r592 54 54 END SUBROUTINE init_advect_tracer 55 55 56 SUBROUTINE advect_tracer(diagflux_on, f_hfluxt, f_wfluxt,f_u, f_q,f_rhodz,f_qfluxt) 57 USE mpipara 56 SUBROUTINE advect_tracer(f_hfluxt, f_wfluxt,f_u, f_q,f_rhodz,& 57 frac, f_masst,f_qmasst,f_massfluxt,f_qfluxt) 58 USE omp_para 58 59 USE trace 59 60 USE write_field_mod 60 61 USE tracer_mod 61 LOGICAL, INTENT(IN) :: diagflux_on62 62 TYPE(t_field),POINTER :: f_hfluxt(:) ! time-integrated horizontal mass flux 63 63 TYPE(t_field),POINTER :: f_wfluxt(:) ! time-integrated vertical mass flux … … 65 65 TYPE(t_field),POINTER :: f_q(:) ! tracer 66 66 TYPE(t_field),POINTER :: f_rhodz(:) ! mass field at beginning of macro time step 67 REAL(rstd), INTENT(in):: frac ! ratio itau_adv/itau_out or 0. if not diagflux_on 68 TYPE(t_field),POINTER :: f_masst(:) ! time-integrated mass 69 TYPE(t_field),POINTER :: f_qmasst(:) ! time-integrated tracer mass 70 TYPE(t_field),POINTER :: f_massfluxt(:)! time-integrated horizontal mass flux 67 71 TYPE(t_field),POINTER :: f_qfluxt(:) ! time-integrated horizontal tracer flux 68 72 69 73 REAL(rstd),POINTER :: q(:,:,:), normal(:,:), tangent(:,:), sqrt_leng(:), gradq3d(:,:,:), cc(:,:,:) 70 REAL(rstd),POINTER :: hfluxt(:,:), wfluxt(:,:), qfluxt(:,:,:)74 REAL(rstd),POINTER :: hfluxt(:,:), wfluxt(:,:), masst(:,:), qmasst(:,:,:), massfluxt(:,:), qfluxt(:,:,:) 71 75 REAL(rstd),POINTER :: rhodz(:,:), u(:,:) 72 76 ! temporary shared variable for vlz … … 76 80 REAL(rstd),POINTER :: wq(:,:) ! time-integrated flux of q 77 81 78 82 INTEGER :: ind,k, nq_last 79 83 LOGICAL,SAVE :: first=.TRUE. 80 84 !$OMP THREADPRIVATE(first) … … 140 144 CALL send_message(f_cc,req_cc) 141 145 142 143 146 ! horizontal transport - split in two to place transfer of gradq3d 144 147 DO k = 1, nqtot … … 153 156 sqrt_leng=f_sqrt_leng(ind) 154 157 CALL compute_gradq3d(q(:,:,k),sqrt_leng,gradq3d,xyz_i,xyz_v) 155 156 158 END DO 157 159 … … 159 161 CALL wait_message(req_cc) 160 162 CALL wait_message(req_gradq3d) 161 162 163 163 164 DO ind=1,ndomain … … 171 172 qfluxt = f_qfluxt(ind) 172 173 gradq3d = f_gradq3d(ind) 173 CALL compute_advect_horiz(k==nq_last,diagflux_on, hfluxt,cc,gradq3d, rhodz,q(:,:,k),qfluxt(:,:,k)) 174 175 IF(frac>0.) THEN ! accumulate mass, mass flux and tracer mass 176 qmasst = f_qmasst(ind) 177 qmasst(:,ll_begin:ll_end,k) = qmasst(:,ll_begin:ll_end,k) + & 178 frac*rhodz(:,ll_begin:ll_end)*q(:,ll_begin:ll_end,k) 179 IF(k==nq_last) THEN 180 masst = f_masst(ind) 181 massfluxt = f_massfluxt(ind) 182 masst(:,ll_begin:ll_end) = masst(:,ll_begin:ll_end)+frac*rhodz(:,ll_begin:ll_end) 183 massfluxt(:,ll_begin:ll_end) = massfluxt(:,ll_begin:ll_end)+hfluxt(:,ll_begin:ll_end) 184 END IF 185 END IF 186 CALL compute_advect_horiz(k==nq_last,frac>0., hfluxt,cc,gradq3d, rhodz, q(:,:,k), qfluxt(:,:,k)) 174 187 END DO 188 175 189 ENDIF 176 190 END DO
Note: See TracChangeset
for help on using the changeset viewer.