Skip to content

Commit 544d404

Browse files
authored
TSTEP1 read&write fix (#851)
* add simple test model for TSTEP1 * Add unit test for TSTEP1 * move TSTEP1 cards from tstepnls to tsteps dictionary
1 parent d7989da commit 544d404

File tree

8 files changed

+105
-27
lines changed

8 files changed

+105
-27
lines changed

models/nx/sol401/sol401_tstep1.dat

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
ID,NASTRAN,model2_sim1-solution_1
2+
SOL 401
3+
CEND
4+
ECHO = NONE
5+
RIGID = AUTO
6+
TEMP(INIT) = 1
7+
LOAD = 100
8+
SPC = 100
9+
DISPLACEMENT(PLOT,REAL) = ALL
10+
SPCFORCES(PLOT,REAL) = ALL
11+
STRESS(PLOT,REAL,VONMISES,CENTER) = ALL
12+
SUBCASE 1
13+
LABEL = Subcase - Nonlinear Statics 1
14+
TSTEP = 101
15+
ANALYSIS = STATICS
16+
SEQDEP = YES
17+
BEGIN BULK
18+
TSTEP1* 1011.0000000000E+00 3 YES+
19+
*
20+
PARAM LGDISP 1
21+
PARAM OIBULK YES
22+
PARAM OMACHPR YES
23+
PARAM POST -2
24+
PARAM POSTEXT YES
25+
PARAM UNITSYS MN-MM
26+
GRID* 1 00.0000000000E+000.0000000000E+00+
27+
* 0.0000000000E+00 0
28+
GRID* 2 0-5.000000000E+010.0000000000E+00+
29+
* 0.0000000000E+00 0
30+
GRID* 3 00.0000000000E+00-5.000000000E+01+
31+
* 0.0000000000E+00 0
32+
GRID* 4 00.0000000000E+005.0000000000E+01+
33+
* 0.0000000000E+00 0
34+
GRID* 5 05.0000000000E+010.0000000000E+00+
35+
* 0.0000000000E+00 0
36+
GRID* 6 0-5.000000000E+015.0000000000E+01+
37+
* 0.0000000000E+00 0
38+
GRID* 7 0-5.000000000E+01-5.000000000E+01+
39+
* 0.0000000000E+00 0
40+
GRID* 8 05.0000000000E+01-5.000000000E+01+
41+
* 0.0000000000E+00 0
42+
GRID* 9 05.0000000000E+015.0000000000E+01+
43+
* 0.0000000000E+00 0
44+
CQUAD4 1 1 9 4 1 5
45+
CQUAD4 2 1 4 6 2 1
46+
CQUAD4 3 1 1 2 7 3
47+
CQUAD4 4 1 5 1 3 8
48+
PSHELL 1 11.000000 11.000000 10.833333 0.0000
49+
MAT1 11.000+10 0.300000
50+
FORCE 2 3 05.0000+7 0.0000-1.00000 0.0000
51+
FORCE 2 7 02.5000+7 0.0000-1.00000 0.0000
52+
FORCE 2 8 02.5000+7 0.0000-1.00000 0.0000
53+
FORCE 3 4 05.0000+7 0.00001.000000 0.0000
54+
FORCE 3 6 02.5000+7 0.00001.000000 0.0000
55+
FORCE 3 9 02.5000+7 0.00001.000000 0.0000
56+
SPC 4 8 123 0.0000
57+
SPC 5 9 13 0.0000
58+
SPC 6 6 3 0.0000
59+
TEMPD 1 20.0000
60+
LOAD 1001.0000001.000000 21.000000 3
61+
SPCADD 100 4 5 6
62+
ENDDATA a015b074

models/nx/sol401/sol401_tstep1.op2

35 KB
Binary file not shown.

pyNastran/bdf/bdf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2852,7 +2852,7 @@ def add_card(cls, card: BDFCard, comment: str=''):
28522852
'NLPARM': (NLPARM, add_methods.add_nlparm_object),
28532853
'NLPCI': (NLPCI, add_methods.add_nlpci_object),
28542854
'TSTEP': (TSTEP, add_methods.add_tstep_object),
2855-
'TSTEP1': (TSTEP1, add_methods.add_tstepnl_object),
2855+
'TSTEP1': (TSTEP1, add_methods.add_tstep_object),
28562856
'TSTEPNL': (TSTEPNL, add_methods.add_tstepnl_object),
28572857

28582858
'TF': (TF, add_methods.add_tf_object),

pyNastran/bdf/bdf_interface/attributes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,8 @@
333333
'dphases': ['DPHASE'],
334334
'nlparms': ['NLPARM'],
335335
'nlpcis': ['NLPCI'],
336-
'tsteps': ['TSTEP'],
337-
'tstepnls': ['TSTEPNL', 'TSTEP1'],
336+
'tsteps': ['TSTEP', 'TSTEP1'],
337+
'tstepnls': ['TSTEPNL'],
338338
'transfer_functions': ['TF'],
339339
'delays': ['DELAY'],
340340
'rotors': ['ROTORG', 'ROTORD'],

pyNastran/bdf/mesh_utils/remove_unused.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def remove_unused(bdf_filename: PathLike,
7979
unreferenced_types_case_control = {
8080
'EIGR', 'EIGRL', 'EIGB', 'EIGP', 'EIGC',
8181
'FREQ', 'FREQ1', 'FREQ2',
82-
'TSTEP', 'TSTEPNL',
82+
'TSTEP', 'TSTEP1', 'TSTEPNL',
8383
'NLPCI', 'NLPARM',
8484

8585
# aero

pyNastran/bdf/test/test_bdf.py

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1787,28 +1787,15 @@ def _check_case_parameters(subcase: Subcase,
17871787
stop_on_failure: bool=True) -> int:
17881788
"""helper method for ``check_case``"""
17891789
log = fem.log
1790-
if fem.sol in {401, 402}:
1791-
# TSTEP references a TSTEP1, but not a TSTEP
1792-
# TSTEP1s are stored in tstepnls
1793-
if any(subcase.has_parameter('TIME', 'TSTEP')):
1794-
if 'TSTEP' in subcase:
1795-
tstep_id: int = subcase.get_int_parameter('TSTEP')
1796-
else: # pragma: no cover
1797-
raise NotImplementedError(subcase)
1798-
if tstep_id not in fem.tstepnls:
1799-
raise RuntimeError(_tstep_msg(fem, subcase, tstep_id))
1800-
else:
1801-
raise RuntimeError(f'missing TSTEP in case control deck\n{subcase}')
1802-
else:
1803-
if any(subcase.has_parameter('TIME', 'TSTEP')):
1804-
if 'TIME' in subcase:
1805-
tstep_id: int = subcase.get_int_parameter('TIME')
1806-
elif 'TSTEP' in subcase:
1807-
tstep_id: int = subcase.get_int_parameter('TSTEP')
1808-
else: # pragma: no cover
1809-
raise NotImplementedError(subcase)
1810-
if tstep_id not in fem.tsteps:
1811-
raise RuntimeError(_tstep_msg(fem, subcase, tstep_id))
1790+
if any(subcase.has_parameter('TIME', 'TSTEP')):
1791+
if 'TIME' in subcase:
1792+
tstep_id: int = subcase.get_int_parameter('TIME')
1793+
elif 'TSTEP' in subcase:
1794+
tstep_id: int = subcase.get_int_parameter('TSTEP')
1795+
else: # pragma: no cover
1796+
raise NotImplementedError(subcase)
1797+
if tstep_id not in fem.tsteps:
1798+
raise RuntimeError(_tstep_msg(fem, subcase, tstep_id))
18121799

18131800
check_subcase_dmig_matrices(fem, subcase)
18141801
if 'TSTEPNL' in subcase:

pyNastran/dev/bdf_vectorized3/bdf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2272,7 +2272,7 @@ def add_card(cls, card, comment=''):
22722272
'NLPARM' : (NLPARM, add_methods.add_nlparm_object),
22732273
'NLPCI' : (NLPCI, add_methods.add_nlpci_object),
22742274
'TSTEP' : (TSTEP, add_methods.add_tstep_object),
2275-
'TSTEP1' : (TSTEP1, add_methods.add_tstepnl_object),
2275+
'TSTEP1' : (TSTEP1, add_methods.add_tstep_object),
22762276
'TSTEPNL' : (TSTEPNL, add_methods.add_tstepnl_object),
22772277

22782278
# nx_opt

pyNastran/op2/test/test_op2_unit_tests.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,35 @@ def test_nx_sol111_solid_stress(self):
10331033
stop_on_failure=True, dev=False,
10341034
build_pandas=True, log=log)
10351035

1036+
def test_nx_sol401_tstep1(self):
1037+
"""Test SOL401 simulation with a TSTEP1 card."""
1038+
1039+
log = get_logger(level='info')
1040+
bdf_filename = MODEL_PATH / 'nx' / 'sol401' / 'sol401_tstep1.dat'
1041+
op2_filename = MODEL_PATH / 'nx' / 'sol401' / 'sol401_tstep1.op2'
1042+
1043+
# can't parse replication
1044+
unused_fem1, unused_fem2, diff_cards = self.run_bdf('', bdf_filename, log=log)
1045+
diff_cards2 = list(set(diff_cards))
1046+
diff_cards2.sort()
1047+
assert len(diff_cards2) == 0, diff_cards2
1048+
1049+
model = read_bdf(bdf_filename, debug=False, log=log, xref=False)
1050+
model.safe_cross_reference()
1051+
save_load_deck(model, run_save_load=False, run_renumber=False)
1052+
1053+
log = get_logger(level='warning')
1054+
exclude_results = None # ['*cplstn3*']
1055+
run_op2(op2_filename, make_geom=True, write_bdf=False, read_bdf=True,
1056+
write_f06=True, write_op2=False, write_hdf5=False, # IS_H5PY
1057+
is_mag_phase=False,
1058+
is_sort2=False, is_nx=None, delete_f06=True,
1059+
subcases=None, exclude_results=exclude_results,
1060+
short_stats=False,
1061+
compare=False, debug=True, binary_debug=True,
1062+
quiet=True,
1063+
stop_on_failure=True, dev=False,
1064+
build_pandas=True, log=log)
10361065

10371066
class TestMSC(Tester):
10381067
def test_cantilever_plate_nonlinear_msc_2021(self):

0 commit comments

Comments
 (0)