Skip to content

Commit

Permalink
Update mesh.py
Browse files Browse the repository at this point in the history
add ncores kwarg, ability to load mesh file in xarray structure, fix a compatibility issue.
  • Loading branch information
brey committed Apr 6, 2024
1 parent cf32241 commit b70acbf
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pyposeidon/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Mesh module
"""

# Copyright 2018 European Union
# This file is part of pyposeidon.
# Licensed under the EUPL, Version 1.2 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "Licence").
Expand Down Expand Up @@ -191,6 +192,8 @@ def __init__(self, **kwargs):
self.Dataset = mgmsh.read_msh(mesh_file, **kwargs)
else:
raise ValueError("Please define 'mesh_genarator' argument")
elif mesh_file.endswith(".nc"):
self.Dataset = xr.open_dataset(mesh_file)

elif mesh_generator == "gmsh":
if boundary is None:
Expand Down Expand Up @@ -229,7 +232,7 @@ def read_file(hgrid, **kwargs):
df.columns = ["data"]

# extract number of elements, number of nodes
ni, nj = df.iloc[0].str.split()[0]
ni, nj = df.iloc[0].str.split().iloc[0]
ni = int(ni)
nj = int(nj)

Expand Down Expand Up @@ -533,8 +536,10 @@ def validate(self, **kwargs):

scribes = kwargs.get("scribes", -1)

ncores = kwargs.get("ncores", 1)

tools.create_schism_mpirun_script(
target_dir=path, cmd=bin_path, script_name="launchSchism.sh", ncores=1, scribes=scribes
target_dir=path, cmd=bin_path, script_name="launchSchism.sh", ncores=ncores, scribes=scribes
)

proc = tools.execute_schism_mpirun_script(cwd=path)
Expand Down

0 comments on commit b70acbf

Please sign in to comment.