Skip to content

Time varying wave spectrum forcing + given wave frequencies - #1147

Open
mhrib wants to merge 26 commits into
CICE-Consortium:mainfrom
mhrib:wam
Open

mhrib wants to merge 26 commits into
CICE-Consortium:mainfrom
mhrib:wam

Conversation

@mhrib

@mhrib mhrib commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

For detailed information about submitting Pull Requests (PRs) to the CICE-Consortium,
please refer to: https://github.com/CICE-Consortium/About-Us/wiki/Resource-Index#information-for-developers

PR checklist

  • Short (1 sentence) summary of your PR:
    Option for time varying wave spectrum forcing

  • Developer(s):
    @mhrib (Mads Hvid Ribergaard)

  • Suggest PR reviewers from list in the column to the right.
    @apcraig
    @lettie-roach
    @eclare108213

  • Please copy the PR test results link or provide a summary of testing completed below.
    19 measured results of 19 total results
    19 of 19 tests PASSED
    0 of 19 tests PENDING
    0 of 19 tests MISSING data
    0 of 19 tests FAILED

  • How much do the PR code changes differ from the unmodified code?

    • bit for bit (If wave forcing is not used)
    • different at roundoff level
    • more substantial
  • Does this PR create or have dependencies on Icepack or any other models?

    • Yes
    • No
  • Does this PR update the Icepack submodule? If so, the Icepack submodule must point to a hash on Icepack's main branch.

    • Yes
    • No
  • Does this PR add any new test cases?

    • Yes
    • No
  • Is the documentation being updated? ("Documentation" includes information on the wiki or in the .rst files from doc/source/, which are used to create the online technical docs at https://readthedocs.org/projects/cice-consortium-cice/. A test build of the technical docs will be performed as part of the PR testing.)

    • Yes
    • No, does the documentation need to be updated at a later time?
      • Yes
      • No
  • Please document the changes in detail, including why the changes are made. This will become part of the PR commit log.

UPDATE AFTER first pull request

I have corrected my misunderstandings in FSD calculations as nicely explained in comments below by: @erinethomas

Changes:

  1. Now read NetCDF wave forcing file as before using wave_spec_file namelist parameter
  2. Skip option wave_spec_type = 'WAM'. Instead:
  3. IF the NetCDF file contains time and wavefreq, then use the new reader, which reads in provided wave frequencies and wave forcing record times. If not, then use the existing forced to 6-hourly interval and hard-coded frequencies. AND read only wave forcing ONCE (the update call was comment'ed out in CICE_RunMod)
  4. Can handle wave_spec_type : 'constant' and 'random'
  5. Still keep the namelist option dt_wavefracture, which forces the interval for wave fracture calculations. Default is every timestep (-1: dt). Else a fracture step of CICE time step dt increasing the "wave fracture forcing" according to dt_wavefracture timestep
  6. Added dt_wavefracture=0: This does the wave fracture calculation only on the wave forcing record times. Can handle uneven steps between record time if needed. This setting stop CICE, if time is not part of the NetCDF wave forcing file.
  7. Updated to present CICE main branch (no conflicts)
  8. Added test case set_nml.fsd12wam. Test if "WAM" forcing can be read correctly including time info and wave frequencies from file. Runs for one day only similar as fsd12ww3 on the GX3 domain. REQUIRES a new test forcing file: CICE_data/forcing/gx3/WAM/wam.20050101_efreq_wavefreq_time_remapgx3.nc
  9. Added text to the science_guide

Existing

At present, using wave forcing, the wave frequencies and number of frequencies are (almost) hardcoded. Options for wave_spec_type is:

  • none
  • profile: fixed dummy wave spectrum for testing
  • constant: wave spectrum data file provided, constant phase and one iteration
  • random:

New

Introduce a new option for time varying directional integrated wave spectrum and given frequencies:

  • WAM : Time varying wave spectra is written from NetCDF file similar to the existing wave forcing (efreq)
float wavefreq(ML) ;
		wavefreq:long_name = "wave frequencies" ;
float efreq(time, ML, ny, nx) ;
		efreq:long_name = "Wave spectra density, directional integrated" ;
double time(time) ;
		time:long_name = "time" ;
		time:units = "days since 1900-12-31 00:00:00" ;

Time axis is like HYCOM time format. Updated to use "units" attribute if exist to make it general using "days since yyyy-mm-dd HH:MM:SS.

A new namelist parameter is introduced, dt_wavefracture. It gives the interval (seconds) between wave fracture computations and it is scaled by the interval. Default is every CICE timestep (dt) given as -1.

NOTE: The reason for choosing the name WAM is, that we use WAM at DMI . But it can - of course - be named differently if preferred. Especially now time is generalized using time attribute units using "days since yyyy-mm-dd HH:MM:SS" syntax or similar taken from the NetCDF forcing file.

Other modifications

  • Update ice_get_ncvarsize routine:
    Now extract variable size from either a dimension parameter or from a variable. Using interface it can also handle / extract sizes from an array - eg 4D variable efreq above.

  • Add ice_read_nc_refdate routine:
    Make time vector general: Use "units" attribute in NetCDF time variable evaluating: "days since yyyy-mm-dd HH:MM:SS".

  • Add ice_nc_has_var routine:
    Check if a NetCDF file contain a specific variable. True/False.

  • Minor adjustments of reading hycom atmospheric fields.
    Same behaviour.

My own test using "WAM" forcing data and "HYCOM" Atmospheric forcing format touch the cases above without any problems.

@eclare108213

Copy link
Copy Markdown
Contributor

Hi @mhrib!
This looks like a nice addition to the code, which apparently does not affect the wave code in Icepack at all. Are particular Icepack configuration settings are needed to use this?

I'd like to understand better how these CICE changes would interface with other models. Are you running this coupled in DMI's systems? Does it make sense to use it in standalone mode, at least for testing purposes? We will want to have some CICE standalone tests with it turned on for regression etc going forward, so the standalone driver will also need to be modified. And this forcing option will need documentation beyond the namelist settings.

We can add the forcing file to our zenodo offerings and the forcing wiki page once the PR is merged (or ready to be).
Thanks!

@mhrib

mhrib commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Hi @eclare108213

Are particular Icepack configuration settings are needed to use this?

No, no further configuration is needed in Icepack. It uses the present one.

However added dt_wavefractureto CICE namelist. It gives the interval (seconds) between wave fracture computations and it is scaled by the interval. This is implemented, because the floe size / wave interaction is a bit slow. So eg. given dt=180 but only wave forcing on hourly timestep, then using dt_wavefracture=3600 the wave fracture computations is only done every 20th time step. However the "wave forcing" is then scaled (amplified) by 20.

In ice_step_mod.F90:

dt_wave = dt_wavefracture / dt

which is used by the icepack function icepack_step_wavefracture(dt=dt_wave,...)

The default for dt_wavefracture is dt, ie. wave fracture computations every timestep (as long as wave forcing exists).

Are you running this coupled in DMI's systems?

Not "real" coupling. Only off-line coupling for the time being, like:

  1. run HYCOM+CICE for one day. Pass ocean velocities + sea ice thickness + concentration to WAM as 1 hour forcing file input.
  2. Run WAM for one day. Pass dir. integrated wave spectrum to WAM as 1 hour forcing file input.

Input files are created as post-processing jobs mainly interpolating between CICE and WAM grids.

Does it make sense to use it in standalone mode, at least for testing purposes?

Yes, absolutely.

Both for testing and to get a feeling for how different wave spectra influences both the sea-ice edge but also how far swells propagates and interacts. Forcing COULD be taken from another WAVE model similar as Atmospheric forcing in a non-coupled system toprovide short forecasts or hindcasts.

We will want to have some CICE standalone tests with it turned on for regression etc going forward, so the standalone driver will also need to be modified. And this forcing option will need documentation beyond the namelist settings. We can add the forcing file to our zenodo offerings and the forcing wiki page once the PR is merged (or ready to be).

Good idea. But then I need some assistance on how to do it.

Should I provide a "forcing.WAM.nc" file for one of the standard grids ??

**

Could also consider IF "WAM" is the best name for wave_spec_type. "prognostic" or similar could also be an option, now I have made the CICE reader general by reading the time:units attribute to determine the reference datetime. Ie. not locked to "HYCOM date" = "days since 1900-12-31 00:00:00"

@erinethomas

Copy link
Copy Markdown

Quick clarifications,

  1. The setting “wave_spec_type = 'constant’” does not mean the wave input spectrum is constant in time. It determines the method in icepack that reconstructs the sea surface height. It means that, for the current wave spectrum E(f,t) (wave power as a function of frequency and time for any given grid cell) Icepack constructs the sea-surface-height realization from the wave spectrum using a fixed/constant phase. This ensures deterministic, bit-for-bit-reproducible ice fracture calculations, normally using one realization per coupling step.
    This is different than, say, wave_spec_type = “random” which means icepack will use a random phases and repeated realization until the surface hight converges to reconstruct the sea surface height realization (this may be more statistically accurate, but is computationally more expensive, and simulations will not be BFB reproducible.)
    NOTE: ICEPACK does not recognize a setting such as 'WAM', and thus Icepack will fall into the constant-phase branch only by accident (since every string ≠ 'random' will use constant instead), which is generally, unadvisable for a community-used model like CICE/Icepack.
    I think to allow CICE to use externally provided wave spectrum from a netcdf file, you should use wave_spec_type = 'constant’ (unless you want to use ‘random’ as discussed above).

And if it is needed, we should probably implement a separate control, via a new nameless parameter, that specifies the SOURCE of the spectrum separately. New nameless parameter ideas: “wave_spectrum_source”= “file”/“coupled”/“none”? Or “wave_spectrum_format”= “file”/“coupled”/“none”? - If we go this route, as mentioned above, we should avoid using ‘WAM’ - since this can apply to any externally provided wave spectra data.

  1. Correct me if I am reading this wrong, but your wave forcing file will contain longer time steps than CICE operates on, correct? And you wish to only fracture the sea ice on the time step in which you have wave spectra data (allowing the FSD to contain NO wave fracture on intermediate sea ice time steps?
    In this case, I think your implementation of dt_wavefracture is correct. that you wish for no FSD changes due to wave fracture on time steps between wave spectra data intervals.

@eclare108213

Copy link
Copy Markdown
Contributor

Should I provide a "forcing.WAM.nc" file for one of the standard grids ??

That would be nice!

Could also consider IF "WAM" is the best name for wave_spec_type. "prognostic" or similar could also be an option, now I have made the CICE reader general by reading the time:units attribute to determine the reference datetime. Ie. not locked to "HYCOM date" = "days since 1900-12-31 00:00:00"

Given @erinethomas's comments above, I think you should use wave_spec_type = constant in CICE, since that's what Icepack is using in your case, and create (or use) other namelist flags to identify this particular setup. She suggests a pointer to the data source , which could be set up similarly to what we do now for other CICE netcdf input files.

A general comment (not your fault) is that the meaning of 'constant' wave_spec_type is ambiguous in CICE. It's fairly clear in Icepack's documentation but in CICE it's not clear whether it refers to being constant in time -- it can be constant in time but doesn't have to be, as your usage shows. We can improve this as part of your documentation.

We're happy to help sort out the configuration options and with publishing a sample forcing file for testing.

@mhrib

mhrib commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

@erinethomas : Thanks for the clarifications.

  1. The setting “wave_spec_type = 'constant’” does not mean the wave input spectrum is constant in time.

Obviously I have misunderstood the meaning of "constant" for the namelist variable wave_spec_type. It is now corrected, such that is is MUCH more in line with the existing. Now it reads in wavefreq and time if both exist in the provided NetCDF forcing file wave_spec_file. If not, it uses the existing reader, assuming fixed time interval and hardcoded wave frequencies. Thereby no needs for a new namelist parameter for this.

  1. your wave forcing file will contain longer time steps than CICE operates on, correct?

Yes exactly. For now on it is only off-line coupling with (much) lower wave forcing interval than the CICE time step.
An I want only want wave fracture calculations on time steps dt_wavefracture higher than the CICE time step dt.
Default is every CICE time step (dt_wavefracture = -1 changes in code to dt_wavefracture = dt). Now also added optional dt_wavefracture=0, which follows the provided Wave forcing interval - can be uneven.

@eclare108213

Should I provide a "forcing.WAM.nc" file for one of the standard grids ??

That would be nice!

Which grid would you suggest and approx which time interval? I assume that it should only be a small NetCDF time with only two or three time steps, which overlap with existing 'standard' forcing files. The purpose of the file is only to test if future changes is still BFB and nothing more, which only needs a few timesteps ??

This can perhaps be done separated to this poll request? Or is the setup of a test case fast done?

@mhrib mhrib changed the title Option for time varying wave spectrum forcing : wave_spec_type = 'WAM' Option for time varying wave spectrum forcing + given wave frequencies Nov 5, 2026
@eclare108213

Copy link
Copy Markdown
Contributor

Which grid would you suggest and approx which time interval? I assume that it should only be a small NetCDF time with only two or three time steps, which overlap with existing 'standard' forcing files. The purpose of the file is only to test if future changes is still BFB and nothing more, which only needs a few timesteps ??

This can perhaps be done separated to this poll request? Or is the setup of a test case fast done?

It's better to include it with this PR, since it improves our confidence in the new code via an additional test. You'll need to update the cice standalone driver, then you can run various test suites to test bit-for-bitness without your option (they are easy to run following instructions in the documentation). Use one of the existing FSD tests as guidance for creating your own (perhaps with a variant of set_nml.fsd12ww3) and let us know if you have questions. Some of our tests only run a day, which is probably long enough for this purpose. @dabail10 @lettie-roach, please weigh in if you have suggestions for a particular test based on what you've been doing.

@mhrib

mhrib commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor Author

Which grid would you suggest and approx which time interval? I assume that it should only be a small NetCDF time with only two or three time steps, which overlap with existing 'standard' forcing files. The purpose of the file is only to test if future changes is still BFB and nothing more, which only needs a few timesteps ??
This can perhaps be done separated to this poll request? Or is the setup of a test case fast done?

It's better to include it with this PR, since it improves our confidence in the new code via an additional test. You'll need to update the cice standalone driver, then you can run various test suites to test bit-for-bitness without your option (they are easy to run following instructions in the documentation). Use one of the existing FSD tests as guidance for creating your own (perhaps with a variant of set_nml.fsd12ww3) and let us know if you have questions. Some of our tests only run a day, which is probably long enough for this purpose. @dabail10 @lettie-roach, please weigh in if you have suggestions for a particular test based on what you've been doing.

@eclare108213
I have updated the code - now also able to read time and frequencies from WW3 data.
Also provided a test-case for the processed "WAM" wave forcing data interpolated to GX3 domain. Test if forcing wave data is readable and behave as expected. However REQUIRES a new forcing file:
CICE_data/forcing/gx3/WAM/wam.20100101_efreq_wavefreq_time_remapgx3.nc
Including a symbolic link to CICE_data/forcing/gx3/ similar as done for WW3 forcing

It is tested locally on the "DMI-HPC"

How do I add this to: https://github.com/CICE-Consortium/CICE/wiki/CICE-Input-Data
And force CICE to use it for standard tests?

@eclare108213

Copy link
Copy Markdown
Contributor

@apcraig Is the cancelled GHActions job for macos-15 what you would expect?

@apcraig

apcraig commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

I have resubmitted the failed test. This seems to be happening intermittently at the moment, not sure why. It looks like resources aren't available to run the tests.

@eclare108213 eclare108213 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is looking good to me, a few comments below.

Thank you for the gx3 test case and forcing. You can submit the forcing file to the CICE community on zenodo. Once that's accepted (by me), we can add the DOI to the CICE Input Data wiki.

There is a section of the CICE documentation for standalone forcing, but it has not been kept up to date. For now, please write a short paragraph describing this data (what it is, where it came from, how it is used) as a PR comment. I'll try to get the documentation updated quickly and include yours at that time.

Can this same forcing file be used for tests with other values of dt_wavespec, e.g. -1?

Comment thread cicecore/cicedyn/general/ice_init.F90 Resolved
@eclare108213

Copy link
Copy Markdown
Contributor

Out of curiosity, is WAM an acronym? What does it stand for? When I see "ww3" my mind reads "wave watch 3", and it would be nice to have a similarly meaningful definition for WAM. Wave Asomething Model? Danish is fine...

@rgrumbine

Copy link
Copy Markdown
Contributor

Nothing so good. WAM = WAve Model

@mhrib mhrib changed the title Option for time varying wave spectrum forcing + given wave frequencies Time varying wave spectrum forcing + given wave frequencies Nov 17, 2026
@mhrib

mhrib commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

@eclare108213 :

Can this same forcing file be used for tests with other values of dt_wavespec, e.g. -1?

yes. Also tested. For "-1" it does the wave fracture at EVERY time step (slow). For "0" only at "forcing time" and for a positive number at the given timestep (has to be an integer division of "dt")

You can submit the forcing file to the CICE community on zenodo

Done. I have uploaded the data file I used for the test-case to Zenodo.

A test error is introduced

I tried to make the WAVE forcing reader in CICE general for both WAM and WW3, and thereby changed wavefreq in processed WAM data to "f" as in the WW3 file.

But

  1. I discovered an error in the name I provided to the WAM forcing file and uploaded earlier today. It is valid from 20050101 - not from 20100101 as within the filename of the previous upload. The file content remains the same ie. starts at 20050101 as calculated by the CICE code using time and time:units attributes despite the misleading filename.

  2. Also discovered/confirmed, that the WW3 wave forcing file is valid from 20100101 as it also state according to the filename AND the NetCDF file info ("days since 1990-01-01 00:00:00" + 7305 days = 2010010100). This is OK. Filename and time info is inline.

However:

  1. The CICE testcase for "smoke gx3 8x2 fsd12ww3,diag24,run1day" starts at 20050101. Therefore this test results in an ERROR because time is used. If timeis not used, it assumes 6 hourly data starting from first dataset (here efreq).

  2. To correct the error in pt 3 above, I can change back f to wavefreq. In this case WAM still read time from file, whereas WW3 assume 6 hourly data starting from 20050101, as the variable wavefreq is not found within the NetCDF file variables and therefore it falls back to default hardcoded.

  3. Moreover, at the reading of WAVE forcing was commented out in the default standalone CICE_RunMod, the forcing was ONLY read ONCE at the start time. And as the ww3 forcing file only contains 4 timesteps at 00,06,12,18 it will miss hour 18-24 and crash. The default behavior - read only ONCE - is now handled in ice_forcing.F90 and reproduce exact the same test as "smoke gx3 8x2 fsd12ww3,diag24,run1day"

I could see a point in using f for wave frequencies rather than wavespec, as it is then general and can be used by both WAM and WW3. However, this then changes the test-case for WW3 and potentially also other users,that does not use the time variable from the file.

What I have done / just pull'ed

Continued with wavefreq

This is working "as before" and with the new time varying format.

Then it can easily be generalized later if desired?

@eclare108213

Copy link
Copy Markdown
Contributor

The wave forcing data file has been accepted at zenodo, https://doi.org/10.5281/zenodo.24315918

@mhrib

mhrib commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

I think it is ready for review and perhaps merging now:

19 measured results of 19 total results
19 of 19 tests PASSED
0 of 19 tests PENDING
0 of 19 tests MISSING data
0 of 19 tests FAILED

@eclare108213 eclare108213 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please clean up the documentation as noted in my comments - thanks. Before merging, one of us with edit permission needs to add the link to the new wave forcing file to the cice input forcing wiki page. Then it would be a good idea to run the new code through a larger battery of tests to check that all works as expected, including reading and using the new data file. I expect it's fine but it's good for someone not already set up to go through the whole process and make sure it works. (I would but have run out of time this month...)

@mhrib
mhrib requested a review from eclare108213 November 19, 2026 22:50

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants