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 COAPS/FSU IAU capability #68

Merged
merged 8 commits into from
Jul 22, 2021
Merged

Conversation

pjpegion
Copy link

@pjpegion pjpegion commented Jun 2, 2021

Alex Bozec and Alan Wallcraft from COAPS/Florida State University have developed Incremental analysis update capability for MOM6. This has been tested in the UFS-datm with a "replay" to ORAS5 analysis.

pjpegion and others added 5 commits June 2, 2021 13:24
This is a basic framework to use NCODA increments on layer space for ODA incremental updates.
P_inc has been replaced by h  of analysis state, add options to use full fields instead of increments and add diagnostics to get outputs of increments (for now to check what your increment looks like if full fields).
Increments calculation moved at initialization, updates applied over nstep instead of nstep+1 and increments diagnostics has been added
…rection and general clean up

- Add option to use or not uv increment
- The calculation of the increment when using full field has been moved at initialization
- A SSH correction has been applied to h_obs to account for the different SSH between the background and target state
- The incremental update is now done over nstep-1
- a general clean up has been done with variable name change to make the code easier to follow
@jiandewang
Copy link
Collaborator

From Bob Hallberg:
There are a few things with this prototype of a commit that pop out at first look.

  1. First, I think that the fields that are being updated in apply_oda_incupd() should be passed in as arguments to help make it more explicit what is going on. This could be (h, u, v, tv) or (h, u, v, T, S), but the way that there are pointers being stored to these arrays, and then their contents are being changed under the covers makes it less explicit what is going on. In the other places where these arrays are used but not change, it might be less problematic, but if we can conveniently rewrite those with explicit arguments replacing the pointers to external fields, that would be preferable too.

  2. There are a few places that use complicated (but probably correct) array syntax expressions like hv_obs(1:nz_data) = (sum(hv(1:nz))/sum(hv_obs(1:nz_data))) *hv_obs(1:nz_data) that appear to be correct but could introduce machine or compiler dependencies. We generally try to avoid using complicated array syntax expressions. (See the discussion in https://github.com/NOAA-GFDL/MOM6/wiki/Code-style-guide .)

  3. It looks like the incremental updates are cumulative, so they will probably need to appear in the restarts.

  4. There are some places where some of the ..._answers_2018 parameters have been reproduced in MOM_oda_incupd.F90 from other code. These flags are just there to reproduce old answers, and for any new code the right option is just to code them as though ..._answers_2018 = .false. in all cases.

I would be happy to comment again after this has been revised.

@pjpegion
Copy link
Author

pjpegion commented Jun 21, 2021 via email

abozec and others added 2 commits June 21, 2021 11:06
…ility

- remove the u,v,tv pointers from the set_up_oda_incupd subroutines 
- explicitly put tv,u,v in arguments of apply_oda_incupd 
- change name  get_oda_increments to calc_oda_increments 
- explicitly put tv,u,v in arguments of calc_oda_increments 
- use loops to calculate sum of h’s
- remove the 2018_answers options
- added option to output increments when using full fields 
- added subroutine output_oda_incupd_inc to write a separate double-precision file for the increments.
- add if (mask==1 ) condition to apply/calculate the increments 
-add pass_var,pass_vector on increments and u,v,tv at the end of
calc_oda_increments and apply_oda_incupd respectively
- added CS%ncount to restart file to have reproducibility on restart.
- Added option ODA_INCUPD_RESET_NCOUNT  (! default= True, If True, reinitialize number of updates already done.)
@pjpegion
Copy link
Author

I have tested the updates on hera. I have also added a regression test for MOM6-IAU.

@jiandewang
Copy link
Collaborator

@pjpegion : I am going to ask Bob to check the updated code.

@jiandewang
Copy link
Collaborator

comments from Bob Hallberg (June 25):

After going through this PR visually, it seems to me like it is reasonable. I would also like to run it past Matt Harrison, though, to make sure that he doesn't see anything where this might either conflict with or excessively duplicate the other ODA code that we have (although I do not expect this).

There are a few minor things that I would have done differently to follow the typical MOM6 syntax as documented in the style guide (https://github.com/NOAA-GFDL/MOM6/wiki/Code-style-guide), like avoiding array-syntax math, documenting the units of all real variables, using a longer and more descriptive variable name than just 'q', correct the indent of the end subroutine statement or adding spacing around assignments that I would suggest. However, but these are all very minor things that can be corrected later, and I think that the overall structure of these additions might be about right.

There are a few more self-consistency tests that I would like to suggest that you try before putting in the PR. First, please verify that you get identical answers if you use a different PE count and layout - I am expecting this to succeed, but we should test it. Second, please verify that you get identical answers if you do the dimensional consistency tests by using values of [TZLRQ]_RESCALE_POWER in your MOM_input files that are something other than 0. In doing these tests, it is advisable that each of the T, Z, L, R, and Q should be scaled by different values. We should get the bitwis identical solutions with any combination of values, but if the various units are all scaled by the same power, bugs can still slip through. Please try your test with something like T_RESCALE_POWER = 13, Z_RESCALE_POWER = -7, L_RESCALE_POWER = 23, R_RESCALE_POWER = 4, Q_RESCALE_POWER = 29. From my inspection of the code in this PR, I would not be surprised if we need to add rescaling of some of the input fields, but the tests are the right way to figure this out.

@jiandewang
Copy link
Collaborator

from Mat Harrison (June 28):

These updates seem like they will be mergeable . You are correct to route the updates through the diabatic driver, which differs from the approach taken in the SPEAR configuration . I suspect that we may want to similarly route the updates in the online ensemble filter. In SPEAR, Feiyu is applying a background climatological increment via file, in addition to the online updates, so there will be some initial duplication of capabilities . Having two ODA control structures (ODA_incup_CS and ODA_CS) is also potentially confusing, but we can work on streamlining the two.

Feiyu and I will be making a PR shortly for the online code used in SPEAR. I'm not sure if having online ensemble filter capabilities is within the scope of your applications, but we should be able to interface with UFS code within the algorithm (e.g. for observational data streaming , covariance operators, ...) if needed.

@pjpegion
Copy link
Author

pjpegion commented Jul 1, 2021

I clean up the code to follow MOM6 coding standard, and added a rescale factor for ODA_INCUPD_NHOURS. I get zero diffs when running on different process layouts and when testing with RESCALE_POWER

@jiandewang
Copy link
Collaborator

I will work with Phil to push back to GFDL once IAU PR and GFDL"s 20210708 main branch updating are in EMC repo.

@jiandewang
Copy link
Collaborator

UFS RT finished on all machines except wcoss which is down at this moment, per discussion with Jun we decide to skip the wcoss RT.

@jiandewang jiandewang merged commit 67c1fd9 into NOAA-EMC:dev/emc Jul 22, 2021
This pull request was closed.
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