Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove simpleOCart and update imports #54

Merged
merged 11 commits into from
May 12, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ To install, type
or optionally with the `--user` flag if you are not using a virtual environment.
A console script called `cgns_utils` is provided, which should be installed automatically and available without modifying your `$PATH`.

Advanced features require additional dependencies, which can be checked with

pip install .[advanced]

## Usage

All of the `cgnsUtilties` functionality is accessible through the `cgns_utils` command.
Expand Down
32 changes: 9 additions & 23 deletions cgnsutilities/cgns_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import tempfile
import argparse
import pickle
import numpy
import numpy as np

from cgnsutilities.cgnsutilities import (
Block,
Expand Down Expand Up @@ -517,16 +517,6 @@ def get_parser():
p_sub.add_argument("mgcycle", help="Minimum MG cycle to enforce", type=int)
p_sub.add_argument("outFile", help="Name of output CGNS file")

# ------------ Options for 'simpleOCart' mode --------------------
p_sub = subparsers.add_parser("simpleOCart", help="Generates a background cartesian mesh surrounding by an OMesh")
p_sub.add_argument("gridFile", help="Name of input CGNS file")
p_sub.add_argument("dh", help="Uniform cartesian spacing size", type=float)
p_sub.add_argument("hExtra", help='Extension in "O" dimension', type=float)
p_sub.add_argument("nExtra", help="Number of nodes to use for extension", type=int)
p_sub.add_argument("sym", help="Normal for possible sym plane", type=str)
p_sub.add_argument("mgcycle", help="Minimum MG cycle to enforce", type=int)
p_sub.add_argument("outFile", help="Name of output CGNS file")

# ------------ Options for 'translate' mode --------------------
p_t = subparsers.add_parser("translate", help="Translate a grid.")
p_t.add_argument("gridFile", help="Name of input CGNS file")
Expand Down Expand Up @@ -742,7 +732,7 @@ def main():

# Now we make a character array of the file names, and hand if off to
# fortran for all the actual reading/writing.
fileNames = numpy.zeros((len(files), 256), "c")
fileNames = np.zeros((len(files), 256), "c")
for i in range(len(files)):
fileNames[i, 0 : len(files[i])] = files[i]

Expand All @@ -753,12 +743,12 @@ def main():
nx = args.nx
ny = args.ny
nz = args.nz
X = numpy.zeros((nx, ny, nz, 3))
X = np.zeros((nx, ny, nz, 3))
Xcart = []
Xcart.append(numpy.linspace(0, 1, nx))
Xcart.append(numpy.linspace(0, 1, ny))
Xcart.append(numpy.linspace(0, 1, nz))
Xx, Xy, Xz = numpy.meshgrid(Xcart[0], Xcart[1], Xcart[2], indexing="ij")
Xcart.append(np.linspace(0, 1, nx))
Xcart.append(np.linspace(0, 1, ny))
Xcart.append(np.linspace(0, 1, nz))
Xx, Xy, Xz = np.meshgrid(Xcart[0], Xcart[1], Xcart[2], indexing="ij")
X[:, :, :, 0] = Xx
X[:, :, :, 1] = Xy
X[:, :, :, 2] = Xz
Expand Down Expand Up @@ -934,10 +924,6 @@ def main():
curGrid.simpleCart(args.dh, args.hExtra, args.nExtra, args.sym, args.mgcycle, args.outFile)
sys.exit(0)

elif args.mode == "simpleOCart":
curGrid.simpleOCart(args.dh, args.hExtra, args.nExtra, args.sym, args.mgcycle, args.outFile)
sys.exit(0)

elif args.mode == "translate":
curGrid.translate(args.dx, args.dy, args.dz)

Expand Down Expand Up @@ -968,7 +954,7 @@ def main():
end = int(spec)
for i in range(start, end + 1):
toWrite.append(i)
toWrite = numpy.unique(toWrite)
toWrite = np.unique(toWrite)
toWrite.sort()
curGrid.writeToCGNSSelected(args.outFile, toWrite)
sys.exit(0)
Expand Down Expand Up @@ -1087,7 +1073,7 @@ def main():
data.append(curGrid.convArray[entry])

# Convert data to array
data = numpy.array(data).T
data = np.array(data).T

# Write tecplot results
write_tecplot_file(outFile, "Convergence", ["Iteration"] + curGrid.convArray.keys(), data)
Expand Down
Loading