Skip to content

Commit

Permalink
solve icb related segfault
Browse files Browse the repository at this point in the history
  • Loading branch information
ackerlar committed Oct 20, 2024
1 parent e9a4586 commit f65da84
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/icb_step.F90
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ subroutine iceberg_step1(ice, mesh, partit, dynamics, ib, height_ib_single,lengt
i_have_element=.false.
!if the first node belongs to this processor.. (just one processor enters here!)
!if( local_idx_of(iceberg_elem) > 0 .and. elem2D_nodes(1,local_idx_of(iceberg_elem)) <= myDim_nod2D ) then
if((local_idx_of(iceberg_elem)>0) .and. (local_idx_of(iceberg_elem)<=partit%myDim_elem2D+partit%eDim_elem2D) ) then
if((local_idx_of(iceberg_elem)>0) .and. (local_idx_of(iceberg_elem)<=partit%myDim_elem2D) ) then
if( elem2D_nodes(1,local_idx_of(iceberg_elem)) <= partit%myDim_nod2D ) then

i_have_element=.true.
Expand Down Expand Up @@ -804,14 +804,19 @@ subroutine iceberg_step2(mesh, partit,arr, elem_from_block, ib, height_ib_single
write(*,*) " * set iceberg ", ib, " back to elem ", old_element, " from elem ", iceberg_elem
write(*,*) " * area_ib = ", length_ib_single * width_ib_single, "; area_ib_tot = ", area_ib_tot, "; elem_area = ", elem_area_tmp
end if

left_mype = 0.0
lon_rad = old_lon
lat_rad = old_lat
lon_deg = lon_rad/rad
lat_deg = lat_rad/rad
iceberg_elem = old_element
u_ib = 0.
v_ib = 0.

i_have_element= (local_idx_of(iceberg_elem) .ne. 0)
if(i_have_element) then
i_have_element= mesh%elem2D_nodes(1,local_idx_of(iceberg_elem)) <= partit%myDim_nod2D !1 PE still .true.
end if
end if
else
if (mype==0) write(*,*) 'iceberg ',ib, ' changed PE or was very fast'
Expand Down
2 changes: 1 addition & 1 deletion src/io_meandata.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1049,7 +1049,7 @@ subroutine ini_mean_io(ice, dynamics, tracers, partit, mesh)
call def_stream(nod2D, myDim_nod2D, 'ibfwbv', 'basal iceberg melting', 'm/s', ibfwbv(:), 1, 'm', i_real4, partit, mesh)
call def_stream(nod2D, myDim_nod2D, 'ibfwl', 'lateral iceberg melting', 'm/s', ibfwl(:), 1, 'm', i_real4, partit, mesh)
call def_stream(nod2D, myDim_nod2D, 'ibfwe', 'iceberg erosion', 'm/s', ibfwe(:), 1, 'm', i_real4, partit, mesh)
call def_stream((/nl,nod2D/), (/nl,myDim_nod2D/), 'ibhf', 'heat flux from iceberg melting', 'm/s', ibhf_n(:,:), 1, 'm', i_real4, partit, mesh)
call def_stream((/nl,nod2D/), (/nl,myDim_nod2D/), 'ibhf', 'heat flux from iceberg melting', 'W/m2', ibhf_n(:,:), 1, 'm', i_real4, partit, mesh)
end if
!------------------------------------------
!_______________________________________________________________________________
Expand Down

0 comments on commit f65da84

Please sign in to comment.