Skip to content

Commit 4daa26c

Browse files
committed
Edits to some more PY files
1 parent 23eee09 commit 4daa26c

File tree

4 files changed

+482
-240
lines changed

4 files changed

+482
-240
lines changed

src/ansys/dyna/core/pre/dynaiga.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
IGA API
33
==========
44
5-
Module to create IGA dyna input deck
5+
Module for creating an IGA DYNA input deck.
66
"""
77

88
import logging
@@ -11,7 +11,7 @@
1111

1212

1313
class DynaIGA(DynaBase):
14-
"""Contains methods to create keyword related to IGA."""
14+
"""Contains methods for creating a keyword related to IGA."""
1515

1616
def __init__(self):
1717
DynaBase.__init__(self)
@@ -23,11 +23,12 @@ def create_section_igashell(self, secid, elform, shrf, thickness):
2323
Parameters
2424
----------
2525
secid : int
26-
Section ID. SECID is referenced on the \*PART card. A unique number or label must be specified.
26+
Section ID. ``SECID`` is referenced on the ``\*PART`` card.
27+
A unique number or label must be specified.
2728
elform : int
2829
Element formulation.
2930
shrf : float
30-
Shear correction factor which scales the transverse shear stress.
31+
Shear correction factor, which scales the transverse shear stress.
3132
thickness : float
3233
Shell thickness.
3334

src/ansys/dyna/core/pre/dynaisph.py

Lines changed: 97 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
ISPH API
33
==========
44
5-
Module to create ISPH dyna input deck
5+
Module for creating an ISPH (incompressible smooth particle hydrodynamics) DYNA input deck.
66
"""
77

88
import logging
@@ -11,7 +11,7 @@
1111

1212

1313
class DynaISPH(DynaBase):
14-
"""Contains methods to create keyword related to incompressible smooth particle hydrodynamics."""
14+
"""Contains methods for creating a keyword related to ISPH."""
1515

1616
def __init__(self):
1717
DynaBase.__init__(self)
@@ -26,24 +26,32 @@ def set_des(
2626
approximation_theory=0,
2727
max_velocty=1e15,
2828
):
29-
"""Provide controls related to SPH.
29+
"""Provide controls related to ISPH.
3030
3131
Parameters
3232
----------
33-
num_timestep : int
34-
Number of time steps between particle sorting.
35-
boxid : int
36-
SPH approximations are computed inside a specified box.
37-
When a particle has gone outside the BOX, it is deactivated.
38-
space_dimension : int
39-
Space dimension for SPH particles, EQ.3: 3D problems,
40-
EQ.2: 2D plane strain problems, EQ.-2: 2D axisymmetric problems
41-
neighbors : int
42-
Defines the initial number of neighbors per particle.
43-
approximation_theory : int
44-
Particle approximation theory.
45-
max_velocty : float
46-
Maximum value for velocity for the SPH particles.
33+
num_timestep : int, optional
34+
Number of time steps between particle sorting. The default
35+
is ``1``.
36+
boxid : int, optional
37+
Box ID. The default is ``0``. ISPH approximations are computed
38+
inside the specified box. When a particle has gone outside this
39+
box, it is deactivated.
40+
space_dimension : int, optional
41+
Space dimension for ISPH particles. The default is ``3``. Options
42+
are:
43+
44+
- EQ.3: 3D problems
45+
- EQ.2: 2D plane strain problems
46+
- EQ.-2: 2D axisymmetric problems
47+
48+
neighbors : int, optional
49+
Initial number of neighbors per particle. The default is ``150``.
50+
approximation_theory : int, optional
51+
Particle approximation theory. The default is ``0``.
52+
max_velocty : float, optional
53+
Maximum value for velocity for the ISPH particles. The default
54+
is ``1000000000000000.0``.
4755
4856
Returns
4957
-------
@@ -76,7 +84,7 @@ def save_file(self):
7684

7785

7886
class ISPHAnalysis:
79-
"""Provide controls related to SPH (Smooth Particle Hydrodynamics)."""
87+
"""Provide controls related to ISPH."""
8088

8189
def __init__(self, num_timestep=1):
8290
self.stub = DynaBase.get_stub()
@@ -89,35 +97,57 @@ def __init__(self, num_timestep=1):
8997
self.velocity_scaling = 0
9098

