winstonwu91
New member
Hi,
I modified module_avgflx_em.F to find resolved turbulent heat flux (u'T' v'T' w'T') and its horizontal and vertical gradient (du'T'/dx dv'T'/dy dw'T'/dz). I added the code as follows. The u_mass, v_mass, w_mass are velocity at mass points and I used grid%u_phy, grid%v_phy and grid%w_phy as input when upd_avgflx is called in solve_em.F.
While the resolved turbulent heat flux and the vertical gradient of vertical heat flux worked great, strange streaks are present at the horizontal gradients between the MPI-tiles. Then I tried
1) defining halo for the horizontal gradient of horizontal heat fluxes in registry.avgflx,
2) included the corresponding halo and called set_physical_bc3d for each of the horizontal gradients of horizontal heat fluxes in solve_em.F right after upd_avgflx.
The streaks are still present.
The modified code is as follows:
The added halo at the last of lines in registry.avgflx:
And corresponding solve_em.F
The streaks look like this. My Ntasks in X is 18 so the tiles are at the boundaries.
I am out of ideas of how to remove the streaks between tiles. If possible is it a way to solve the horizontal gradient of horizontal fluxes?
Best,
Winston
I modified module_avgflx_em.F to find resolved turbulent heat flux (u'T' v'T' w'T') and its horizontal and vertical gradient (du'T'/dx dv'T'/dy dw'T'/dz). I added the code as follows. The u_mass, v_mass, w_mass are velocity at mass points and I used grid%u_phy, grid%v_phy and grid%w_phy as input when upd_avgflx is called in solve_em.F.
While the resolved turbulent heat flux and the vertical gradient of vertical heat flux worked great, strange streaks are present at the horizontal gradients between the MPI-tiles. Then I tried
1) defining halo for the horizontal gradient of horizontal heat fluxes in registry.avgflx,
2) included the corresponding halo and called set_physical_bc3d for each of the horizontal gradients of horizontal heat fluxes in solve_em.F right after upd_avgflx.
The streaks are still present.
The modified code is as follows:
Code:
subroutine upd_avgflx(avgflx_count,tol_steps,avgflx_rum,avgflx_rvm,avgflx_wwm, &
& ru_m, rv_m, ww_m, &
& ids, ide, jds, jde, kds, kde, &
& ims, ime, jms, jme, kms, kme, &
& its, ite, jts, jte, kts, kte, do_cu, &
& cfu1,cfd1,dfu1,efu1,dfd1,efd1, &
& rdx, rdy, rdz, &
& avgflx_cfu1,avgflx_cfd1,avgflx_dfu1,avgflx_efu1,avgflx_dfd1,avgflx_efd1, &
& u_mass,v_mass,w_mass,t_mass, nba_mij, n_nba_mij, &
& avgflx_u,avgflx_v,avgflx_w, avgflx_t, &
& avgflx_uth_resolve, avgflx_vth_resolve, &
& avgflx_wth_resolve, &
& avgflx_dutdx, avgflx_dvtdy, avgflx_dwtdz)
...
REAL, DIMENSION(ims:ime, kms:kme, jms:jme) , INTENT(INOUT) ::
& avgflx_u, avgflx_v, avgflx_w, avgflx_t, &
& avgflx_uth_resolve, avgflx_vth_resolve, &
& avgflx_wth_resolve, &
& avgflx_dutdx, avgflx_dvtdy, avgflx_dwtdz
...
! Time-averaged wind speed, temperature and resolved turbulent heat flux at mass points
DO j=jts,jte
DO k=kts,kte
DO i=its,ite
uprime(i,k,j) = u_mass(i,k,j) - avgflx_u(i,k,j)
vprime(i,k,j) = v_mass(i,k,j) - avgflx_v(i,k,j)
wprime(i,k,j) = w_mass(i,k,j) - avgflx_w(i,k,j)
tprime(i,k,j) = t_mass(i,k,j) - avgflx_t(i,k,j)
avgflx_uth_resolve(i,k,j) = (local_count*avgflx_uth_resolve(i,k,j) + uprime(i,k,j) * tprime(i,k,j) )/(local_count+1.)
avgflx_vth_resolve(i,k,j) = (local_count*avgflx_vth_resolve(i,k,j) + vprime(i,k,j) * tprime(i,k,j) )/(local_count+1.)
avgflx_wth_resolve(i,k,j) = (local_count*avgflx_wth_resolve(i,k,j) + wprime(i,k,j) * tprime(i,k,j) )/(local_count+1.)
avgflx_u(i,k,j) = (local_count*avgflx_u(i,k,j) + u_mass(i,k,j))/(local_count+1.)
avgflx_v(i,k,j) = (local_count*avgflx_v(i,k,j) + v_mass(i,k,j))/(local_count+1.)
avgflx_w(i,k,j) = (local_count*avgflx_w(i,k,j) + w_mass(i,k,j))/(local_count+1.)
avgflx_t(i,k,j) = (local_count*avgflx_t(i,k,j) + t_mass(i,k,j))/(local_count+1.)
...
END DO
END DO
END DO
! Gradient of turbulent heat flux
ktf=MIN(kte,kde-1)
i_start = its
i_end = MIN(ite,ide-1)
j_start = jts
j_end = MIN(jte,jde-1)
DO j=j_start-1,j_end+1 ! I tried j_start,j_end; kts, ktf; i_start, i_end too, streaks are still there.
DO k=kts-1,ktf+1
DO i=i_start-1,i_end+1
! Central difference for heat flux gradient at mass points
avgflx_dwtdz(i,k,j) = 0.5 * (avgflx_wth_resolve(i,k+1,j) - avgflx_wth_resolve(i,k-1,j)) * rdz(i,k,j)
avgflx_dutdx(i,k,j) = 0.5 * (avgflx_uth_resolve(i+1,k,j) - avgflx_uth_resolve(i-1,k,j)) * rdx
avgflx_dvtdy(i,k,j) = 0.5 * (avgflx_vth_resolve(i,k,j+1) - avgflx_vth_resolve(i,k,j-1)) * rdy
END DO
END DO
END DO
The added halo at the last of lines in registry.avgflx:
Code:
...
halo HALO_EM_AVGFLX 8:avgflx_dutdx,avgflx_dvtdy,avgflx_dwtdz
period PERIOD_EM_AVGFLX 3:avgflx_dutdx,avgflx_dvtdy,avgflx_dwtdz
And corresponding solve_em.F
Code:
...
!After calling upd_avgflx
#ifdef DM_PARALLEL
# include "HALO_EM_AVGFLX.inc"
# include "PERIOD_EM_AVGFLX.inc"
#endif
!$OMP PARALLEL DO &
!$OMP PRIVATE ( ij )
DO ij = 1 , grid%num_tiles !--------------------------------
CALL set_physical_bc3d( grid%avgflx_dutdx, 't', config_flags, &
ids, ide, jds, jde, kds, kde, &
ims, ime, jms, jme, kms, kme, &
ips, ipe, jps, jpe, kps, kpe, &
grid%i_start(ij), grid%i_end(ij), &
grid%j_start(ij), grid%j_end(ij), &
k_start, k_end )
CALL set_physical_bc3d( grid%avgflx_dvtdy, 't', config_flags, &
ids, ide, jds, jde, kds, kde, &
ims, ime, jms, jme, kms, kme, &
ips, ipe, jps, jpe, kps, kpe, &
grid%i_start(ij), grid%i_end(ij), &
grid%j_start(ij), grid%j_end(ij), &
k_start, k_end )
CALL set_physical_bc3d( grid%avgflx_dwtdz, 't', config_flags, &
ids, ide, jds, jde, kds, kde, &
ims, ime, jms, jme, kms, kme, &
ips, ipe, jps, jpe, kps, kpe, &
grid%i_start(ij), grid%i_end(ij), &
grid%j_start(ij), grid%j_end(ij), &
k_start, k_end )
ENDDO !-----------------------------------------------------
!$OMP END PARALLEL DO
...
The streaks look like this. My Ntasks in X is 18 so the tiles are at the boundaries.
I am out of ideas of how to remove the streaks between tiles. If possible is it a way to solve the horizontal gradient of horizontal fluxes?
Best,
Winston