|
1 | 1 | """
|
| 2 | +.. _ref_airbag_deploy: |
2 | 3 | Airbag deploy example
|
3 |
| -===================== |
| 4 | +--------------------- |
4 | 5 |
|
5 |
| -This example show how to create an Airbag deploy model with Pydyna-pre module. \n |
| 6 | +This example show how to create an Airbag deploy model with Pydyna-pre module. |
6 | 7 | LS-DYNA version : ls-dyna_smp_d_R13.0_365-gf8a97bda2a_winx64_ifort190.exe
|
| 8 | +
|
7 | 9 | """
|
8 | 10 |
|
9 | 11 | import os
|
|
24 | 26 | ShellPart,
|
25 | 27 | ShellFormulation,
|
26 | 28 | )
|
| 29 | + |
| 30 | +############################################################################### |
| 31 | +# Manually start the dyna.core.pre server |
| 32 | +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 33 | +# Copy the folder pyDyna/src/ansys/dyna/core/pre/Server to a desired location |
| 34 | +# Start the dyna.core.pre server at this location as shown below |
| 35 | +# |
| 36 | +# python kwserver.py |
| 37 | +# |
| 38 | +# Now the pre server is up and running and is waiting to be connected to the client |
| 39 | +# Connect to the server using the hostname and the port. In this example, default |
| 40 | +# "localhost" and port "50051" are used |
| 41 | + |
27 | 42 | from ansys.dyna.core.pre.dynamaterial import MatRigid, MatFabric
|
28 | 43 | from ansys.dyna.core.pre import examples
|
29 | 44 | # sphinx_gallery_thumbnail_path = '_static/pre/airbag/airbag.png'
|
30 | 45 |
|
31 | 46 | hostname = "localhost"
|
32 | 47 | if len(sys.argv) > 1:
|
33 | 48 | hostname = sys.argv[1]
|
| 49 | + |
| 50 | + |
| 51 | +############################################################################### |
| 52 | +# Start the Solution workflow |
| 53 | +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 54 | +# Dynasolution class is like a workflow orchestrator. |
| 55 | +# It inherits methods from other classes and helps create a complete workflow |
| 56 | +# |
34 | 57 | airbag_solution = DynaSolution(hostname)
|
35 | 58 | fns = []
|
36 | 59 | # path = sys.path[0] + os.sep + "input" + os.sep + "airbag_deploy" + os.sep
|
37 | 60 | path = examples.airbag_deploy + os.sep
|
38 | 61 | fns.append(path + "airbag_deploy.k")
|
39 | 62 | airbag_solution.open_files(fns)
|
40 |
| - |
| 63 | +############################################################################### |
| 64 | +# Create standard explicit control cards |
| 65 | +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 66 | +# Dynasolution class is like a workflow orchestrator. |
| 67 | +# It inherits methods from other classes and helps create a complete workflow. |
| 68 | +# "set_termination" method here is used to set the termination time to 0.03 in *CONTROL_TERMINATION. |
| 69 | +# DynaMech class automatically generates the common control cards used in |
| 70 | +# explicit problems. CONTROL_ACCURACY, CONTACT, BULK VISCOCITY, CONTACT |
| 71 | +# are all automatically generated |
41 | 72 | airbag_solution.set_termination(0.03)
|
42 | 73 |
|
43 | 74 | airbagdeploy = DynaMech()
|
44 | 75 | airbag_solution.add(airbagdeploy)
|
45 | 76 |
|
| 77 | +############################################################################### |
| 78 | +# Define *AIRBAG_SIMPLE_AIRBAG_MODEL |
| 79 | +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 80 | +# DynaMech class has Airbag function that can be used to create this keyword. |
| 81 | +# LSDYNA has many different AIRBAG models. Only SIMPLE_AIRBAG_MODEL is supported |
| 82 | +# by pydyna at this moment. Please contact us if there is an urgent need for other |
| 83 | +# Airbag models. |
| 84 | + |
46 | 85 | airbag = Airbag(
|
47 | 86 | set=PartSet([3]),
|
48 | 87 | heat_capacity_at_constant_volume=1.736e3,
|
|
55 | 94 | )
|
56 | 95 | airbagdeploy.add(airbag)
|
57 | 96 |
|
| 97 | +############################################################################### |
| 98 | +# Define *RIGIDWALL_PLANAR |
| 99 | +# ~~~~~~~~~~~~~~~~~~~~~~~~ |
| 100 | +# Infinite planar rigidwall is generated by defining the coordinates of the heat vector |
| 101 | +# and the tail vector of the plane. |
58 | 102 | rigidwall = RigidwallPlanar(Point(0, 0, 0), Point(0, 1, 0), coulomb_friction_coefficient=0.5)
|
59 | 103 | airbagdeploy.add(rigidwall)
|
60 | 104 |
|
| 105 | +############################################################################### |
| 106 | +# Define *CONTACT_NODES_TO_SURFACE |
| 107 | +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 108 | +# A contact NODES_TO_SURFACE is defined here by passing a master set and a slave part set. |
| 109 | + |
61 | 110 | contact = Contact(category=ContactCategory.NODES_TO_SURFACE)
|
62 | 111 | contact.set_friction_coefficient(static=0.5, dynamic=0.5)
|
63 | 112 | surf1 = ContactSurface(PartSet([3]))
|
|
66 | 115 | contact.set_slave_surface(surf1)
|
67 | 116 | contact.set_master_surface(surf2)
|
68 | 117 | airbagdeploy.contacts.add(contact)
|
| 118 | +############################################################################### |
| 119 | +# Define Material cards |
| 120 | +# ~~~~~~~~~~~~~~~~~~~~~ |
| 121 | +# Dyna as we all know has over 300 materials that are used for varied applications. |
| 122 | +# Not all material cards are supported at this time. Some of the most commonly used materials |
| 123 | +# like MAT_ELASTIC, RIGID, PIECEWISE_LINEAR_PLASTICITY, FABRIC are currently supported in pydyna. |
| 124 | +# All the supported material can be accessed from the dynamaterial() class. |
| 125 | +# In the code block below, we define MAT_RIGID for the cylindrical tube and the bottom plate and MAT_FABRIC for |
| 126 | +# the airbag volume. Note here that the "platemat" has the contraints defined as well. |
69 | 127 |
|
70 | 128 | platemat = MatRigid(
|
71 | 129 | mass_density=7.84e-4,
|
|
82 | 140 | shear_modulus=1.53e6,
|
83 | 141 | )
|
84 | 142 |
|
| 143 | +############################################################################### |
| 144 | +# Define Sectional Properties |
| 145 | +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 146 | +# We now define the sectional properties of the parts. In this example we have three |
| 147 | +# shell parts. Each part is initialized as a ShellPart with a unique ID and the appropriate |
| 148 | +# shell formulation have been assigned. Again, not all element formulations are supported at this time. |
| 149 | +# The supported formulations can be found in the "dynabase" class |
| 150 | + |
85 | 151 | plate = ShellPart(1)
|
86 | 152 | plate.set_material(platemat)
|
87 | 153 | plate.set_element_formulation(ShellFormulation.BELYTSCHKO_TSAY)
|
|
101 | 167 | airbagpart.set_integration_points(4)
|
102 | 168 | airbagdeploy.parts.add(airbagpart)
|
103 | 169 |
|
| 170 | +############################################################################### |
| 171 | +# Define Database Outputs ASCII and Binary |
| 172 | +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 173 | +# "set_output_database" and "create_database_binary" methods are used here to define the |
| 174 | +# output frequency of the ASCII and Binary D3PLOT files. Finally the model is written out as |
| 175 | +# an input dyna key file by calling the save_file() |
| 176 | + |
104 | 177 | airbag_solution.set_output_database(
|
105 | 178 | abstat=2.0e-4, glstat=2.0e-4, matsum=2.0e-4, rcforc=2.0e-4, rbdout=2.0e-4, rwforc=2.0e-4
|
106 | 179 | )
|
|
0 commit comments