This repository contains many useful functions for working with CGNS grids and a CLI program called cgns_utils
to call these functions.
Copyright 2020 MDO Lab. See the LICENSE file for details
cgnsUtilities is a collection of functions for working with CGNS grids.
License: Other
What types of issue is it?
The information in the readme needs to reflect the current capabilities of the tool.
We currently only include default values in a few places, but we should do it for all defaults. This can be done in one of two ways:
default: None
stuff everywhere.Some modes use camelCase when others don't. To improve readability, we should change everything to camelCase. This will however break backwards compatibility, and if we want, we could cast everything to lower when comparing. But I am also fine with breaking backwards compatibility as long as we state it clearly in release notes.
The add_subparsers
function accepts both help
and description
. My understanding is that help
is displayed at the main parser level, and description is a longer..description displayed at the subparser level. It would be good to have both shown, and we can do this by defining the help string as a variable, then appending to it some more detailed description and passing that to description=
.
Note that this has certain implications if we plan to add sphinx documentation and use autoprogram or equivalent to document the CLI.
Some of the internal methods that are supposed to overwrite existing BC information with the new BC information fails to "overwrite" and just end up creating duplicate BC data on these families. As a result, these meshes fail to run in adflow. I think this functionality definitely worked at some point, so I am guessing it will be a relatively minor fix on how we interact with the cgns library.
Try to overwrite the BC information on any mesh via overwritebcs
. I dont have an exact script ready now, but in the past, I had to first explicitly remove all BCs, and then set the updated ones one by one.
BC info is not overwritten and instead is duplicated.
BC info should be overwritten so that there is a single BC definition for each face.
Since this tool is actually somewhat complex, we may want to have a documentation site. This would include both auto-generated documentation (via autoprogram
or equivalent), as well as some additional information for some file formats expected by the CLI tool (that don't fit into the help string). Some diagrams etc. may also be helpful.
Note that these Sphinx extensions that parse argparser
are somewhat finicky, so #39 will be related to this effort.
What types of issue is it?
Select the appropriate type(s) that describe this issue
Should we merge this package with pyHyp? The two packages are typically used in conjunction, and this would help consolidate our repositories and make installation/maintenance easier.
cgns_utils combine fails if the file name is to long. It only happens, when the name is longer than 31 chars. So I assume it has something to do with a length cap on a datatype.
a_reaaaaaaaaaaly_long_name1.cgns
a_reaaaaaaaaaaly_long_name2.cgns
cgns_utils combine a_reaaaaaaaaaaly_long_name1.cgns a_reaaaaaaaaaaly_long_name2.cgns test.cgns
This error gets thrown: Duplicate child name found: a_reaaaaaaaaaaly_long_name1.0000
It should work regardless of the file name length.
What types of issue is it?
Select the appropriate type(s) that describe this issue
Currently, the command line interface cgns_utils
is not installed. Instead, we manually add the directory to the $PATH
.
To do this properly, We would package the software using setup.py
, such that during installation the script is placed in a directory which is on the $PATH
. There are many helpful tutorials out there for this. The package folder structure would probably have to be updated too.
What types of issue is it?
Review all command line options. The following should be performed for each option:
Running cgnsutilities with extract function will trigger the following:
ValueError: Non-string object detected for the array ordering. Please pass in 'C', 'F', 'A', or 'K' instead
This is probably introduced in new NumPy version from v1.4.0.
Someone may have interested in this link.
What types of issue is it?
Select the appropriate type(s) that describe this issue
The option timecombine
does not work, as the Fortran subroutine is commented out (see here). I'm not sure why that is, but this is something we should probably fix at some point.
There are not many tests. We should probably test the Python library rather than the command line program. Or both.
writeSubfaceFamily call does not work if the target BC is already defined as a collection of patches. This check to find the target BC only picks up the first patch:
https://github.com/mdolab/cgnsutilities/blob/main/cgnsutilities/cgnsutilities.py#L391-L404
# Locate the Boco we're replacing
boco = None
for i in range(len(self.blocks[blockID].bocos)):
r = self.blocks[blockID].bocos[i].ptRange # get the point range for existing boco
if (
(r[0][0] == r[0][1] == 1 and face == "ilow")
or (r[0][0] == r[0][1] == self.blocks[blockID].dims[0] and face == "ihigh")
or (r[1][0] == r[1][1] == 1 and face == "jlow")
or (r[1][0] == r[1][1] == self.blocks[blockID].dims[1] and face == "jhigh")
or (r[2][0] == r[2][1] == 1 and face == "klow")
or (r[2][0] == r[2][1] == self.blocks[blockID].dims[2] and face == "khigh")
):
boco = i
break
If a grid comes from a parallel pyHyp run (most of our volume grids), then the BC is written in patches that are divided during the parallel load balancing. As a result, the writeSubfaceFamily only works if it is preceded by a complete overwrite of BCs.
The writeSubFaceFamily should first find all patches on a BC, and overwrite all of it. This should be communicated in the documentation as well.
I end up with this error after executing the command:
$ cgns_utils autobc RAE2822wing_vol.cgns "z" 211.5
Traceback (most recent call last):
File "/home/godot/repos/cgnsutilities/bin/cgns_utils", line 685, in <module>
curGrid = readGrid(args.gridFile)
File "/home/godot/repos/cgnsutilities/bin/cgns_utils.py", line 2620, in readGrid
zoneName, dims, nBoco, nB2B = libcgns_utils.utils.getblockinfo(inFile, iBlock)
SystemError: bad format char passed to Py_BuildValue
The CGNS file is generated via pyHyp after following the ICEM surface meshing tutorial. Essentially, any functions that call cgns_utils
through any of the other scripts are unusable because of this error. For example, here's the output that shows up after the mesh generation table when running run_pyhyp.py
with autoConnect: True
in options
:
Traceback (most recent call last):
File "/home/godot/repos/cgnsutilities/bin/cgns_utils", line 685, in <module>
curGrid = readGrid(args.gridFile)
File "/home/godot/repos/cgnsutilities/bin/cgns_utils.py", line 2620, in readGrid
zoneName, dims, nBoco, nB2B = libcgns_utils.utils.getblockinfo(inFile, iBlock)
SystemError: bad format char passed to Py_BuildValue
+------------------------------------------------------------------------------+
| pyHyp Error: system command 'cgns_utils connect' failed, autoconnect was NOT |
| performed |
+------------------------------------------------------------------------------+
Traceback (most recent call last):
File "run_pyhyp.py", line 49, in <module>
hyp.writeCGNS('RAE2822wing_vol.cgns')
File "/home/godot/repos/pyhyp/python/pyHyp.py", line 747, in writeCGNS
autoconnect was NOT performed")
pyhyp.python.pyHyp.Error
I should note that this error was popping up on an OS installation of Ubuntu 18.04 LTS while running ADFlow and pyHyp (without links to cgns_utils
). So now I'm currently running a fresh install of Ubuntu 16.04 LTS (via Windows Subsystem for Linux), and all the required MDOLab modules I've cloned (ADflow, pyOptSparse, cgnsUtilities etc.) have compiled successfully (with successful imports and execution using the pre-generated meshes), and the only problems are occurring in the execution of cgns_utils
, so I'm guessing this is some kind of version control issue, because cgns_utils
works fine on 18.04 LTS. I've attached the differences between the packages installed on the two versions for reference.
Running cgnsutilities will trigger the following:
/home/mdolabuser/repos/cgnsutilities/cgnsutilities/cgnsutilities.py:1309: DeprecationWarning: invalid escape sequence \d
last_int = re.findall("\d+", blk.name)[-1]
This is probably introduced in Python 3.8.
Create proper tutorials page with examples and figured demonstrating the effect of all options as possible.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.