Skip to content

Conversation

@katsmith133
Copy link

@katsmith133 katsmith133 commented Oct 30, 2025

Add the VertMix class to Omega, which consists of:

Methods to calculate the vertical diffusivity and viscosity using (for now just) the PP option, which can linearly add contributions from background, convective, and shear mixing based upon user choices in the config file. The VertMix options and parameter values are set in the yaml config file. There is a dummy KPP option in there now to set up the structure for adding it in the near future (I can remove if we think this is messy). This PR includes tests for each individual mixing process (background, convective, and shear), as well as one that linearly adds all of them together. Because both the convective and shear mixing require the Brunt Vaiasla frequency, this PR also adds the calculation of BruntVaisalaFreq to the EOS class and adds corresponding tests. The BruntVaisalaFreq is calculated in the way that was in MPAS-O if the Linear EOS is used (i.e. with linear coefficients and the derivative based upon changes in z) and is calculated in the same way the TEOS-10 package calculates it if the TEOS-10 EOS is used (i.e. with non-linear coefficients and the derivative based upon changes in p).

Ran ctests successfully on pm-cpu, pm-gpu, and chrysalis.

Checklist

  • Documentation:
    • User's Guide has been updated
    • Developer's Guide has been updated
    • Documentation has been built locally and changes look as expected
  • Building
    • CMake build does not produce any new warnings from changes in this PR
  • Testing
    • A comment in the PR documents testing used to verify the changes including any tests that are added/modified/impacted.
    • CTest unit tests for new features have been added per the approved design.
    • Unit tests have passed. Please provide a relevant CDash build entry for verification.

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 fails on Frontier GPU with a memory access error, so some array/variable may be missing or not scoped? I have some other comments spread below.

bool Enabled = true; ///< Enable convective mixing flag

// Convective mixing parameters
Real ConvDiff =

Choose a reason for hiding this comment

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

I realize that these (and similar parameters for other options) will be overwritten by config values, but might want to initialize to zero or some unphysical value to cause it to fail or produce bad results if not initialized later.

// and outputs the Brunt-Vaisala frequency.
KOKKOS_FUNCTION void operator()(Array2DReal BruntVaisalaFreq, I4 ICell,
const Array2DReal &SpecVol) const {
Real Gravity = 9.80616; // gravitational acceleration
Copy link
Collaborator

Choose a reason for hiding this comment

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

should use shared constant here

Copy link
Author

Choose a reason for hiding this comment

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

@vanroekel I agree, but that PR has not gone through yet

@katsmith133
Copy link
Author

This fails on Frontier GPU with a memory access error, so some array/variable may be missing or not scoped? I have some other comments spread below.

@philipwjones did the error provide any more information than that? At the moment my Frontier build is stopping at the cmake step (it keeps hanging at the Cpptrace auto config: Using cxxabi for demangling?), so I can't test to see what this issue is.

@philipwjones
Copy link

@katsmith133 No additional info and I didn't have a chance to narrow it further, but I forgot to mention that it failed both EOS and VertMix unit tests, so it could point to something in the EOS additions. And I think this was with the AMD compiler - I can look into it further next week if no one gets to it first.

@katsmith133
Copy link
Author

@katsmith133 No additional info and I didn't have a chance to narrow it further, but I forgot to mention that it failed both EOS and VertMix unit tests, so it could point to something in the EOS additions. And I think this was with the AMD compiler - I can look into it further next week if no one gets to it first.

Thanks @philipwjones! I am in a Deep Learning course this week, and probably will not get to it. So if you have time, that would be appreciated! If not, I can pick it back up next week.

Copy link
Member

@mwarusz mwarusz left a comment

Choose a reason for hiding this comment

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

@katsmith133 @philipwjones

I had a chance to look into the test failures of this PR on Frontier. There are issues with accessing host pointers on the device in EosTest.cpp and VertMixTest.cpp. My suggestion shows how to fix one loop, but similar changes need to be applied for all accesses to VCoord->ZMid and various Mesh->X arrays in these two tests.

Comment on lines +345 to +351
parallelFor(
"populateArrays", {Mesh->NCellsAll, VCoord->NVertLayers},
KOKKOS_LAMBDA(I4 ICell, I4 K) {
VCoord->ZMid(ICell, K) = -K;
Mesh->NEdgesOnCell(ICell) = 5;
Mesh->AreaCell(ICell) = 3.6e10_Real;
});
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
parallelFor(
"populateArrays", {Mesh->NCellsAll, VCoord->NVertLayers},
KOKKOS_LAMBDA(I4 ICell, I4 K) {
VCoord->ZMid(ICell, K) = -K;
Mesh->NEdgesOnCell(ICell) = 5;
Mesh->AreaCell(ICell) = 3.6e10_Real;
});
const auto &ZMid = VCoord->ZMid;
const auto &NEdgesOnCell = Mesh->NEdgesOnCell;
const auto &AreaCell = Mesh->AreaCell;
parallelFor(
"populateArrays", {Mesh->NCellsAll, VCoord->NVertLayers},
KOKKOS_LAMBDA(I4 ICell, I4 K) {
ZMid(ICell, K) = -K;
NEdgesOnCell(ICell) = 5;
AreaCell(ICell) = 3.6e10_Real;
});

Choose a reason for hiding this comment

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

Thanks @mwarusz I can make those changes.

Comment on lines +242 to +243
"Vertical viscosity at center and"
" top of cell", // Long Name

Choose a reason for hiding this comment

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

Suggested change
"Vertical viscosity at center and"
" top of cell", // Long Name
"Vertical viscosity at center of cell and"
" top of layer", // Long Name

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.

5 participants