|
2 | 2 | Airbag deploy example
|
3 | 3 | ---------------------
|
4 | 4 |
|
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``. |
7 | 7 |
|
8 | 8 | """
|
| 9 | +############################################################################### |
| 10 | +# Perform required imports |
| 11 | +# ~~~~~~~~~~~~~~~~~~~~~~~~ |
| 12 | +# Import required imports. |
9 | 13 |
|
10 | 14 | import os
|
11 | 15 | import sys
|
|
27 | 31 | )
|
28 | 32 |
|
29 | 33 | ###############################################################################
|
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: |
34 | 38 | #
|
35 |
| -# python kwserver.py |
| 39 | +# ``python kwserver.py`` |
36 | 40 | #
|
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). |
40 | 44 |
|
41 | 45 | from ansys.dyna.core.pre.dynamaterial import MatRigid, MatFabric
|
42 | 46 | from ansys.dyna.core.pre import examples
|
|
48 | 52 |
|
49 | 53 |
|
50 | 54 | ###############################################################################
|
51 |
| -# Start the Solution workflow |
| 55 | +# Start the solution workflow |
52 | 56 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
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. |
55 | 59 | #
|
56 | 60 | airbag_solution = DynaSolution(hostname)
|
57 | 61 | fns = []
|
|
62 | 66 | ###############################################################################
|
63 | 67 | # Create standard explicit control cards
|
64 | 68 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
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 | +# |
71 | 75 | airbag_solution.set_termination(0.03)
|
72 | 76 |
|
73 | 77 | airbagdeploy = DynaMech()
|
74 | 78 | airbag_solution.add(airbagdeploy)
|
75 | 79 |
|
76 | 80 | ###############################################################################
|
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]>`_. |
83 | 88 |
|
84 | 89 | airbag = Airbag(
|
85 | 90 | set=PartSet([3]),
|
|
94 | 99 | airbagdeploy.add(airbag)
|
95 | 100 |
|
96 | 101 | ###############################################################################
|
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 | +# |
101 | 107 | rigidwall = RigidwallPlanar(Point(0, 0, 0), Point(0, 1, 0), coulomb_friction_coefficient=0.5)
|
102 | 108 | airbagdeploy.add(rigidwall)
|
103 | 109 |
|
104 | 110 | ###############################################################################
|
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. |
108 | 115 |
|
109 | 116 | contact = Contact(category=ContactCategory.NODES_TO_SURFACE)
|
110 | 117 | contact.set_friction_coefficient(static=0.5, dynamic=0.5)
|
|
114 | 121 | contact.set_slave_surface(surf1)
|
115 | 122 | contact.set_master_surface(surf2)
|
116 | 123 | airbagdeploy.contacts.add(contact)
|
| 124 | + |
117 | 125 | ###############################################################################
|
118 |
| -# Define Material cards |
| 126 | +# Define material cards |
119 | 127 | # ~~~~~~~~~~~~~~~~~~~~~
|
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. |
126 | 136 |
|
127 | 137 | platemat = MatRigid(
|
128 | 138 | mass_density=7.84e-4,
|
|
140 | 150 | )
|
141 | 151 |
|
142 | 152 | ###############################################################################
|
143 |
| -# Define Sectional Properties |
| 153 | +# Define sectional properties |
144 | 154 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
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. |
149 | 160 |
|
150 | 161 | plate = ShellPart(1)
|
151 | 162 | plate.set_material(platemat)
|
|
167 | 178 | airbagdeploy.parts.add(airbagpart)
|
168 | 179 |
|
169 | 180 | ###############################################################################
|
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. |
175 | 186 |
|
176 | 187 | airbag_solution.set_output_database(
|
177 | 188 | abstat=2.0e-4, glstat=2.0e-4, matsum=2.0e-4, rcforc=2.0e-4, rbdout=2.0e-4, rwforc=2.0e-4
|
|
0 commit comments