Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions components/omega/configs/Default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ Omega:
State:
NTimeLevels: 2
Advection:
Coef3rdOrder: 0.25
FluxThicknessType: Center
FluxTracerType: Center
VerticalTracerFluxLimiterEnabled: true

Choose a reason for hiding this comment

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

Suggested change
VerticalTracerFluxLimiterEnabled: true
VerticalTracerFluxLimiterEnable: true

I think this is more consistent with other config options

VerticalTracerFluxOrder: 3
WindStress:
InterpType: Isotropic
VertCoord:
Expand All @@ -50,6 +53,9 @@ Omega:
EddyDiff4: 0.0
UseCustomTendency: false
ManufacturedSolutionTendency: false
ThicknessVertAdvTendencyEnable: true
VelocityVertAdvTendencyEnable: true
TracerVertAdvTendencyEnable: true
Tracers:
Base: [Temperature, Salinity]
Debug: [Debug1, Debug2, Debug3]
Expand Down
17 changes: 14 additions & 3 deletions components/omega/src/infra/OmegaKokkos.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ using ScratchMemSpace = ExecSpace::scratch_memory_space;
using Kokkos::MemoryUnmanaged;
using Kokkos::PerTeam;
using Kokkos::TeamThreadRange;
using RealScratchArray =
Kokkos::View<Real *, ScratchMemSpace, Kokkos::MemoryUnmanaged>;

/// team_size for hierarchical parallelism
#ifdef OMEGA_TARGET_DEVICE
Expand Down Expand Up @@ -321,7 +323,8 @@ KOKKOS_INLINE_FUNCTION void teamBarrier(const TeamMember &Team) {
// parallelForOuter: with label
template <int N, class F>
inline void parallelForOuter(const std::string &Label,
const int (&UpperBounds)[N], F &&Functor) {
const int (&UpperBounds)[N], F &&Functor,
int ScratchValsPerTeam = 0) {

auto LinFunctor = LinearIdxWrapper{std::forward<F>(Functor), UpperBounds};
int LinBound = 1;
Expand All @@ -330,6 +333,12 @@ inline void parallelForOuter(const std::string &Label,
}

auto Policy = TeamPolicy(LinBound, OMEGA_TEAMSIZE);

if (ScratchValsPerTeam > 0) {
Policy.set_scratch_size(
0, Kokkos::PerTeam(ScratchValsPerTeam * sizeof(Real)));
}

Kokkos::parallel_for(
Label, Policy, KOKKOS_LAMBDA(const TeamMember &Team) {
const int TeamId = Team.league_rank();
Expand All @@ -339,8 +348,10 @@ inline void parallelForOuter(const std::string &Label,

// parallelForOuter: without label
template <int N, class F>
inline void parallelForOuter(const int (&UpperBounds)[N], F &&Functor) {
parallelForOuter("", UpperBounds, std::forward<F>(Functor));
inline void parallelForOuter(const int (&UpperBounds)[N], F &&Functor,
int ScratchValsPerTeam = 0) {
parallelForOuter("", UpperBounds, std::forward<F>(Functor),
ScratchValsPerTeam);
}

// parallelForInner
Expand Down
5 changes: 3 additions & 2 deletions components/omega/src/ocn/AuxiliaryState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,9 @@ void AuxiliaryState::computeMomAux(const OceanState *State, int ThickTimeLevel,

parallelForInner(
Team, KRange, INNER_LAMBDA(int KChunk) {
LocLayerThicknessAux.computeVarsOnCells(ICell, KChunk,
LayerThickCell);
LocLayerThicknessAux.computeVarsOnCells(
ICell, KChunk, LayerThickCell, NormalVelEdge, 0._Real);
// TODO: make timestep available to this call
});
});
Pacer::stop("AuxState:cellAuxState3", 2);
Expand Down
5 changes: 3 additions & 2 deletions components/omega/src/ocn/CustomTendencyTerms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "Config.h"
#include "GlobalConstants.h"
#include "TimeStepper.h"
#include "VertCoord.h"

namespace OMEGA {

Expand Down Expand Up @@ -76,8 +77,8 @@ void ManufacturedSolution::init() {
/// This test case assumes that the restingThickness is horizontally uniform
/// and that only one vertical level is used so only one set of indices is
/// used here.
HorzMesh *DefHorzMesh = HorzMesh::getDefault();
R8 H0 = DefHorzMesh->BottomDepthH(0);
VertCoord *DefVCoord = VertCoord::getDefault();
R8 H0 = DefVCoord->BottomDepthH(0);

// Define and compute common constants
R8 Kx = TwoPi / WavelengthX; // Wave in X-dir
Expand Down
10 changes: 0 additions & 10 deletions components/omega/src/ocn/HorzMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ HorzMesh::HorzMesh(const std::string &Name, //< [in] Name for new mesh
// Read x/y/z and lon/lat coordinates for cells, edges, and vertices
readCoordinates();

// Read the cell-centered bottom depth
readBottomDepth();

// Read the mesh areas, lengths, and angles
readMeasurements();

Expand Down Expand Up @@ -439,12 +436,6 @@ void HorzMesh::readCoordinates() {

} // end readCoordinates

//------------------------------------------------------------------------------
// Read the cell-centered bottom depth
void HorzMesh::readBottomDepth() {
readCellArray(BottomDepthH, "bottomDepth");
} // end readDepth

//------------------------------------------------------------------------------
// Read the mesh areas (cell, triangle, and kite),
// lengths (between centers and vertices), and edge angles
Expand Down Expand Up @@ -600,7 +591,6 @@ void HorzMesh::copyToDevice() {
AngleEdge = createDeviceMirrorCopy(AngleEdgeH);
WeightsOnEdge = createDeviceMirrorCopy(WeightsOnEdgeH);
FVertex = createDeviceMirrorCopy(FVertexH);
BottomDepth = createDeviceMirrorCopy(BottomDepthH);
FEdge = createDeviceMirrorCopy(FEdgeH);
XCell = createDeviceMirrorCopy(XCellH);
YCell = createDeviceMirrorCopy(YCellH);
Expand Down
9 changes: 0 additions & 9 deletions components/omega/src/ocn/HorzMesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,12 @@ class HorzMesh {

void readCoordinates();

void readBottomDepth();

void readMeasurements();

void readWeights();

void readCoriolis();

// void computeEdgeSign();

void copyToDevice();

// int computeMesh();
Expand Down Expand Up @@ -232,11 +228,6 @@ class HorzMesh {
Array1DReal FVertex; ///< Coriolis parameter at vertices (radians s^-1)
HostArray1DReal FVertexH; ///< Coriolis parameter at vertices (radians s^-1)

// Depth

Array1DReal BottomDepth; ///< Depth of the bottom of the ocean (m)
HostArray1DReal BottomDepthH; ///< Depth of the bottom of the ocean (m)

// Edge sign

Array2DReal EdgeSignOnCell; ///< Sign of vector connecting cells
Expand Down
Loading
Loading