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

refactor bkgerrstddev into a saber block #1085

Open
wants to merge 21 commits into
base: develop
Choose a base branch
from

Conversation

travissluka
Copy link
Collaborator

@travissluka travissluka commented Oct 22, 2024

Description

This PR converts the existing BkgErrGodas linear variable change into a ParametricOceanStdDev saber block (that lives in the SOCA repo for now), written in C++

Why?

  • This is the first step in generalizing the code enough to be moved out of the SOCA repo and into SABER. Similar to what was done with diffusion, I'll save moving it out of SOCA for a later PR (once we're sure it works as intended and is indeed generic)
  • I need to move this into a saber block if I want to move the balance operator into a saber block (which I do want to do)
  • It's slightly faster and uses slightly less memory, since we are no longer going in and out of the Fortran code (see timings below)
  • By default, this saber block uses the oops::Diffusion class to smooth the resulting stddev by the length scales. Much less noisy now (see images below), the scales by which the fields are smoothed can be configured. Unlike with the correlation operator, no offline parameters need to be calculated to use the smoothing (since there is no normalization)
  • By being in C++, now all the yaml parameters are checked when they are read in. No more accidentally setting wrong parameters that don't do anything!
  • the "other variable" section (eg. all variables other than T/S/SSH) was hardcoded in the Fortran. This removes that hardcoding and allows for a "fraction of background / min / max" to be set for any input variable

Also,

  • I fixed a bug where the values along the bottom level were too large (not sure how we missed that before), (see images below)

Usage:

The saber block has reasonable default values set (in an effort to keep outside collaborators from trying to do crazy things), so, for example you could use a minimum yaml such as

- saber block name: SOCAParametricOceanStdDev
  temperature:  # use defaults other than SST input file
    sst:
      filepath: data_static/godas_sst_bgerr.nc
      variable: sst_bgerr
  unbalanced salinity: {} # use default values
  unbalanced ssh: {} # use default values

this will still enable the smoothing by default.

Or, if you want to set parameters explicitly, see what is given in the testinput/dirac_parametric_ocean_stddev.yml file, or look at the parameters class in src/soca/SaberBlocks/ParametricOceanStdDev/ParametricOceanStdDev.h (real documentation will be coming, I promise!)

Testing

  • All ctests have been updated
  • a 1/4 deg test has been run. background error is less noisy, doesn't have the bug at the bottom, and the multiply is faster

This is the T bkg error at lvl 15 (very noisy
image

Same level but with this new saber block, where the stddev is smoothed by the Rossby radius
image

@travissluka travissluka added the SOCA Sea-ice, Ocean, and Coupled Assimilation label Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SOCA Sea-ice, Ocean, and Coupled Assimilation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant