Skip to content
Merged
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: 3 additions & 3 deletions components/omega/src/ocn/Eos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ Eos::Eos(const std::string &Name, ///< [in] Name for eos object
ComputeBruntVaisalaFreqSqLinear(VCoord),
ComputeBruntVaisalaFreqSqTeos10(VCoord), Name(Name), Mesh(Mesh),
VCoord(VCoord) {
SpecVol = Array2DReal("SpecVol", Mesh->NCellsAll, VCoord->NVertLayers);
SpecVol = Array2DReal("SpecVol", Mesh->NCellsSize, VCoord->NVertLayers);
SpecVolDisplaced =
Array2DReal("SpecVolDisplaced", Mesh->NCellsAll, VCoord->NVertLayers);
Array2DReal("SpecVolDisplaced", Mesh->NCellsSize, VCoord->NVertLayers);
BruntVaisalaFreqSq =
Array2DReal("BruntVaisalaFreqSq", Mesh->NCellsAll, VCoord->NVertLayers);
Array2DReal("BruntVaisalaFreqSq", Mesh->NCellsSize, VCoord->NVertLayers);

defineFields();
}
Expand Down
4 changes: 2 additions & 2 deletions components/omega/src/ocn/VertMix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ VertMix::VertMix(const std::string &Name, ///< [in] Name for VertMix object
)
: ComputeVertMixConv(VCoord), ComputeVertMixShear(Mesh, VCoord), Name(Name),
Mesh(Mesh), VCoord(VCoord) {
VertDiff = Array2DReal("VertDiff", Mesh->NCellsAll, VCoord->NVertLayers);
VertVisc = Array2DReal("VertVisc", Mesh->NCellsAll, VCoord->NVertLayers);
VertDiff = Array2DReal("VertDiff", Mesh->NCellsSize, VCoord->NVertLayers);
VertVisc = Array2DReal("VertVisc", Mesh->NCellsSize, VCoord->NVertLayers);

defineFields();
}
Expand Down
64 changes: 32 additions & 32 deletions components/omega/test/ocn/EosTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ void testEosLinear() {
const auto Mesh = HorzMesh::getDefault();
const auto VCoord = VertCoord::getDefault();
VCoord->NVertLayers = NVertLayers;
I4 NCellsAll = Mesh->NCellsAll;
I4 NCellsSize = Mesh->NCellsSize;
/// Get Eos instance to test
Eos *TestEos = Eos::getInstance();
TestEos->EosChoice = EosType::LinearEos;

/// Create and fill ocean state arrays
Array2DReal SArray = Array2DReal("SArray", NCellsAll, NVertLayers);
Array2DReal TArray = Array2DReal("TArray", NCellsAll, NVertLayers);
Array2DReal PArray = Array2DReal("PArray", NCellsAll, NVertLayers);
Array2DReal SArray = Array2DReal("SArray", NCellsSize, NVertLayers);
Array2DReal TArray = Array2DReal("TArray", NCellsSize, NVertLayers);
Array2DReal PArray = Array2DReal("PArray", NCellsSize, NVertLayers);
/// Use Kokkos::deep_copy to fill the entire view with the ref value
deepCopy(SArray, Sa);
deepCopy(TArray, Ct);
Expand Down Expand Up @@ -156,7 +156,7 @@ void testEosLinear() {
// If test fails, print bad values and abort
if (NumMismatches != 0) {
auto SpecVolH = createHostMirrorCopy(TestEos->SpecVol);
for (int I = 0; I < NCellsAll; ++I) {
for (int I = 0; I < Mesh->NCellsAll; ++I) {
for (int K = 0; K < NVertLayers; ++K) {
if (!isApprox(SpecVolH(I, K), LinearExpValue, RTol))
LOG_ERROR("EosTest: SpecVol Linear Bad Value: "
Expand All @@ -177,15 +177,15 @@ void testEosLinearDisplaced() {
const auto Mesh = HorzMesh::getDefault();
const auto VCoord = VertCoord::getDefault();
VCoord->NVertLayers = NVertLayers;
I4 NCellsAll = Mesh->NCellsAll;
I4 NCellsSize = Mesh->NCellsSize;
/// Get Eos instance to test
Eos *TestEos = Eos::getInstance();
TestEos->EosChoice = EosType::LinearEos;

/// Create and fill ocean state arrays
Array2DReal SArray = Array2DReal("SArray", NCellsAll, NVertLayers);
Array2DReal TArray = Array2DReal("TArray", NCellsAll, NVertLayers);
Array2DReal PArray = Array2DReal("PArray", NCellsAll, NVertLayers);
Array2DReal SArray = Array2DReal("SArray", NCellsSize, NVertLayers);
Array2DReal TArray = Array2DReal("TArray", NCellsSize, NVertLayers);
Array2DReal PArray = Array2DReal("PArray", NCellsSize, NVertLayers);
/// Use Kokkos::deep_copy to fill the entire view with the ref value
deepCopy(SArray, Sa);
deepCopy(TArray, Ct);
Expand Down Expand Up @@ -227,7 +227,7 @@ void testEosLinearDisplaced() {
// If test fails, print bad values and abort
if (NumMismatches != 0) {
auto SpecVolDisplacedH = createHostMirrorCopy(SpecVolDisplaced);
for (int I = 0; I < NCellsAll; ++I) {
for (int I = 0; I < Mesh->NCellsAll; ++I) {
for (int K = 0; K < NVertLayers; ++K) {
if (!isApprox(SpecVolDisplacedH(I, K), LinearExpValue, RTol))
LOG_ERROR("EosTest: SpecVol Linear Displaced Bad Value: "
Expand All @@ -248,15 +248,15 @@ void testBruntVaisalaFreqSqLinear() {
const auto Mesh = HorzMesh::getDefault();
const auto VCoord = VertCoord::getDefault();
VCoord->NVertLayers = NVertLayers;
I4 NCellsAll = Mesh->NCellsAll;
I4 NCellsSize = Mesh->NCellsSize;
/// Get Eos instance to test
Eos *TestEos = Eos::getInstance();
TestEos->EosChoice = EosType::LinearEos;

/// Create and fill ocean state arrays
Array2DReal SArray = Array2DReal("SArray", NCellsAll, NVertLayers);
Array2DReal TArray = Array2DReal("TArray", NCellsAll, NVertLayers);
Array2DReal PArray = Array2DReal("PArray", NCellsAll, NVertLayers);
Array2DReal SArray = Array2DReal("SArray", NCellsSize, NVertLayers);
Array2DReal TArray = Array2DReal("TArray", NCellsSize, NVertLayers);
Array2DReal PArray = Array2DReal("PArray", NCellsSize, NVertLayers);
/// Use deep copy to initialize results to zero
deepCopy(TestEos->SpecVol, 0.0);
deepCopy(TestEos->BruntVaisalaFreqSq, 0.0);
Expand All @@ -265,7 +265,7 @@ void testBruntVaisalaFreqSqLinear() {
// for K = 1.
OMEGA_SCOPE(ZMid, VCoord->ZMid);
parallelFor(
"populateArrays", {NCellsAll, NVertLayers},
"populateArrays", {Mesh->NCellsAll, NVertLayers},
KOKKOS_LAMBDA(I4 ICell, I4 K) {
if (K == 0) {
ZMid(ICell, 0) = -992.1173890198451_Real;
Expand Down Expand Up @@ -338,7 +338,7 @@ void testBruntVaisalaFreqSqLinear() {
// If test fails, print bad values and abort
if (NumMismatches != 0) {
auto BruntVaisalaFreqSqH = createHostMirrorCopy(BruntVaisalaFreqSq);
for (int I = 0; I < NCellsAll; ++I) {
for (int I = 0; I < Mesh->NCellsAll; ++I) {
// top layer should be zero
if (BruntVaisalaFreqSqH(I, 0) != 0.0)
LOG_ERROR("EosTest: Brunt-Vaisala Linear Bad Value: "
Expand Down Expand Up @@ -372,15 +372,15 @@ void testEosTeos10() {
const auto Mesh = HorzMesh::getDefault();
const auto VCoord = VertCoord::getDefault();
VCoord->NVertLayers = NVertLayers;
I4 NCellsAll = Mesh->NCellsAll;
I4 NCellsSize = Mesh->NCellsSize;
/// Get Eos instance to test
Eos *TestEos = Eos::getInstance();
TestEos->EosChoice = EosType::Teos10Eos;

/// Create and fill ocean state arrays
Array2DReal SArray = Array2DReal("SArray", NCellsAll, NVertLayers);
Array2DReal TArray = Array2DReal("TArray", NCellsAll, NVertLayers);
Array2DReal PArray = Array2DReal("PArray", NCellsAll, NVertLayers);
Array2DReal SArray = Array2DReal("SArray", NCellsSize, NVertLayers);
Array2DReal TArray = Array2DReal("TArray", NCellsSize, NVertLayers);
Array2DReal PArray = Array2DReal("PArray", NCellsSize, NVertLayers);
/// Use Kokkos::deep_copy to fill the entire view with the ref value
deepCopy(SArray, Sa);
deepCopy(TArray, Ct);
Expand Down Expand Up @@ -421,7 +421,7 @@ void testEosTeos10() {
// If test fails, print bad values and abort
if (NumMismatches != 0) {
auto SpecVolH = createHostMirrorCopy(SpecVol);
for (int I = 0; I < NCellsAll; ++I) {
for (int I = 0; I < Mesh->NCellsAll; ++I) {
for (int K = 0; K < NVertLayers; ++K) {
if (!isApprox(SpecVolH(I, K), LinearExpValue, RTol))
LOG_ERROR("EosTest: SpecVol TEOS Bad Value: "
Expand All @@ -442,15 +442,15 @@ void testEosTeos10Displaced() {
const auto Mesh = HorzMesh::getDefault();
const auto VCoord = VertCoord::getDefault();
VCoord->NVertLayers = NVertLayers;
I4 NCellsAll = Mesh->NCellsAll;
I4 NCellsSize = Mesh->NCellsSize;
/// Get Eos instance to test
Eos *TestEos = Eos::getInstance();
TestEos->EosChoice = EosType::Teos10Eos;

/// Create and fill ocean state arrays
Array2DReal SArray = Array2DReal("SArray", NCellsAll, NVertLayers);
Array2DReal TArray = Array2DReal("TArray", NCellsAll, NVertLayers);
Array2DReal PArray = Array2DReal("PArray", NCellsAll, NVertLayers);
Array2DReal SArray = Array2DReal("SArray", NCellsSize, NVertLayers);
Array2DReal TArray = Array2DReal("TArray", NCellsSize, NVertLayers);
Array2DReal PArray = Array2DReal("PArray", NCellsSize, NVertLayers);
/// Use Kokkos::deep_copy to fill the entire view with the ref value
deepCopy(SArray, Sa);
deepCopy(TArray, Ct);
Expand Down Expand Up @@ -492,7 +492,7 @@ void testEosTeos10Displaced() {
// If test fails, print bad values and abort
if (NumMismatches != 0) {
auto SpecVolDisplacedH = createHostMirrorCopy(SpecVolDisplaced);
for (int I = 0; I < NCellsAll; ++I) {
for (int I = 0; I < Mesh->NCellsAll; ++I) {
for (int K = 0; K < NVertLayers; ++K) {
if (!isApprox(SpecVolDisplacedH(I, K), LinearExpValue, RTol))
LOG_ERROR("EosTest: SpecVol Displaced TEOS Bad Value: "
Expand All @@ -513,23 +513,23 @@ void testBruntVaisalaFreqSqTeos10() {
const auto Mesh = HorzMesh::getDefault();
const auto VCoord = VertCoord::getDefault();
VCoord->NVertLayers = NVertLayers;
I4 NCellsAll = Mesh->NCellsAll;
I4 NCellsSize = Mesh->NCellsSize;
/// Get Eos instance to test
Eos *TestEos = Eos::getInstance();
TestEos->EosChoice = EosType::Teos10Eos;

/// Create and fill ocean state arrays
Array2DReal SArray = Array2DReal("SArray", NCellsAll, NVertLayers);
Array2DReal TArray = Array2DReal("TArray", NCellsAll, NVertLayers);
Array2DReal PArray = Array2DReal("PArray", NCellsAll, NVertLayers);
Array2DReal SArray = Array2DReal("SArray", NCellsSize, NVertLayers);
Array2DReal TArray = Array2DReal("TArray", NCellsSize, NVertLayers);
Array2DReal PArray = Array2DReal("PArray", NCellsSize, NVertLayers);
/// Use deep copy to initialize results to zero
deepCopy(TestEos->BruntVaisalaFreqSq, 0.0);
deepCopy(TestEos->SpecVol, 0.0);

/// Fill inputs with values that should lead to ref result for K=1
OMEGA_SCOPE(ZMid, VCoord->ZMid);
parallelFor(
"populateArrays", {NCellsAll, NVertLayers},
"populateArrays", {Mesh->NCellsAll, NVertLayers},
KOKKOS_LAMBDA(I4 ICell, I4 K) {
if (K == 0) {
ZMid(ICell, 0) = -992.1173890198451_Real;
Expand Down Expand Up @@ -602,7 +602,7 @@ void testBruntVaisalaFreqSqTeos10() {
// If test fails, print bad values and abort
if (NumMismatches != 0) {
auto BruntVaisalaFreqSqH = createHostMirrorCopy(BruntVaisalaFreqSq);
for (int ICell = 0; ICell < NCellsAll; ++ICell) {
for (int ICell = 0; ICell < Mesh->NCellsAll; ++ICell) {
// top layer should be zero
if (BruntVaisalaFreqSqH(ICell, 0) != 0.0)
LOG_ERROR("EosTest: Brunt-Vaisala TEOS Bad Value: "
Expand Down
21 changes: 10 additions & 11 deletions components/omega/test/ocn/VertMixTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ void testBackVertMix() {
VCoord->NVertLayers = NVertLayers;
I4 NCellsSize = Mesh->NCellsSize;
I4 NEdgesSize = Mesh->NEdgesSize;
I4 NCellsAll = Mesh->NCellsAll;
I4 NEdgesAll = Mesh->NEdgesAll;
OMEGA_SCOPE(ZMid, VCoord->ZMid);

Expand All @@ -126,7 +125,7 @@ void testBackVertMix() {
deepCopy(TestVertMix->VertVisc, 0.0);

parallelFor(
"populateArrays", {NCellsAll, NVertLayers},
"populateArrays", {Mesh->NCellsAll, NVertLayers},
KOKKOS_LAMBDA(I4 ICell, I4 K) { ZMid(ICell, K) = -K; });

parallelFor(
Expand Down Expand Up @@ -231,7 +230,7 @@ void testConvVertMix() {
const auto Mesh = HorzMesh::getDefault();
const auto VCoord = VertCoord::getDefault();
VCoord->NVertLayers = NVertLayers;
I4 NCellsAll = Mesh->NCellsAll;
I4 NCellsSize = Mesh->NCellsSize;
I4 NEdgesAll = Mesh->NEdgesAll;
OMEGA_SCOPE(ZMid, VCoord->ZMid);

Expand All @@ -242,7 +241,7 @@ void testConvVertMix() {
auto NormalVelEdge = Array2DReal("NormalVelEdge", NEdgesAll, NVertLayers);
auto TangVelEdge = Array2DReal("TangVelEdge", NEdgesAll, NVertLayers);
auto BruntVaisalaFreqSqCell =
Array2DReal("BruntVaisalaFreqSqCell", NCellsAll, NVertLayers);
Array2DReal("BruntVaisalaFreqSqCell", NCellsSize, NVertLayers);

/// Use deep copy to initialize with the ref value
deepCopy(NormalVelEdge, NV);
Expand All @@ -252,7 +251,7 @@ void testConvVertMix() {
deepCopy(TestVertMix->VertVisc, 0.0);

parallelFor(
"populateArrays", {NCellsAll, NVertLayers},
"populateArrays", {Mesh->NCellsAll, NVertLayers},
KOKKOS_LAMBDA(I4 ICell, I4 K) { ZMid(ICell, K) = -K; });

parallelFor(
Expand Down Expand Up @@ -358,7 +357,7 @@ void testShearVertMix() {
const auto Mesh = HorzMesh::getDefault();
const auto VCoord = VertCoord::getDefault();
VCoord->NVertLayers = NVertLayers;
I4 NCellsAll = Mesh->NCellsAll;
I4 NCellsSize = Mesh->NCellsSize;
I4 NEdgesAll = Mesh->NEdgesAll;
OMEGA_SCOPE(ZMid, VCoord->ZMid);
OMEGA_SCOPE(NEdgesOnCell, Mesh->NEdgesOnCell);
Expand All @@ -373,7 +372,7 @@ void testShearVertMix() {
auto NormalVelEdge = Array2DReal("NormalVelEdge", NEdgesAll, NVertLayers);
auto TangVelEdge = Array2DReal("TangVelEdge", NEdgesAll, NVertLayers);
auto BruntVaisalaFreqSqCell =
Array2DReal("BruntVaisalaFreqSqCell", NCellsAll, NVertLayers);
Array2DReal("BruntVaisalaFreqSqCell", NCellsSize, NVertLayers);

/// Use Kokkos::deep_copy to fill the entire view with the ref value
deepCopy(NormalVelEdge, NV);
Expand All @@ -383,7 +382,7 @@ void testShearVertMix() {
deepCopy(TestVertMix->VertVisc, 0.0);

parallelFor(
"populateArrays", {NCellsAll, NVertLayers},
"populateArrays", {Mesh->NCellsAll, NVertLayers},
KOKKOS_LAMBDA(I4 ICell, I4 K) {
ZMid(ICell, K) = -K;
NEdgesOnCell(ICell) = 5;
Expand Down Expand Up @@ -508,7 +507,7 @@ void testTotalVertMix() {
const auto Mesh = HorzMesh::getDefault();
const auto VCoord = VertCoord::getDefault();
VCoord->NVertLayers = NVertLayers;
I4 NCellsAll = Mesh->NCellsAll;
I4 NCellsSize = Mesh->NCellsSize;
I4 NEdgesAll = Mesh->NEdgesAll;
OMEGA_SCOPE(ZMid, VCoord->ZMid);
OMEGA_SCOPE(NEdgesOnCell, Mesh->NEdgesOnCell);
Expand All @@ -523,7 +522,7 @@ void testTotalVertMix() {
auto NormalVelEdge = Array2DReal("NormalVelEdge", NEdgesAll, NVertLayers);
auto TangVelEdge = Array2DReal("TangVelEdge", NEdgesAll, NVertLayers);
auto BruntVaisalaFreqSqCell =
Array2DReal("BruntVaisalaFreqSqCell", NCellsAll, NVertLayers);
Array2DReal("BruntVaisalaFreqSqCell", NCellsSize, NVertLayers);

/// Use deep copy to initialize with the ref value
deepCopy(NormalVelEdge, NV);
Expand All @@ -535,7 +534,7 @@ void testTotalVertMix() {
deepCopy(TestVertMix->VertVisc, 0.0);

parallelFor(
"populateArrays", {NCellsAll, NVertLayers},
"populateArrays", {Mesh->NCellsAll, NVertLayers},
KOKKOS_LAMBDA(I4 ICell, I4 K) {
ZMid(ICell, K) = -K;
NEdgesOnCell(ICell) = 5;
Expand Down
Loading