9199
def set_num_timestep(self, num_timestep):
92-
"""Set number of time steps between particle sorting."""
100+
"""Set the number of time steps between particle sorting.
101+
102+
Parameters
103+
----------
104+
num_timestep : int, optional
105+
Number of time steps between particle sorting. The default
106+
is ``1``.
107+
"""
93108
self.num_timestep = num_timestep
94109

95110
def set_box(self, box):
96-
"""Define box,SPH approximations are computed inside a specified box.
111+
"""Set the box. ISPH approximations are computed inside a specified box.
97112
98113
Parameters
99114
----------
100115
box : Box
101-
When a particle has gone outside the BOX, it is deactivated.
102-
This will save computational time by eliminating particles that no
103-
longer interact with the structure.
116+
Box for computing ISHPH approximattions. When a particle has gone
117+
outside this box, it is deactivated.
104118
"""
105119
self.box = box
106120

107121
def set_neighbors(self, neighbors):
108-
"""Define the initial number of neighbors per particle."""
122+
"""Set the initial number of neighbors per particle.
123+
124+
Parameters
125+
----------
126+
neighbors : int, optional
127+
Initial number of neighbors per particle.
128+
"""
109129
self.neighbors = neighbors
110130

111131
def set_particle_deactivation(self, deactivation):
112-
"""Define the type of BEM matrices as well as the way they are assembled."""
132+
"""Set the type of BEM matrices and the way they are assembled.
133+
134+
Parameters
135+
----------
136+
deactivation :
137+
"""
113138
self.particle_deactivation = deactivation
114139

115140
def set_velocity_scaling(self, scaling):
116-
"""Define the type of BEM matrices as well as the way they are assembled."""
141+
"""Set the type of BEM matrices and the way they are assembled.
142+
143+
Parameters
144+
----------
145+
scaling :
146+
"""
117147
self.velocity_scaling = scaling
118148

119149
def create(self):
120-
"""Create ISPHAnalysis."""
150+
"""Create an ISPH analysis."""
121151
if self.box == None:
122152
boxid = 0
123153
else:
@@ -140,7 +170,16 @@ def create(self):
140170

141171

142172
class SPHSection:
143-
"""Define section properties for SPH particles."""
173+
"""Defines section properties for ISPH particles.
174+
175+
Parameters
176+
----------
177+
cslh : float, optional
178+
hmin : float, optional
179+
hmax : float, optional
180+
sphini : int, optional
181+
182+
"""
144183

145184
def __init__(self, cslh=1.2, hmin=0.2, hmax=2.0, sphini=0):
146185
stub = DynaBase.get_stub()
@@ -149,22 +188,22 @@ def __init__(self, cslh=1.2, hmin=0.2, hmax=2.0, sphini=0):
149188

150189

151190
class MassflowPlane:
152-
"""Measure SPH mass flow rate across a defined plane.
191+
"""Measures ISPH mass flow rate across a defined plane.
153192
154193
Parameters
155194
----------
156-
particles : NodeSet,PartSet
157-
Node set or part set specifying the SPH particles to be measured.
195+
particles : NodeSet, PartSet
196+
Node set or part set specifying the ISPH particles to measure.
158197
surface : PartSet
159-
Part set ID or part ID defining the surface across which the flow rate is measured.
198+
Part set ID or part ID defining the surface across which to measure the flow rate.
160199
"""
161200

162201
def __init__(self, particles, surface):
163202
self.particles = particles
164203
self.surface = surface
165204

166205
def create(self, stub):
167-
"""Create mass flow plane."""
206+
"""Create a mass flow plane."""
168207
self.particles.create(stub)
169208
self.surface.create(stub)
170209
pid = self.particles.id
@@ -191,20 +230,22 @@ def create(self, stub):
191230

192231

193232
class ISPHFluidPart(Part):
194-
"""Generate SPH particles inside a given box.
233+
"""Generates ISPH particles inside a box.
195234
196235
Parameters
197236
----------
237+
pid : int
238+
Part ID.
198239
minpoint : Point
199240
Minimum x,y,z-coordinate.
200241
length : Point
201242
Box length in the x,y,z-direction.
202243
numdirx : int
203-
Number of SPH particles in the x-direction.
244+
Number of ISPH particles in the x-direction.
204245
numdiry : int
205-
Number of SPH particles in the y-direction.
246+
Number of ISPH particles in the y-direction.
206247
numdirz : int
207-
Number of SPH particles in the z-direction.
248+
Number of ISPH particles in the z-direction.
208249
"""
209250

210251
def __init__(self, pid, minpoint, length, numdirx, numdiry, numdirz):
@@ -230,21 +271,21 @@ def set_smoothing_length(self, initial, min, max, optional):
230271
Parameters
231272
----------
232273
initial : float
233-
Constant used to calculate the initial smoothing length of the particles.
274+
Constant for calculating the initial smoothing length of the particles.
234275
min : float
235276
Scale factor for the minimum smoothing length.
236277
max : float
237278
Scale factor for the maximum smoothing length.
238-
optional : float
239-
Optional initial smoothing length (overrides true smoothing length).
279+
optional : float, optional
280+
Initial smoothing length, which overrides the true smoothing length.
240281
"""
241282
self.cslh = initial
242283
self.hmin = min
243284
self.hmax = max
244285
self.sphini = optional
245286

246287
def create_particles(self):
247-
"""Create SPH particles inside a given box."""
288+
"""Create ISPH particles inside the box."""
248289
coords = (
249290
self.minpoint.x,
250291
self.minpoint.y,
@@ -259,11 +300,11 @@ def create_particles(self):
259300
)
260301

261302
def create_massflow_plane(self, surfaces):
262-
"""Measure SPH mass flow rate across a defined plane."""
303+
"""Measure ISPH mass flow rate across a defined plane."""
263304
self.massflowplane = MassflowPlane(PartSet([self.id]), surfaces)
264305

265306
def set_property(self):
266-
"""Set properties for SPH fluid part."""
307+
"""Set properties for an ISPH fluid part."""
267308
self.create_particles()
268309
self.massflowplane.create(self.stub)
269310
sec = SPHSection(cslh=self.cslh, hmin=self.hmin, hmax=self.hmax, sphini=self.sphini)
@@ -283,14 +324,16 @@ def set_property(self):
283324

284325

285326
class ISPHStructPart(Part):
286-
"""Generate and place SPH elements on the surface of triangular shell elements.
327+
"""Generates and places ISPH elements on the surface of triangular shell elements.
287328
288329
Parameters
289330
----------
331+
pid : int
332+
Part ID.
290333
couple_partset : PartSet
291-
Part or part set ID for the region of the mesh upon which the SPH elements will be placed.
334+
Part or part set ID for the region of the mesh to place the ISPH elements on.
292335
space : float
293-
Maximum space between SPH elements.
336+
Maximum space between ISPH elements.
294337
"""
295338

296339
def __init__(self, pid, couple_partset, space):
@@ -308,24 +351,27 @@ def __init__(self, pid, couple_partset, space):
308351
def set_smoothing_length(self, initial, min, max, optional):
309352
"""Calculate the smoothing length of the particles.
310353
354+
Parameters
355+
----------
311356
Parameters
312357
----------
313358
initial : float
314-
Constant used to calculate the initial smoothing length of the particles.
359+
Constant for calculating the initial smoothing length of the particles.
315360
min : float
316361
Scale factor for the minimum smoothing length.
317362
max : float
318363
Scale factor for the maximum smoothing length.
319-
optional : float
320-
Optional initial smoothing length (overrides true smoothing length).
364+
optional : float, optional
365+
Initial smoothing length, which overrides the true smoothing length.
366+
321367
"""
322368
self.cslh = initial
323369
self.hmin = min
324370
self.hmax = max
325371
self.sphini = optional
326372

327373
def create_particles(self):
328-
"""Create SPH elements on the surface of triangular shell elements."""
374+
"""Create ISPH elements on the surface of triangular shell elements."""
329375
sid = self.couple_partset.create(self.stub)
330376
if self.couple_partset.type == "PARTSET":
331377
type = 0
@@ -337,7 +383,7 @@ def create_particles(self):
337383
)
338384

339385
def set_property(self):
340-
"""Set properties for SPH structural part."""
386+
"""Set properties for the ISPH structural part."""
341387
self.create_particles()
342388
sec = SPHSection(cslh=self.cslh, hmin=self.hmin, hmax=self.hmax, sphini=self.sphini)
343389
self.secid = sec.id

0 commit comments

Comments
 (0)