Skip to content

Commit

Permalink
Modified calve_icebergs so that new berg prev/old velocities and posi…
Browse files Browse the repository at this point in the history
…tions are not initialized unless using interactive icebergs. This has no impact except enabling the berg restart chksums to match the reference runs in the om4 regression tests (the regression tests pass either way, but this modification undoes a previous change that caused mismatch in the berg restart chksums only).
  • Loading branch information
alex-huth committed Jan 3, 2023
1 parent b4ce7eb commit 5a5a175
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 30 deletions.
58 changes: 31 additions & 27 deletions src/icebergs.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3082,26 +3082,28 @@ subroutine thermodynamics(bergs)

!if footloose is based on length of foot, accumulate side mass loss on fl_k
!note: this only works when bergs%use_operator_splitting=.true.
if (bergs%fl_use_l_scale .and. this%fl_k>=0) then
l_b3 = 3.*l_c*(lw_c*bergs%fl_youngs*B_c*(Tn**3.))**0.25 !child berg length x 3
if (L>l_b3) then !do not accumulate side made loss for sides < l_b3
fb = Tn*(1.-bergs%rho_bergs/rho_seawater) !freeboard
kd = Tn-fb !keel depth
if (W>l_b3) then
if (bergs%fl_l_scale_erosion_only) then
this%fl_k=this%fl_k + (dMe/fb - dMv/kd)/bergs%rho_bergs !horiz area from erosion - from buoy conv
if (this%fl_k<0) this%fl_k=0
else
this%fl_k= this%fl_k + (dMe + dMv)/Tn
endif
else
dMv_l=dMv*(Wn1 + W)/(2.*(Ln1 + W)) !mass loss from length from buoyant convection
dMe_l=dMe*(Wn+ Wn1)/(2.*(Ln+ Wn1)) !mass loss from length from erosion
if (bergs%fl_l_scale_erosion_only) then
this%fl_k=this%fl_k + (dMe_l/fb - dMv_l/kd)/bergs%rho_bergs
if (this%fl_k<0) this%fl_k=0
if (bergs%fl_r>0.) then
if (bergs%fl_use_l_scale .and. this%fl_k>=0) then
l_b3 = 3.*l_c*(lw_c*bergs%fl_youngs*B_c*(Tn**3.))**0.25 !child berg length x 3
if (L>l_b3) then !do not accumulate side made loss for sides < l_b3
fb = Tn*(1.-bergs%rho_bergs/rho_seawater) !freeboard
kd = Tn-fb !keel depth
if (W>l_b3) then
if (bergs%fl_l_scale_erosion_only) then
this%fl_k=this%fl_k + (dMe/fb - dMv/kd)/bergs%rho_bergs !horiz area from erosion - from buoy conv
if (this%fl_k<0) this%fl_k=0
else
this%fl_k= this%fl_k + (dMe + dMv)/Tn
endif
else
this%fl_k= this%fl_k + (dMe_l + dMv_l)/Tn
dMv_l=dMv*(Wn1 + W)/(2.*(Ln1 + W)) !mass loss from length from buoyant convection
dMe_l=dMe*(Wn+ Wn1)/(2.*(Ln+ Wn1)) !mass loss from length from erosion
if (bergs%fl_l_scale_erosion_only) then
this%fl_k=this%fl_k + (dMe_l/fb - dMv_l/kd)/bergs%rho_bergs
if (this%fl_k<0) this%fl_k=0
else
this%fl_k= this%fl_k + (dMe_l + dMv_l)/Tn
endif
endif
endif
endif
Expand Down Expand Up @@ -6374,14 +6376,16 @@ subroutine calve_icebergs(bergs)
newberg%uvel=0.
newberg%vvel=0.
!--added by Alex:
newberg%uvel_prev=0.
newberg%vvel_prev=0.
newberg%uvel_old=0.
newberg%vvel_old=0.
newberg%lon_prev=newberg%lon
newberg%lat_prev=newberg%lat
newberg%lon_old=newberg%lon
newberg%lat_old=newberg%lat
if (bergs%interactive_icebergs_on) then
newberg%uvel_prev=0.
newberg%vvel_prev=0.
newberg%uvel_old=0.
newberg%vvel_old=0.
newberg%lon_prev=newberg%lon
newberg%lat_prev=newberg%lat
newberg%lon_old=newberg%lon
newberg%lat_old=newberg%lat
endif
newberg%fl_k=0.
!--added by Alon
newberg%axn=0.
Expand Down
6 changes: 3 additions & 3 deletions src/icebergs_framework.F90
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ module ice_bergs_framework
real :: fl_bits_scale_t=0.9 !< For determining dimensions of FL bits berg; FL_bits thickness = fl_bits_scale_t * T

!backwards compatibility
logical :: old_interp_flds_order=.false. !< Use old order of when to interpolate grid variables to bergs. Will be false if MTS, DEM, or footloose (.not. fl_r>0)
logical :: old_interp_flds_order=.false. !< Use old order of when to interpolate grid variables to bergs. Will be false if MTS, DEM, or footloose (fl_r>0)
end type icebergs

!> Read original restarts. Needs to be module global so can be public to icebergs_mod.
Expand All @@ -644,9 +644,9 @@ module ice_bergs_framework

!> Version of file provided by CPP macro (usually set to git hash)
#ifdef _FILE_VERSION
character(len=128) :: version = _FILE_VERSION !< Version of file
character(len=128) :: version = _FILE_VERSION !< Version of file
#else
character(len=128) :: version = 'unknown' !< Version of file
character(len=128) :: version = 'unknown' !< Version of file
#endif

!> Set a value in the buffer at position (counter,n) after incrementing counter
Expand Down

0 comments on commit 5a5a175

Please sign in to comment.