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

Add drying slope case #352

Merged
merged 24 commits into from
May 3, 2022
Merged

Conversation

cbegeman
Copy link
Collaborator

@cbegeman cbegeman commented Apr 5, 2022

This PR ports the MPAS-Ocean drying_slope test case from legacy, which is based on

Warner, J. C., Defne, Z., Haas, K., & Arango, H. G. (2013). A wetting and
drying scheme for ROMS. Computers & geosciences, 58, 54-61.

Currently, we support one vertical coordinate (sigma) and two horizontal resolutions (250m, 1km). The test case was verified to produce the same results as the legacy case.
image
image

@pep8speaks
Copy link

pep8speaks commented Apr 5, 2022

Hello @cbegeman! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2022-04-19 15:28:19 UTC

@cbegeman cbegeman requested review from xylar, dengwirda and sbrus89 April 5, 2022 20:13
@cbegeman cbegeman added ocean legacy DEPRECATED: PRs or Issues related to the legacy branch of COMPASS labels Apr 5, 2022
@cbegeman cbegeman force-pushed the add-drying-slope-case branch 3 times, most recently from 535acf8 to 0c2354d Compare April 5, 2022 20:43
@xylar xylar removed the legacy DEPRECATED: PRs or Issues related to the legacy branch of COMPASS label Apr 5, 2022
@xylar
Copy link
Collaborator

xylar commented Apr 5, 2022

This is exciting! I'll give this a look tomorrow.

I took off the "legacy" tag because we use that to indicate PRs into the legacy branch. I'll update the description of that tag to make that clear.

@xylar xylar self-assigned this Apr 8, 2022
Copy link
Collaborator

@xylar xylar left a comment

Choose a reason for hiding this comment

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

This is really great! I'm able to run the test cases successfully through both forward runs but the viz step is giving me some trouble.

viz is failing because the csv files are not getting downloaded automatically. It will be necessary to add all of the csv files as input files to the step, using database=drying_slope as one of the arguments.

