Weir type 2 in parallel mode

Dear [name removed],

i’m trying to modify the subroutine calcul_q_weir.f on version V9.1 in order to define rules for mobile gates represented as weirs of type 2 on T2D. The management rules depend on the water level at various points.

I am having difficulty retrieving the level values at these points in parallel mode using the P_MAX_ARRAY and P_MIN_ARRAY functions. The calculation gets stuck without displaying any error message (see log file) : it seems to stop when calling P_MAX_ARRAY.

I’ve attached the start of the subroutine if you have some idea.

Thank you in advance

[name removed]


V9P1_calcul_q_weir.f (3.88 KB)

Two points to investigate the problem

Is it working in sequential?

What about the other log (same message or different one?)

Regards

Hi [name removed],

We dig in the problem and the reason is:

In parallel, lecsng2.f does not read the number of weir from cas but from the splited weir file and some subdomains are without weir. In **telemac2d.[name removed]], CALCUL_Q_WEIR is guarded with IF(NWEIRS.GT.0) so only few ranks call P_MAX_ARRAY and OpenMPI hangs, waiting for all MPI_ALLREDUCE.

Workaround is to move the P_MAX_ARRAY call outside CALCUL_Q_WEIR, in a function that is called by all ranks.**

Hi [name removed] to see you find the problem and also the solution.

Regards