-
Notifications
You must be signed in to change notification settings - Fork 24
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
Adjusted cartesian mesh generation for 2D meshes #66
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #66 +/- ##
==========================================
- Coverage 17.84% 17.77% -0.07%
==========================================
Files 3 3
Lines 2315 2323 +8
==========================================
Hits 413 413
- Misses 1902 1910 +8 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, @neysecco, hope you are doing well! Sorry for the delay, and thanks for the PR! Did a quick pass and overall the changes look good, but see my comments. I would not be too worried about backwards compatibility, for these options, so if you have any alternate ideas please let us know. Aside from that, we should add some examples or tests, or both. This could be something simple as just showing how to use the command, and compare the cgns output file to a reference file. For reference we do something similar for pyHyp tests.
@@ -784,7 +834,18 @@ def main(): | |||
xMin = [args.xmin, args.ymin, args.zmin] | |||
xMax = [args.xmax, args.ymax, args.zmax] | |||
|
|||
simpleCart(xMin, xMax, args.dh, args.hExtra, args.nExtra, args.sym, args.mgcycle, args.outFile) | |||
# Change dh to a list of integers, since we had |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment mentions int, but the type casting below is float.
@@ -922,7 +983,18 @@ def main(): | |||
sys.exit(0) | |||
|
|||
elif args.mode == "simpleCart": | |||
curGrid.simpleCart(args.dh, args.hExtra, args.nExtra, args.sym, args.mgcycle, args.outFile) | |||
# Change dh to a list of integers, since we had |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
@@ -922,7 +983,18 @@ def main(): | |||
sys.exit(0) | |||
|
|||
elif args.mode == "simpleCart": | |||
curGrid.simpleCart(args.dh, args.hExtra, args.nExtra, args.sym, args.mgcycle, args.outFile) | |||
# Change dh to a list of integers, since we had | |||
# to define it as a string in arg_parser to avoid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the new code here is a duplication from explicitCart
. Refactoring this into a function processing the cart inputs would be great.
Purpose
Hello everyone,
The explicitCart and simpleCart functions could not generate cartesian meshes for 2D cases when used from the command line. The issue was that we could not set multiple symmetry planes from the command line, even though the Python part of these functions already had this functionality.
I adapted the parser to read multiple symmetry planes and mesh spacings. This modification should be backward-compatible.
This is further explained in the documentation of these functions ("$ cgns_utils explicitCart -h" and "$ cgns_utils simpleCart -h").
I also made minor changes to the cartesian function due to changes in scipy.optimize inteface and Python3 standards. However, I strongly recommend that we remove this function, since explicitCart and simpleCart give better control over mesh spacings.
Type of change
Changes to the command-line interface
Testing
The code can be tested with:
$ cgns_utils explicitCart -3 -3 0 4 3 1 0.3,0.3,1.0 10.0 15 zmin,zmax 0 bg.cgns
The expected output is:
Grid Dimensions: [54, 51, 2]
Grid Ratios: [1.12192755 1.12387294 4. ]
A new file named bg.cgns will be created with a cartesian mesh for 2D simulation.
Checklist
flake8
andblack
to make sure the Python code adheres to PEP-8 and is consistently formattedfprettify
or C/C++ code withclang-format
as applicable