New to pyNastran

291 views
Skip to first unread message

Rob McDonald

unread,
Apr 29, 2022, 2:42:32 PM4/29/22
to pyNastran Discuss
Steve,

I'm working on OpenVSP's built in structures stuff and need to make sure I don't break anything.  I don't have NASTRAN or any associated tools (or a clue how to use any of them), so I figured it was high time I give pyNastran a try.  Thanks for making this available.

I first tried 'pip install pynastran'.  It installed with no problems, but wouldn't run because I didn't have vtk in my base environment.  Resolving that, it would crash with the following error (that I think you may have already fixed in the 1.3 branch)...

Traceback (most recent call last):
File "/usr/local/anaconda3/bin/pyNastranGUI", line 5, in <module>
from pyNastran.gui.gui import cmd_line
File "/usr/local/anaconda3/lib/python3.8/site-packages/pyNastran/gui/gui.py", line 20, in <module>
from pyNastran.gui.main_window import MainWindow, get_stylesheet
File "/usr/local/anaconda3/lib/python3.8/site-packages/pyNastran/gui/main_window.py", line 27, in <module>
from pyNastran.gui.formats import NastranIO
File "/usr/local/anaconda3/lib/python3.8/site-packages/pyNastran/gui/formats.py", line 35, in <module>
from pyNastran.converters.tecplot.tecplot_io import TecplotIO
File "/usr/local/anaconda3/lib/python3.8/site-packages/pyNastran/converters/tecplot/tecplot_io.py", line 8, in <module>
from pyNastran.converters.tecplot.tecplot import read_tecplot
File "/usr/local/anaconda3/lib/python3.8/site-packages/pyNastran/converters/tecplot/tecplot.py", line 15, in <module>
from pyNastran.converters.tecplot.zone import Zone, CaseInsensitiveDict, is_3d
File "/usr/local/anaconda3/lib/python3.8/site-packages/pyNastran/converters/tecplot/zone.py", line 6, in <module>
from pyNastran.nptyping import NDArrayN3float, NDArrayN3int, NDArrayN4int
File "/usr/local/anaconda3/lib/python3.8/site-packages/pyNastran/nptyping.py", line 6, in <module>
NDArray3float = NDArray[(3, ), float]
File "/usr/local/anaconda3/lib/python3.8/site-packages/nptyping/ndarray.py", line 73, in __getitem__
shape_expression, dtype = _get_from_tuple(item)
File "/usr/local/anaconda3/lib/python3.8/site-packages/nptyping/ndarray.py", line 128, in _get_from_tuple
raise InvalidArgumentsError(
nptyping.error.InvalidArgumentsError: Unexpected argument '(3,)', expecting Shape[<ShapeExpression>] or Literal[<ShapeExpression>]

From there, I decided to 'pip uninstall pynastran' and instead clone the GitHub repo and go with 'python setup.py develop' from the main branch.

I'm working on writing out orthotropic materials to a MAT8.  For now, I don't have the CTE for my example materials, so I've set them to 0.0.  I'm writing  them via printf with a %8.3g format specifier -- which gives freedom to choose whether to use scientific notation or not.  In this case, it writes out '0' -- with no decimal at all.

pyNastran bombs on this because it is an integer when it was expecting a float.  I can (and will) fix this, but I was a little surprised to see it react this way.

I'm certainly use to source code differentiating between 0 and 0. -- but usually file formats don't care.  Does this behavior match NASTRAN?  If so -- then it is great to have as a diagnostic message.  If it does not, then I think you may want to match NASTRAN's behavior.

Anyway, I expect I'll be back with a bunch more trivial questions and comments.  Thanks again for all the work.

Rob

Peter Hudson

unread,
Apr 29, 2022, 5:13:59 PM4/29/22
to pynastra...@googlegroups.com

Hi Steve and Rob

I've been using OpenVSP, NASTRAN95 (the open source one) and pyNastran for a while now on an ultralight sailplane design.  I'm excited to see what you two, working together, might accomplish!

I'm happy to offer up help, advice, opinions, or testing where I can. I've written a few scripts but but I'm not a programmer by any stretch of imagination.  I was a aero/structures analyst by trade.

My current "workflow" is pretty bad from "flow" point of view:

I figured out my aircraft configuration mostly with OpenVSP.

I create NASTRAN95 models of components by hand (old school use of spreadsheets and text, or simple scripts to generate the grids and elements, then I'll either assume pressure distributions or use XFLR5 to get panel by panel data to map using a custom python script to the PLOAD4 cards.

I can confirm the quality/look of the FEM mesh by changing the .inp file extension to .bdf . I then have to start pyNastranGUI from a command line with the file as an argument. (I don't know why it wont work if I start the gui then point it to the file. but it doesn't)

Then I run the analysis with the .inp file using NASTRAN95.  There is a DMAP alter to get NASTRAN95 to output an OP2 file. 

Once the .bdf is up in the gui I can then read in the .op2 results.  It gets the displacements OK, but it doesn't translate the cquad4 stress results for some reason.  I can use a python script to get those stress results in a .csv file that I CAN read into pyNastranGUI and display and there it is...results!

So I have a work around for each hurdle but...getting meshes and mapped loads out of OpenVSP, (tweaking the .inp by hand for all the properties, materials, and boundary conditions is fine by me) then running them in NASTRAN95, and viewing results in pyNastranGUI.  That would be awesome!


-Peter Hudson-

--
You received this message because you are subscribed to the Google Groups "pyNastran Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pynastran-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pynastran-discuss/53042cc5-6ed0-4584-a34e-24bb177d9151n%40googlegroups.com.

steve

unread,
May 28, 2022, 6:59:59 PM5/28/22
to pyNastran Discuss
Hi Rob,

Sorry for missing this.  I didn't see the email.

So, hopefully this weekend I push the new version ( to fix your  expecting Shape[<ShapeExpression>] or Literal[<ShapeExpression>] issue), but it's caused by a new package version.  You can fix it by running:
 >>> pip uninstall nptyping

> I'm working on writing out orthotropic materials to a MAT8.  For now, I don't have the CTE for my example materials, so I've set them to 0.0.  I'm writing  them via printf with a %8.3g format specifier -- which gives freedom to choose whether to use scientific notation or not.  In this case, it writes out '0' -- with no decimal at all.
> pyNastran bombs on this because it is an integer when it was expecting a float.  I can (and will) fix this, but I was a little surprised to see it react this way.

Yes.  Unfortunately Nastran doesn't have the best error messages.  Being picky about types, INCLUDE files, coordinate systems existing, etc. makes it a lot easier to avoid common issues.  I still mess this stuff up and I know other people do too.  Depending on the version of Nastran, sometimes not following the format specified by the QRG is ok and othertimes it's not.
Reply all
Reply to author
Forward
0 new messages