NCAR / wrf_hydro_nwm_public

WRF-Hydro model code
https://ral.ucar.edu/projects/wrf_hydro
Other
181 stars 139 forks source link

running WRF_HYDRO NWM with MPP_LAND #714

Closed jbensabat closed 1 year ago

jbensabat commented 1 year ago

Expected Behavior

when the flag of parallel processing is on (MPP_LAND) there is a call to the following function

ifdef MPP_LAND

  call MPP_LAND_INIT()
  call MPI_COMM_RANK(HYDRO_COMM_WORLD, rank, ierr)

else

  rank = 0

endif

in the library hydro_mpp.lib (file mpp_land.f) the subroutine is subroutine MPP_LAND_INIT(in_global_nx,in_global_ny)

so it requires the size of the grid too soon, before this data is available and this causes a crash of the code

I suggest to either read the header before calling this function or place this call after reading the header

Current Behavior

Possible Solution

Steps to Reproduce (for bugs)

1. 2. 3. 4.

Your Environment

scrasmussen commented 1 year ago

Hi @jbensabat, thank you for pointing this out. The call to MPP_Land_init(), without any arguments, is only used in the Noah version, which should probably be viewed as a legacy build since NoahMP has replaced it. If you want to use Noah then I believe the v5.0.3 version might work for you. If you don't need to use Noah, I would recommend following the CMake build instructions where this issue won't be a problem.

Either way since the subroutine arguments are optional, these statements should be in an "if present" check. I'll work on creating a PR for that, thanks!

jbensabat commented 1 year ago

Good morning and thanks for your reply I am learning the code so I am trying various configurations including NWM. Actually I fixed the issue by moving

ifdef MPP_LAND

call MPP_LAND_INIT(ix,jx) call MPI_COMM_RANK(HYDRO_COMM_WORLD, rank, ierr)

else

rank = 0

endif

after the call to call read_hrldas_hdrinfo which provides the values of ix, jx using the "present" function in MPP_LAND does not solve the problem as this function calls another function where explicit values of ix and jx are needed.

there is another issue related to this option, there are two preprocessor flags MPP_LAND and PARALLEL if I understand properly, MPP_LAND switches on parallel processing (MPI) so why is the purpose of PARALLEL ? is it needed ? best jac