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

Include pkg/steep_icecavity by leveraging pkg/shelfice files #789

Merged
merged 60 commits into from May 24, 2024

Conversation

owang01
Copy link
Collaborator

@owang01 owang01 commented Oct 24, 2023

What changes does this PR introduce?

This PR is based on Martin's PR #772, which offers an alternative method for including pkg/steep_icecavity as initially implemented in PR #368. This alternative method leverages existing files in pkg/shelfice, ensuring that pkg/steep_icecavity contains only the minimal necessary files. As a result, many files present in PR #368's version of pkg/steep_icecavity are eliminated.

What is the current behaviour?

(You can also link to an open issue here)

What is the new behaviour

(if this is a feature change)?

Does this PR introduce a breaking change?

(What changes might users need to make in their application due to this PR?)

Other information:

Suggested addition to tag-index

(To avoid unnecessary merge conflicts, please don't update tag-index. One of the admins will do that when merging your pull request.)

mjlosch and others added 18 commits September 21, 2023 12:43
- make ALLOW_STEEP_ICECAVITY a CPP flag in SHELFICE_OPTIONS.h and
  change useSTIC to SHEFICEuseSTIC to be set in data.shelfice
- the most pain was caused by the flag ALLOW_SHITRANSCOEFF_3D, which
  is only indirectly related to the merge.

forward verification experiments:
- compiles and does not break isomip reference experiments as long as
  ALLOW_STEEP_ICECAVITY is undefined
- with ALLOW_STEEP_ICECAVITY defined, there are naming conflicts with
  pkg/icefront (naturally), but when icefront is disabled in
  packkages.conf, the remaining verification experiments do not break
- new verification experiment isomip.stic

TAF-AD verification experiments:
- isomip does not break when ALLOW_STEEP_ICECAVITY is undefined
- no additional recomputations when ALLOW_STEEP_ICECAVITY is
  defined
- does not yet work with ALLOW_SHITRANSCOEFF_3D (unclear)
- new AD-verification experiment isomip.stic

TODO:
- rename icefront variables to given them unique names so that
  shelfice and icefront can be compiled together
- in SHELFICE.h separate icefront and shelfice code (separate common
  blocks)
- sort out use of ALLOW_STEEP_ICECAVITY (define fields only when
  necessary)
- formatting, details ...
- restore do_oceanic_phys.F
- strangely this requires new store directives for shiTransCoeffS and
  addMass
for anticipated pkg-name STEEP_ICECAVITY and steep icecavity front and
sometimes icf for iceFront. All of these names can be changed, I
guess.
This allows compiling pkg/shelfice together with pkg/icefront again.
- 3D shiTransCoeffs do not make any sense for pkg/shelfice, where
everything is 2d
- keeps pkg/sheflice and pkg/steep_icecavity appart even more
- add check and soft warning, if they are ever different
- (hopefully) improved error messages
- rename diagnostics to be unique
- cleanup
- fix a cpp-flag name for store directive
- move call to stic_init_depths to where it belongs (ini_masks_etc.F)
- fix cpp-flag and include files in pkg/ecco
@mjlosch mjlosch added the work in progress Should not be merged until this label is removed label Oct 24, 2023
@jrscott jrscott requested a review from mjlosch November 13, 2023 15:53
@jrscott jrscott added adjoint Affects the adjoint model; label triggers full OpenAD test and removed work in progress Should not be merged until this label is removed labels Nov 13, 2023
Copy link
Member

@mjlosch mjlosch left a comment

Choose a reason for hiding this comment

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

Both forward and TAF-AD code experiments run. I have a few inline comments that should be addressed, some left over clean-up etc. otherwise it looks good (as far as I can see). It would be great if this new code could also support vectorisation, but maybe no in this PR.

pkg/shelfice/shelfice_forcing.F Outdated Show resolved Hide resolved
pkg/ctrl/ctrl_check.F Outdated Show resolved Hide resolved
model/src/ini_parms.F Outdated Show resolved Hide resolved
pkg/shelfice/shelfice_thermodynamics.F Outdated Show resolved Hide resolved
pkg/steep_icecavity/stic_ad_check_lev1_dir.h Outdated Show resolved Hide resolved
verification/isomip/input_ad.stic/data.ecco Outdated Show resolved Hide resolved
pkg/steep_icecavity/stic_check.F Outdated Show resolved Hide resolved
pkg/shelfice/shelfice_thermodynamics.F Outdated Show resolved Hide resolved
pkg/shelfice/shelfice_thermodynamics.F Outdated Show resolved Hide resolved
Include STIC_OPTIONs.h in two files

Make minor editorial changes
@owang01
Copy link
Collaborator Author

owang01 commented Dec 3, 2023

Hi @mjlosch Thank you for your comments. I believe I have addressed all of them in the latest commit b46ad66.

@mjlosch
Copy link
Member

mjlosch commented Dec 4, 2023

@owang01, changes look good, except that a new directory pkg/stepice appeared in the last commit. Probably not on purpose ...

Co-authored-by: Martin Losch <30285667+mjlosch@users.noreply.github.com>
@owang01
Copy link
Collaborator Author

owang01 commented Apr 17, 2024

The failed adjoint run of isomip.stic fails is related to commit 2a49a34. However, it is not clear to me why the adjoint failed. The testreport check of the forward run of isomip.stic passes.

"INTERNAL ERROR" messages are TAF-related.

@owang01
Copy link
Collaborator Author

owang01 commented Apr 21, 2024

@jm-c I have updated stic_thermodynamics.F to handle the case of non-UNSET_RL temp_addMass and salt_addMass, as suggested in your second option.

@jm-c
Copy link
Member

jm-c commented May 22, 2024

@owang01 I am going to push little changes (update some comments, avoid un-used var) and will review this PR soon after.

jm-c added 3 commits May 22, 2024 10:27
- include STIC_OPTIONS.h in shelfice_forcing.F (use STIC.h)
- replace "1." with oneRL (avoid conversion)
- restaure original indentation
also remove consecutive blank lines
Copy link
Member

@jm-c jm-c left a comment

Choose a reason for hiding this comment

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

I checked this latest version and this looks good. Just minor comments:

  1. Without considering the adjoint-code, we could think of removing the ALLOW_SHITRANSCOEFF_3D new CPP options (in pkg/shelfice, the corresponding 2-D arrays are alwayes there, not CPP option around). But this might make the adjoint-code more complicated to generate. And if it's the case it's fine to leave it the way it is now.
  2. There are many header files included in stic_solve4fluxes.F and it's likely that most of them are not needed ; something to check.

I did not check (yet) the changes/addition to isomip exp but will do this soon.

not needed (by default, links all files from ../input)
@jm-c
Copy link
Member

jm-c commented May 22, 2024

I've just checked the changes/addition to isomip experiment and it's good. I updated the 2 new reference output since the previous ones were not that recent (with many more lines in the old output_adm.stic.txt).

@owang01
Copy link
Collaborator Author

owang01 commented May 24, 2024

@jm-c Thank you for your review and approval. Regarding your two comments, I keep the CPP option ALLOW_SHITRANSCOEFF_3D, since one could turn it off to not declare some 3d arrays and also make the model run a bit faster. I have removed some unnecessary header files in stic_solve4fluxes.F.

@jm-c
Copy link
Member

jm-c commented May 24, 2024

@owang01 So everything is good and I think this PR is ready to be merged. Do you agree ?
If yes then will merge it soon (like later today), unless someone wants to add something (@mjlosch are you OK with this ?).

@owang01
Copy link
Collaborator Author

owang01 commented May 24, 2024

Thanks @jm-c. LGTM. Also, a big thank-you to @mjlosch for all the contributions to this PR.

@jm-c jm-c merged commit 00f81e6 into MITgcm:master May 24, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adjoint Affects the adjoint model; label triggers full OpenAD test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants