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
OBCS_SEAICE_NEUMANN flag, more store directives, and cleanup #740
base: master
Are you sure you want to change the base?
Conversation
while not used in the current code, it can be useful to have simple mask for flexible cost function definition
- when defined, boundary value are computed from interior fields so that the normal derivative across the boundary is zero (for pkg/seaice variables only)
- also make sure that do_oceanic_phys, seaice_model, obcs_calc is not recomputed in parts or totally (without TAF-warnings)
to resolve conflicts
pkg/obcs/obcs_apply_uvice.F
Outdated
@@ -77,7 +75,12 @@ SUBROUTINE OBCS_APPLY_UVICE( | |||
DO i=1-OLx,sNx+OLx | |||
Jobc = OB_Jn(i,bi,bj) | |||
IF ( Jobc.NE.OB_indexNone ) THEN | |||
# ifdef SEAICE_OBCS_NEUMANN | |||
C Neumann boundary conditions | |||
uFld(i,Jobc,bi,bj) = uFld(j,Jobc-1,bi,bj) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be "= uFld(i,Jobc-1,bi,bj)" instead ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a look at code changes and have few comments:
- There are many TAF store dir changes, and few changes to testreport AD output (all 4 global_ocean.90x40x15 tests + global_ocean_ebm + tutorial_global_oce_optim), all small differences and some in forward grad-check and some in AD grad-check + AD monitor. Will need to run this on villon to check if I need to update few ref-output. Also need to run with Tapenade since I notices few changes related to Tapenade code.
- there is a new CPP "OBCS_SEAICE_NEUMANN" in SEAICE_OPTIONS.h but I see few "#ifdef SEAICE_OBCS_NEUMANN" in obcs_apply_uvice.F & obcs_apply_seaice.F.
- Also,since it does not involve new arrays in common block, would it be difficult to have a run-time switch instead of a CPP option ?
- At some point, it would be good to get a minimal doc of pkg/obcs implemetation in the manual (currently 8.3.1.6 and 8.3.1.5.10 are empty), specially for seaice since it does not follow the same sequence (e.g.,
obcs_apply_seaice
called at the very end, after all pkg/seaice update butobcs_apply_uvice
called before any update of pkg/seaice fields ). - Not sure it would be better, but could we skip the changes in obcs_apply_uvice.F and set OB[N,S,E,W]u,vice instead ?
- very minor, for "cost config" report in STDOUT, I like what
pkg/ctrl
reports:
control vector configuration >>> START <<<
control vector configuration >>> END <<<
and could use the same convention here.
Detail: I don't see anymore any change related to "divisions by zero in taf-generated ad-code of ggl90_calc.F", so may be the PR description could be updated. |
@jm-c thanks for having a look and for you comments
This is not the cleanest PR, because it mixes the Neumann BCs for seaice with other stuff. The "other" stuff is more reorganisation of store directives to avoid extra computations where they are not necessary (e.g. 85ec739. This reorders the AD code and I can imagine that there are small changes due to reading tapes instead of recomputing (truncation). Not sure where the FW differences come from. I will have another look to make sure that everything is OK with that.
i.e. the agreement with the reference even improves a little. This somewhat supports my feeling that the differences is a truncation error issue when replacing recomputation by tapes.
That's embarrassing and will be fixed. It's a bad idea not to test new code ... will think of a verification experiment where I can add this functionality.
That should be possible. I didn't do it because I thought that extra "if" would make the code less efficient. Do think that this type of code would be OK? Would the runtime flag
That would be great. There are so many sea ice options that I did not implement, so that I am not sure that could describe them properly, but we could start doing so in this PR. I'll give it a shot.
Would be more efficient, see 3. point
Yes, we could modify |
as a basis for further improvement
@mjlosch I have not looked at your latest changes but few comments regarding your answers:
I will take a look at the new docs (exiting !). |
in d8ac131 I applied some sort of hybrid: Along with replacing the CPP flag with a runtime flag for Neumann BCs, I copied the corresponding |
@mjlosch regarding this:
Should this be after the OBCS_CONTROL ? or at the same level as OBCS_STEVENS ? (and in this case just after ?). |
neither I guess putting this at the end after |
addressed unwarned recomputations and some new recomputation warnings associated with obcs
plus useSeaiceNeumann boundary conditions, aEVP, Visbeck97 in AD mode
I now added a forward test of the sea ice Neumann boundary conditions to Everything after commit 5c100af is preparation for a TAF-AD test for I had to turn off tides in AD because they lead to massive recomputation warnings which I couldn't fix quickly. That's something on the to-do list. Both reference solutions are generated on my MacBook and will require updates from the reference machine. |
What changes does this PR introduce?
new feature and some additional tweaks of TAF store directives and cleanup
What is the current behaviour?
What is the new behaviour
OBCS_SEAICE_NEUMANN
, defining this flag will override any other input from files for sea ice variables.ALLOW_OBCS_BALANCE
andALLOW_OBCS_STEVENS
andOBCS_SEAICE_NEUMANN
are definedpkg/cost
:cost_mask_file
, which can be useful for flexible cost function definitionsDoes this PR introduce a breaking change?
No
Other information:
These are changes that were required for a specific configuration. I think they are useful for everyone.
Suggested addition to
tag-index
o pkg/obcs:
ALLOW_OBCS_BALANCE
andALLOW_OBCS_STEVENS
andOBCS_SEAICE_NEUMANN
are definedo pkg/cost: new runtime flag for
pkg/cost
:cost_mask_file
, which can be useful for flexible cost function definitions