Skip to content

Debug build#39

Draft
anton-seaice wants to merge 22 commits intoCICE6.6.1-xfrom
debug
Draft

Debug build#39
anton-seaice wants to merge 22 commits intoCICE6.6.1-xfrom
debug

Conversation

@anton-seaice
Copy link
Collaborator

Will need rebasing onto the default branch

038a276 is the important bit

apcraig and others added 22 commits August 6, 2025 10:49
Adds vicen, vsnon to zap_small_areas. This helps eliminate some sub-puny ice, but does not changes answers in
a full test suite run on derecho with 4 compilers.
Also cleans up some kind statements in the forcing module.
Update the gaea port

Support gaeac5 and gaeac6 as separate machines with the intel icx/ifort compiler.  Remove the "gaea" port in favor of "gaeac5" and "gaeac6".

Required some workaround for the intel/hdf5 compiler issues with the check uninit and fpe0.

---------

Co-authored-by: apcraig <anthony.p.craig@gmail.com>
This PR address CICE-Consortium#1044

Resolve issues with nans / accessing arrays out of range

There are a couple of spots in the code when loading files which fail when building with checks for floating point exceptions (-fpe0 in intel land). This addresses those issues

This change max sure that CICE is not trying to use array indeces which don't have values associated with them, and puts a value in _FillValue when it's not set (to avoid a nan). When creating ULAT, don't create the work_mom array on tasks other than master task because it is not used. When loading _FillValue, reset the value to spval_dbl if _FillValue is a nan.
* Update Copyright

Update version number in preparation for minor release

Clean up trailing blanks

Update Icepack to #f9789c2f325993c0af
- Update Copyright and version number

* Update Copyright in zenodo json file in CICE and Icepack
Co-authored-by: Till Rasmussen <tar@dmi.dk>
Update the qstat job completion checks to use

set qstatus = `${ICE_MACHINE_QSTAT} $job | grep $job | wc -l`

Some recent changes made the return status of "${ICE_MACHINE_QSTAT} $job"
no longer robust as a way to check if a job was in the queue or not.
…) (CICE-Consortium#1031)

This adds support in NUOPC/CMEPS driver for the addition of datestamps to the pointer filenames to be configurable through the nuopc option restart_pointer_append_date .

This is a companion change to ESCOMP/CESM_share#70, and does not impact any current default behaviour.

* Make datestamps in pointer filenames configurable (#9)

* set across all io options consistently

* use ice_restart_shared consistently across all 3 methods

---------

Co-authored-by: Andrew Kiss <31054815+aekiss@users.noreply.github.com>
Co-authored-by: Dougie Squire <42455466+dougiesquire@users.noreply.github.com>
Fix bug in ice_restoring with respect to indexing of trcrn_rest. This will change answers when ice restoring is turned on.

The CICE restoring feature is not generally used, and we currently have no tests to cover that feature. This bug was discovered as part of an ongoing effort to improve regional grid capability with additional PRs to come in the future. A full test suite run on derecho with the intel compiler confirmed this, no answers changed.
…ilation or retrievals/products) (CICE-Consortium#1060)

Add an option to be able to update ice concentration (from data assimilation or retrievals/products) at restart.

- This feature is being ported from CICE4, that is used in RTOFS:
    - We use the sea ice concentration from data assimilation (DA), performed using RTOFS-DA.
    - In this (CICE6) version usage is turned ON (default: OFF) via restart_mod="adjust_aice".
    - See similar/same implementation in the old (CICE4) version of ice_restart.F90, search for insert_ssmi.
    - @awallcraft ported the code he wrote (and is used in CICE4) to CICE6.
    - This PR was originally sent to the NOAA-EMC/CICE fork and following @NickSzapiro-NOAA's recommendation, being redirected here; that PR is now closed.
    - All the comments and conversations (@NickSzapiro-NOAA and @awallcraft) can be read via NOAA-EMC#104, however, for the sake of self-completeness

A brief text/description follows:
One of the main goals of a data assimilation (DA)/prediction system that strives to provide close to observed sea ice concentrations and ice edge is to be able to reconcile the differences in modeled and observed sea ice concentrations derived from space borne instruments. Posey et al., 2025 implemented such a method with CICE4, it is hereby ported to CICE6. By default this feature is turned OFF. To turn it ON, set restart_mod='adjust_aice' in ice_in (input) namelist file and provide sic.nc to be able to nudge the modeled ice concentration to that from data assimilated (or observed) concentration.  By default, restart_mod='none'.  There is also a test mode, restart_mod='adjust_aice_test' which modifies aice read on restart to the nearest 5/100ths just to test the algorithm.


- With this proposed addition, an ability to insert data assimilated sea ice concentration is provided. Implementation is similar/same as in CICE4; see https://github.com/NOAA-EMC/RTOFS_GLO/blob/develop/sorc/rtofs_hycom.fd/src_2.2.99DHMTi-dist2B_relo_cice_v4.0e/source/ice_restart.F90 ; search for insert_ssmi. @awallcraft ported the code he wrote (and is used in CICE4) to CICE6.
- There is an acknowledgement that the coupler and/or MOM6 will need some modifications, but that is beyond the scope of this (CICE) repository. Such work will be taken up in future.

Co-authored-by: Nicholas Szapiro <149816583+NickSzapiro-NOAA@users.noreply.github.com>
Co-authored-by: Nick Szapiro <Nick.Szapiro@noaa.gov>
Co-authored-by: Till Rasmussen <tar@dmi.dk>
Co-authored-by: apcraig <anthony.p.craig@gmail.com>
…ons (CICE-Consortium#1062)

Refactor CICE to support open boundary conditions where values may be imposed on the outer boundary. Prior to this update, the HaloUpdate was zeroing out the halo before updating the halo. This meant any values set on the halo were lost anytime a HaloUpdate was executed. Several other issues upstream and downstream were found as this was implemented. In particular, the global index set on the outer boundary for open and closed boundary conditions was "special", a zero global index was used internally as a flag, and both the scatter_global and haloUpdate was covering up some issues with uninitialized data.

Update the i_glob and j_glob indexing for open and closed boundary conditions on the outer boundary. For open, closed, and tripole (south) boundaries, now extrapolate index values on the outer boundary. This might mean indices are less than 0 or greater than n[x,y]_global+2*nghost. In the original implementation, these outer boundary indices were either set to some internal values so they would be set with the scatter_global method or to zero which was treated as a special value. The zero special value feature has been removed and the scatter_global implementation has been refactored to fill all gridpoints with valid global indices and leave others unset. The only special case remaining in the global indexing is for tripole grids on the north boundary where the j global index is set to a negative value.

- Refactor HaloUpdate in ice_boundary in serial and mpi to avoid zeroing out the halo. The ew and ns directions are handled separately. The new implementation will always zero the internal halo points. It will also zero the outer halo if cyclic or tripole is specified or if a fillvalue is passed into the haloUpdate. Otherwise, the outer halo is left unchanged.
   - Added ewBoundaryType and nsBoundaryType to halo datatype to keep track of the boundary conditions for each halo datatype.
   - Zero out the outer boundary during HaloUpdate only under certain conditions including cyclic or tripole bcs or if a fillValue is explicitly passed
- Add a few fillvalue=c0 arguments to HaloUpdate calls during initialization to force the outer boundary values to zero, mostly during initialization of grid data and similar cases.
- Add several HaloExtrapolate calls to initialize boundary values for grid fields. This replaces those fields being set by the incorrect global indices and the scatter.
- Explicitly zero out all allocated variables at initialization
- Explicitly zero out restart fields before reading to be extra careful
- Explicitly zero out some arrays in the evp1d before use
- Replace the G_HTN and G_HTE initialization with a call to gather_global_ext on HTN and HTE respectively after HTN and HTE are set and the halos updated.
- Move the closed boundary condition abort to initialization in ice_domain.F90
- Refactor halochk unit test, add explicit fill tests
- Update documentation

Additional Features

- Update ice_HaloExtrapolate to support more than 1 ghost cell
- Add support for kmt_type = none with in subroutine rectgrid for rectangular grids. This allows a user to setup a rectangular grid with no land.
- Update the restart_ext implementation in ice_read_write. There was a bug if restart_ext=.false. was passed, nothing would happen. The update also allows some extra restart_ext logic in io_netcdf/ice_restart.F90 to be cleaned up.
- Carry out some code cleanup in init_domain_distribution and init_grid2
- Rename iglb/jglb to isrc/jsrc consistent in scatter_global_ext to be consistent with other scatter methods.

All tests are bit-for-bit except the halochk unittest which was refactored and passes. There is an issue in the evp1d implementation where on some compilers when the debug flag is on, the code will trap on a floating point error. If the floating point error isn't trapped, the cases run to completion and are bit-for-bit with the current trunk. This suggests there is something like a 0/0 calculation being trapped in the evp1d which has no impact on the solution, is only caught by a subset of compilers, and probably requires an if test to avoid. I spent some time trying to track down the error without any success.
Changes in CICE:

- move conversion to K into the define_hist_field call
- fix the accumulation of sitemptop, sitempsnic, and sitempbot to reflect the "intrinsic" versus "extrinsic" definitions.
- redo the avg_ice_present division by aice, so that conb is added at the end
- also undo the ravgct multiplication and division for the case of avg_ice_present
- add cell_methods as "area: time: mean where sea ice (mask=siconc)"
- Update icepack hash to bug fix version of "Tsnice", CICE-Consortium/Icepack#542
…rs to remove residual ice (CICE-Consortium#1067)

Removes residual amounts of ice that are not otherwise handled by the numerics. The controlling parameters (itd_area_min and itd_mass_min, implemented in Icepack) set minimum ice area and mass values below which all ice is removed following the thermodynamics and ridging calculations. For the B-grid, these parameters are currently set to the dynamics stability minima, which are being reduced to extremely small values based on testing in multiple modeling systems. If needed, users can revert these parameters to the original, larger values by adding them to ice_in. Setting them to 0 turns off the new zapping completely. These parameters are set to the larger, original values in the C-grid test scripts, pending further work.

This updates Icepack and changes answers.
After an upgrade, several of Carpenter's modules were removed. These changes update the modules and software versions used to compiler and run CICE.
There is a great deal of confusion about how various history variables are time-averaged, e.g. SIMIP history output implementation CICE-Consortium#1038, Fixes for sitemptop, sitempbot, and sitempsnic. CICE-Consortium#1054. This PR attempts to clarify the situation. These averages are also relevant for conservative coupling.
…ormat) (CICE-Consortium#1079)

Add ability to read an extended grid (supported for pop netcdf file format)

Add subroutine popgrid_nc_ext to read an extended grid pop netcdf file
Add 'nc_ext' option to grid_format namelist
The extended grid will apply to the kmt file as well as these are specified by the same grid_format namelist
Modify gridbox_verts to operate on a local array instead of a global array, this should improve performance and removes redundant extrapolation calculations. This approach also supports both regular and extended grid reads.
The implementation largely duplicates subroutine popgrid_nc but for an extended grid in subroutine popgrid_nc_ext. The extended grid represents the active points plus the full halo. As much as possible, the extended grid (LON, LAT, ANGLE, KMT) is read in on the halo instead of being computed. For some grid metrics (DXT, DYT, DXU, DYU, etc), extrapolation is still required onto the halo.

Remove some trailing blanks is other places as needed.
Adds a namelist flag to allow significant wave height to be passed into the ice model from a coupler. In addition, this PR moves wave_spec_height out of icepack interface argument lists, since it is initialized via icepack_init_parameters.

See CICE-Consortium/Icepack#545

Update Icepack to #0bcde255637a594

Update ice_step_mod.F90 in opticep unit test to be consistent with latest changes

---------

Co-authored-by: apcraig <anthony.p.craig@gmail.com>
Updated all of the variable names, long names, and units to correspond to the CMIP7 data request.
Added new variables requested in the CMIP7 data request.
Added documentation about the CMIP6 to CMIP7 update.
Simplified the accumulation of some fields where possible and added prognostic sea ice density.
Added accumulation of variables relative to aice_init or aice.
Bug fix for flwout (sifllwutop) where aice_init = 0, but aice > 0.
Bug fix for shortwave abosrbed and albedo computation (more coming later)
Bug fix: Some variables that were scaled by aice, should be multiplied by aice (not aice_init) to get the _ai quantities,  including fswabs, fsens, flat, etc.
Removed f_CMIP flag and added set_nml.cmip option instead.
Added comment field for SIMIP variables that uses part of the description field in the CMIP data request table.
Added long_name field to address issue: time_bounds, lat?_bounds, lon?_bounds attributes CICE-Consortium#1057
Partly addresses aice versus aice_init aice vs. aice/aice_init factor in ice_history CICE-Consortium#1033
Partial fix for albedo variables [albedo]_ai history variables over 100% CICE-Consortium#1051
Addresses issue: Some CMIP variables are computed using a mix of U and T quantities CICE-Consortium#904
Add history restart to netcdf and pio IO options. Binary was not included due to the complexity of having to track history fields in binary files. History restart files are written automatically for history streams that are averaged and when a restart is written during the middle of a history accumulation period. There is one history restart file per history stream. File are written in the restart directory using the history name, an appended "_r[histfreq]", and the model date. An ice_read_hist subroutine was added to the ice_history_write.F90 file. For binary, calling this returns with a warning message that history restarts are not implemented. When history restarts are read, the model will only read files and fields that are found and continue with the accumulator initialized to zero for fields that are not found. For production runs, this should work fine. If a user modifies the history streams in the middle or a run, then an assessment should be made of which fields are valid on the first restart run.

The history restart files are basically history files, written at double precision, writing the accumulated fields. In addition, some additional fields are written including time_beg, avgct, albcnt, and snwcnt which represent accumulation counters for time average history output.

A new histall10d set_nml option was added that turns on 3 averaged history streams and all history fields. When used in a restart test, the scripts will verify bit-for-bit history files and history restart files across the restart. Several tests were added to the io_suite to include formal testing of bit-for-bit history restarts. Two fields, mlt_onset and frz_onset and not turned on with histall10d because they do not restart properly and they are unable to restart bit-for-bit on the history file, see CICE-Consortium#1068.

Several history fields have a bug in them and have been written out incorrectly, and these bugs were fixed. The bug in these cases was that the fields were accumulated during the timestep across categories but were not zeroed out at the start of the timestep. As a result, those fields were accumulating over the entire run incorrectly. The fields that had to be zeroed out were evaps and evaps plus upNO, upNH, bTiz, bphi, iDi, and iki associated with bgc. The bit-for-bit history restart test discovered these errors.

Add a new namelist, write_histrest, to turn off history restart writing. The default is that history restarts are on.

Update set_nml.cmip to fix an error in f_apond_ai setting.
Update Copyright to 2026

Remove trailing whitespace

Update Icepack to #2f31ee37f3a70, Icepack v1.5.3
Bug fix for lwout in CESM driver
Also some FSD stuff for coupling
Fix define for sitimefrac
Add the CESM3 namelist changes
@anton-seaice anton-seaice changed the title Debug Debug build Feb 5, 2026
@anton-seaice anton-seaice self-assigned this Feb 5, 2026
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.

7 participants