Skip to content

Commit

Permalink
avoid unneccesary loop
Browse files Browse the repository at this point in the history
  • Loading branch information
ackerlar committed Sep 27, 2024
1 parent ec878cb commit c8f287a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/icb_step.F90
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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"
Expand Down

0 comments on commit c8f287a

Please sign in to comment.