Skip to content

Commit 41c2ded

Browse files
committed
Edits to first example and typo fixes
1 parent a1ccaf3 commit 41c2ded

File tree

9 files changed

+110
-98
lines changed

9 files changed

+110
-98
lines changed

examples/Airbag/airbag_deploy.py

Lines changed: 60 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22
Airbag deploy example
33
---------------------
44
5-
This example show how to create an Airbag deploy model with Pydyna-pre module.
6-
LS-DYNA version : ls-dyna_smp_d_R13.0_365-gf8a97bda2a_winx64_ifort190.exe
5+
This example shows how to create an airbag deploy model with the PyDNYA ``pre`` service.
6+
The executable file for LS-DYNA is ``ls-dyna_smp_d_R13.0_365-gf8a97bda2a_winx64_ifort190.exe``.
77
88
"""
9+
###############################################################################
10+
# Perform required imports
11+
# ~~~~~~~~~~~~~~~~~~~~~~~~
12+
# Import required imports.
913

1014
import os
1115
import sys
@@ -27,16 +31,16 @@
2731
)
2832

2933
###############################################################################
30-
# Manually start the dyna.core.pre server
31-
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32-
# Copy the folder pyDyna/src/ansys/dyna/core/pre/Server to a desired location
33-
# Start the dyna.core.pre server at this location as shown below
34+
# Manually start the ``pre`` server
35+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
36+
# Copy the ``pyDyna/src/ansys/dyna/core/pre/Server``folder to a desired location.
37+
# Start the ``pre``service at this location by running this command:
3438
#
35-
# python kwserver.py
39+
# ``python kwserver.py``
3640
#
37-
# Now the pre server is up and running and is waiting to be connected to the client
38-
# Connect to the server using the hostname and the port. In this example, default
39-
# "localhost" and port "50051" are used
41+
# Once the ``pre`` servic is running, you can connect a client to it using
42+
# the hostname and the port. This example uses the default local host and port
43+
# (``"localhost"`` and ``"50051"`` respectively).
4044

4145
from ansys.dyna.core.pre.dynamaterial import MatRigid, MatFabric
4246
from ansys.dyna.core.pre import examples
@@ -48,10 +52,10 @@
4852

4953

5054
###############################################################################
51-
# Start the Solution workflow
55+
# Start the solution workflow
5256
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~
53-
# Dynasolution class is like a workflow orchestrator.
54-
# It inherits methods from other classes and helps create a complete workflow
57+
# The ``DynaSolution`` class is like a workflow orchestrator.
58+
# It inherits methods from other classes and helps create a complete workflow.
5559
#
5660
airbag_solution = DynaSolution(hostname)
5761
fns = []
@@ -62,24 +66,25 @@
6266
###############################################################################
6367
# Create standard explicit control cards
6468
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
65-
# Dynasolution class is like a workflow orchestrator.
66-
# It inherits methods from other classes and helps create a complete workflow.
67-
# "set_termination" method here is used to set the termination time to 0.03 in *CONTROL_TERMINATION*.
68-
# DynaMech class automatically generates the common control cards used in
69-
# explicit problems. CONTROL_ACCURACY, CONTACT, BULK VISCOCITY, CONTACT
70-
# are all automatically generated
69+
# This code uses the ``set_termination`` method to set the termination time
70+
# to ``0.03`` in ``*CONTROL_TERMINATION*``. The ``DynaMech`` class
71+
# automatically generates the common control cards used in
72+
# explicit problems. ``CONTROL_ACCURACY``, ``CONTACT``, ``BULK VISCOCITY``,
73+
# and ``CONTACT``are all automatically generated.
74+
#
7175
airbag_solution.set_termination(0.03)
7276

7377
airbagdeploy = DynaMech()
7478
airbag_solution.add(airbagdeploy)
7579

7680
###############################################################################
77-
# Define *AIRBAG_SIMPLE_AIRBAG_MODEL*
78-
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
79-
# DynaMech class has Airbag function that can be used to create this keyword.
80-
# LSDYNA has many different AIRBAG models. Only SIMPLE_AIRBAG_MODEL is supported
81-
# by pydyna at this moment. Please contact us if there is an urgent need for other
82-
# Airbag models.
81+
# Define *AIRBAG_SIMPLE_AIRBAG_MODEL* as a keyword
82+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
83+
# Using the ``Airbag`` function in the ``DynaMech`` class, create
84+
# *AIRBAG_SIMPLE_AIRBAG_MODEL* as a keyword. While LS-DYNA has many different
85+
# airbag models, PyDNYA currently supports only one airbag model:
86+
# SIMPLE_AIRBAG_MODEL. If you have an urgent need for PyDYNA to support
87+
# another airbag model, email `[email protected] <mailto:[email protected]>`_.
8388

8489
airbag = Airbag(
8590
set=PartSet([3]),
@@ -94,17 +99,19 @@
9499
airbagdeploy.add(airbag)
95100

96101
###############################################################################
97-
# Define *RIGIDWALL_PLANAR*
98-
# ~~~~~~~~~~~~~~~~~~~~~~~~~
99-
# Infinite planar rigidwall is generated by defining the coordinates of the heat vector
100-
# and the tail vector of the plane.
102+
# Generate an infinite planar rigid wall
103+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
104+
# To generate an infinite planar rigidwall, define the coordinates of the heat
105+
# vector and the tail vector of the plane.
106+
#
101107
rigidwall = RigidwallPlanar(Point(0, 0, 0), Point(0, 1, 0), coulomb_friction_coefficient=0.5)
102108
airbagdeploy.add(rigidwall)
103109

104110
###############################################################################
105-
# Define *CONTACT_NODES_TO_SURFACE*
106-
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
107-
# A contact NODES_TO_SURFACE is defined here by passing a master set and a slave part set.
111+
# Define a contact *NODES_TO_SURFACE*
112+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
113+
# Define a contact NODES_TO_SURFACE by passing a master part set and a slave
114+
# part set.
108115

109116
contact = Contact(category=ContactCategory.NODES_TO_SURFACE)
110117
contact.set_friction_coefficient(static=0.5, dynamic=0.5)
@@ -114,15 +121,18 @@
114121
contact.set_slave_surface(surf1)
115122
contact.set_master_surface(surf2)
116123
airbagdeploy.contacts.add(contact)
124+
117125
###############################################################################
118-
# Define Material cards
126+
# Define material cards
119127
# ~~~~~~~~~~~~~~~~~~~~~
120-
# Dyna as we all know has over 300 materials that are used for varied applications.
121-
# Not all material cards are supported at this time. Some of the most commonly used materials
122-
# like MAT_ELASTIC, RIGID, PIECEWISE_LINEAR_PLASTICITY, FABRIC are currently supported in pydyna.
123-
# All the supported material can be accessed from the dynamaterial() class.
124-
# In the code block below, we define MAT_RIGID for the cylindrical tube and the bottom plate and MAT_FABRIC for
125-
# the airbag volume. Note here that the "platemat" has the contraints defined as well.
128+
# LS-DYNA has over 300 materials that are used for varied applications.
129+
# Whlie PyDYNA does not yet support all material cards, it does support some
130+
# of the most commonly used materials, including ``FABRIC``, `MAT_ELASTIC``,
131+
# ``PIECEWISE_LINEAR_PLASTICITY``, and ``RIGID``. All supported materials
132+
# are accessed from the ``dynamaterial`` class. In the following code,
133+
# ``MAT_RIGID`` is defined as the material for the cylindrical tube and the
134+
# bottom plate. ``MAT_FABRIC`` is defined as the material for the airbag volume.
135+
# Note that ``platemat`` has contraints defined as well.
126136

127137
platemat = MatRigid(
128138
mass_density=7.84e-4,
@@ -140,12 +150,13 @@
140150
)
141151

142152
###############################################################################
143-
# Define Sectional Properties
153+
# Define sectional properties
144154
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~
145-
# We now define the sectional properties of the parts. In this example we have three
146-
# shell parts. Each part is initialized as a ShellPart with a unique ID and the appropriate
147-
# shell formulation have been assigned. Again, not all element formulations are supported at this time.
148-
# The supported formulations can be found in the "dynabase" class
155+
# The following code defines the sectional properties of the parts. This example
156+
# has three shell parts. Each shell part is initialized as ``ShellPart`` with a
157+
# unique ID and an appropriate shell formulation has been assigned. Again,
158+
# PyDYNA does not yet support all element formulations. You can find the
159+
# supported formulations in ``dynabase`` class.
149160

150161
plate = ShellPart(1)
151162
plate.set_material(platemat)
@@ -167,11 +178,11 @@
167178
airbagdeploy.parts.add(airbagpart)
168179

169180
###############################################################################
170-
# Define Database Outputs ASCII and Binary
171-
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
172-
# "set_output_database" and "create_database_binary" methods are used here to define the
173-
# output frequency of the ASCII and Binary D3PLOT files. Finally the model is written out as
174-
# an input dyna key file by calling the save_file()
181+
# Define database outputs in ASCII and binary
182+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
183+
# Use the ``set_output_database()`` and ``create_database_binary``methods to define the
184+
# output frequency of the ASCII and binary D3PLOT files. The, use the ``save_file()``
185+
# method to write out the model as an input DYNA key file.
175186

176187
airbag_solution.set_output_database(
177188
abstat=2.0e-4, glstat=2.0e-4, matsum=2.0e-4, rcforc=2.0e-4, rbdout=2.0e-4, rwforc=2.0e-4

examples/README.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ Examples
55
========
66

77

8-
Here are a series of examples using LS-DYNA with the ``ansys-dyna-core`` library.
8+
Here are a series of examples using LS-DYNA with PyDYNA.

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

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

88
from .dynabase import * # noqa : F403
@@ -30,16 +30,16 @@ def create_control_output(self, npopt=0, neecho=0):
3030
npopt : int, optional
3131
Print suppression during the input phase flag for the D3HSP file.
3232
The default is ``0``. Options are:
33-
33+
3434
- EQ.0: No suppression.
3535
- EQ.1: Nodal coordinates, element connectivities, rigid wall definitions,
3636
nodal SPCs, initial velocities, initial strains, adaptive constraints, and
3737
SPR2/SPR3 constraints are not printed.
38-
38+
3939
neecho : int, optional
4040
Print suppression during the input phase flag for the echo file.
4141
The default is ``0``. Options are:
42-
42+
4343
- EQ.0: All data is printed.
4444
- EQ.1: Nodal printing is suppressed.
4545
- EQ.2: Element printing is suppressed.
@@ -196,10 +196,10 @@ def create_section_discrete(self, secid, dro=0, kd=0, v0=0, cl=0, fd=0, cdl=0, t
196196
Section ID.
197197
dro : int, optional
198198
Displacement/rotation. The default is ``0``. Options are:
199-
199+
200200
- EQ.0: Material describes a translational spring/damper.
201201
- EQ.1: Material describes a torsional spring/damper.
202-
202+
203203
kd : float, optional
204204
Dynamic magnification factor. The default is ``0``.
205205
v0 : float, optional
@@ -327,10 +327,10 @@ class Airbag:
327327
----------
328328
Set : SegmentSet or PartSet
329329
Set. Options are:
330-
330+
331331
- EQ.0: Segment set ID.
332332
- EQ.1: Part set ID.
333-
333+
334334
heat_capacity_at_constant_volume : float, optional
335335
Heat capacity at constant volume. The default is ``0``.
336336
heat_capacity_at_constant_pressure : float, optional

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def set_frequency_response_function(
8383
Parameters
8484
----------
8585
excitation_input_set :
86-
excitation_input_dof :
86+
excitation_input_dof :
8787
excitation_input_type :
8888
max_natural_frequency :
8989
modal_damping_coefficient :

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def fill(
7373
Material name.
7474
geometry_type : string
7575
Geometry type. The default is ``"Null"``. Options are:
76-
76+
7777
- BOXCOR
7878
- BOXCPT
7979
- CYLINDER
@@ -82,7 +82,7 @@ def fill(
8282
- PLANE
8383
- SEGSET
8484
- SPHERE
85-
85+
8686
nsample : int, optional
8787
Number of sampling points. The default is ``4``.
8888
define_geometry_parameters : list
@@ -94,7 +94,7 @@ def fill(
9494
vid : int, optional
9595
Flag for assigning the initial velocity to the material filling the domain.
9696
The default is ``0``.
97-
reference_pressure :
97+
reference_pressure :
9898
9999
Returns
100100
-------
@@ -312,7 +312,7 @@ def set_output_database(self, matsum=0, glstat=0):
312312
matsum : float, optional
313313
Time interval between outputs of part energies. The
314314
default is ``0``.
315-
glstat : float, optinal
315+
glstat : float, optional
316316
Time interval between outputs of global statistics and energies.
317317
The default is ``0``.
318318

0 commit comments

Comments
 (0)