Skip to content

Commit a1ccaf3

Browse files
committed
Submit edits to PY files for API
1 parent 2752179 commit a1ccaf3

File tree

8 files changed

+410
-209
lines changed

8 files changed

+410
-209
lines changed

src/ansys/dyna/core/pre/README.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# PyDYNA ``pre`` service
22

3-
The PyDYNA ``pre`` service provide the ability to create a keyword input deck through the gRPC framework.
3+
The PyDYNA ``pre`` service provide the ability to create keyword input decks through the gRPC framework.
44

55
## Run the ``pre`` service in a virtual environment
66

@@ -12,20 +12,20 @@ Install virtualenv:
1212
pip install virtualenv
1313
```
1414

15-
Create a Python virtual environment of the same version as ``virtualenv``,installed into the subdirectory "venv":
15+
Create a Python virtual environment of the same version as ``virtualenv``, installed in the subdirectory ``venv``:
1616

1717
```
1818
virtualenv venv
1919
```
2020

21-
Activate the ``venv`` environment on Windows by running these commands:
21+
On Windows, activate the ``venv`` environment by running these commands:
2222

2323
```
2424
cd venv
2525
./Scripts/activate
2626
```
2727

28-
Activate the ``venv`` environment on Linux by running these commands:
28+
On Linux, activate the ``venv`` environment by running these commands:
2929

3030
```
3131
cd venv
@@ -57,9 +57,9 @@ cd pyDyna/requirement/pythonxx
5757
pip install -r requirements.txt
5858
```
5959

60-
## Start the Server
60+
## Start the server
6161

62-
So far, Python 3.6 through 3-8 can be used to start server. Validate by running
62+
Python 3.6 through 3.8 can be used to start the server. Validate by running
6363
these commands:
6464

6565
```
@@ -84,7 +84,7 @@ Server/
8484

8585
### Start the server on Windows
8686

87-
Start the server on Windows by running these commands:
87+
On Windows, start the server by running these commands:
8888

8989
```shell
9090
(venv) C:\pyDyna\ansys\dyna\pre\Server> python .\kwserver.py
@@ -93,18 +93,17 @@ kwgrpc Server listening on: localhost:50051
9393

9494
### Start the server on Linux
9595

96-
Start the server on Linux by running these commands:
96+
On Linux, start the server by running these commands:
9797

9898
```
9999
(venv) :~/pyDyna/ansys/dyna/pre/Server> python kwserver.py
100100
```
101101

102102
## Run the PyDYNA ``pre`` service
103103

104-
See the ``Examples`` folder for some basic usage examples. More
105-
examples are to be added later.
104+
See the ``Examples`` folder for basic usage examples.
106105

107-
### Structure ALE demo
106+
### S-ALE (Structure ALE) demo
108107

109108
Go to the ``pyDyna/examples/pre`` directory and run the ``sale_efp.py`` file:
110109

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

Lines changed: 84 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Mechanical API
33
==============
44
5-
Module to setup Explicit or Implicit analysis
5+
Module for settting up explicit or implicit analysis.
66
"""
77

88
from .dynabase import * # noqa : F403
@@ -15,7 +15,7 @@ class AnalysisType(Enum):
1515

1616

1717
class DynaMech(DynaBase):
18-
"""Define an Mechanical analysis."""
18+
"""Defines a Mechanical analysis."""
1919

2020
def __init__(self, analysis=AnalysisType.EXPLICIT):
2121
DynaBase.__init__(self)
@@ -27,18 +27,23 @@ def create_control_output(self, npopt=0, neecho=0):
2727
2828
Parameters
2929
----------
30-
npopt : int
31-
Print suppression during input phase flag for the d3hsp file:
32-
EQ.0: No suppression.
33-
EQ.1: Nodal coordinates, element connectivities, rigid wall definitions,
34-
nodal SPCs, initial velocities, initial strains, adaptive constraints, and
35-
SPR2/SPR3 constraints are not printed.
36-
neecho : int
37-
Print suppression during input phase flag for echo file:
38-
EQ.0: All data printed.
39-
EQ.1: Nodal printing is suppressed.
40-
EQ.2: Element printing is suppressed.
41-
EQ.3: Both nodal and element printing is suppressed.
30+
npopt : int, optional
31+
Print suppression during the input phase flag for the D3HSP file.
32+
The default is ``0``. Options are:
33+
34+
- EQ.0: No suppression.
35+
- EQ.1: Nodal coordinates, element connectivities, rigid wall definitions,
36+
nodal SPCs, initial velocities, initial strains, adaptive constraints, and
37+
SPR2/SPR3 constraints are not printed.
38+
39+
neecho : int, optional
40+
Print suppression during the input phase flag for the echo file.
41+
The default is ``0``. Options are:
42+
43+
- EQ.0: All data is printed.
44+
- EQ.1: Nodal printing is suppressed.
45+
- EQ.2: Element printing is suppressed.
46+
- EQ.3: Both nodal and element printing is suppressed.
4247
4348
Returns
4449
-------
@@ -50,14 +55,14 @@ def create_control_output(self, npopt=0, neecho=0):
5055
return ret
5156

5257
def set_init_velocity(self, translational=Velocity(0, 0, 0), rotational=RotVelocity(0, 0, 0)):
53-
"""Define initial nodal point velocities using nodal set ID.
58+
"""Define initial nodal point velocities using a nodal set ID.
5459
5560
Parameters
5661
----------
5762
nsid : int
5863
Nodal set ID.
5964
translational : Velocity
60-
Initial translational velocity in x,y,z-direction.
65+
Initial translational velocity in the x,y,z-direction.
6166
rotational : RotVelocity
6267
Initial rotational velocity about the x,y,z-axis.
6368
@@ -86,20 +91,20 @@ def create_defineorientation(self, vid, iop, vector, node1, node2):
8691
vid : int
8792
Orientation vector ID.
8893
iop : int
89-
Option:
94+
Options are:
9095
91-
* EQ.0: deflections/rotations are measured and forces/moments applied
96+
- EQ.0: Deflections/rotations are measured and forces/moments are applied
9297
along the following orientation vector.
93-
* EQ.1: deflections/rotations are measured and forces/moments applied
98+
- EQ.1: Deflections/rotations are measured and forces/moments are applied
9499
along the axis between the two spring/damper nodes projected onto the plane normal
95100
to the following orientation vector.
96-
* EQ.2: deflections/rotations are measured and forces/moments applied
101+
- EQ.2: Deflections/rotations are measured and forces/moments are applied
97102
along a vector defined by the following two nodes.
98-
* EQ.3: deflections/rotations are measured and forces/moments applied
103+
- EQ.3: Deflections/rotations are measured and forces/moments are applied
99104
along the axis between the two spring/damper nodes projected onto the
100105
plane normal to the a vector defined by the following two nodes.
101106
vector : list [x,y,z]
102-
x,y,z : x,y,z-value of orientation vector.
107+
x,y,z : x,y,z-value of the orientation vector.
103108
node1 : int
104109
Node 1 ID.
105110
node2 : int
@@ -122,13 +127,13 @@ def create_shellset(self, option, title, sid, eids):
122127
Parameters
123128
----------
124129
option : string
125-
Available options:<BLANK>,LIST,GENERAL
130+
Available options. Choices are ``<BLANK>``,``LIST``, and ``GENERAL``.
126131
title : string
127-
Define title for shell set.
132+
Title for the shell set.
128133
sid : int
129134
Set ID.
130135
eids : list
131-
Shell element IDs.
136+
List of shell element IDs.
132137
133138
Returns
134139
-------
@@ -145,7 +150,7 @@ def create_solidset(self, title, sid, ki):
145150
Parameters
146151
----------
147152
title : string
148-
Define title for solid set.
153+
Title for the set of solid elements.
149154
sid : int
150155
Set ID.
151156
ki : list
@@ -166,9 +171,9 @@ def create_section_solid(self, title, secid, elform):
166171
Parameters
167172
----------
168173
title : string
169-
Define title for section solid.
174+
Title for section solid.
170175
secid : int
171-
Section ID. SECID is referenced on the \*PART card.
176+
Section ID. ``SECID`` is referenced on the ``\*PART`` card.
172177
A unique number must be specified.
173178
elform : int
174179
Element formulation options.
@@ -189,22 +194,24 @@ def create_section_discrete(self, secid, dro=0, kd=0, v0=0, cl=0, fd=0, cdl=0, t
189194
----------
190195
secid : int
191196
Section ID.
192-
dro : int
193-
Displacement/Rotation Option:
194-
EQ.0: the material describes a translational spring/damper,
195-
EQ.1: the material describes a torsional spring/damper.
196-
kd : float
197-
Dynamic magnification factor.
198-
v0 : float
199-
Test velocity.
200-
cl : float
201-
Clearance.
202-
fd : float
203-
Failure deflection.
204-
cdl : float
205-
Deflection limit in compression.
206-
cd1 : float
207-
Deflection limit in tension.
197+
dro : int, optional
198+
Displacement/rotation. The default is ``0``. Options are:
199+
200+
- EQ.0: Material describes a translational spring/damper.
201+
- EQ.1: Material describes a torsional spring/damper.
202+
203+
kd : float, optional
204+
Dynamic magnification factor. The default is ``0``.
205+
v0 : float, optional
206+
Test velocity. The default is ``0``.
207+
cl : float, optional
208+
Clearance. The default is ``0``.
209+
fd : float, optional
210+
Failure deflection. The default is ``0``.
211+
cdl : float, optional
212+
Deflection limit in compression. The default is ``0``.
213+
td1 : float, optional
214+
Deflection limit in tension. The default is ``0``.
208215
209216
Returns
210217
-------
@@ -226,16 +233,16 @@ def create_hourglass(self, ghid, ihq, qm=0.1, q1=1.5, q2=0.06, qb=1e-9, qw=1e-9)
226233
Hourglass ID. A unique number or label must be specified.
227234
ihq : int
228235
Hourglass control type.
229-
qm : float
230-
Hourglass coefficient.
231-
q1 : float
232-
Quadratic bulk viscosity coefficient.
233-
q2 : float
234-
Linear bulk viscosity coefficient.
235-
qb : float
236-
Hourglass coefficient for shell bending.
237-
qw : float
238-
Hourglass coefficient for shell warping.
236+
qm : float, optional
237+
Hourglass coefficient. The default is ``0.1``.
238+
q1 : float, optional
239+
Quadratic bulk viscosity coefficient. The default is ``1.5``.
240+
q2 : float, optional
241+
Linear bulk viscosity coefficient. The default is ``0.06``.
242+
qb : float, optional
243+
Hourglass coefficient for shell bending. The default is ``1e-09``.
244+
qw : float, optional
245+
Hourglass coefficient for shell warping. The default is ``1e-09``.
239246
240247
Returns
241248
-------
@@ -314,26 +321,31 @@ def save_file(self, defaultsetting=1):
314321

315322

316323
class Airbag:
317-
"""Define an airbag or control volume.
324+
"""Defines an airbag or control volume.
318325
319326
Parameters
320327
----------
321-
Set : SegmentSet/PartSet
322-
Set : EQ.0:segment EQ.1: part set ID.
323-
heat_capacity_at_constant_volume : float
324-
Heat capacity at constant volume.
325-
heat_capacity_at_constant_pressure : float
326-
Heat capacity at constant pressure.
327-
input_gas_temperature : float
328-
Temperature of input gas.
329-
input_mass_flow_rate : int
330-
Load curve ID specifying input mass flow rate.
331-
shape_factor_for_exit_hole : float
332-
Shape factor for exit hole.
333-
ambient_pressure : float
334-
Ambient pressure.
335-
ambient_density : float
336-
Ambient density.
328+
Set : SegmentSet or PartSet
329+
Set. Options are:
330+
331+
- EQ.0: Segment set ID.
332+
- EQ.1: Part set ID.
333+
334+
heat_capacity_at_constant_volume : float, optional
335+
Heat capacity at constant volume. The default is ``0``.
336+
heat_capacity_at_constant_pressure : float, optional
337+
Heat capacity at constant pressure. The default is ``0``.
338+
input_gas_temperature : float, optional
339+
Temperature of the input gas. The default is ``0``.
340+
input_mass_flow_rate : int, optional
341+
Load curve ID specifying the input mass flow rate.
342+
The default is ``0``.
343+
shape_factor_for_exit_hole : float, optional
344+
Shape factor for exit hole. The default is ``0``.
345+
ambient_pressure : float, optional
346+
Ambient pressure. The default is ``0``.
347+
ambient_density : float, optional
348+
Ambient density. The default is ``0``.
337349
338350
Returns
339351
-------
@@ -367,7 +379,7 @@ def __init__(
367379
self.sidtyp = 1
368380

369381
def create(self):
370-
"""Create airbag."""
382+
"""Create an airbag."""
371383
self.stub.CreateAirbagModel(
372384
AirbagModelRequest(
373385
modeltype="SIMPLE_AIRBAG_MODEL",

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

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

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

1212

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

1616
def __init__(self):
1717
DynaBase.__init__(self)
@@ -56,7 +56,7 @@ class ResponseType(Enum):
5656

5757

5858
class FrequencyDomain:
59-
"""Provide a way of defining and solving frequency domain vibration and acoustic problems."""
59+
"""Provides a way of defining and solving frequency domain vibration and acoustic problems."""
6060

6161
def __init__(self):
6262
self.stub = DynaBase.get_stub()
@@ -82,8 +82,20 @@ def set_frequency_response_function(
8282
8383
Parameters
8484
----------
85-
box : Box
86-
When l save eract with the structure.
85+
excitation_input_set :
86+
excitation_input_dof :
87+
excitation_input_type :
88+
max_natural_frequency :
89+
modal_damping_coefficient :
90+
modal_damping_coefficient_curve :
91+
modal_damping_coefficient_curve_type :
92+
response_output_set :
93+
response_output_dof :
94+
response_output_type :
95+
frf_output_min_frequency :
96+
frf_output_max_frequency :
97+
frf_output_num_frequency :
98+
8799
"""
88100
self.defined_frf = True
89101
self.n1 = excitation_input_set
@@ -101,7 +113,7 @@ def set_frequency_response_function(
101113
self.nfreq = frf_output_num_frequency
102114

103115
def create(self):
104-
"""Define frequency domain vibration and acoustic problems."""
116+
"""Define a frequency domain vibration and acoustic problem."""
105117
if self.defined_frf:
106118
if self.lcdam is not None:
107119
cid = self.lcdam.create(self.stub)

0 commit comments

Comments
 (0)