Skip to content

Commit

Permalink
Merge pull request #119 from kaschau/gDot
Browse files Browse the repository at this point in the history
Using g. not gv.
  • Loading branch information
kaschau authored Mar 11, 2022
2 parents 07f8364 + 5681da2 commit 83d8435
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/peregrinepy/readers/readGrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def readGrid(mb, path="./"):
"""

for blk in mb:
fileName = f"{path}/gv.{blk.nblki:06d}.h5"
fileName = f"{path}/g.{blk.nblki:06d}.h5"
if blk.blockType == "solver":
ng = blk.ng
readS = np.s_[ng:-ng, ng:-ng, ng:-ng]
Expand Down
6 changes: 3 additions & 3 deletions src/peregrinepy/writers/parallelWriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ def registerParallelXdmf(mb, blocksForProcs, path="./", gridPath="./", animate=T
dataXElem.set("Dimensions", f"{nk} {nj} {ni}")
dataXElem.set("Precision", "8")
dataXElem.set("Format", "HDF")
dataXElem.text = f"{gridPath}/gv.{nblki:06d}.h5:/coordinates/x"
dataXElem.text = f"{gridPath}/g.{nblki:06d}.h5:/coordinates/x"

geometryElem.append(deepcopy(dataXElem))
geometryElem[-1].text = f"{gridPath}/gv.{nblki:06d}.h5:/coordinates/y"
geometryElem[-1].text = f"{gridPath}/g.{nblki:06d}.h5:/coordinates/y"

geometryElem.append(deepcopy(dataXElem))
geometryElem[-1].text = f"{gridPath}/gv.{nblki:06d}.h5:/coordinates/z"
geometryElem[-1].text = f"{gridPath}/g.{nblki:06d}.h5:/coordinates/z"

# Only solvers will call this
names = ["rho", "p", "T"] + mb[0].speciesNames
Expand Down
10 changes: 5 additions & 5 deletions src/peregrinepy/writers/writeGrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def writeGrid(mb, path="./", precision="double", withHalo=False):
else:
writeS = np.s_[:, :, :]

with h5py.File(f"{path}/gv.{blk.nblki:06d}.h5", "w") as f:
with h5py.File(f"{path}/g.{blk.nblki:06d}.h5", "w") as f:
f.create_group("coordinates")
f.create_group("dimensions")

Expand Down Expand Up @@ -94,19 +94,19 @@ def writeGrid(mb, path="./", precision="double", withHalo=False):
dataX1Elem.set("Dimensions", f"{blk.nk+2*ng} {blk.nj+2*ng} {blk.ni+2*ng}")
dataX1Elem.set("Precision", "8")
dataX1Elem.set("Format", "HDF")
dataX1Elem.text = f"gv.{blk.nblki:06d}.h5:/coordinates/x"
dataX1Elem.text = f"g.{blk.nblki:06d}.h5:/coordinates/x"

geometryElem.append(deepcopy(dataX1Elem))
geometryElem[-1].text = f"gv.{blk.nblki:06d}.h5:/coordinates/y"
geometryElem[-1].text = f"g.{blk.nblki:06d}.h5:/coordinates/y"

geometryElem.append(deepcopy(dataX1Elem))
geometryElem[-1].text = f"gv.{blk.nblki:06d}.h5:/coordinates/z"
geometryElem[-1].text = f"g.{blk.nblki:06d}.h5:/coordinates/z"

gridElem.append(deepcopy(blockElem))

if mb.mbType in ["grid", "restart"]:
progressBar(blk.nblki + 1, len(mb), f"Writing out block {blk.nblki}")

et = etree.ElementTree(xdmfElem)
save_file = f"{path}/gv.xmf"
save_file = f"{path}/g.xmf"
et.write(save_file, pretty_print=True, encoding="UTF-8", xml_declaration=True)
6 changes: 3 additions & 3 deletions src/peregrinepy/writers/writeRestart.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ def writeRestart(mb, path="./", gridPath="./", animate=True, precision="double")
dataXElem.set("Dimensions", f"{blk.nk} {blk.nj} {blk.ni}")
dataXElem.set("Precision", "8")
dataXElem.set("Format", "HDF")
dataXElem.text = f"{gridPath}/gv.{blk.nblki:06d}.h5:/coordinates/x"
dataXElem.text = f"{gridPath}/g.{blk.nblki:06d}.h5:/coordinates/x"

geometryElem.append(deepcopy(dataXElem))
geometryElem[-1].text = f"{gridPath}/gv.{blk.nblki:06d}.h5:/coordinates/y"
geometryElem[-1].text = f"{gridPath}/g.{blk.nblki:06d}.h5:/coordinates/y"

geometryElem.append(deepcopy(dataXElem))
geometryElem[-1].text = f"{gridPath}/gv.{blk.nblki:06d}.h5:/coordinates/z"
geometryElem[-1].text = f"{gridPath}/g.{blk.nblki:06d}.h5:/coordinates/z"

if blk.blockType == "solver":
names = ["rho", "p", "T"] + blk.speciesNames
Expand Down
4 changes: 1 addition & 3 deletions utilities/analyzeGrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ def analyzeGrid(mb):
args = parser.parse_args()
gp = args.gridDir

nblks = len(
[i for i in os.listdir(gp) if i.startswith("gv.") and i.endswith(".h5")]
)
nblks = len([i for i in os.listdir(gp) if i.startswith("g.") and i.endswith(".h5")])

mb = mbg(nblks)
readGrid(mb, gp)
Expand Down
2 changes: 1 addition & 1 deletion utilities/cutGrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ def performCutOperations(mb, cutOps):
metavar="<fromDir>",
dest="fromDir",
default="./from",
help="Directory containing the gv.* and conn.yaml files to cut. Default is ./from",
help="Directory containing the g.* and conn.yaml files to cut. Default is ./from",
type=str,
)
parser.add_argument(
Expand Down
8 changes: 4 additions & 4 deletions utilities/interpolate.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
metavar="<fromDir>",
dest="fromDir",
default="./from",
help="Directory containing the gv.*.h5 and q.*.h5 files to interpolate from. Default is ./from",
help="Directory containing the g.*.h5 and q.*.h5 files to interpolate from. Default is ./from",
type=str,
)
parser.add_argument(
Expand All @@ -49,7 +49,7 @@
metavar="<toDir>",
dest="toDir",
default="./to",
help="Directory containing the gv.*.h5 files to interpolate to. Default is ./to",
help="Directory containing the g.*.h5 files to interpolate to. Default is ./to",
type=str,
)
parser.add_argument(
Expand Down Expand Up @@ -102,7 +102,7 @@

# Read in from data
nblkFrom = len(
[i for i in os.listdir(fromDir) if i.startswith("gv.") and i.endswith(".h5")]
[i for i in os.listdir(fromDir) if i.startswith("g.") and i.endswith(".h5")]
)
mbFrom = mbr(nblkFrom, speciesNames)
fromNrst = int(
Expand All @@ -113,7 +113,7 @@

# Read in to data
nblkTo = len(
[i for i in os.listdir(toDir) if i.startswith("gv.") and i.endswith(".h5")]
[i for i in os.listdir(toDir) if i.startswith("g.") and i.endswith(".h5")]
)
mbTo = mbr(nblkTo, speciesNames)
readGrid(mbTo, toDir)
Expand Down
2 changes: 1 addition & 1 deletion utilities/loadBalancer.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def allBlocksAssigned(mb, procGroups):
metavar="<fromDir>",
dest="fromDir",
default="./",
help="Directory containing the gv.* files. Default is ./",
help="Directory containing the g.* files. Default is ./",
type=str,
)
parser.add_argument(
Expand Down
4 changes: 1 addition & 3 deletions utilities/verifyGrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,7 @@ def extractFace(blk, nface):

gp = args.gridPath
cp = args.connPath
nblks = len(
[i for i in os.listdir(gp) if i.startswith("gv.") and i.endswith(".h5")]
)
nblks = len([i for i in os.listdir(gp) if i.startswith("g.") and i.endswith(".h5")])
assert nblks > 0
mb = pg.multiBlock.grid(nblks)

Expand Down

0 comments on commit 83d8435

Please sign in to comment.