From 7d0dc9c08a84f9d62937ef4a4e27939a5371074c Mon Sep 17 00:00:00 2001 From: wpbonelli Date: Tue, 5 Dec 2023 12:51:31 -0500 Subject: [PATCH] fix(GwfGwtExchange): check node counts before comparison (#1478) --- src/Exchange/GwfGwtExchange.f90 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Exchange/GwfGwtExchange.f90 b/src/Exchange/GwfGwtExchange.f90 index 9b80c14b469..9313efcce59 100644 --- a/src/Exchange/GwfGwtExchange.f90 +++ b/src/Exchange/GwfGwtExchange.f90 @@ -356,11 +356,15 @@ subroutine gwfconn2gwtconn(this, gwfModel, gwtModel) ! if (associated(gwfEx%model1, gwfModel) .or. & associated(gwfEx%model2, gwfModel)) then - ! again, connecting the same nodes nrs will be + + ! check exchanges have same node counts + areEqual = size(gwfEx%nodem1) == size(gwtConn%prim_exchange%nodem1) + ! then, connecting the same nodes nrs will be ! sufficient evidence of equality - areEqual = all(gwfEx%nodem1 == gwtConn%prim_exchange%nodem1) - areEqual = areEqual .and. & - all(gwfEx%nodem2 == gwtConn%prim_exchange%nodem2) + if (areEqual) & + areEqual = all(gwfEx%nodem1 == gwtConn%prim_exchange%nodem1) + if (areEqual) & + areEqual = all(gwfEx%nodem2 == gwtConn%prim_exchange%nodem2) if (areEqual) then ! link exchange to connection write (iout, '(/6a)') 'Linking exchange ', &