Changeset 601
- Timestamp:
- 10/23/17 18:25:46 (7 years ago)
- Location:
- codes/icosagcm/devel/src
- Files:
-
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
codes/icosagcm/devel/src/diagnostics/diagflux.F90
r595 r601 10 10 f_massfluxt(:), f_qfluxt(:), & ! time-integrated mass flux and tracer flux 11 11 f_qfluxt_lon(:), f_qfluxt_lat(:), & ! scalar flux reconstructed at cell centers 12 f_ epot(:), f_ekin(:), f_enthalpy(:), & ! time-averaged potential E, kinetic E and enthalpy13 f_ epotfluxt(:), f_ekinfluxt(:), f_enthalpyfluxt(:) ! time averaged 'fluxes' of epot, ekin and enthalpy12 f_ulont(:), f_thetat(:), f_epot(:), f_ekin(:), f_enthalpy(:), & ! time-averaged potential E, kinetic E and enthalpy 13 f_ulonfluxt(:), f_thetafluxt(:), f_epotfluxt(:), f_ekinfluxt(:), f_enthalpyfluxt(:) ! time averaged 'fluxes' of epot, ekin and enthalpy 14 14 LOGICAL :: diagflux_on 15 15 !$OMP THREADPRIVATE(diagflux_on) … … 26 26 ll = MERGE(llm,1,diagflux_on) 27 27 CALL allocate_field(f_masst, field_t,type_real,ll, name="masst") 28 CALL allocate_field(f_ulont, field_t,type_real,ll, name="ulont") 29 CALL allocate_field(f_thetat, field_t,type_real,ll, name="thetat") 28 30 CALL allocate_field(f_epot, field_t,type_real,ll, name="epot") 29 31 CALL allocate_field(f_ekin, field_t,type_real,ll, name="ekin") … … 31 33 CALL allocate_field(f_qmasst, field_t,type_real,ll,nqtot, name="qmasst") 32 34 CALL allocate_field(f_massfluxt, field_u,type_real,ll, name="massfluxt") 35 CALL allocate_field(f_ulonfluxt, field_u,type_real,ll, name="ulonfluxt") 36 CALL allocate_field(f_thetafluxt, field_u,type_real,ll, name="thetafluxt") 33 37 CALL allocate_field(f_epotfluxt, field_u,type_real,ll, name="epotfluxt") 34 38 CALL allocate_field(f_ekinfluxt, field_u,type_real,ll, name="ekinfluxt") … … 110 114 !------------------------------------ Compute energy fluxes --------------------------------------- 111 115 112 SUBROUTINE diagflux_energy(frac, f_phis,f_rhodz,f_theta_rhodz,f_u, f_geopot,f_theta, f_hfluxt)116 SUBROUTINE diagflux_energy(frac, f_phis,f_rhodz,f_theta_rhodz,f_u, f_geopot,f_theta,f_pk, f_hfluxt) 113 117 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(:)118 TYPE(t_field),POINTER :: f_phis(:),f_rhodz(:),f_theta_rhodz(:),f_u(:), f_geopot(:), f_theta(:), f_pk(:), f_hfluxt(:) 115 119 REAL(rstd), POINTER :: phis(:), rhodz(:,:), theta_rhodz(:,:,:), u(:,:), & 116 geopot(:,:), pk(:,:,:), hfluxt(:,:), &117 epot(:,:), ekin(:,:), enthalpy(:,:), &118 epotflux(:,:), ekinflux(:,:), enthalpyflux(:,:)120 geopot(:,:), theta(:,:,:), pk(:,:), hfluxt(:,:), & 121 ulont(:,:), thetat(:,:), epot(:,:), ekin(:,:), enthalpy(:,:), & 122 thetaflux(:,:), ulonflux(:,:), epotflux(:,:), ekinflux(:,:), enthalpyflux(:,:) 119 123 INTEGER :: ind 120 124 DO ind=1,ndomain … … 128 132 u = f_u(ind) 129 133 geopot = f_geopot(ind) 130 pk = f_theta(ind) ! buffer 134 theta = f_theta(ind) ! buffer 135 pk = f_pk(ind) ! buffer 136 ulont = f_ulont(ind) 137 thetat = f_thetat(ind) 131 138 epot = f_epot(ind) 132 139 ekin = f_ekin(ind) 133 140 enthalpy = f_enthalpy(ind) 141 ulonflux = f_ulonfluxt(ind) 142 thetaflux = f_thetafluxt(ind) 134 143 epotflux = f_epotfluxt(ind) 135 144 ekinflux = f_ekinfluxt(ind) 136 145 enthalpyflux = f_enthalpyfluxt(ind) 137 CALL compute_diagflux_energy(frac,hfluxt, phis,rhodz,theta_rhodz,u, geopot,pk, epot,ekin,enthalpy, epotflux, ekinflux, enthalpyflux) 146 CALL compute_diagflux_energy(frac,hfluxt, phis,rhodz,theta_rhodz,u, geopot,theta,pk, & 147 ulont, thetat, epot, ekin, enthalpy, & 148 ulonflux, thetaflux, epotflux, ekinflux, enthalpyflux) 138 149 END DO 139 150 END SUBROUTINE diagflux_energy 140 151 141 SUBROUTINE compute_diagflux_energy(frac, massflux, phis,rhodz,theta_rhodz,u, geopot,pk, epot,ekin,enthalpy, epot_flux, ekin_flux, enthalpy_flux) 152 SUBROUTINE compute_diagflux_energy(frac, massflux, phis,rhodz,theta_rhodz,ue, geopot,theta,pk, & 153 ulon, thetat, epot, ekin, enthalpy, & 154 ulon_flux, thetat_flux, epot_flux, ekin_flux, enthalpy_flux) 142 155 USE disvert_mod, ONLY : ptop 143 156 REAL(rstd), INTENT(IN) :: frac 144 REAL(rstd), INTENT(IN) :: massflux(3*iim*jjm,llm), u (3*iim*jjm,llm),&157 REAL(rstd), INTENT(IN) :: massflux(3*iim*jjm,llm), ue(3*iim*jjm,llm),& 145 158 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 = buffer147 REAL(rstd), INTENT(INOUT), DIMENSION(iim*jjm, llm) :: epot, ekin, enthalpy148 REAL(rstd), INTENT(INOUT), DIMENSION(3*iim*jjm, llm) :: epot_flux, ekin_flux, enthalpy_flux149 REAL(rstd) :: energy, p_ik, theta_ik, temp_ik, gv, Rd 159 REAL(rstd), INTENT(INOUT) :: geopot(iim*jjm,llm+1), theta(iim*jjm,llm), pk(iim*jjm,llm) ! theta,pk = buffers 160 REAL(rstd), INTENT(INOUT), DIMENSION(iim*jjm, llm) :: ulon, thetat, epot, ekin, enthalpy 161 REAL(rstd), INTENT(INOUT), DIMENSION(3*iim*jjm, llm) :: ulon_flux, thetat_flux, epot_flux, ekin_flux, enthalpy_flux 162 REAL(rstd) :: energy, p_ik, theta_ik, temp_ik, gv, Rd, cx,cy,cz, ux,uy,uz, ue_le,ulon_i 150 163 INTEGER :: ij, l, ij_omp_begin_ext, ij_omp_end_ext 151 164 Rd = kappa*cpp -
codes/icosagcm/devel/src/kernels/energy_fluxes.k90
r594 r601 11 11 END DO 12 12 END DO 13 ! NB : at this point pressure is stored in array pk 14 ! pk then serves as buffer to store temperature 13 15 SELECT CASE(caldyn_thermo) 14 16 CASE(thermo_theta) … … 17 19 p_ik = pk(ij,l) 18 20 theta_ik = theta_rhodz(ij,l,1)/rhodz(ij,l) 21 theta(ij,l) = theta_ik 19 22 temp_ik = theta_ik*(p_ik/preff)**kappa 20 23 gv = (g*Rd)*temp_ik/p_ik … … 29 32 theta_ik = theta_rhodz(ij,l,1)/rhodz(ij,l) 30 33 temp_ik = Treff*exp((theta_ik + Rd*log(p_ik/preff))/cpp) 34 theta(ij,l) = Treff*exp(theta_ik/cpp) 31 35 gv = (g*Rd)*temp_ik/p_ik ! specific volume v = Rd*T/p 32 36 pk(ij,l) = temp_ik … … 37 41 !$OMP BARRIER 38 42 ! Now accumulate energies and energy fluxes 39 ! enthalpy40 43 ! NB : at this point temperature is stored in array pk 41 44 ! pk then serves as buffer to store energy 45 ! enthalpy 42 46 DO l = ll_begin, ll_end 43 47 !DIR$ SIMD … … 73 77 END DO 74 78 END DO 79 ! theta 80 DO l = ll_begin, ll_end 81 !DIR$ SIMD 82 DO ij=ij_begin_ext, ij_end_ext 83 energy = theta(ij,l) 84 thetat(ij,l) = thetat(ij,l) + frac*rhodz(ij,l)*energy 85 pk(ij,l) = energy 86 END DO 87 END DO 88 DO l = ll_begin, ll_end 89 !DIR$ SIMD 90 DO ij=ij_begin_ext, ij_end_ext 91 thetat_flux(ij+u_right,l) = thetat_flux(ij+u_right,l) + .5*massflux(ij+u_right,l)*(pk(ij,l)+pk(ij+t_right,l)) 92 thetat_flux(ij+u_lup,l) = thetat_flux(ij+u_lup,l) + .5*massflux(ij+u_lup,l)*(pk(ij,l)+pk(ij+t_lup,l)) 93 thetat_flux(ij+u_ldown,l) = thetat_flux(ij+u_ldown,l) + .5*massflux(ij+u_ldown,l)*(pk(ij,l)+pk(ij+t_ldown,l)) 94 END DO 95 END DO 75 96 ! kinetic energy 76 97 DO l = ll_begin, ll_end … … 78 99 DO ij=ij_begin_ext, ij_end_ext 79 100 energy=0.d0 80 energy = energy + le(ij+u_rup)*de(ij+u_rup)*u (ij+u_rup,l)**281 energy = energy + le(ij+u_lup)*de(ij+u_lup)*u (ij+u_lup,l)**282 energy = energy + le(ij+u_left)*de(ij+u_left)*u (ij+u_left,l)**283 energy = energy + le(ij+u_ldown)*de(ij+u_ldown)*u (ij+u_ldown,l)**284 energy = energy + le(ij+u_rdown)*de(ij+u_rdown)*u (ij+u_rdown,l)**285 energy = energy + le(ij+u_right)*de(ij+u_right)*u (ij+u_right,l)**2101 energy = energy + le(ij+u_rup)*de(ij+u_rup)*ue(ij+u_rup,l)**2 102 energy = energy + le(ij+u_lup)*de(ij+u_lup)*ue(ij+u_lup,l)**2 103 energy = energy + le(ij+u_left)*de(ij+u_left)*ue(ij+u_left,l)**2 104 energy = energy + le(ij+u_ldown)*de(ij+u_ldown)*ue(ij+u_ldown,l)**2 105 energy = energy + le(ij+u_rdown)*de(ij+u_rdown)*ue(ij+u_rdown,l)**2 106 energy = energy + le(ij+u_right)*de(ij+u_right)*ue(ij+u_right,l)**2 86 107 energy = energy * (.25/Ai(ij)) 87 108 ekin(ij,l) = ekin(ij,l) + frac*rhodz(ij,l)*energy … … 97 118 END DO 98 119 END DO 120 ! ulon 121 DO l = ll_begin, ll_end 122 !DIR$ SIMD 123 DO ij=ij_begin_ext, ij_end_ext 124 cx=centroid(ij,1) 125 cy=centroid(ij,2) 126 cz=centroid(ij,3) 127 ux=0. ; uy=0. ; uz=0. 128 ue_le = ne_rup*ue(ij+u_rup,l)*le(ij+u_rup) 129 ux = ux + ue_le*(.5*(xyz_v(ij+z_rup,1)+xyz_v(ij+z_up,1))-cx) 130 uy = uy + ue_le*(.5*(xyz_v(ij+z_rup,2)+xyz_v(ij+z_up,2))-cy) 131 uz = uz + ue_le*(.5*(xyz_v(ij+z_rup,3)+xyz_v(ij+z_up,3))-cz) 132 ue_le = ne_lup*ue(ij+u_lup,l)*le(ij+u_lup) 133 ux = ux + ue_le*(.5*(xyz_v(ij+z_lup,1)+xyz_v(ij+z_up,1))-cx) 134 uy = uy + ue_le*(.5*(xyz_v(ij+z_lup,2)+xyz_v(ij+z_up,2))-cy) 135 uz = uz + ue_le*(.5*(xyz_v(ij+z_lup,3)+xyz_v(ij+z_up,3))-cz) 136 ue_le = ne_left*ue(ij+u_left,l)*le(ij+u_left) 137 ux = ux + ue_le*(.5*(xyz_v(ij+z_lup,1)+xyz_v(ij+z_ldown,1))-cx) 138 uy = uy + ue_le*(.5*(xyz_v(ij+z_lup,2)+xyz_v(ij+z_ldown,2))-cy) 139 uz = uz + ue_le*(.5*(xyz_v(ij+z_lup,3)+xyz_v(ij+z_ldown,3))-cz) 140 ue_le = ne_ldown*ue(ij+u_ldown,l)*le(ij+u_ldown) 141 ux = ux + ue_le*(.5*(xyz_v(ij+z_ldown,1)+xyz_v(ij+z_down,1))-cx) 142 uy = uy + ue_le*(.5*(xyz_v(ij+z_ldown,2)+xyz_v(ij+z_down,2))-cy) 143 uz = uz + ue_le*(.5*(xyz_v(ij+z_ldown,3)+xyz_v(ij+z_down,3))-cz) 144 ue_le = ne_rdown*ue(ij+u_rdown,l)*le(ij+u_rdown) 145 ux = ux + ue_le*(.5*(xyz_v(ij+z_rdown,1)+xyz_v(ij+z_down,1))-cx) 146 uy = uy + ue_le*(.5*(xyz_v(ij+z_rdown,2)+xyz_v(ij+z_down,2))-cy) 147 uz = uz + ue_le*(.5*(xyz_v(ij+z_rdown,3)+xyz_v(ij+z_down,3))-cz) 148 ue_le = ne_right*ue(ij+u_right,l)*le(ij+u_right) 149 ux = ux + ue_le*(.5*(xyz_v(ij+z_rup,1)+xyz_v(ij+z_rdown,1))-cx) 150 uy = uy + ue_le*(.5*(xyz_v(ij+z_rup,2)+xyz_v(ij+z_rdown,2))-cy) 151 uz = uz + ue_le*(.5*(xyz_v(ij+z_rup,3)+xyz_v(ij+z_rdown,3))-cz) 152 ulon_i = ux*elon_i(ij,1) + uy*elon_i(ij,2) + uz*elon_i(ij,3) 153 energy = ulon_i*(1./Ai(ij)) 154 ulon(ij,l) = ulon(ij,l) + frac*rhodz(ij,l)*energy 155 pk(ij,l) = energy 156 END DO 157 END DO 158 DO l = ll_begin, ll_end 159 !DIR$ SIMD 160 DO ij=ij_begin_ext, ij_end_ext 161 ulon_flux(ij+u_right,l) = ulon_flux(ij+u_right,l) + .5*massflux(ij+u_right,l)*(pk(ij,l)+pk(ij+t_right,l)) 162 ulon_flux(ij+u_lup,l) = ulon_flux(ij+u_lup,l) + .5*massflux(ij+u_lup,l)*(pk(ij,l)+pk(ij+t_lup,l)) 163 ulon_flux(ij+u_ldown,l) = ulon_flux(ij+u_ldown,l) + .5*massflux(ij+u_ldown,l)*(pk(ij,l)+pk(ij+t_ldown,l)) 164 END DO 165 END DO 99 166 !---------------------------- energy_fluxes ---------------------------------- 100 167 !-------------------------------------------------------------------------- -
codes/icosagcm/devel/src/time/timeloop_gcm.f90
r595 r601 309 309 ! At this point advect_tracer has obtained the halos of u and rhodz, 310 310 ! needed for correct computation of kinetic energy 311 IF(diagflux_on) CALL diagflux_energy(adv_over_out, f_phis,f_rhodz,f_theta_rhodz,f_u, f_geopot,f_theta, f_hfluxt)311 IF(diagflux_on) CALL diagflux_energy(adv_over_out, f_phis,f_rhodz,f_theta_rhodz,f_u, f_geopot,f_theta,f_buf_i, f_hfluxt) 312 312 313 313 IF (check_rhodz) THEN ! check that rhodz is consistent with ps
Note: See TracChangeset
for help on using the changeset viewer.