xu-xianghua / ofpp Goto Github PK
View Code? Open in Web Editor NEWOpenFOAM Python Parser, parse data in OpenFOAM output files to Numpy array.
License: MIT License
OpenFOAM Python Parser, parse data in OpenFOAM output files to Numpy array.
License: MIT License
Hi,
Parsing internal non uniform field with linux works fine, but with windows we get this error:
could not convert string to float: b'-3.85361e-19)'
It seems that the character ')' is read inside the string.
Regards
Robert
Hi,
Firstly, thanks for the library. I discovered it yesterday and it's already been very handy to debug my setup.
In return, I just wanted to point out that the subroutine parse_faces_content()
fails for faces with more than 10 points as the line data = [[int(s) for s in ln[2:-2].split()] for ln in content[n + 2:n + 2 + num]]
reasonably assumes that faces have less than 10 vertices. Ominously it appears I have just produced a mesh containing a face with 10 vertices. As OpenFOAM supports any shape of cell, perhaps consider changing the line to data = [[int(s) for s in re.findall(b"\d+", ln)[1:]] for ln in content[n + 2:n + 2 + num]]
. Of course this requires an import of the re library.
Great job !
Many thanks for the modules :)
Do you plan to extend this module to post-processing utilities like extraction of data into an arbitrary plane, plot over line, etc ?
@greole https://github.com/greole/owls has also made an excellent package in this direction but it looks like his repository is not maintained anymore.
Anyway, congratulations for this awesome job and many thanks for sharing it.
Long life to ofpp :)
Regards,
François
Hi,
First of all, thank for sharing this package, it's really useful to have this kind of tool to quickly load and manipulate OpenFOAM cases. I noticed a error about the total number of cells. The num_cell
attribute return X cells, while there are X +1 cells (as it is written in the note of the constant/owner
file)
Best regards,
Jérôme.
When reading binary data, I found that sometimes the reader exited early for boundary data. I think this is due to the fact that the }
character is sometimes in binary OF data. In the function split_boundary_content
this causes a wrong content range.
At line 172 of field_parser.py
. I added an ugly fix which checks if the following line is long enough to still contain binary data:
if in_boundary_field:
#USER FIX
if (lc.rstrip() == b'}' and len(content[n+1])<30):
break
if in_patch_field:
if (lc.strip() == b'}' and len(content[n+1])<30):
The keyword in parse_data_nonuniform() for symmetric tensors should be "symmTensor" instead of "symmtensor".
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.