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 EOS design document #191

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

sbrus89
Copy link

@sbrus89 sbrus89 commented Jan 13, 2025

This PR adds a design document for the equation of state in OMEGA.

(Developed with @alicebarthel and @xylar with input from @mwarusz and @grnydawn.)

Checklist

  • Documentation:
    • Design document has been generated and added to the docs
    • Documentation has been built locally and changes look as expected

@sbrus89 sbrus89 added documentation Improvements or additions to documentation Omega labels Jan 13, 2025
@sbrus89 sbrus89 self-assigned this Jan 13, 2025
Copy link

@philipwjones philipwjones left a comment

Choose a reason for hiding this comment

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

This is a reasonable start, but see the comments throughout.


# Equation of State

## 1 Overview The equation of state relates density to the prognostic state

Choose a reason for hiding this comment

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

start sentence on new line after the heading for proper formatting

polynomial).

### 2.3 Requirement: computational efficiency
The eos code should not be major computational bottleneck (criteria?)

Choose a reason for hiding this comment

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

Bottleneck is unrealistic. In every ocean model I've worked with, the EOS is one of the 2-3 top kernels and is always a bottleneck. TEOS-10 is even more expensive with a larger polynomial. Maybe something more like: As one of the most expensive kernels, the EOS must be as efficient as possible. Developers should be discouraged from calling the EOS too frequently.

### 2.6 Desired: freezing temperature calculation
Later versions should include calculating the freezing temperature of seawater.

### 2.7 Desired: output in situ temperature

Choose a reason for hiding this comment

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

Is this really a function for the EOS?

Copy link

Choose a reason for hiding this comment

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

TEOS-10 broadly handles all the thermodynamic conversions associated with the Gibbs Free Energy. It is capable of, among other things, converting conservative temperature to in situ temperature. This is something we may likely need for surface coupling.

I think we are taking the broader view of the scope of the "EOS" adopted by TEOS-10 here, rather than just limiting ourselves to computing the density (or specific volume). In this broader view, the freezing point of seawater would also be part of the "EOS".

(MPAS-Ocean, reanalysis, other models etc.) These functions may be used offline
in pre- or post-processing but need to be consistent with the EOS
implementation.

Choose a reason for hiding this comment

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

I believe we still have a requirement for adiabatically displaced density for the purposes of computing stability or Brunt-Vaisala freq. For stability, this is often from neighboring vertical layers. For mixed-layer models, we sometimes need surface-displaced densities.

Omega. The GSW-C toolbox sub-module will serve as a baseline reference for our
ports in unit tests.

For flexibility in optimizing performance, calls to the EOS function should be

Choose a reason for hiding this comment

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

As mentioned above, I suspect we want to restrict computing density to one time per step and given the EOS complexity, probably won't be inlined or merged with other kernels. Guess we shouldn't design it out, but the preference would be whole-array if there are any compromises associated with the single-cell support.

};
```

Any function that depends on the EOS will be a template:

Choose a reason for hiding this comment

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

Similarly here - not sure we need a templated class based on EOS type.

}
```

Functions that depend on the EOS will be called as follows:

Choose a reason for hiding this comment

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

EOS choice should be encapsulated in the class and not exposed external to the EOS. I would prefer a single EOS interface with this choice/conditional embedded inside rather than exposed to external calling routines.


### 2.8 Desired: output first derivatives
The EOS will need to be able to produce alpha and beta (drho/dT and drho/dS)
for linear expansions in the higher-order pressure gradient.

Choose a reason for hiding this comment

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

and for some mixing parameterizations.

Later versions should include a check on the range of ocean properties to
assess use of TEOS-10 (equivalent to the ``ocean funnel'' check).

### 2.10 Desired: check value range

Choose a reason for hiding this comment

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

duplicate heading - replace with input conversion?


### 2.9 Desired: check value range
Later versions should include a check on the range of ocean properties to
assess use of TEOS-10 (equivalent to the ``ocean funnel'' check).

Choose a reason for hiding this comment

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

This is really a hard requirement I think? If the input ocean model quantities exceed the valid range for the polynomial, the deviations can be quite extreme. And how do we want to treat out-of-range values that can unfortunately arise in a typical ocean simulation? In previous models, we have typically truncated the values to the valid range only for the purposes of the EOS calculation while leaving the values unchanged otherwise.

Choose a reason for hiding this comment

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

btw, this requirement also makes the point-wise evaluation a little problematic. In prior implementations, it was often more efficient to do the range restriction as part of some pre-processing together with some other preparatory calculations before hitting the polynomial loop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation Omega
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants