2222from pyNastran .bdf .cards .base_card import BaseCard
2323from pyNastran .bdf .bdf_interface .internal_get import material_id , table_id
2424from pyNastran .bdf .bdf_interface .assign_type import (
25- integer , integer_or_blank , double , double_or_blank , string )
25+ integer , integer_or_blank , double , double_or_blank , string , string_or_blank )
2626from pyNastran .bdf .field_writer_8 import print_card_8
2727from pyNastran .bdf .field_writer_16 import print_card_16
2828if TYPE_CHECKING : # pragma: no cover
@@ -87,12 +87,22 @@ class MATS1(MaterialDependence):
8787 entry is specified with the same MID in a nonlinear solution sequence
8888 (SOLs 106 and 129).
8989
90+ Format (NX Nastran):
91+ +--------+---------+-------+-------+------+-----+-----+--------+--------+
92+ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
93+ +========+=========+=======+=======+======+=====+=====+========+========+
94+ | MATS1 | MID | TID | TYPE | H | YF | HR | LIMIT1 | LIMIT2 |
95+ +--------+---------+-------+-------+------+-----+-----+--------+--------+
96+ | | STRMEAS | | | | | | | |
97+ +--------+---------+-------+-------+------+-----+-----+--------+--------+
98+
9099 """
91100 type = 'MATS1'
92101
93102 def __init__ (self , mid : int , nl_type : Optional [str ],
94103 h : float , hr : float , yf : float ,
95- limit1 : float , limit2 : float ,
104+ limit1 : Optional [float ], limit2 : Optional [float ],
105+ strmeas : Optional [str ] = None ,
96106 tid : int = 0 , comment : str = '' ):
97107 MaterialDependence .__init__ (self )
98108 if comment :
@@ -136,6 +146,11 @@ def __init__(self, mid: int, nl_type: Optional[str],
136146 #: Internal friction angle, measured in degrees, for the
137147 #: Mohr-Coulomb and Drucker-Prager yield criteria
138148 self .limit2 = limit2
149+
150+ #: Stress/strain measure of the TABLES1 or TABLEST data referenced by the TID field.
151+ #: Valid for NX Nastran SOL 401 and SOL 402 only.
152+ self .strmeas = strmeas
153+
139154 self .tid_ref = None
140155 self .mid_ref = None
141156 assert tid is not None
@@ -150,7 +165,8 @@ def _init_from_empty(cls):
150165 yf = None
151166 limit1 = None
152167 limit2 = None
153- return MATS1 (mid , nl_type , h , hr , yf , limit1 , limit2 , tid = tid , comment = '' )
168+ strmeas = None
169+ return MATS1 (mid , nl_type , h , hr , yf , limit1 , limit2 , strmeas , tid = tid , comment = '' )
154170
155171 def validate (self ) -> None :
156172 if self .nl_type not in ['NLELAST' , 'PLASTIC' , 'PLSTRN' ]:
@@ -191,15 +207,21 @@ def add_card(cls, card: BDFCard, comment: str=''):
191207 h = double_or_blank (card , 4 , 'H' )
192208 yf = integer_or_blank (card , 5 , 'yf' , default = 1 )
193209 hr = integer_or_blank (card , 6 , 'hr' , default = 1 )
194- limit1 = double (card , 7 , 'limit1' )
210+ limit1 = double_or_blank (card , 7 , 'limit1' )
195211
196212 if yf in [3 , 4 ]:
197213 limit2 = double (card , 8 , 'limit2' )
198214 else :
199215 #limit2 = blank(card, 8, 'limit2')
200216 limit2 = None
201- assert len (card ) <= 9 , f'len(MATS1 card) = { len (card ):d} \n card={ card } '
202- return MATS1 (mid , nl_type , h , hr , yf , limit1 , limit2 , tid = tid , comment = comment )
217+
218+ if len (card ) > 9 :
219+ strmeas = string_or_blank (card , 9 , 'strmeas' )
220+ else :
221+ strmeas = None
222+
223+ assert len (card ) <= 10 , f'len(MATS1 card) = { len (card ):d} \n card={ card } '
224+ return MATS1 (mid , nl_type , h , hr , yf , limit1 , limit2 , strmeas , tid = tid , comment = comment )
203225
204226 @classmethod
205227 def add_op2_data (cls , data , comment : str = '' ):
@@ -214,7 +236,21 @@ def add_op2_data(cls, data, comment: str=''):
214236 a comment for the card
215237
216238 """
217- (mid , tid , nl_type_int , h , yf , hr , limit1 , limit2 ) = data
239+
240+ if len (data ) < 9 :
241+ (mid , tid , nl_type_int , h , yf , hr , limit1 , limit2 ) = data
242+ strmeas = None
243+ else :
244+ (mid , tid , nl_type_int , h , yf , hr , limit1 , limit2 , strmeas_int ) = data
245+ strmeas_map = {
246+ 0 : None , # NULL
247+ 1 : 'UNDEF' ,
248+ 2 : 'ENG' ,
249+ 3 : 'TRUE' ,
250+ 4 : 'CAUCHY' ,
251+ }
252+ strmeas = strmeas_map [strmeas_int ]
253+
218254 if nl_type_int == 1 :
219255 nl_type = 'NLELAST'
220256 elif nl_type_int == 2 :
@@ -224,7 +260,8 @@ def add_op2_data(cls, data, comment: str=''):
224260 else : # pragma: no cover
225261 raise RuntimeError (f'Invalid Type: mid={ mid } ; Type={ nl_type_int } ; must be 1=NLELAST, '
226262 '2=PLASTIC, or 3=PLSTRN' )
227- return MATS1 (mid , nl_type , h , hr , yf , limit1 , limit2 , tid = tid , comment = comment )
263+
264+ return MATS1 (mid , nl_type , h , hr , yf , limit1 , limit2 , strmeas , tid = tid , comment = comment )
228265
229266 def Yf (self ) -> str :
230267 d = {1 : 'VonMises' , 2 : 'Tresca' , 3 : 'MohrCoulomb' , 4 : 'Drucker-Prager' }
@@ -298,7 +335,7 @@ def Tid(self) -> int:
298335
299336 def raw_fields (self ) -> list :
300337 list_fields = ['MATS1' , self .Mid (), self .Tid (), self .nl_type ,
301- self .h , self .yf , self .hr , self .limit1 , self .limit2 ]
338+ self .h , self .yf , self .hr , self .limit1 , self .limit2 , self . strmeas ]
302339 return list_fields
303340
304341 def repr_fields (self ) -> list :
0 commit comments