SteveDoyle2 / pyNastran

A Python-based interface tool for Nastran's file formats
Other
384 stars 147 forks source link

MAT1 Young's modulus accept integer type #747

Open jaredmagnusson opened 11 months ago

jaredmagnusson commented 11 months ago

Our FEA meshing tool outputs a default material MAT1 for stainless steel with a Young's Modulus E=206800 when generating a BDF file. This always triggers an error when pyNastran reads in the file:

E = '206800' (field #2) on card must be a float or blank (not an integer).
card=['MAT1*', '100', '206800', '80155.039', '0.29', '7e-06', '1.2e-05']
SyntaxError: E = '206800' (field #2) on card must be a float (not an integer).

Given that Young's moduli are usually large values and often aren't known to decimal precision (when not written with exponential format), could pyNastran simply convert the int to a float here? When adding the material card, rather than calling double_or_blank, it could call integer_double_or_blank?

SteveDoyle2 commented 11 months ago

It’s bad practice to write E as an integer. It’s specifically called out in the QRG as a float.

You’re welcome to modify the source, but I disagree it should be supported in the official release.

On Mon, Sep 25, 2023 at 9:02 AM jaredmagnusson @.***> wrote:

Our FEA meshing tool outputs a default material MAT1 for stainless steel with a Young's Modulus E=206800 when generating a BDF file. This always triggers an error when pyNastran reads in the file:

E = '206800' (field #2) on card must be a float or blank (not an integer). card=['MAT1*', '100', '206800', '80155.039', '0.29', '7e-06', '1.2e-05'] SyntaxError: E = '206800' (field #2) on card must be a float (not an integer).

Given that Young's moduli are usually large values and often aren't known to decimal precision (when not written with exponential format), could pyNastran simply convert the int to a float here? When adding the material card, rather than calling double_or_blank, it could call integer_double_or_blank?

— Reply to this email directly, view it on GitHub https://github.com/SteveDoyle2/pyNastran/issues/747, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAICUWJMTRZYUNYNSYRMRRLX4GTHRANCNFSM6AAAAAA5GKLX3Y . You are receiving this because you are subscribed to this thread.Message ID: @.***>

jaredmagnusson commented 11 months ago

Ok. Currently all Cubit Nastran exports include a default MAT1 card with this issue.