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

Use safer default min_thickness = 1.0e-3 #303

Merged
merged 1 commit into from
Sep 11, 2019
Merged

Conversation

aekiss
Copy link
Collaborator

@aekiss aekiss commented Aug 21, 2019

@aidanheerdegen
Copy link
Contributor

@russfiedler I've pinged you on this just so you can confirm this will have no unintended consequences. Seems harmless enough, but thought it good to check.

@russfiedler
Copy link
Collaborator

It may change users' high vertical resolution grids if they are poorly specified and rely on the old defaults. New experiments will be fine but starting from existing restarts may have problems since the code as it stands does not do what is intended and may have produced a corrupted kmt mask.

@aidanheerdegen
Copy link
Contributor

So arguably it is a big fix that may break some existing restarts? Is there a work-around in those cases?

@russfiedler
Copy link
Collaborator

The user can set the value in the namelist.

@aidanheerdegen
Copy link
Contributor

In which case, I reckon we should just make this change.

@aidanheerdegen aidanheerdegen merged commit 46774ee into master Sep 11, 2019
@aekiss
Copy link
Collaborator Author

aekiss commented Sep 11, 2019

If this change breaks runs from old restarts, will it appear to run OK or will runs fail so users know there is a problem?

@russfiedler
Copy link
Collaborator

The kmt mask will have extra cells which were formerly rock(but the user probably thought were ocean). It should crash the new runs. The only way that I can think of protecting the user is to demand that they supply a valid min_thickness. Have a negative default and abort if it is negative with messages explaining how to safely choose a sensible value and why. Maybe that's a better option.

@StephenGriffies
Copy link
Contributor

If there is a crash for new runs due to changes in default, then we need to tell users (via error message) what they should set to accord with the prior defaults. Setting a "valid min_thickness" begs the question what is valid and what was the setting prior to the hard error.

@aidanheerdegen
Copy link
Contributor

Sorry, I merged this PR before @StephenGriffies had a chance to comment. I'm happy to submit another PR with Steve's suggestions, or @russfiedler can knock something up.

If I'm to do it, I'd appreciate some help in terms of where this error message should go in the code and what criteria to use to diagnose this issue.

@aekiss
Copy link
Collaborator Author

aekiss commented Nov 27, 2019

how does this look? #309

@russfiedler
Copy link
Collaborator

I'd add that for floating point representation reasons min_thickness should be no less than spacing(max_depth,kind=real32) where max_depth is the maximum depth of the model and the real32 parameter can be obtained from iso_fortran_env.

@aekiss
Copy link
Collaborator Author

aekiss commented Nov 28, 2019

ok thanks @russfiedler, I'll add that.
Also the documentation states that min_thickness is only used for a mosaic grid but we terminate without checking for that, ie we demand that min_thickness is specified even if unused. I guess that's ok? Or should we check we are on a mosaic grid before deciding to terminate?

@russfiedler
Copy link
Collaborator

min_thickness is also used if kmt_recompute=.true. (not recommended). So I'd only check it in the file_exist(ocean_topog) and kmt_recompute if blocks.

aekiss added a commit that referenced this pull request Nov 28, 2019
@aekiss
Copy link
Collaborator Author

aekiss commented Nov 28, 2019

did you mean something like this? https://github.com/mom-ocean/MOM5/pull/309/files

@russfiedler
Copy link
Collaborator

Be careful with the length of the error message. I think it's limited to 512 characters.

@aekiss
Copy link
Collaborator Author

aekiss commented Nov 28, 2019

ok I've now reduced the messages to under 512 chars

@aekiss
Copy link
Collaborator Author

aekiss commented Dec 11, 2019

Any objections to me merging the updated PR #309 into master?

Note that this will break old configs (by design), as it now requires min_thickness to be explicitly specified in ocean_topog_nml.

As explained in the error message, old configs should set min_thickness to 1.0 to restore their previous behaviour, whereas for new runs min_thickness=1.0e-3 is a better choice.

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.

4 participants