From f65da846b098477d5d5c2f20d607aeae75234521 Mon Sep 17 00:00:00 2001 From: ackerlar Date: Sun, 20 Oct 2024 21:50:18 +0200 Subject: [PATCH] solve icb related segfault --- src/icb_step.F90 | 9 +++++++-- src/io_meandata.F90 | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/icb_step.F90 b/src/icb_step.F90 index a7da3baa8..a3cfefe46 100644 --- a/src/icb_step.F90 +++ b/src/icb_step.F90 @@ -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. @@ -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' diff --git a/src/io_meandata.F90 b/src/io_meandata.F90 index 5b2fc8876..3596a9083 100644 --- a/src/io_meandata.F90 +++ b/src/io_meandata.F90 @@ -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 !------------------------------------------ !_______________________________________________________________________________