Skip to content

Commit

Permalink
Merge branch 'main' into clean_up_repo
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickscholz authored Oct 21, 2024
2 parents edabc9f + 367d333 commit 804c3b7
Show file tree
Hide file tree
Showing 16 changed files with 757 additions and 473 deletions.
2 changes: 1 addition & 1 deletion config/namelist.icepack
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
ustar_min = 0.0005
emissivity = 0.95
fbot_xfer_type = 'constant'
update_ocn_f = .false.
update_ocn_f = .true.
l_mpond_fresh = .false.
tfrz_option = 'linear_salt'
oceanmixed_ice = .true.
Expand Down
2 changes: 1 addition & 1 deletion config/namelist.icepack.cesm.ponds
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
ustar_min = 0.0005
emissivity = 0.95
fbot_xfer_type = 'constant'
update_ocn_f = .false.
update_ocn_f = .true.
l_mpond_fresh = .false.
tfrz_option = 'linear_salt'
oceanmixed_ice = .true.
Expand Down
2 changes: 1 addition & 1 deletion src/icb_coupling.F90
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ subroutine prepare_icb2fesom(mesh, partit, ib,i_have_element,localelement,depth_
end if
dz = abs( lev_low - lev_up )
if( (abs(lev_low)>=abs(depth_ib)) .and. (abs(lev_up)<abs(depth_ib)) ) then
dz = abs( lev_up - abs(depth_ib) )
dz = abs(abs(lev_up) - abs(depth_ib))
end if

if( depth_ib==0.0 ) then
Expand Down
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
74 changes: 54 additions & 20 deletions src/ice_oce_coupling.F90
Original file line number Diff line number Diff line change
Expand Up @@ -357,23 +357,35 @@ subroutine oce_fluxes(ice, dynamics, tracers, partit, mesh)
!
#if defined (__icepack)

call icepack_to_fesom (nx_in=(myDim_nod2D+eDim_nod2D), &
aice_out=a_ice, &
vice_out=m_ice, &
vsno_out=m_snow, &
fhocn_tot_out=net_heat_flux, &
fresh_tot_out=fresh_wa_flux, &
fsalt_out=real_salt_flux, &
dhi_dt_out=thdgrsn, &
dhs_dt_out=thdgr, &
evap_ocn_out=evaporation )

heat_flux(:) = - net_heat_flux(:)
water_flux(:) = - (fresh_wa_flux(:)/1000.0_WP) - runoff(:)

! Evaporation
evaporation(:) = - evaporation(:) / 1000.0_WP
ice_sublimation(:) = 0.0_WP
call icepack_to_fesom (nx_in = (myDim_nod2D+eDim_nod2D), &
aice_out = a_ice, &
vice_out = m_ice, &
vsno_out = m_snow, &
fhocn_tot_out = net_heat_flux, &
fresh_tot_out = fresh_wa_flux, &
fsalt_out = real_salt_flux, &
dhs_dt_out = thdgrsn, &
dhi_dt_out = thdgr, &
evap_ocn_out = evaporation, &
evap_out = ice_sublimation )

!$OMP PARALLEL DO
do n=1, myDim_nod2d+eDim_nod2d
! Heat flux
heat_flux(n) = - net_heat_flux(n)

! Freshwater flux (convert units from icepack to fesom)
water_flux(n) = - (fresh_wa_flux(n) * inv_rhowat) - runoff(n)

! Evaporation (convert units from icepack to fesom)
evaporation(n) = - evaporation(n) * (1.0_WP - a_ice(n)) * inv_rhowat

! Ice-Sublimation is added to to the freshwater in icepack --> see
! icepack_therm_vertical.90 --> subroutine thermo_vertical(...): Line: 453
! freshn = freshn + evapn - (rhoi*dhi + rhos*dhs) / dt , evapn==sublimation
ice_sublimation(n) = - ice_sublimation(n) * inv_rhowat
end do
!$OMP END PARALLEL DO

call init_flux_atm_ocn()

Expand Down Expand Up @@ -515,12 +527,31 @@ subroutine oce_fluxes(ice, dynamics, tracers, partit, mesh)
! enforce the total freshwater/salt flux be zero
! 1. water flux ! if (.not. use_virt_salt) can be used!
! we conserve only the fluxes from the database plus evaporation.
! ICEPACK: adds rain, snow and evap is based on the newly formed ice
! concentration (a_ice). In our standard ice model rain, snow and evap is
! added based on the ice concentration of the previous time step (a_ice_old)
! So for the proper balancing of snow the proper aice has to be choosen
! -icepack_therm_itd.F90 --> subroutine icepack_step_therm2(...)
! fresh = fresh + frain*aice
! -icedrv_step.F90: subroutine ocn_mixed_layer_icepack(...
! fresh_tot = fresh + (-evap_ocn + frain + fsnow)*(c1-aice)
! At the end all rain is added to the ocean, only snow needs to be
! scaled with (1-aice )
! -Ice-Sublimation is not added to evap in icepack, therefor we dont need
! to compensate for it the ice2atmos subplimation does not contribute
! to the freshwater flux into the ocean

!$OMP PARALLEL DO
do n=1, myDim_nod2D+eDim_nod2D
flux(n) = evaporation(n) &
flux(n) = evaporation(n) &
-ice_sublimation(n) & ! the ice2atmos subplimation does not contribute to the freshwater flux into the ocean
+prec_rain(n) &
+prec_rain(n) &
#if defined (__icepack)
+prec_snow(n)*(1.0_WP-a_ice(n)) &
#else
+prec_snow(n)*(1.0_WP-a_ice_old(n)) &
#endif

#if defined (__oasis) || defined (__ifsinterface)
+residualifwflx(n) & ! balance residual ice flux only in coupled case
#endif
Expand Down Expand Up @@ -614,6 +645,8 @@ subroutine oce_fluxes(ice, dynamics, tracers, partit, mesh)
!$OMP END PARALLEL DO
end if


!___________________________________________________________________________
!---fwf-code-begin
if(use_landice_water) then
!$OMP PARALLEL DO
Expand All @@ -622,7 +655,8 @@ subroutine oce_fluxes(ice, dynamics, tracers, partit, mesh)
end do
!$OMP END PARALLEL DO
end if


!___________________________________________________________________________
if(lwiso .and. use_landice_water) then
!$OMP PARALLEL DO
do n=1, myDim_nod2D+eDim_nod2D
Expand Down
3 changes: 2 additions & 1 deletion src/icepack_drivers/download_icepack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ DIR="./Icepack"
if [ ! -d "$DIR" ]; then
git clone https://github.com/lzampier/Icepack.git
cd $DIR
git checkout icepack_fesom2
# git checkout icepack_fesom2
git checkout icepack_fesom2_bugfix
fi
4 changes: 4 additions & 0 deletions src/icepack_drivers/icedrv_allocate.F90
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ subroutine alloc_flux
opening(nx) , & ! rate of opening due to divergence/shear (1/s)
dhi_dt(nx) , & ! ice volume tendency due to thermodynamics (m/s)
dhs_dt(nx) , & ! snow volume tendency due to thermodynamics (m/s)
dhi_t_dt(nx) , & ! ice volume tendency due to thermodynamics (m/s)
dhs_t_dt(nx) , & ! snow volume tendency due to thermodynamics (m/s)
dhi_r_dt(nx) , & ! ice volume tendency due to ridging (m/s)
dhs_r_dt(nx) , & ! snow volume tendency due to ridging (m/s)
dardg1ndt(nx,ncat), & ! rate of area loss by ridging ice (1/s)
dardg2ndt(nx,ncat), & ! rate of area gain by new ridges (1/s)
dvirdgndt(nx,ncat), & ! rate of ice volume ridged (m/s)
Expand Down
Loading

0 comments on commit 804c3b7

Please sign in to comment.