Skip to content

Commit

Permalink
Merge pull request #637 from FESOM/workbench_mainf26_icepack
Browse files Browse the repository at this point in the history
Workbench mainf26 icepack
  • Loading branch information
JanStreffing authored Oct 21, 2024
2 parents 7f374ae + 203a3f4 commit 367d333
Show file tree
Hide file tree
Showing 14 changed files with 748 additions and 469 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
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 367d333

Please sign in to comment.