Skip to content

Conversation

@blimlim
Copy link
Collaborator

@blimlim blimlim commented Apr 16, 2025

Not to be merged

This PR describes the changes in updating the base of CM3's icepack version from 6703bc5 to 43ead56. If the changes are approved, I'll change the branch name from update-cm3-icepack to cm3-coupling-0.4.0.

This branch was created by rebasing cm3-coupling onto 43ead56.

Several conflicts came up in the merge. I'll record each of the conflicts here for the purpose of documentation. For review, I've separated them into more substantial conflicts, and much more straightforward ones where I'm more confident in my choice for resolution. Where relevant, I've tried to include some background on the upstream or local changes that caused the conflicts.

Conflicts

Clashes more likely to need review

Change of hi_min parameter

The minimum ice thickness hi_min was previously set in icepack_itd.F90, where it was given a default value and overwritten in specific cirumstances.

8fad768 on main moves its definition and default value to icepack_parameters.F90, making it definable in a CICE namelist. This includes for example the following changes in icepack_itd.F90:

+      use icepack_parameters, only: skl_bgc, z_tracers, hi_min
...

subroutine icepack_init_itd(hin_max)
...
-      hi_min = p01    ! minimum ice thickness allowed (m) for thermo
-                       ! note hi_min is reset to 0.1 for kitd=0, below

...

- #ifndef CESMCOUPLED
-             hi_min = p1    ! minimum ice thickness allowed (m) for thermo
- #endif

The following clashes between our branch and main occur in parts of icepack_itd.F90:

<<<<<<< HEAD
=======
#ifndef CESMCOUPLED
            hi_min = p1    ! minimum ice thickness allowed (m) for thermo
#endif
            hi_min =  p2
>>>>>>> c1e1d5d (increase ice and snow thickness minimum values to match CM2, revert conductive flux limits to CM2)
<<<<<<< HEAD
=======
      hi_min = p2    ! minimum ice thickness allowed (m) for thermo
                      ! note hi_min is reset to 0.1 for kitd=0, below

>>>>>>> e4815a4 (Swap hi_min to 0.2 and add aicenmin=1.e-5)
<<<<<<< HEAD
=======
#ifndef CESMCOUPLED
            hi_min = p1    ! minimum ice thickness allowed (m) for thermo
#endif
>>>>>>> e4815a4 (Swap hi_min to 0.2 and add aicenmin=1.e-5)

I think it makes sense for us to pick up the changes from main. Since our CM3 coupling requires hi_min=p1 to match the value in the UM, we need to be careful when bringing in this change.

I've changed the new default value of hi_min in icepack_parameters.F90 from p01 be p1 (required to match UM value), and will add a comment in the namelist warning that hi_min=p1 is required for CM3's coupling.


More straightforward clashes:

Details In `icepack_therm_bl99.F90`:
<<<<<<< HEAD
      do k = 1, nilyr

         Iswabs_tmp = c0 ! all Iswabs is moved into fswsfc
         if (Tin_init(k) <= Tmlts(k) - sw_dtemp) then
            if (l_brine) then
               ci = cp_ice - Lfresh * Tmlts(k) / (Tin_init(k)**2)
               Iswabs_tmp = min(Iswabs(k), &
                                sw_frac*(Tmlts(k)-Tin_init(k))*ci/dt_rhoi_hlyr)
            else
               ci = cp_ice
               Iswabs_tmp = min(Iswabs(k), &
                                sw_frac*(-Tin_init(k))*ci/dt_rhoi_hlyr)
=======
         do k = 1, nilyr

            Iswabs_tmp = c0 ! all Iswabs is moved into fswsfc
            if (Tin_init(k) <= Tmlts(k) - sw_dtemp) then
               if (l_brine) then
                  ci = cp_ice - Lfresh * Tmlts(k) / (Tin_init(k)**2)
                  Iswabs_tmp = min(Iswabs(k), &
                                 sw_frac*(Tmlts(k)-Tin_init(k))*ci/dt_rhoi_hlyr)
               else
                  ci = cp_ice
                  Iswabs_tmp = min(Iswabs(k), &
                                 sw_frac*(-Tin_init(k))*ci/dt_rhoi_hlyr)
               endif
>>>>>>> b40315a (logging, tweaked newton solver tolerances, re-add einex)

This is an indentation change in our cm3-coupling branch, added to fix the indentation under if calc_Tsfc. Keep changes from cm3-coupling.


