Skip to content

Commit

Permalink
Preissmann slot initialization minor bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sazzad-sharior committed Jul 28, 2023
1 parent d1b8ef1 commit 0c004ea
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 5 deletions.
6 changes: 5 additions & 1 deletion initialization/BIPquick.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,11 @@ subroutine phantom_node_generator &
!% HACK CODE
!% try to keep the phantom link length closer to nominal element length
if (setting%Partitioning%PhantomLinkAdjust) then
print*, ' spanning link name ', link%names(spanning_link)%str, ' ...'
if (spanning_link <= setting%SWMMinput%N_link) then
print*, ' spanning link name ', link%names(spanning_link)%str, ' ...'
else
print*, ' cutting at a phantom link whcih has a link index of ', spanning_link, ' ...'
end if
print*, ' which has a length of', link%R(spanning_link,lr_length), ' ...'
print*, ' cutting at length ', link%R(spanning_link, lr_Length) - phantom_node_start, ' from downstream'
print*, ' resulting in phantom link of length', phantom_node_start
Expand Down
65 changes: 61 additions & 4 deletions initialization/initial_condition.f90
Original file line number Diff line number Diff line change
Expand Up @@ -4954,6 +4954,9 @@ subroutine init_IC_slot ()
!% --- initialize preissmann slot variables for JM elements
call init_IC_slot_JM ()

!% --- initialize preissmann slot variables for Diagnostic elements
call init_IC_slot_Diag ()

!%------------------------------------------------------------------
!% Closing
if (setting%Debug%File%initial_condition) &
Expand All @@ -4966,7 +4969,7 @@ end subroutine init_IC_slot
subroutine init_IC_slot_CCJB ()
!%-----------------------------------------------------------------
!% Description:
!% initialize Preissmann Slot for CC, JB, Diagnostic elements
!% initialize Preissmann Slot for CC, JB elements
!%-----------------------------------------------------------------
!% Declarations:
real(8) :: OldTargetPCelerity
Expand All @@ -4979,7 +4982,7 @@ subroutine init_IC_slot_CCJB ()
write(*,"(A,i5,A)") '*** enter ' // trim(subroutine_name) // " [Processor ", this_image(), "]"
!%-----------------------------------------------------------------
!% Aliases
thisColP => col_elemP(ep_CCJBDiag)
thisColP => col_elemP(ep_CCJB)
Npack => npack_elemP(thisColP)
if (Npack < 1) return

Expand Down Expand Up @@ -5045,8 +5048,9 @@ subroutine init_IC_slot_CCJB ()

case (DynamicSlot)

where (elemR(thisP,er_Preissmann_Number_initial) < oneR)
!% --- resetting the target celerity on CC elements, where it results in a very wide slot
where ((elemI(thisP,ei_elementType) == CC ) .and. &
(elemR(thisP,er_Preissmann_Number_initial) < oneR) )
!% --- resetting the target celerity only on CC elements, where it may results in a very wide slot
elemR(thisP,er_Temp01) = MinPnumber * Alpha * sqrt(grav * elemR(thisP,er_FullDepth))
endwhere

Expand Down Expand Up @@ -5214,6 +5218,59 @@ end subroutine init_IC_slot_JM
!
!==========================================================================
!==========================================================================
!
subroutine init_IC_slot_Diag
!%-----------------------------------------------------------------
!% Description:
!% initialize Preissmann Slot for Diag elements
!% Preissmann slot is not needed in diagnostic elements
!% however, the variables are needed to be initialized so that
!% they dont have junk valuse, which may throw off the interpolation
!%-----------------------------------------------------------------
!% Declarations:
real(8) :: MaxCCPreissmannNumber
integer, pointer :: SlotMethod, thisColP, npack, thisP(:)
real(8), pointer :: TargetPCelerity, grav, Alpha, MinPnumber
character(64) :: subroutine_name = 'init_IC_slot_JM'
!%-----------------------------------------------------------------
!% Preliminaries
if (setting%Debug%File%initial_condition) &
write(*,"(A,i5,A)") '*** enter ' // trim(subroutine_name) // " [Processor ", this_image(), "]"
!%-----------------------------------------------------------------
!% Aliases
thisColP => col_elemP(ep_Diag)
Npack => npack_elemP(thisColP)
if (Npack < 1) return

thisP => elemP(1:Npack,thisColP)

MaxCCPreissmannNumber = maxval(elemR(:,er_Preissmann_Number), elemI(:,ei_ElementType) == CC)

!% --- initialize slots
elemR(thisP,er_SlotVolume) = zeroR
elemR(thisP,er_SlotArea) = zeroR
elemR(thisP,er_SlotWidth) = zeroR
elemR(thisP,er_dSlotArea) = zeroR
elemR(thisP,er_dSlotDepth) = zeroR
elemR(thisP,er_dSlotVolume) = zeroR
elemR(thisP,er_SlotVolume_N0) = zeroR
elemR(thisP,er_Preissmann_Celerity) = zeroR
elemR(thisP,er_Surcharge_Time) = zeroR
elemR(thisP,er_SlotDepth_N0) = zeroR
elemR(thisP,er_Preissmann_Number_initial) = MaxCCPreissmannNumber
elemR(thisP,er_Preissmann_Number) = MaxCCPreissmannNumber
elemR(thisP,er_Preissmann_Celerity) = zeroR
elemR(thisP,er_SlotWidth) = zeroR
elemR(thisP,er_SlotArea) = zeroR
elemR(thisP,er_SlotVolume) = zeroR
!%-----------------------------------------------------------------
!% Closing
if (setting%Debug%File%initial_condition) &
write(*,"(A,i5,A)") '*** leave ' // trim(subroutine_name) // " [Processor ", this_image(), "]"
end subroutine init_IC_slot_Diag
!
!==========================================================================
!==========================================================================
!
subroutine init_reference_head ()
!%------------------------------------------------------------------
Expand Down

0 comments on commit 0c004ea

Please sign in to comment.