OnSphere, which is used in SecondDerivativeOnCell in HorzOperators.h, is not currently configured from the initial condition. Instead, it is hard-coded to true in HorzOperators.cpp:
30 SecondDerivativeOnCell::SecondDerivativeOnCell(HorzMesh const *Mesh)
31 : OnSphere(true), NCellsAll(Mesh->NCellsAll), MaxEdges(1 + Mesh->MaxEdges),
As a result, SecondDerivativeOnCell always precomputes the second derivative coefficients for tracer advection on a sphere, even when the geometry is planar.
234 if (OnSphere) {
235 const Array1DI4 edgesOnCell =
236 Kokkos::subview(EdgesOnCell, ICell, Kokkos::ALL);
237 DetermineSphericalPatchGeometry(
238 NEdges, edgesOnCell, VerticesOnEdge, XCell, YCell, ZCell, XVertex,
239 YVertex, ZVertex, CellList, XP, YP, Angle2D, ThetaAbs[ICell]);
240 } else { // On an x-y plane
241 const Array1DI4 edgesOnCell =
242 Kokkos::subview(EdgesOnCell, ICell, Kokkos::ALL);
243 DeterminePlanerPatchGeometry(ICell, NEdges, edgesOnCell, CellsOnEdge,
244 AngleEdge, DcEdge, XP, YP, Angle2D);
245 }
This eventually leads to NaN values in AdvCoefs and AdvCoefs3rd when high-order horizontal tracer advection is used in the baroclinic channel and the overflow test.
IEdge I AdvCoefs(I, IEdge) AdvCoefs3rd(I, IEdge)
2 1 nan nan
2 2 nan nan
2 3 nan nan
2 4 nan nan
2 5 nan nan
2 6 nan nan
2 7 nan nan
When OnSphere(false) is used for the tests on a plane domain, I confirmed that AdvCoefs and AdvCoefs3rd don't have NaN values and that the test completes successfully.
IEdge I AdvCoefs(I, IEdge) AdvCoefs3rd(I, IEdge)
2 1 481.125 96.225
2 2 769.8 -192.45
2 3 -96.225 96.225
2 4 3.66054e-15 -3.66054e-15
2 5 2.06117e-14 -2.06117e-14
2 6 -6.59004e-15 6.59004e-15
2 7 7.0732e-15 -7.0732e-15
Therefore, OnSphere should be read from the initial condition file, as in MPAS-O, using the global attribute on_a_sphere, or handled through a simpler alternative if available.
OnSphere, which is used inSecondDerivativeOnCellinHorzOperators.h, is not currently configured from the initial condition. Instead, it is hard-coded totrueinHorzOperators.cpp:As a result,
SecondDerivativeOnCellalways precomputes the second derivative coefficients for tracer advection on a sphere, even when the geometry is planar.This eventually leads to
NaNvalues inAdvCoefsandAdvCoefs3rdwhen high-order horizontal tracer advection is used in the baroclinic channel and the overflow test.When
OnSphere(false)is used for the tests on a plane domain, I confirmed thatAdvCoefsandAdvCoefs3rddon't haveNaNvalues and that the test completes successfully.Therefore,
OnSphereshould be read from the initial condition file, as in MPAS-O, using the global attributeon_a_sphere, or handled through a simpler alternative if available.