Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Numerical Solution for Wave Attenuation in sea ice #1294

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

erinethomas
Copy link
Contributor

@erinethomas erinethomas commented Aug 15, 2024

Pull Request Summary

This PR provides a new switch (called IC4_ACCURATE_NUMERICS). This switch allows for using an updated numerics scheme for wave attenuation in sea ice.

Description

The default behavior for wave attenuation in sea ice uses 'time splitting' for the wave action equation. This PR and the use of the new switch setting allows the user to place the 'sea ice' with the other source terms, thus reducing the errors introduced with the time splitting method for wave attenuation in sea ice resulting in more accurate wave action in sea ice.

Currently, this code is intended to be used in tandem with the newly proposed Meylan et al 2021 attenuation scheme : IC4M10 (see PR: #1293 ). This combination (IC4M10 plus IC4_ACCURATE_NUMERICS) has been tested in coupled CESM and E3SM runs, yet we note, at this time, this new numerics calculation for wave attenuation has not yet been tested with IC4 methods 1-9, although, we expect similar improvements for all IC4 methods.

This PR is the original work of @cmbitz and Vince Cooper (University of Washington). Collaborators include @erinethomas, @dabail10, @NickSzapiro-NOAA

Issue(s) addressed

This PR fixes the following Issue: #738

Commit Message

Introduction of a new switch (IC4_ACCURATE_NUMERICS) that allows for more accurate numerics scheme for wave attenuation in sea ice. Coauthors: Cecilia Bitz, Vince Cooper, Erin Thomas, David Bailey, Nick Szapiro.

Check list

Testing

  • How were these changes tested?
    This code has been tested by @cmbitz (details to be posted below), by @erinethomas in E3SM configurations with wave-sea ice coupling, and by @dabail10 in CESM configurations with wave-sea ice coupling.
  • Are the changes covered by regression tests? (If not, why? Do new tests need to be added?)
  • Have the matrix regression tests been run (if yes, please note HPC and compiler)?
  • Please indicate the expected changes in the regression test output, (Note the list of known non-identical tests.)
  • Please provide the summary output of matrix.comp (matrix.Diff.txt, matrixCompFull.txt and matrixCompSummary.txt):

@erinethomas erinethomas changed the title Updated Numerical Solution for Wave aAtenuation in sea ice Updated Numerical Solution for Wave Attenuation in sea ice Aug 15, 2024
@NickSzapiro-NOAA
Copy link
Contributor

Maybe it is possible to progress with some discussion/review during this pause, @MatthewMasarik-NOAA ? I don't know if any IC4 developers in particular have feedback

@MatthewMasarik-NOAA
Copy link
Collaborator

Hi @NickSzapiro-NOAA, others should feel free to discuss. If this is not needed for either gfsv17 or gefsv13 though, than Avichal has reiterated that the waves team needs to pause any reviewing since we don't have the manpower currently.

@MatthewMasarik-NOAA
Copy link
Collaborator

@erinethomas, we will also process this in ~November. Thank you for the very informative PR header.

@cmbitz
Copy link
Collaborator

cmbitz commented Oct 2, 2024

I've made a github repository about this issue at https://github.com/cmbitz/WW3Numerics where I've written up some more detailed notes about this issue and show some results in slides from a number of integrations to test it. I also provide a Python Notebook with some idealized examples that can be solved exactly where I compare the various solution options. In short, the modifications I'm suggesting can be implemented so they only matter in the sea ice. They can work for any IC/IS option combination, though I confess I've only tested with IC4Method10. I'm 100% sure it would improve wave amplitudes in the sea ice for any IC option. Happy to talk to anyone who wants to listen. I understand that this issue is on the back-burner, which is okay with me. I'll wait.

@erinethomas
Copy link
Contributor Author

thanks for the extra details @cmbitz!

@@ -2097,7 +2145,7 @@ SUBROUTINE W3SRCE ( srce_call, IT, ISEA, JSEA, IX, IY, IMOD, &
#ifdef W3_IC3
ATT=EXP(ICE*VDIC(IS)*DTG)
#endif
#ifdef W3_IC4
#ifndef W3_IC4_ACCURATE_NUMERICS
Copy link
Collaborator

@sbanihash sbanihash Dec 7, 2024

Choose a reason for hiding this comment

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

In a case of IC0 for example, where there is no IC1-IC5 defined, then VDIC has not been defined (look at line 744 in this same script) and the build will give this error: This name does not have a type, and must have an explicit type. [VDIC]
ATT=EXP(ICE*VDIC(IS)*DTG)
suggested changes is:
#ifdef WW3_IC4
#ifndef WW3_IC4_ACCURATE_NUMERICS
ATT = EXP(ICE * VDIC(IS) * DTG)
#endif
#endif

Copy link
Collaborator

Choose a reason for hiding this comment

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

@erinethomas @NickSzapiro-NOAA do you agree with this change? If so could you please go ahead and make the changes?

Copy link
Contributor

Choose a reason for hiding this comment

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

Keeping both makes sense to me to protect VDIC

@ErickRogers
Copy link
Collaborator

Why is this implemented as a switch? Could a logical variable in the IC4 namelist do the same thing?

@dabail10
Copy link

dabail10 commented Jan 6, 2025

Why is this implemented as a switch? Could a logical variable in the IC4 namelist do the same thing?

Hi Erick. We were following the example of the W3_IC? options here. Happy to change it to a namelist option if this is preferred.

@ErickRogers
Copy link
Collaborator

Hi David.
Yes, I'm not sure if this is covered in the guidelines for developers, but the switches tend to be used for things that are pretty major, like selecting a propagation scheme, selecting a physics parameterization, selecting parallel computing method, or compiling in extra software (e.g., SCRIP). When a switch is changed, it requires a re-compile, whereas changing a namelist variable in the ww3_grid.inp file does not require a re-compile. Any new switch needs to be accommodated in the build system (/bin/build_utils.sh), which is an argument for "fewer switches=better". If this is limited to IC4, you can use a new logical variable in the IC4 namelist. If your option adds to the computation time, e.g., by forcing a small time step, then the original setting should be the default. (This will also make the discussion re: NCEP's "matrix" testing straightforward.) If this is intended to be used with any of the other IC# methods, you can put the new logical variable in the MISC namelist instead of the IC4 namelist.

@dabail10
Copy link

dabail10 commented Jan 6, 2025

Ok. I will work with @erinethomas on this.

@ErickRogers
Copy link
Collaborator

Adding a namelist variable is very easy. I just did this the other day, to put in a new option for hacking the ice thickness. You can look at an existing variable to see how it is done, e.g. "grep IC4 *.F90 | grep -i ki". Any new variable will have 2 names. One is used in ww3_grid.inp and the other is used internally, e.g. IC4KI and IC4_KI. There are 3-4 files that need minor editing to add the new variable, as you will see with the output from above grep command. Keep in mind that after making this change, any old mod-def files that you have will no longer work.

@erinethomas
Copy link
Contributor Author

This seems like a good way forward (to go with namelist options rather than switches) - I will update the PR as soon as I can!

@sbanihash
Copy link
Collaborator

@erinethomas @dabail10 Do we have any updates to this PR?

@erinethomas
Copy link
Contributor Author

yes -I have worked out how to move this from a switch setting to a namelist parameter - I am still doing some final tests - code coming soon.

@erinethomas
Copy link
Contributor Author

erinethomas commented Feb 12, 2025

@cmbitz @dabail10 @NickSzapiro-NOAA
UPDATE: I have modified the code to use a logical Namelist setting called "ICNUMERICS"/"IC_NUMERICS". This namelist setting should be placed under "MISC" namelist category. I placed it under MISC (as opposed to IC4) since, in the future this numerical scheme should be applicable (and tested) for any Sea Ice dissipation scheme (not just IC4). This code should be applicable for users to use in any IC/IS combination. Keeping in mind this flexibility, would you all take a look at the modifications, and check if the logic I implemented is correct ... especially with respect to the changes I made in w3srcemd.F90 and any "IC/IS" switches used.... (for example Line ~1330, Line ~1416, Line 1460, etc.)

@sbanihash
Copy link
Collaborator

Thank you @erinethomas for your updates! Please let me know when you are ready for the second round of review.

Copy link
Collaborator

@ErickRogers ErickRogers left a comment

Choose a reason for hiding this comment

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

The recent updates by Erin look good to me. I don't have any other concerns or suggestions. I suppose it needs to get through the matrix testing now.

@sbanihash
Copy link
Collaborator

sbanihash commented Feb 18, 2025

Thank you @ErickRogers for your review. @erinethomas I will be starting my second round of review soon. Please let me know if there are still changes or checks you need to do on you side before I do so. Thanks

@erinethomas
Copy link
Contributor Author

thanks @ErickRogers, @sbanihash - you are welcome to review this now - but I would very much like one or more of the other developers (@cmbitz, @dabail10, @NickSzapiro-NOAA) to review these changes as well before the PR is finalized.

@@ -809,6 +809,7 @@ MODULE W3GRIDMD
!
REAL(8) :: GSHIFT ! see notes in WMGHGH
LOGICAL :: FLC, ICEDISP, TRCKCMPR
LOGICAL :: ICNUMERICS

Choose a reason for hiding this comment

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

This is a nit-picky thing, but do we need both ICNUMERICS and IC_NUMERICS? I feel like the other ice flags have IICESMOOTH and ICESMOOTH.

Copy link
Contributor Author

@erinethomas erinethomas Feb 19, 2025

Choose a reason for hiding this comment

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

I was following the naming convention for "IC4KI and IC4_KI" - but the MISC namelist settings seem to have the 'extra I' rather than the underscore... we could probably pick either convention. I have no strong opinion on this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It is fine, IMO.

@@ -1423,6 +1457,11 @@ SUBROUTINE W3SRCE ( srce_call, IT, ISEA, JSEA, IX, IY, IMOD, &
#ifdef W3_UOST
VS(IS) = VS(IS) + VSUO(IS)
#endif
IF ( IC_NUMERICS .AND. ICE.GT.0. ) THEN
#if defined(W3_IC1) || defined(W3_IC2) || defined(W3_IC3) || defined(W3_IC4) || defined(W3_IC5)
VS(IS) = VS(IS) + VSIC(IS)

Choose a reason for hiding this comment

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

In my version of the code we also have VD(IS) = VD(IS) + VDIC(IS)?

Choose a reason for hiding this comment

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

Oh wait, I see this is down further.

@@ -700,6 +701,7 @@ MODULE W3GDATMD

LOGICAL :: GINIT, FLDRY, FLCX, FLCY, FLCTH, FLCK, FLSOU, IICEDISP,&
IICESMOOTH
LOGICAL, POINTER :: IC_NUMERICS

Choose a reason for hiding this comment

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

Is this supposed to be a pointer in both places?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not 100% sure to be honest - I don't understand why some of the namlist settings here are pointers... but other are not... for example, most of the IC4 namelist settings are pointers in both places? but the IICEDISP is only a pointer in one place?

Copy link

@dabail10 dabail10 left a comment

Choose a reason for hiding this comment

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

Testing this out in CESM.

@@ -1454,6 +1498,11 @@ SUBROUTINE W3SRCE ( srce_call, IT, ISEA, JSEA, IX, IY, IMOD, &

!
DT = MAX ( 0.5, DT ) ! The hardcoded min. dt is a problem for certain cases e.g. laborotary scale problems.
IF ( IC_NUMERICS .AND. ICE .GT. 0.01 .and. ICE .LT. 0.95) THEN
Copy link
Contributor

Choose a reason for hiding this comment

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

ICE.GT.0 is used elsewhere. Is this a big change in efficiency or to avoid something in particular?

If not, I'm hesitant as these seem buried and may lead to spatial differences around these sea ice concentrations

Copy link
Contributor Author

@erinethomas erinethomas Feb 19, 2025

Choose a reason for hiding this comment

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

Good question @NickSzapiro-NOAA ... @cmbitz can you explain your logic for putting 'ICE.GT.01' rather than 0 here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

It doesn't really matter if it is 0 or 0.01 provided tiny dots of sea ice don't hang around. I was just trying to make the code run a bit faster when the sea ice concentration is small since there isn't much point in increasing the accuracy for less than 1% of the area. The error in the 99% or more area of open water will dominate anyway. Though @dabail10 is right that I think we should not bother with this line of code at all. I wouldn't bother with it regardless of OFFSET. We had limited the timestep since there are conditions where my recommended numerical changes in the sea ice are less accurate unless the timestep is also reduced. However, I don't think it is that important. What is much more important is the "merging" of the sea ice source with the other source terms that is the main thrust of this pull request.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for the extra details! I will remove this line and update the PR.

@dabail10
Copy link

@cmbitz was actually advocating that we should remove this timestep limitation under the ice. However, I don't know if that is only when OFFSET=0.5 in w3srcemod.F90

@dabail10
Copy link

These changes work in the CESM code.

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