Skip to content

Commit 3c40bd2

Browse files
RaphaelHeinigerpyansys-ci-botkoubaa
authored
fix: CONTROL_TIMESTEP and CONTROL_TIME_STEP (#629) (#631)
Co-authored-by: pyansys-ci-bot <[email protected]> Co-authored-by: Mohamed Koubaa <[email protected]>
1 parent d7938a2 commit 3c40bd2

File tree

9 files changed

+377
-11
lines changed

9 files changed

+377
-11
lines changed

codegen/generate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@
4242
"ELEMENT_SOLID (ten nodes format)",
4343
"ELEMENT_SOLID",
4444
"ELEMENT_SOLID_ORTHO (ten nodes format)",
45-
"ELEMENT_SOLID_ORTHO",
45+
"ELEMENT_SOLID_ORTHO"
4646
# issue #184 - this is not documented in the manual
47-
"CONTROL_TIMESTEP",
47+
#"CONTROL_TIMESTEP",CONTROL_TIMESTEP is in the kwd.json now and should be generated issue #629
4848
]
4949
)
5050

codegen/manifest.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -550,11 +550,6 @@
550550
]
551551
}
552552
},
553-
"CONTROL_TIME_STEP" : {
554-
"generation-options": {
555-
"override-subkeyword": "TIMESTEP"
556-
}
557-
},
558553
"MAT_NULL": {
559554
"type": "multiple",
560555
"generations": [

doc/changelog/631.added.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fix: CONTROL_TIMESTEP and CONTROL_TIME_STEP (#629)

src/ansys/dyna/core/keywords/keyword_classes/auto/control_time_step.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ControlTimeStep(KeywordBase):
2828
"""DYNA CONTROL_TIME_STEP keyword"""
2929

3030
keyword = "CONTROL"
31-
subkeyword = "TIMESTEP"
31+
subkeyword = "TIME_STEP"
3232

3333
def __init__(self, **kwargs):
3434
super().__init__(**kwargs)
Lines changed: 357 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,357 @@
1+
# Copyright (C) 2021 - 2024 ANSYS, Inc. and/or its affiliates.
2+
# SPDX-License-Identifier: MIT
3+
#
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in all
13+
# copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
# SOFTWARE.
22+
23+
import typing
24+
from ansys.dyna.core.lib.card import Card, Field, Flag
25+
from ansys.dyna.core.lib.keyword_base import KeywordBase
26+
27+
class ControlTimestep(KeywordBase):
28+
"""DYNA CONTROL_TIMESTEP keyword"""
29+
30+
keyword = "CONTROL"
31+
subkeyword = "TIMESTEP"
32+
33+
def __init__(self, **kwargs):
34+
super().__init__(**kwargs)
35+
self._cards = [
36+
Card(
37+
[
38+
Field(
39+
"dtinit",
40+
float,
41+
0,
42+
10,
43+
kwargs.get("dtinit", 0)
44+
),
45+
Field(
46+
"tssfac",
47+
float,
48+
10,
49+
10,
50+
kwargs.get("tssfac", 0.0)
51+
),
52+
Field(
53+
"isdo",
54+
int,
55+
20,
56+
10,
57+
kwargs.get("isdo", 0)
58+
),
59+
Field(
60+
"tslimt",
61+
float,
62+
30,
63+
10,
64+
kwargs.get("tslimt", 0.0)
65+
),
66+
Field(
67+
"dt2ms",
68+
float,
69+
40,
70+
10,
71+
kwargs.get("dt2ms", 0.0)
72+
),
73+
Field(
74+
"lctm",
75+
int,
76+
50,
77+
10,
78+
kwargs.get("lctm", 0)
79+
),
80+
Field(
81+
"erode",
82+
int,
83+
60,
84+
10,
85+
kwargs.get("erode", 0)
86+
),
87+
Field(
88+
"ms1st",
89+
int,
90+
70,
91+
10,
92+
kwargs.get("ms1st", 0)
93+
),
94+
],
95+
),
96+
Card(
97+
[
98+
Field(
99+
"dt2msf",
100+
float,
101+
0,
102+
10,
103+
kwargs.get("dt2msf")
104+
),
105+
Field(
106+
"dt2mslc",
107+
int,
108+
10,
109+
10,
110+
kwargs.get("dt2mslc")
111+
),
112+
Field(
113+
"imscl",
114+
int,
115+
20,
116+
10,
117+
kwargs.get("imscl")
118+
),
119+
Field(
120+
"unused",
121+
int,
122+
30,
123+
10,
124+
kwargs.get("unused")
125+
),
126+
Field(
127+
"unused",
128+
int,
129+
40,
130+
10,
131+
kwargs.get("unused")
132+
),
133+
Field(
134+
"rmscl",
135+
float,
136+
50,
137+
10,
138+
kwargs.get("rmscl", 0.0)
139+
),
140+
Field(
141+
"emscl",
142+
float,
143+
60,
144+
10,
145+
kwargs.get("emscl", 0.0)
146+
),
147+
Field(
148+
"ihdo",
149+
int,
150+
70,
151+
10,
152+
kwargs.get("ihdo", 0)
153+
),
154+
],
155+
),
156+
Card(
157+
[
158+
Field(
159+
"unused",
160+
int,
161+
0,
162+
10,
163+
kwargs.get("unused")
164+
),
165+
Field(
166+
"igado",
167+
int,
168+
10,
169+
10,
170+
kwargs.get("igado", 0)
171+
),
172+
],
173+
),
174+
]
175+
176+
@property
177+
def dtinit(self) -> float:
178+
"""Get or set the Initial time step size:
179+
EQ.0.0: LS-DYNA determines initial step size (default).
180+
""" # nopep8
181+
return self._cards[0].get_value("dtinit")
182+
183+
@dtinit.setter
184+
def dtinit(self, value: float) -> None:
185+
self._cards[0].set_value("dtinit", value)
186+
187+
@property
188+
def tssfac(self) -> float:
189+
"""Get or set the Scale factor for computed time step.
190+
LT.0: |TSSFAC| is the load curve or function defining the scale factor as a function of time.
191+
""" # nopep8
192+
return self._cards[0].get_value("tssfac")
193+
194+
@tssfac.setter
195+
def tssfac(self, value: float) -> None:
196+
self._cards[0].set_value("tssfac", value)
197+
198+
@property
199+
def isdo(self) -> int:
200+
"""Get or set the Basis of time size calculation.
201+
EQ.0: characteristic length=area/(longest side),
202+
EQ.1: characteristic length=area/(longest diagonal),
203+
EQ.2: based on bar wave speed and MAX [shortest side, area/longest side].
204+
""" # nopep8
205+
return self._cards[0].get_value("isdo")
206+
207+
@isdo.setter
208+
def isdo(self, value: int) -> None:
209+
self._cards[0].set_value("isdo", value)
210+
211+
@property
212+
def tslimt(self) -> float:
213+
"""Get or set the Shell element minimum time step assignment. Applies only to *MAT_PLASTIC_KINEMATIC, *MAT_PONER_LAW_PLASTICITY, *MAT_STRAIN_RATE_DEPENDENT_PLASTICITY, *MAT_PIECE-WISE_LINEAR_PLASTICITY.
214+
""" # nopep8
215+
return self._cards[0].get_value("tslimt")
216+
217+
@tslimt.setter
218+
def tslimt(self, value: float) -> None:
219+
self._cards[0].set_value("tslimt", value)
220+
221+
@property
222+
def dt2ms(self) -> float:
223+
"""Get or set the Time step size for mass scaled solutions (default set to 0.0).
224+
""" # nopep8
225+
return self._cards[0].get_value("dt2ms")
226+
227+
@dt2ms.setter
228+
def dt2ms(self, value: float) -> None:
229+
self._cards[0].set_value("dt2ms", value)
230+
231+
@property
232+
def lctm(self) -> int:
233+
"""Get or set the Load curve ID that limits the maximum time step size (optional).
234+
""" # nopep8
235+
return self._cards[0].get_value("lctm")
236+
237+
@lctm.setter
238+
def lctm(self, value: int) -> None:
239+
self._cards[0].set_value("lctm", value)
240+
241+
@property
242+
def erode(self) -> int:
243+
"""Get or set the Erosion flag for elements with small time step. See Remark 5.
244+
EQ.0: calculation will terminate if the solution time step drops to (see *CONTROL_‌TERMINATION).
245+
EQ.1: solid elements or thick shell elements that cause the time step to drop to will erode; similarly, SPH particles that cause the time step to drop will be deactivated.
246+
EQ.10: shell elements with time step below will erode.
247+
EQ.11: same as ERODE = 1 but shell elements will also erode
248+
EQ.100: beam elements with time step below will erode.
249+
EQ.101: same as ERODE = 1 but beam elements will also erode
250+
EQ.110: beam and shell elements will erode.
251+
EQ.111: same as ERODE = 1 but beam and shell elements will also erode
252+
""" # nopep8
253+
return self._cards[0].get_value("erode")
254+
255+
@erode.setter
256+
def erode(self, value: int) -> None:
257+
if value not in [0, 1, 10, 11, 100, 101, 110, 111]:
258+
raise Exception("""erode must be one of {0,1,10,11,100,101,110,111}""")
259+
self._cards[0].set_value("erode", value)
260+
261+
@property
262+
def ms1st(self) -> int:
263+
"""Get or set the Limit mass scaling to the first step and fix the mass vector according to the time steps. The time step will not be fixed but may drop during the calculation from the specified minimum:
264+
EQ.0: no,
265+
EQ.1: yes.
266+
""" # nopep8
267+
return self._cards[0].get_value("ms1st")
268+
269+
@ms1st.setter
270+
def ms1st(self, value: int) -> None:
271+
if value not in [0, 1]:
272+
raise Exception("""ms1st must be one of {0,1}""")
273+
self._cards[0].set_value("ms1st", value)
274+
275+
@property
276+
def dt2msf(self) -> typing.Optional[float]:
277+
"""Get or set the Reduction factor for initial time step size to determine the minimum time step size permitted.
278+
""" # nopep8
279+
return self._cards[1].get_value("dt2msf")
280+
281+
@dt2msf.setter
282+
def dt2msf(self, value: float) -> None:
283+
self._cards[1].set_value("dt2msf", value)
284+
285+
@property
286+
def dt2mslc(self) -> typing.Optional[int]:
287+
"""Get or set the Load curve specifying DT2MS as a function of time during the explicit solutions phase. The load curve can only be used for increasing the magnitude of DT2MS. Consequently, the magnitude of DT2MS is taken as the maximum of the current value and the value from the load curve.
288+
""" # nopep8
289+
return self._cards[1].get_value("dt2mslc")
290+
291+
@dt2mslc.setter
292+
def dt2mslc(self, value: int) -> None:
293+
self._cards[1].set_value("dt2mslc", value)
294+
295+
@property
296+
def imscl(self) -> typing.Optional[int]:
297+
"""Get or set the Flag for selective mass scaling if and only if mass scaling active. Selective mass scaling does not scale the rigid body mass and is therefore more accurate. Since it is memory and CPU intensive, it should be applied only to small finely meshed parts. This option is available starting with the third revision of version 971.
298+
EQ.0: no selective mass scaling.
299+
EQ.1: all parts undergo selective mass scaling.
300+
LT.0: recommended. |IMSCL| is the part set ID of the parts that undergo selective mass scaling; all other parts are mass scaled the usual way
301+
""" # nopep8
302+
return self._cards[1].get_value("imscl")
303+
304+
@imscl.setter
305+
def imscl(self, value: int) -> None:
306+
self._cards[1].set_value("imscl", value)
307+
308+
@property
309+
def rmscl(self) -> float:
310+
"""Get or set the Flag for using rotational option in selective mass scaling
311+
EQ.0.: Only translational inertia are selectively mass scaled
312+
NE.0.: Both translational and rotational inertia are selectively mass scaled.
313+
""" # nopep8
314+
return self._cards[1].get_value("rmscl")
315+
316+
@rmscl.setter
317+
def rmscl(self, value: float) -> None:
318+
self._cards[1].set_value("rmscl", value)
319+
320+
@property
321+
def emscl(self) -> float:
322+
"""Get or set the Fraction of added mass from mass scaling that contributes to gravity loads, in addition to the physical mass. See also *LOAD_BODY, this number should be between 0 and 1.
323+
""" # nopep8
324+
return self._cards[1].get_value("emscl")
325+
326+
@emscl.setter
327+
def emscl(self, value: float) -> None:
328+
self._cards[1].set_value("emscl", value)
329+
330+
@property
331+
def ihdo(self) -> int:
332+
"""Get or set the Method for calculating solid element time steps:
333+
EQ.0: default method
334+
EQ.1: modified method to improve time step continuity.
335+
""" # nopep8
336+
return self._cards[1].get_value("ihdo")
337+
338+
@ihdo.setter
339+
def ihdo(self, value: int) -> None:
340+
if value not in [0, 1]:
341+
raise Exception("""ihdo must be one of {0,1}""")
342+
self._cards[1].set_value("ihdo", value)
343+
344+
@property
345+
def igado(self) -> int:
346+
"""Get or set the Method for calculating time steps for IGA elements:
347+
EQ.0: Default method(conservative)
348+
EQ.1 : account for interelement continuity(usually leads to larger time steps)
349+
""" # nopep8
350+
return self._cards[2].get_value("igado")
351+
352+
@igado.setter
353+
def igado(self, value: int) -> None:
354+
if value not in [0, 1]:
355+
raise Exception("""igado must be one of {0,1}""")
356+
self._cards[2].set_value("igado", value)
357+

0 commit comments

Comments
 (0)