pyNastran icon indicating copy to clipboard operation
pyNastran copied to clipboard

MAT1 Young's modulus accept integer type

Open jaredmagnusson opened this issue 1 year ago • 2 comments

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?

jaredmagnusson avatar Sep 25 '23 16:09 jaredmagnusson

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: @.***>

SteveDoyle2 avatar Sep 25 '23 16:09 SteveDoyle2

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

jaredmagnusson avatar Sep 26 '23 18:09 jaredmagnusson