<<<<<<< HEAD

               call get_matrix_elements_know_Tsfc (          &
=======
               fcondtopn_force = fcondtopn - fcondtopn_reduction
               call get_matrix_elements_know_Tsfc (nilyr, nslyr, &
>>>>>>> b40315a (logging, tweaked newton solver tolerances, re-add einex)

05ac0ec on main removed the nilyr and nslyr arguments to this subroutine, as they are already available from

use icepack_tracers, only: nilyr, nslyr

at the top of the module. Combine the changes from both branches resulting in:

               fcondtopn_force = fcondtopn - fcondtopn_reduction
               call get_matrix_elements_know_Tsfc (          &

icepack_therm_vertical.F90

<<<<<<< HEAD

      subroutine thermo_vertical (dt,          aicen,     &
=======
      subroutine thermo_vertical (nilyr,       nslyr,     &
                                  dt,          aicen,     &
>>>>>>> b40315a (logging, tweaked newton solver tolerances, re-add einex)

Use changes from main, which remove redundant subroutine arguments.


<<<<<<< HEAD
      massice(:) = c0
      massliq(:) = c0
=======
      e_num = c0
      fcondtopn_extra = c0
>>>>>>> b40315a (logging, tweaked newton solver tolerances, re-add einex)

Separate variable initialisations were added in each branch. Use both changes

      call thickness_changes(dt,          yday,      &
                             efinal,                 &
                             hin,         hilyr,     &
                             hsn,         hslyr,     &
                             zqin,        zqsn,      &
                             smice,       massice,   &
                             smliq,       massliq,   &
                             fbot,        Tbot,      &
                             flatn,       fsurfn,    &
                             fcondtopn_solve,   fcondbotn, &
                             fsnow,       hsn_new,   &
                             fhocnn,      evapn,     &
                             evapsn,      evapin,    &
                             meltt,       melts,     &
                             meltsliq,    frain,     &
                             meltb,                  &
                             congel,      snoice,    &
                             mlt_onset,   frz_onset, &
                             zSin,        sss,       &
<<<<<<< HEAD
                             sst,                    &
                             dsnow,       rsnw)
=======
                             dsnow,       rsnw,       &
                             e_num, fcondtopn_extra   )
>>>>>>> b40315a (logging, tweaked newton solver tolerances, re-add einex)

sst added as argument in main in 4c87095 to allow for one-step congelation formulation. e_num, fcondtopn_extra added in cm3-coupling. Combine both changes into

                             sst,                    &
                             dsnow,       rsnw,      &
                             e_num, fcondtopn_extra  )

Same changes added further down in subroutine definition.

icepack_itd.F90

<<<<<<< HEAD
      use icepack_parameters, only: c0, c1, c2, c3, c15, c25, c100, p1, p01, p001, p5, puny
      use icepack_parameters, only: Lfresh, rhos, ice_ref_salinity, hs_min, cp_ice, rhoi
      use icepack_parameters, only: rhosi, sk_l, hs_ssl, min_salin, rsnw_fall, rhosnew
      use icepack_tracers,    only: ncat, nilyr, nslyr, nblyr, ntrcr, nbtrcr, n_aero
=======
      use icepack_parameters, only: c0, c1, c2, c3, c15, c25, c100, p1, p01, p001, p5, puny, p2
      use icepack_parameters, only: Lfresh, rhos, ice_ref_salinity, hs_min, cp_ice, Tocnfrz, rhoi
      use icepack_parameters, only: rhosi, sk_l, hs_ssl, min_salin, rsnw_fall
>>>>>>> c1e1d5d (increase ice and snow thickness minimum values to match CM2, revert conductive flux limits to CM2)

cm3-coupling adds p2 for use as a minimum ice-thickness. 8fad768 on main removes Tocnfrz, replacing it with Tf (provided as an input from CICE). Main adds rhosnew. 05ac0ec on main adds the line

use icepack_tracers,    only: ncat, nilyr, nslyr, nblyr, ntrcr, nbtrcr, n_aero

and removes these parameters from subroutine arguments.

Keep the changes from both branches, i.e:

      use icepack_parameters, only: c0, c1, c2, c3, c15, c25, c100, p1, p01, p001, p5, puny, p2
      use icepack_parameters, only: Lfresh, rhos, ice_ref_salinity, hs_min, cp_ice, rhoi
      use icepack_parameters, only: rhosi, sk_l, hs_ssl, min_salin, rsnw_fall, rhosnew
      use icepack_tracers,    only: ncat, nilyr, nslyr, nblyr, ntrcr, nbtrcr, n_aero

Additional changes required after resolving merge conflicts

Some additional small changes were needed to get the model to build and run:

Details

Deprecated zsalinity

f5e093f on main deprecated zsalinity.

One solve_zsal flag remained after the rebase due to an indentation change in b40315a, causing the build to fail.

         if (solve_zsal) sw_dtemp = p1  ! lower tolerance with dynamic salinity

This line should be removed to match the changes in main

Copy link

@kieranricardo kieranricardo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Only suggestion is to delete some of the old comments to clean up the diff a little


use icepack_kinds
use icepack_parameters, only: c0, c1, c2, c3, c15, c25, c100, p1, p01, p001, p5, puny
use icepack_parameters, only: c0, c1, c2, c3, c15, c25, c100, p1, p01, p001, p5, puny, p2

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we use p2 here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great point. p2 shouldn't be needed here anymore. I've removed it in 33bbca5

Comment on lines 713 to 715
! Flux extra energy out of the ice
fcondbot = fcondbot + einex/dt
! fcondbot = fcondbot + einex/dt

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can delete these commented lines

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed in 33bbca5!

@kieranricardo kieranricardo changed the base branch from main to cm3-coupling April 23, 2025 07:02
@kieranricardo kieranricardo changed the base branch from cm3-coupling to main April 23, 2025 07:06
blimlim and others added 2 commits April 24, 2025 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants