2
2
ISPH API
3
3
==========
4
4
5
- Module to create ISPH dyna input deck
5
+ Module for creating an ISPH (incompressible smooth particle hydrodynamics) DYNA input deck.
6
6
"""
7
7
8
8
import logging
11
11
12
12
13
13
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 ."""
15
15
16
16
def __init__ (self ):
17
17
DynaBase .__init__ (self )
@@ -26,24 +26,32 @@ def set_des(
26
26
approximation_theory = 0 ,
27
27
max_velocty = 1e15 ,
28
28
):
29
- """Provide controls related to SPH .
29
+ """Provide controls related to ISPH .
30
30
31
31
Parameters
32
32
----------
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``.
47
55
48
56
Returns
49
57
-------
@@ -76,7 +84,7 @@ def save_file(self):
76
84
77
85
78
86
class ISPHAnalysis :
79
- """Provide controls related to SPH (Smooth Particle Hydrodynamics) ."""
87
+ """Provide controls related to ISPH ."""
80
88
81
89
def __init__ (self , num_timestep = 1 ):
82
90
self .stub = DynaBase .get_stub ()
@@ -89,35 +97,57 @@ def __init__(self, num_timestep=1):
89
97
self .velocity_scaling = 0
90
98
91
99
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
+ """
93
108
self .num_timestep = num_timestep
94
109
95
110
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.
97
112
98
113
Parameters
99
114
----------
100
115
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.
104
118
"""
105
119
self .box = box
106
120
107
121
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
+ """
109
129
self .neighbors = neighbors
110
130
111
131
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
+ """
113
138
self .particle_deactivation = deactivation
114
139
115
140
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
+ """
117
147
self .velocity_scaling = scaling
118
148
119
149
def create (self ):
120
- """Create ISPHAnalysis ."""
150
+ """Create an ISPH analysis ."""
121
151
if self .box == None :
122
152
boxid = 0
123
153
else :
@@ -140,7 +170,16 @@ def create(self):
140
170
141
171
142
172
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
+ """
144
183
145
184
def __init__ (self , cslh = 1.2 , hmin = 0.2 , hmax = 2.0 , sphini = 0 ):
146
185
stub = DynaBase .get_stub ()
@@ -149,22 +188,22 @@ def __init__(self, cslh=1.2, hmin=0.2, hmax=2.0, sphini=0):
149
188
150
189
151
190
class MassflowPlane :
152
- """Measure SPH mass flow rate across a defined plane.
191
+ """Measures ISPH mass flow rate across a defined plane.
153
192
154
193
Parameters
155
194
----------
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 .
158
197
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.
160
199
"""
161
200
162
201
def __init__ (self , particles , surface ):
163
202
self .particles = particles
164
203
self .surface = surface
165
204
166
205
def create (self , stub ):
167
- """Create mass flow plane."""
206
+ """Create a mass flow plane."""
168
207
self .particles .create (stub )
169
208
self .surface .create (stub )
170
209
pid = self .particles .id
@@ -191,20 +230,22 @@ def create(self, stub):
191
230
192
231
193
232
class ISPHFluidPart (Part ):
194
- """Generate SPH particles inside a given box.
233
+ """Generates ISPH particles inside a box.
195
234
196
235
Parameters
197
236
----------
237
+ pid : int
238
+ Part ID.
198
239
minpoint : Point
199
240
Minimum x,y,z-coordinate.
200
241
length : Point
201
242
Box length in the x,y,z-direction.
202
243
numdirx : int
203
- Number of SPH particles in the x-direction.
244
+ Number of ISPH particles in the x-direction.
204
245
numdiry : int
205
- Number of SPH particles in the y-direction.
246
+ Number of ISPH particles in the y-direction.
206
247
numdirz : int
207
- Number of SPH particles in the z-direction.
248
+ Number of ISPH particles in the z-direction.
208
249
"""
209
250
210
251
def __init__ (self , pid , minpoint , length , numdirx , numdiry , numdirz ):
@@ -230,21 +271,21 @@ def set_smoothing_length(self, initial, min, max, optional):
230
271
Parameters
231
272
----------
232
273
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.
234
275
min : float
235
276
Scale factor for the minimum smoothing length.
236
277
max : float
237
278
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.
240
281
"""
241
282
self .cslh = initial
242
283
self .hmin = min
243
284
self .hmax = max
244
285
self .sphini = optional
245
286
246
287
def create_particles (self ):
247
- """Create SPH particles inside a given box."""
288
+ """Create ISPH particles inside the box."""
248
289
coords = (
249
290
self .minpoint .x ,
250
291
self .minpoint .y ,
@@ -259,11 +300,11 @@ def create_particles(self):
259
300
)
260
301
261
302
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."""
263
304
self .massflowplane = MassflowPlane (PartSet ([self .id ]), surfaces )
264
305
265
306
def set_property (self ):
266
- """Set properties for SPH fluid part."""
307
+ """Set properties for an ISPH fluid part."""
267
308
self .create_particles ()
268
309
self .massflowplane .create (self .stub )
269
310
sec = SPHSection (cslh = self .cslh , hmin = self .hmin , hmax = self .hmax , sphini = self .sphini )
@@ -283,14 +324,16 @@ def set_property(self):
283
324
284
325
285
326
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.
287
328
288
329
Parameters
289
330
----------
331
+ pid : int
332
+ Part ID.
290
333
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 .
292
335
space : float
293
- Maximum space between SPH elements.
336
+ Maximum space between ISPH elements.
294
337
"""
295
338
296
339
def __init__ (self , pid , couple_partset , space ):
@@ -308,24 +351,27 @@ def __init__(self, pid, couple_partset, space):
308
351
def set_smoothing_length (self , initial , min , max , optional ):
309
352
"""Calculate the smoothing length of the particles.
310
353
354
+ Parameters
355
+ ----------
311
356
Parameters
312
357
----------
313
358
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.
315
360
min : float
316
361
Scale factor for the minimum smoothing length.
317
362
max : float
318
363
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
+
321
367
"""
322
368
self .cslh = initial
323
369
self .hmin = min
324
370
self .hmax = max
325
371
self .sphini = optional
326
372
327
373
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."""
329
375
sid = self .couple_partset .create (self .stub )
330
376
if self .couple_partset .type == "PARTSET" :
331
377
type = 0
@@ -337,7 +383,7 @@ def create_particles(self):
337
383
)
338
384
339
385
def set_property (self ):
340
- """Set properties for SPH structural part."""
386
+ """Set properties for the ISPH structural part."""
341
387
self .create_particles ()
342
388
sec = SPHSection (cslh = self .cslh , hmin = self .hmin , hmax = self .hmax , sphini = self .sphini )
343
389
self .secid = sec .id
0 commit comments