From c8f287a9acbab0ed543b3f72f6b35f2fd6ebfc66 Mon Sep 17 00:00:00 2001 From: ackerlar Date: Fri, 27 Sep 2024 23:05:18 +0200 Subject: [PATCH] avoid unneccesary loop --- src/icb_step.F90 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/icb_step.F90 b/src/icb_step.F90 index 17ae8b31..f15b28c9 100644 --- a/src/icb_step.F90 +++ b/src/icb_step.F90 @@ -554,9 +554,10 @@ subroutine iceberg_step1(ice, mesh, partit, dynamics, ib, height_ib_single,lengt !----------------------------- ! LA 2022-11-30 - if(cell_saturation > 0) then + if((cell_saturation>0) .and. (iceberg_elem.ne.old_element)) then if( lverbose_icb) then - write(*,*) " * checking for cell saturation - ib: ", ib, ", old_elem: ", old_element, ", new_elem: ", iceberg_elem + write(*,*) " * checking for cell saturation" + write(*,*) " * ib: ", ib, ", old_elem: ", old_element, ", new_elem: ", iceberg_elem end if select case(cell_saturation) !num of coastal points case(1) @@ -575,12 +576,11 @@ subroutine iceberg_step1(ice, mesh, partit, dynamics, ib, height_ib_single,lengt !$OMP END PARALLEL !----------------------------- - if ((area_ib_tot > elem_area_glob(iceberg_elem)) .and. (old_element.ne.0) .and. (iceberg_elem.ne.old_element)) then ! .and. (left_mype == 0)) then + if ((area_ib_tot > elem_area_glob(iceberg_elem)) .and. (old_element.ne.0)) then ! .and. (left_mype == 0)) then if( lverbose_icb) then write(*,*) " *******************************************************" write(*,*) " * set iceberg ", ib, " back to elem ", old_element, " from elem ", iceberg_elem write(*,*) " * area_ib_tot = ", area_ib_tot, "; elem_area = ", elem_area(local_idx_of(iceberg_elem)) - end if i_have_element = .true. left_mype = 0.0 @@ -779,7 +779,7 @@ subroutine iceberg_step2(mesh, partit,arr, elem_from_block, ib, height_ib_single iceberg_elem = old_element u_ib = 0. v_ib = 0. - else if(cell_saturation > 0) then + else if((cell_saturation>0) .and. (iceberg_elem.ne.old_element)) then if (mype==0) write(*,*) 'iceberg ',ib, ' changed PE or was very fast' elem_area_tmp = elem_area_glob(iceberg_elem) select case(cell_saturation) !num of coastal points @@ -798,7 +798,7 @@ subroutine iceberg_step2(mesh, partit,arr, elem_from_block, ib, height_ib_single end do !$OMP END DO !$OMP END PARALLEL - if((area_ib_tot > elem_area_tmp) .and. (elem_area_tmp > 0.0) .and. (iceberg_elem.ne.old_element)) then + if((area_ib_tot > elem_area_tmp) .and. (elem_area_tmp > 0.0)) then if(mype==pe_block_red(ib) .and. lverbose_icb) then write(*,*) " *******************************************************" write(*,*) " * iceberg changed PE and saturation"