Changeset 594
- Timestamp:
- 10/18/17 18:46:11 (7 years ago)
- Location:
- codes/icosagcm/devel/src
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
codes/icosagcm/devel/src/diagnostics/diagflux.F90
r593 r594 1 1 MODULE diagflux_mod 2 2 USE icosa 3 USE omp_para 3 4 IMPLICIT NONE 4 5 SAVE 5 6 TYPE(t_field),POINTER :: & 6 PRIVATE 7 8 TYPE(t_field), POINTER, PUBLIC :: & 7 9 f_masst(:), f_qmasst(:), & ! time-averaged mass, tracer mass, 8 10 f_massfluxt(:), f_qfluxt(:), & ! time-integrated mass flux and tracer flux … … 13 15 !$OMP THREADPRIVATE(diagflux_on) 14 16 17 PUBLIC :: diagflux_on, init_diagflux, zero_qfluxt, qflux_centered_lonlat, flux_centered_lonlat, diagflux_energy 18 15 19 CONTAINS 16 20 … … 20 24 diagflux_on = .FALSE. 21 25 CALL getin("diagflux", diagflux_on) 22 ll = MERGE(ll ,0,diagflux_on)26 ll = MERGE(llm,1,diagflux_on) 23 27 CALL allocate_field(f_masst, field_t,type_real,ll, name="masst") 24 28 CALL allocate_field(f_epot, field_t,type_real,ll, name="epot") … … 36 40 END SUBROUTINE init_diagflux 37 41 42 #define ZERO2(field) buf2=field(ind) ; buf2(:,ll_begin:ll_end)=0. 43 #define ZERO3(field) buf3=field(ind) ; buf3(:,ll_begin:ll_end,:)=0. 44 38 45 SUBROUTINE zero_qfluxt 39 USE omp_para40 46 INTEGER :: ind 41 47 REAL(rstd), POINTER :: buf2(:,:),buf3(:,:,:) … … 43 49 IF (.NOT. assigned_domain(ind)) CYCLE 44 50 CALL swap_dimensions(ind) 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. 51 ZERO2(f_masst) 52 ZERO2(f_epot) 53 ZERO2(f_ekin) 54 ZERO2(f_enthalpy) 55 ZERO3(f_qmasst) 56 ZERO2(f_massfluxt) 57 ZERO2(f_epotfluxt) 58 ZERO2(f_ekinfluxt) 59 ZERO2(f_enthalpyfluxt) 60 ZERO3(f_qfluxt) 53 61 END DO 54 62 END SUBROUTINE zero_qfluxt 55 63 56 SUBROUTINE flux_centered_lonlat(scale, f_massflux, f_flux, f_massflux_lon, f_massflux_lat, f_flux_lon, f_flux_lat) 64 !------------------------------------ Reconstruct fluxes at cell centers --------------------------------------- 65 66 SUBROUTINE qflux_centered_lonlat(scale, f_flux, f_flux_lon, f_flux_lat) 57 67 REAL(rstd), INTENT(IN) :: scale 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(:,:) 68 TYPE(t_field),POINTER :: f_flux(:), f_flux_lon(:), f_flux_lat(:) 69 REAL(rstd), POINTER :: flux(:,:,:), flux_lon(:,:,:), flux_lat(:,:,:) 62 70 INTEGER :: ind, itrac 63 71 DO ind=1,ndomain … … 71 79 CALL compute_flux_centered_lonlat(scale, flux(:,:,itrac), flux_lon(:,:,itrac), flux_lat(:,:,itrac)) 72 80 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) 81 END DO 82 END SUBROUTINE qflux_centered_lonlat 83 84 SUBROUTINE flux_centered_lonlat(scale, f_flux, f_flux_lon, f_flux_lat) 85 REAL(rstd), INTENT(IN) :: scale 86 TYPE(t_field),POINTER :: f_flux(:), f_flux_lon(:), f_flux_lat(:) 87 REAL(rstd), POINTER :: flux(:,:), flux_lon(:,:), flux_lat(:,:) 88 INTEGER :: ind 89 DO ind=1,ndomain 90 IF (.NOT. assigned_domain(ind)) CYCLE 91 CALL swap_dimensions(ind) 92 CALL swap_geometry(ind) 93 flux=f_flux(ind) 94 flux_lon=f_flux_lon(ind) 95 flux_lat=f_flux_lat(ind) 96 CALL compute_flux_centered_lonlat(scale, flux, flux_lon, flux_lat) 77 97 END DO 78 98 END SUBROUTINE flux_centered_lonlat … … 88 108 END SUBROUTINE compute_flux_centered_lonlat 89 109 110 !------------------------------------ Compute energy fluxes --------------------------------------- 111 112 SUBROUTINE diagflux_energy(frac, f_phis,f_rhodz,f_theta_rhodz,f_u, f_geopot,f_theta, f_hfluxt) 113 REAL(rstd), INTENT(IN) :: frac 114 TYPE(t_field),POINTER :: f_phis(:),f_rhodz(:),f_theta_rhodz(:),f_u(:), f_geopot(:), f_theta(:), f_hfluxt(:) 115 REAL(rstd), POINTER :: phis(:), rhodz(:,:), theta_rhodz(:,:,:), u(:,:), & 116 geopot(:,:), pk(:,:,:), hfluxt(:,:), & 117 epot(:,:), ekin(:,:), enthalpy(:,:), & 118 epotflux(:,:), ekinflux(:,:), enthalpyflux(:,:) 119 INTEGER :: ind 120 DO ind=1,ndomain 121 IF (.NOT. assigned_domain(ind)) CYCLE 122 CALL swap_dimensions(ind) 123 CALL swap_geometry(ind) 124 hfluxt = f_hfluxt(ind) 125 phis = f_phis(ind) 126 rhodz = f_rhodz(ind) 127 theta_rhodz = f_theta_rhodz(ind) 128 u = f_u(ind) 129 geopot = f_geopot(ind) 130 pk = f_theta(ind) ! buffer 131 epot = f_epot(ind) 132 ekin = f_ekin(ind) 133 enthalpy = f_enthalpy(ind) 134 epotflux = f_epotfluxt(ind) 135 ekinflux = f_ekinfluxt(ind) 136 enthalpyflux = f_enthalpyfluxt(ind) 137 CALL compute_diagflux_energy(frac,hfluxt, phis,rhodz,theta_rhodz,u, geopot,pk, epot,ekin,enthalpy, epotflux, ekinflux, enthalpyflux) 138 END DO 139 END SUBROUTINE diagflux_energy 140 141 SUBROUTINE compute_diagflux_energy(frac, massflux, phis,rhodz,theta_rhodz,u, geopot,pk, epot,ekin,enthalpy, epot_flux, ekin_flux, enthalpy_flux) 142 USE disvert_mod, ONLY : ptop 143 REAL(rstd), INTENT(IN) :: frac 144 REAL(rstd), INTENT(IN) :: massflux(3*iim*jjm,llm), u(3*iim*jjm,llm),& 145 phis(iim*jjm), rhodz(iim*jjm,llm), theta_rhodz(iim*jjm,llm,nqtot) 146 REAL(rstd), INTENT(INOUT) :: geopot(iim*jjm,llm+1), pk(iim*jjm,llm) ! pk = buffer 147 REAL(rstd), INTENT(INOUT), DIMENSION(iim*jjm, llm) :: epot, ekin, enthalpy 148 REAL(rstd), INTENT(INOUT), DIMENSION(3*iim*jjm, llm) :: epot_flux, ekin_flux, enthalpy_flux 149 REAL(rstd) :: energy, p_ik, theta_ik, temp_ik, gv, Rd 150 INTEGER :: ij, l, ij_omp_begin_ext, ij_omp_end_ext 151 Rd = kappa*cpp 152 CALL distrib_level(ij_end_ext-ij_begin_ext+1,ij_omp_begin_ext,ij_omp_end_ext) 153 ij_omp_begin_ext = ij_omp_begin_ext+ij_begin_ext-1 154 ij_omp_end_ext = ij_omp_end_ext+ij_begin_ext-1 155 #include "../kernels/energy_fluxes.k90" 156 END SUBROUTINE compute_diagflux_energy 157 90 158 END MODULE diagflux_mod -
codes/icosagcm/devel/src/diagnostics/observable.f90
r592 r594 163 163 IF(.NOT. init) THEN 164 164 IF(diagflux_on) THEN 165 CALL flux_centered_lonlat(1./(itau_out*dt) , f_massfluxt, f_buf_ulon, f_buf_ulat) 165 166 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 167 CALL output_field("massflux_lon",f_buf_ulon) 170 168 CALL output_field("massflux_lat",f_buf_ulat) 169 CALL flux_centered_lonlat(1./(itau_out*dt) , f_epotfluxt, f_buf_ulon, f_buf_ulat) 170 CALL output_field("epot_t", f_epot) 171 CALL output_field("epotflux_lon",f_buf_ulon) 172 CALL output_field("epotflux_lat",f_buf_ulat) 173 CALL flux_centered_lonlat(1./(itau_out*dt) , f_ekinfluxt, f_buf_ulon, f_buf_ulat) 174 CALL output_field("ekin_t", f_ekin) 175 CALL output_field("ekinflux_lon",f_buf_ulon) 176 CALL output_field("ekinflux_lat",f_buf_ulat) 177 CALL flux_centered_lonlat(1./(itau_out*dt) , f_enthalpyfluxt, f_buf_ulon, f_buf_ulat) 178 CALL output_field("enthalpy_t", f_enthalpy) 179 CALL output_field("enthalpyflux_lon",f_buf_ulon) 180 CALL output_field("enthalpyflux_lat",f_buf_ulat) 181 CALL qflux_centered_lonlat(1./(itau_out*dt) , f_qfluxt, f_qfluxt_lon, f_qfluxt_lat) 182 CALL output_field("qmass_t", f_qmasst) 171 183 CALL output_field("qflux_lon",f_qfluxt_lon) 172 184 CALL output_field("qflux_lat",f_qfluxt_lat) -
codes/icosagcm/devel/src/time/timeloop_gcm.f90
r592 r594 273 273 CALL HEVI_scheme(it, fluxt_zero) 274 274 END SELECT 275 275 276 276 IF (MOD(it,itau_dissip)==0) THEN 277 277 … … 304 304 305 305 IF(MOD(it,itau_adv)==0) THEN 306 IF(diagflux_on) CALL diagflux_energy(adv_over_out, f_phis,f_rhodz,f_theta_rhodz,f_u, f_geopot,f_theta, f_hfluxt) 306 307 CALL advect_tracer(f_hfluxt,f_wfluxt,f_u, f_q,f_rhodz, & ! update q and rhodz after RK step 307 308 adv_over_out, f_masst,f_qmasst,f_massfluxt, f_qfluxt) ! accumulate mass and fluxes if diagflux_on 308 fluxt_zero=.TRUE. 309 ! FIXME : check that rhodz is consistent with ps 310 IF (check_rhodz) THEN 309 fluxt_zero=.TRUE. ! restart accumulation of hfluxt and qfluxt at next call to explicit_scheme / HEVI_scheme 310 IF (check_rhodz) THEN ! check that rhodz is consistent with ps 311 311 DO ind=1,ndomain 312 312 IF (.NOT. assigned_domain(ind)) CYCLE -
codes/icosagcm/devel/src/transport/advect.F90
r590 r594 444 444 #include "../kernels/advect_horiz.k90" 445 445 CALL trace_end("compute_advect_horiz") 446 CONTAINS447 448 !====================================================================================449 PURE REAL(rstd) FUNCTION sum2(a1,a2)450 IMPLICIT NONE451 REAL(rstd),INTENT(IN):: a1(3), a2(3)452 sum2 = a1(1)*a2(1)+a1(2)*a2(2)+a1(3)*a2(3)453 ! sum2 = 0. ! Godunov scheme454 END FUNCTION sum2455 456 446 END SUBROUTINE compute_advect_horiz 457 447
Note: See TracChangeset
for help on using the changeset viewer.