Skip to content

Commit

Permalink
different modes of cell saturation
Browse files Browse the repository at this point in the history
  • Loading branch information
ackerlar committed Sep 28, 2024
1 parent 82aa1a5 commit 9c62518
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/gen_modules_config.F90
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ module g_config
logical :: turn_off_fw=.false.
logical :: use_icesheet_coupling=.false.
logical :: lbalance_fw=.true.
logical :: lcell_saturation=.true.
integer :: cell_saturation=2 ! 0=no cell saturation, 1=one additional iceberg allowed, 2=no daddtional iceberg allowed
logical :: lmin_latent_hf=.true.
logical :: lverbose_icb=.false.
integer :: ib_num=0
Expand All @@ -135,7 +135,7 @@ module g_config
integer :: ib_async_mode=0
integer :: thread_support_level_required=3 ! 2 = MPI_THREAD_SERIALIZED, 3 = MPI_THREAD_MULTIPLE

namelist /icebergs/ use_icebergs, turn_off_hf, turn_off_fw, use_icesheet_coupling, lbalance_fw, lcell_saturation, lmin_latent_hf, &
namelist /icebergs/ use_icebergs, turn_off_hf, turn_off_fw, use_icesheet_coupling, lbalance_fw, cell_saturation, lmin_latent_hf, &
ib_num, steps_per_ib_step, ib_async_mode, thread_support_level_required, lverbose_icb

!wiso-code!!!
Expand Down
2 changes: 1 addition & 1 deletion src/icb_dyn.F90
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module iceberg_dynamics
! Thomas Rackow, 29.06.2010
!==============================================================================
subroutine iceberg_dyn(mesh, partit, ice, dynamics, ib, new_u_ib, new_v_ib, u_ib, v_ib, lon,lat, depth_ib, &
height_ib, length_ib, width_ib, iceberg_elem, &
height_ib, length_ib, width_ib, iceberg_elem, &
mass_ib, Ci, Ca, Co, Cda_skin, Cdo_skin, &
rho_ice, rho_air, rho_h2o, P_sill, conc_sill, frozen_in, &
file1, file2, P_ib, conci_ib, dt_ib, lastsubstep, &
Expand Down
29 changes: 21 additions & 8 deletions src/icb_step.F90
Original file line number Diff line number Diff line change
Expand Up @@ -542,8 +542,17 @@ subroutine iceberg_step1(ice, mesh, partit, dynamics, ib, height_ib_single,lengt

!-----------------------------
! LA 2022-11-30
if(lcell_saturation) then
area_ib_tot = 0.0 !length_ib_single*width_ib_single*scaling(ib)
if((cell_saturation>0) .and. (iceberg_elem.ne.old_element)) then
if( lverbose_icb) then
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)
area_ib_tot = 0.0
case(2)
area_ib_tot = length_ib_single*width_ib_single*scaling(ib)
end select
!$OMP PARALLEL DEFAULT(SHARED) PRIVATE(idx, area_ib_tot)
!$OMP DO
do idx = 1, size(elem_block)
Expand All @@ -555,12 +564,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 @@ -759,10 +767,15 @@ 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(lcell_saturation) 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)
area_ib_tot = 0.0 !length_ib_single * width_ib_single * scaling(ib)
select case(cell_saturation) !num of coastal points
case(1)
area_ib_tot = 0.0
case(2)
area_ib_tot = length_ib_single*width_ib_single*scaling(ib)
end select
!$OMP PARALLEL DEFAULT(SHARED) PRIVATE(idx, area_ib_tot)
!$OMP DO
do idx = 1, size(elem_block_red)
Expand All @@ -773,7 +786,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 All @@ -789,7 +802,7 @@ subroutine iceberg_step2(mesh, partit,arr, elem_from_block, ib, height_ib_single
u_ib = 0.
v_ib = 0.
end if
else if(lcell_saturation) then
else
if (mype==0) write(*,*) 'iceberg ',ib, ' changed PE or was very fast'
end if
end if
Expand Down

0 comments on commit 9c62518

Please sign in to comment.