Then, I think it would be easier if you just moved the functions from MoviePlotter and TimeSeriesPlotter into Viz. This is because there need to be some shared attributes (times, damping_coeffs and datatypes seem like some obvious ones. These could be passed from Viz over to each of the other classes but I think it just doesn't seem clearly advantageous to have 3 classes in this case.

I do realize that this approach was inherited either from IsomipPlus or from the legacy version of drying_slope (or perhaps both) and predates the current compass.

One more thing is that documentation needs to be added before this gets merged.

compass/ocean/tests/drying_slope/default/__init__.py Outdated Show resolved Hide resolved
compass/ocean/tests/drying_slope/default/__init__.py Outdated Show resolved Hide resolved
compass/ocean/tests/drying_slope/default/__init__.py Outdated Show resolved Hide resolved
compass/ocean/tests/drying_slope/default/__init__.py Outdated Show resolved Hide resolved
compass/ocean/tests/drying_slope/default/__init__.py Outdated Show resolved Hide resolved
compass/ocean/tests/drying_slope/viz/plot.py Outdated Show resolved Hide resolved
compass/ocean/tests/drying_slope/viz/plot.py Outdated Show resolved Hide resolved
compass/ocean/tests/drying_slope/viz/plot.py Outdated Show resolved Hide resolved
compass/ocean/tests/drying_slope/viz/plot.py Outdated Show resolved Hide resolved
compass/ocean/tests/drying_slope/viz/plot.py Outdated Show resolved Hide resolved
@cbegeman
Copy link
Collaborator Author

cbegeman commented Apr 8, 2022

@xylar Thanks for the detailed review and suggestions! I implemented all those changes and will get the documentation together by Monday.

@cbegeman cbegeman force-pushed the add-drying-slope-case branch 2 times, most recently from 0d8e1de to 4ced8a3 Compare April 11, 2022 19:09
Copy link
Collaborator

@xylar xylar left a comment

Choose a reason for hiding this comment

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

This is really excellent work! The documentation is very clear. The new organization of the viz step seems to work really well, too. There are a few new PEP8 details to deal with (see #352 (comment)) and I have some additional very minor ones.

I ran both test cases and the resulting movie is really fun to watch!

Comment on lines 65 to 87
"""
"""
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should probably have a one-sentence description.

super().__init__(test_case=test_case, name='viz')

damping_coeffs = [0.0025, 0.01]
times = ['0.50', '0.05', '0.40', '0.15', '0.30', '0.25']
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would it make sense for these to be in ascending order?

@xylar xylar added the enhancement New feature or request label Apr 13, 2022
@cbegeman
Copy link
Collaborator Author

@xylar I believe I've now made all the changes you mentioned and resolved PEP issues.

@sbrus89 Please give this a whirl when you have the chance!

Thanks to you both!

@sbrus89
Copy link
Collaborator

sbrus89 commented Apr 14, 2022

@cbegeman, super. I'll test this today.

Copy link
Collaborator

@sbrus89 sbrus89 left a comment

Choose a reason for hiding this comment

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

@cbegeman, this is a great setup! I have a few minor comments, hopefully they are useful.

@@ -0,0 +1,28 @@
config_run_duration='0000_12:00:01'
config_dt='0000_00:00:30'
Copy link
Collaborator

Choose a reason for hiding this comment

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

The legacy case uses config_dt='0000_00:00:20' for the 250m resolution. With the current 30s dt, there are some large errors on the right boundary for the 250m case:
ssh_depth_section_30s

For a 20 second dt:
ssh_depth_section_20s

I also ran it with a 10 second dt:
ssh_depth_section_10s

The smaller dt progressively improves the boundary mismatch and also improves the drying front (especially for r=0.0025). Maybe we should with with 10s (or even 5 since there's still a slight mismatch with 10?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@sbrus89 Good idea. How about 8s since that is roughly 1/4 the dt of the lower resolution case?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sounds good to me.

config_zero_drying_velocity=.true.
config_verify_not_dry=.true.
config_thickness_flux_type='upwind'
config_cvmix_background_viscosity=1e4
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should set config_use_cvmix = .false..

ny = 28

# the size of grid cells (m)
dc = 1000.0
Copy link
Collaborator

Choose a reason for hiding this comment

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

Similarly, this doesn't seem to be needed. Can resolution be passed as an argument to self.add_step(InitialState(test_case=self)) so this can get set in InitialState.run?

Copy link
Collaborator

Choose a reason for hiding this comment

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

The same, if this is set in the code (in configure()), it shouldn't be set here, too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll defer to @xylar on whether it makes more sense to take the original approach of having these be config options that are modified in Default.configure or remove these as config options and set them in InitialState.run as you suggest. My thinking behind the use of config options was making these dimensions more externally visible, but I can see how it might be misleading since dc and ny are not independent.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's better to include it in configure() and not in the config file, to make a bit clearer that the configure() version always takes priority. You can use the brand new "comment" argument to set() to have the comment included there instead.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks @xylar! I didn't refresh in time so my comment was a bit lagged but it all worked out.

@cbegeman cbegeman force-pushed the add-drying-slope-case branch from 294d9d9 to 5d28325 Compare April 17, 2022 19:03
@cbegeman
Copy link
Collaborator Author

cbegeman commented Apr 17, 2022

I've made the changes @sbrus89 suggested. I also rebased to make use of the new comment feature.

Note: af3b8bb makes use of additional namelist files to set config_dt for each resolution. I'm happy to change this to the add_namelist_options method in Forward step if that's preferred.

@cbegeman cbegeman force-pushed the add-drying-slope-case branch from 5d28325 to 5faedd8 Compare April 17, 2022 19:09
@xylar
Copy link
Collaborator

xylar commented Apr 18, 2022

Note: af3b8bb makes use of additional namelist files to set config_dt for each resolution. I'm happy to change this to the add_namelist_options method in Forward step if that's preferred.

If it were me, I would use add_namelist_options but I don't think it's necessary to change it.

Copy link
Collaborator

@xylar xylar left a comment

Choose a reason for hiding this comment

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

I'm good with this. Hopefully, one of you can run one last set of tests?

@xylar
Copy link
Collaborator

xylar commented Apr 18, 2022

@dengwirda, we're ready for your review on this so we can get it in.

@cbegeman
Copy link
Collaborator Author

I did run these test cases with the latest commits on anvil.

@cbegeman cbegeman force-pushed the add-drying-slope-case branch from 5faedd8 to c175f97 Compare April 18, 2022 15:01
@cbegeman cbegeman force-pushed the add-drying-slope-case branch from c175f97 to 98ec328 Compare April 19, 2022 15:28
@xylar xylar removed the request for review from dengwirda May 3, 2022 16:35
@xylar xylar merged commit e829ea1 into MPAS-Dev:master May 3, 2022
@xylar
Copy link
Collaborator

xylar commented May 3, 2022

Thanks, @cbegeman! Such a good feature to have!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ocean
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants