@@ -163,6 +163,8 @@ VertCoord::VertCoord(const std::string &Name_, //< [in] Name for new VertCoord
163163 PressureMid = Array2DReal (" PressureMid" , NCellsSize, NVertLayers);
164164 ZInterface = Array2DReal (" ZInterface" , NCellsSize, NVertLayersP1);
165165 ZMid = Array2DReal (" ZMid" , NCellsSize, NVertLayers);
166+ SshCell = Array1DReal (" SshCell" , NCellsSize);
167+
166168 GeopotentialMid = Array2DReal (" GeopotentialMid" , NCellsSize, NVertLayers);
167169 LayerThicknessTarget =
168170 Array2DReal (" LayerThicknessTarget" , NCellsSize, NVertLayers);
@@ -174,6 +176,8 @@ VertCoord::VertCoord(const std::string &Name_, //< [in] Name for new VertCoord
174176 PressureMidH = createHostMirrorCopy (PressureMid);
175177 ZInterfaceH = createHostMirrorCopy (ZInterface);
176178 ZMidH = createHostMirrorCopy (ZMid);
179+ SshCellH = createHostMirrorCopy (SshCellH);
180+
177181 GeopotentialMidH = createHostMirrorCopy (GeopotentialMid);
178182 LayerThicknessTargetH = createHostMirrorCopy (LayerThicknessTarget);
179183 RefLayerThicknessH = createHostMirrorCopy (RefLayerThickness);
@@ -236,6 +240,8 @@ void VertCoord::defineFields() {
236240 PressMidFldName = " PressureMid" ;
237241 ZInterfFldName = " ZInterface" ;
238242 ZMidFldName = " ZMid" ;
243+ SshFldName = " SshCell" ;
244+
239245 GeopotFldName = " GeopotentialMid" ;
240246 LyrThickTargetFldName = " LayerThicknessTarget" ;
241247
@@ -249,6 +255,7 @@ void VertCoord::defineFields() {
249255 ZMidFldName.append (Name);
250256 GeopotFldName.append (Name);
251257 LyrThickTargetFldName.append (Name);
258+ SshFldName.append (Name);
252259 }
253260
254261 // Create fields for VertCoord variables
@@ -295,6 +302,19 @@ void VertCoord::defineFields() {
295302 DimNames // dimension names
296303 );
297304
305+ auto SshField = Field::create (
306+ SshFldName, // field name
307+ " sea surface height at cell center" , // long Name or description
308+ " m" , // units
309+ " sea_surface_height" , // CF standard Name
310+ std::numeric_limits<Real>::min (), // min valid value
311+ std::numeric_limits<Real>::max (), // max valid value
312+ FillValueReal, // scalar for undefined entries
313+ NDims, // number of dimensions
314+ DimNames // dimension names
315+ );
316+
317+
298318 NDims = 2 ;
299319 DimNames.resize (NDims);
300320 DimNames[1 ] = " NVertLayersP1" ;
@@ -402,6 +422,7 @@ void VertCoord::defineFields() {
402422 VCoordGroup->addField (ZMidFldName);
403423 VCoordGroup->addField (GeopotFldName);
404424 VCoordGroup->addField (LyrThickTargetFldName);
425+ VCoordGroup->addField (SshFldName);
405426
406427 // Associate Field with data
407428 PressureInterfaceField->attachData <Array2DReal>(PressureInterface);
@@ -410,6 +431,7 @@ void VertCoord::defineFields() {
410431 ZMidField->attachData <Array2DReal>(ZMid);
411432 GeopotentialMidField->attachData <Array2DReal>(GeopotentialMid);
412433 LayerThicknessTargetField->attachData <Array2DReal>(LayerThicknessTarget);
434+ SshField->attachData <Array1DReal>(SshCell);
413435
414436} // end defineFields
415437
@@ -431,6 +453,7 @@ VertCoord::~VertCoord() {
431453 Field::destroy (ZMidFldName);
432454 Field::destroy (GeopotFldName);
433455 Field::destroy (LyrThickTargetFldName);
456+ Field::destroy (SshFldName);
434457 FieldGroup::destroy (GroupName);
435458 }
436459
@@ -872,6 +895,7 @@ void VertCoord::computeZHeight(
872895 OMEGA_SCOPE (LocZInterf, ZInterface);
873896 OMEGA_SCOPE (LocZMid, ZMid);
874897 OMEGA_SCOPE (LocBotDepth, BottomDepth);
898+ OMEGA_SCOPE (LocSshCell, SshCell);
875899
876900 const auto Policy = TeamPolicy (NCellsAll, OMEGA_TEAMSIZE, 1 );
877901 Kokkos::parallel_for (
@@ -893,6 +917,9 @@ void VertCoord::computeZHeight(
893917 LocZInterf (ICell, KLyr) = -LocBotDepth (ICell) + Accum;
894918 LocZMid (ICell, KLyr) =
895919 -LocBotDepth (ICell) + Accum - 0.5 * DZ;
920+ if (KLyr == 0 ) {
921+ LocSshCell (ICell) = LocZInterf (ICell,KLyr);
922+ }
896923 }
897924 });
898925 });
@@ -1005,6 +1032,8 @@ void VertCoord::copyToHost() {
10051032 deepCopy (PressureMidH, PressureMid);
10061033 deepCopy (ZInterfaceH, ZInterface);
10071034 deepCopy (ZMidH, ZMid);
1035+ deepCopy (SshCellH, SshCell);
1036+
10081037 deepCopy (GeopotentialMidH, GeopotentialMid);
10091038 deepCopy (LayerThicknessTargetH, LayerThicknessTarget);
10101039 deepCopy (RefLayerThicknessH, RefLayerThickness);
@@ -1018,6 +1047,8 @@ void VertCoord::copyToDevice() {
10181047 deepCopy (PressureMid, PressureMidH);
10191048 deepCopy (ZInterface, ZInterfaceH);
10201049 deepCopy (ZMid, ZMidH);
1050+ deepCopy (SshCell, SshCellH);
1051+
10211052 deepCopy (GeopotentialMid, GeopotentialMidH);
10221053 deepCopy (LayerThicknessTarget, LayerThicknessTargetH);
10231054 deepCopy (RefLayerThickness, RefLayerThicknessH);
0 commit comments