Hi,
I am wondering if you could give me some directions on how to do a horizontal spatial average of data during simulation of wrf. I was able to write a code that works perfectly in serial but when it came to parallel I am getting some issues due to the distributed memory (I assume). Below are the steps that I implemented.
1- First I created a variable in Registry.EM_COMMON as shown below
state real sp_avg_u1 k misc 1 - rh "sp_avg_u1" "Spatial average of u" "m s-1"
2- Second I created an averaging function and added it to dyn_em/solve_em.F as shown below
ifdef DM_PARALLEL
# include "HALO_EM_PHYS_A.inc"
#endif
! Calculate Spatial average
!$OMP PARALLEL DO &
!$OMP PRIVATE ( ij )
DO ij = 1 , grid%num_tiles
!$OMP CRITICAL(SPATAIL_AVERAGE)
CALL calculate_horizontal_spatial_average ( grid%u_2, grid%sp_avg_u1,
ids, ide, jds, jde, kds, kde, &
ims, ime, jms, jme, kms, kme, &
grid%i_start(ij), grid%i_end(ij), &
grid%j_start(ij), grid%j_end(ij), &
k_start, k_end )
!$OMP END CRITICAL(SPATAIL_AVERAGE)
END DO
!$OMP END PARALLEL DO
The code takes the x-velocity as input, interpolates it to the mass center (or pressure center) and then sums it up into a 1D array sp_avg_u1 according to the height.
This code works perfectly in serial, but when I run it in parallel mode (ex: mpirun -np 4 ./wrf.exe) I am getting errors.
Is there a module I can use that allows me to send data across different nodes like HALO? Or do you know of a module that does MPI messaging that I can look at and implement.
I am wondering if you could give me some directions on how to do a horizontal spatial average of data during simulation of wrf. I was able to write a code that works perfectly in serial but when it came to parallel I am getting some issues due to the distributed memory (I assume). Below are the steps that I implemented.
1- First I created a variable in Registry.EM_COMMON as shown below
state real sp_avg_u1 k misc 1 - rh "sp_avg_u1" "Spatial average of u" "m s-1"
2- Second I created an averaging function and added it to dyn_em/solve_em.F as shown below
ifdef DM_PARALLEL
# include "HALO_EM_PHYS_A.inc"
#endif
! Calculate Spatial average
!$OMP PARALLEL DO &
!$OMP PRIVATE ( ij )
DO ij = 1 , grid%num_tiles
!$OMP CRITICAL(SPATAIL_AVERAGE)
CALL calculate_horizontal_spatial_average ( grid%u_2, grid%sp_avg_u1,
ids, ide, jds, jde, kds, kde, &
ims, ime, jms, jme, kms, kme, &
grid%i_start(ij), grid%i_end(ij), &
grid%j_start(ij), grid%j_end(ij), &
k_start, k_end )
!$OMP END CRITICAL(SPATAIL_AVERAGE)
END DO
!$OMP END PARALLEL DO
The code takes the x-velocity as input, interpolates it to the mass center (or pressure center) and then sums it up into a 1D array sp_avg_u1 according to the height.
This code works perfectly in serial, but when I run it in parallel mode (ex: mpirun -np 4 ./wrf.exe) I am getting errors.
Is there a module I can use that allows me to send data across different nodes like HALO? Or do you know of a module that does MPI messaging that I can look at and implement.