-
Notifications
You must be signed in to change notification settings - Fork 26
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
Generalized Tecplot ASCII and Binary Readers/Writers #95
base: main
Are you sure you want to change the base?
Conversation
…ional data a multiple FE zone types
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #95 +/- ##
===========================================
+ Coverage 41.25% 51.87% +10.61%
===========================================
Files 26 27 +1
Lines 2596 3181 +585
===========================================
+ Hits 1071 1650 +579
- Misses 1525 1531 +6 ☔ View full report in Codecov by Sentry. |
Still need to update the docs, but I wanted to get the review started. We might want to consider a minor version bump as well? |
This is ready for review. I updated the docs and bumped the minor version. |
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.
Yea, this looks good. I agree with the minor version bump. Thanks for alphabetizing the imports too
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.
Looking very good! I was planning on doing a more thorough review, but to avoid having this sitting for long, I think there are few things there to get immediate feedback on. Please check my comments based in this first pass.
Hmm interesting. The size of the data shouldn't have this effect. I'll recreate this stress test and add it as a unit test. As for keeping the temporary files, I would prefer to create a script that can generate the test data to do one-off type checks with Tecplot. I agree that adding Tecplot to the test runners is not a great solution. |
@A-CGray the insane grid structure you were seeing in Tecplot was actually correct. I was using random coordinates to generate the nodal data. I am updating to using linearly increasing nodal data so the output in Tecplot will resemble a line, square, or cube. See here in the tests where this was happening. |
Oh yeah this is fine, I didn't mean to suggest anything was wrong by posting that image, was just showing evidence that I'd tested opening the binary files written by the tests in Tecplot. |
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.
Great work @lamkina !
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.
I am satisfied with this. WIll be taking advantage of this code in DCFoil. Thanks!
@eirikurj asked to wait until he regains access to do a final review and then he can merge. |
I've now used this and can absolutely vouch for its usefulness! @lamkina and I just chatted about plotting in matplotlib. One problem is that by default matplotlib's @property
def triConnectivity(self) -> npt.NDArray:
if self.zoneType == ZoneType.FETRIANGLE:
return self.connectivity
elif self.zoneType == ZoneType.FEQUADRILATERAL:
return np.row_stack((self.connectivity[:, [0, 1, 2]], self.connectivity[:, [2, 3, 0]]))
else:
raise TypeError(f"triConnectivity not supported for {self.zoneType.name} zone type") |
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.
LGTM
@eytanadler and I discovered that it's possible for I implemented a property in Another solution might be to update the nodal data and connectivity when we read the zone to make sure we only store the minimum amount of information necessary for a given zone. @eirikurj , @gawng , @eirikurj , and @eytanadler what are your preferences here? |
I would vote for removing the redundant data |
Purpose
This PR implements generalized Tecplot readers and writers for ASCII and Binary files. I created two new data structures to hold Ordered and Finite Element Tecplot zone types. The data structures contain a dictionary for the variable data arrays, the strand ID, solution time, and for FE zones the connectivity.
There is a single read function that determines the ASCII or Binary functionality automatically based on the file extension. The same pattern is used for the writer. The structure of the data is determined automatically by the dimensions of the numpy arrays for ordered zones. For example, an array of shape (10, 10, 10) will be treated as an I=10, J=10, K=10 Tecplot ordered zone. For FE zones, the nodes are a flattened array and the connectivity should match the FE zone type (LineSeg, Quadrilateral, Triangle, etc.). The writer uses the shape of the connectivity to determine the FE zone type to write.
I added tests that confirm the reader and writer work properly, as well as tests using ADflow ASCII slice
.dat
files and ADflow binary surface.plt
files.Expected time until merged
A few weeks
Type of change
Testing
Run the tests added for the Tecplot IO module.
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