grid_scaler: fix for coarse weights calculation

Coarse weights were calculated wrong in the scaler:

this%coarse_weights(k) = 1.0_dp / real(min(1_i4, this%n_subcells(k)), dp)

Which resulted in a division by 0 error when the coarse cell has no subcells.

In case of no subcells, the coarse weight should default to 1, so the fix is given by changing min to max:

this%coarse_weights(k) = 1.0_dp / real(max(1_i4, this%n_subcells(k)), dp)

Merge request reports

Loading