@@ -208,7 +208,109 @@ def _fesom2_square_delaunay_uniform_z_coordinate():
208208 return ux .UxDataset ({"U" : u , "V" : v , "W" : w , "p" : p }, uxgrid = uxgrid )
209209
210210
211+ def _fesom2_square_delaunay_antimeridian ():
212+ """
213+ Delaunay grid that crosses the antimeridian with uniform z-coordinate, mimicking a FESOM2 dataset.
214+ This dataset consists of a square domain with closed boundaries, where the grid is generated using Delaunay triangulation.
215+ The bottom topography is flat and uniform, and the vertical grid spacing is constant with 10 layers spanning [0,1000.0]
216+ The lateral velocity field components are non-zero constant, and the vertical velocity component is zero.
217+ The pressure field is constant.
218+ All fields are placed on location consistent with FESOM2 variable placement conventions
219+ """
220+ lon , lat = np .meshgrid (
221+ np .linspace (- 210.0 , - 150.0 , Nx , dtype = np .float32 ), np .linspace (0 , 60.0 , Nx , dtype = np .float32 )
222+ )
223+ # wrap longitude from [-180,180]
224+ lon = np .where (lon < - 180 , lon + 360 , lon )
225+ lon_flat = lon .ravel ()
226+ lat_flat = lat .ravel ()
227+ zf = np .linspace (0.0 , 1000.0 , 10 , endpoint = True , dtype = np .float32 ) # Vertical element faces
228+ zc = 0.5 * (zf [:- 1 ] + zf [1 :]) # Vertical element centers
229+ nz = zf .size
230+ nz1 = zc .size
231+
232+ # mask any point on one of the boundaries
233+ mask = (
234+ np .isclose (lon_flat , 0.0 ) | np .isclose (lon_flat , 60.0 ) | np .isclose (lat_flat , 0.0 ) | np .isclose (lat_flat , 60.0 )
235+ )
236+
237+ boundary_points = np .flatnonzero (mask )
238+
239+ uxgrid = ux .Grid .from_points (
240+ (lon_flat , lat_flat ),
241+ method = "regional_delaunay" ,
242+ boundary_points = boundary_points ,
243+ )
244+ uxgrid .attrs ["Conventions" ] = "UGRID-1.0"
245+
246+ # Define arrays U (zonal), V (meridional) and P (sea surface height)
247+ U = np .ones (
248+ (T , nz1 , uxgrid .n_face ), dtype = np .float64
249+ ) # Lateral velocity is on the element centers and face centers
250+ V = np .ones (
251+ (T , nz1 , uxgrid .n_face ), dtype = np .float64
252+ ) # Lateral velocity is on the element centers and face centers
253+ W = np .zeros (
254+ (T , nz , uxgrid .n_node ), dtype = np .float64
255+ ) # Vertical velocity is on the element faces and face vertices
256+ P = np .ones ((T , nz1 , uxgrid .n_node ), dtype = np .float64 ) # Pressure is on the element centers and face vertices
257+
258+ u = ux .UxDataArray (
259+ data = U ,
260+ name = "U" ,
261+ uxgrid = uxgrid ,
262+ dims = ["time" , "nz1" , "n_face" ],
263+ coords = dict (
264+ time = (["time" ], TIME ),
265+ nz1 = (["nz1" ], zc ),
266+ ),
267+ attrs = dict (
268+ description = "zonal velocity" , units = "m/s" , location = "face" , mesh = "delaunay" , Conventions = "UGRID-1.0"
269+ ),
270+ )
271+ v = ux .UxDataArray (
272+ data = V ,
273+ name = "V" ,
274+ uxgrid = uxgrid ,
275+ dims = ["time" , "nz1" , "n_face" ],
276+ coords = dict (
277+ time = (["time" ], TIME ),
278+ nz1 = (["nz1" ], zc ),
279+ ),
280+ attrs = dict (
281+ description = "meridional velocity" , units = "m/s" , location = "face" , mesh = "delaunay" , Conventions = "UGRID-1.0"
282+ ),
283+ )
284+ w = ux .UxDataArray (
285+ data = W ,
286+ name = "w" ,
287+ uxgrid = uxgrid ,
288+ dims = ["time" , "nz" , "n_node" ],
289+ coords = dict (
290+ time = (["time" ], TIME ),
291+ nz = (["nz" ], zf ),
292+ ),
293+ attrs = dict (
294+ description = "vertical velocity" , units = "m/s" , location = "node" , mesh = "delaunay" , Conventions = "UGRID-1.0"
295+ ),
296+ )
297+ p = ux .UxDataArray (
298+ data = P ,
299+ name = "p" ,
300+ uxgrid = uxgrid ,
301+ dims = ["time" , "nz1" , "n_node" ],
302+ coords = dict (
303+ time = (["time" ], TIME ),
304+ nz1 = (["nz1" ], zc ),
305+ ),
306+ attrs = dict (description = "pressure" , units = "N/m^2" , location = "node" , mesh = "delaunay" , Conventions = "UGRID-1.0" ),
307+ )
308+
309+ return ux .UxDataset ({"U" : u , "V" : v , "W" : w , "p" : p }, uxgrid = uxgrid )
310+
311+
211312datasets = {
212313 "stommel_gyre_delaunay" : _stommel_gyre_delaunay (),
213314 "fesom2_square_delaunay_uniform_z_coordinate" : _fesom2_square_delaunay_uniform_z_coordinate (),
315+ "fesom2_square_delaunay_antimeridian" : _fesom2_square_delaunay_antimeridian (),
214316}
0 commit comments