|
9 | 9 | import sys
|
10 | 10 |
|
11 | 11 |
|
12 |
| -from ansys.dyna.core.pre.dynasolution import * |
13 |
| -from ansys.dyna.core.pre.dynamech import * |
14 |
| -from ansys.dyna.core.pre.dynamaterial import * |
| 12 | +from ansys.dyna.core.pre.dynasolution import DynaSolution |
| 13 | +from ansys.dyna.core.pre.dynamech import ( |
| 14 | + DynaMech, |
| 15 | + Airbag, |
| 16 | + PartSet, |
| 17 | + Curve, |
| 18 | + Point, |
| 19 | + RigidwallPlanar, |
| 20 | + Contact, |
| 21 | + ContactSurface, |
| 22 | + ContactCategory, |
| 23 | + ShellPart, |
| 24 | + ShellFormulation, |
| 25 | +) |
| 26 | +from ansys.dyna.core.pre.dynamaterial import MatRigid, MatFabric |
15 | 27 | from ansys.dyna.core.pre import examples
|
16 | 28 |
|
| 29 | +hostname = "localhost" |
| 30 | +if len(sys.argv) > 1: |
| 31 | + hostname = sys.argv[1] |
| 32 | +airbag_solution = DynaSolution(hostname) |
| 33 | +fns = [] |
| 34 | +# path = sys.path[0] + os.sep + "input" + os.sep + "airbag_deploy" + os.sep |
| 35 | +path = examples.airbag_deploy + os.sep |
| 36 | +fns.append(path + "airbag_deploy.k") |
| 37 | +airbag_solution.open_files(fns) |
17 | 38 |
|
18 |
| -if __name__ == "__main__": |
19 |
| - hostname = "localhost" |
20 |
| - if len(sys.argv) > 1: |
21 |
| - hostname = sys.argv[1] |
22 |
| - airbag_solution = DynaSolution(hostname) |
23 |
| - fns = [] |
24 |
| - #path = sys.path[0] + os.sep + "input" + os.sep + "airbag_deploy" + os.sep |
25 |
| - path = examples.airbag_deploy+ os.sep |
26 |
| - fns.append(path + "airbag_deploy.k") |
27 |
| - airbag_solution.open_files(fns) |
| 39 | +airbag_solution.set_termination(0.03) |
28 | 40 |
|
29 |
| - airbag_solution.set_termination(0.03) |
30 |
| - |
31 |
| - airbagdeploy = DynaMech() |
32 |
| - airbag_solution.add(airbagdeploy) |
| 41 | +airbagdeploy = DynaMech() |
| 42 | +airbag_solution.add(airbagdeploy) |
33 | 43 |
|
34 |
| - airbag = Airbag(set=PartSet([3]), |
35 |
| - heat_capacity_at_constant_volume=1.736e3, |
36 |
| - heat_capacity_at_constant_pressure=2.43e3, |
37 |
| - input_gas_temperature=1.2e3, |
38 |
| - input_mass_flow_rate = Curve(x=[0, 0.032, 0.045, 0.08],y=[0, 26, 0.6, 0.1]), |
39 |
| - shape_factor_for_exit_hole=0.7, |
40 |
| - ambient_pressure=14.7, |
41 |
| - ambient_density=3.821e-6) |
42 |
| - airbagdeploy.add(airbag) |
| 44 | +airbag = Airbag( |
| 45 | + set=PartSet([3]), |
| 46 | + heat_capacity_at_constant_volume=1.736e3, |
| 47 | + heat_capacity_at_constant_pressure=2.43e3, |
| 48 | + input_gas_temperature=1.2e3, |
| 49 | + input_mass_flow_rate=Curve(x=[0, 0.032, 0.045, 0.08], y=[0, 26, 0.6, 0.1]), |
| 50 | + shape_factor_for_exit_hole=0.7, |
| 51 | + ambient_pressure=14.7, |
| 52 | + ambient_density=3.821e-6, |
| 53 | +) |
| 54 | +airbagdeploy.add(airbag) |
43 | 55 |
|
44 |
| - rigidwall = RigidwallPlanar(Point(0, 0, 0),Point(0, 1, 0),coulomb_friction_coefficient=0.5) |
45 |
| - airbagdeploy.add(rigidwall) |
| 56 | +rigidwall = RigidwallPlanar(Point(0, 0, 0), Point(0, 1, 0), coulomb_friction_coefficient=0.5) |
| 57 | +airbagdeploy.add(rigidwall) |
46 | 58 |
|
47 |
| - contact = Contact(category=ContactCategory.NODES_TO_SURFACE) |
48 |
| - contact.set_friction_coefficient(static=0.5,dynamic=0.5) |
49 |
| - surf1=ContactSurface(PartSet([3])) |
50 |
| - surf2=ContactSurface(PartSet([2])) |
51 |
| - surf2.set_penalty_stiffness_scale_factor(0.06667) |
52 |
| - contact.set_slave_surface(surf1) |
53 |
| - contact.set_master_surface(surf2) |
54 |
| - airbagdeploy.contacts.add(contact) |
| 59 | +contact = Contact(category=ContactCategory.NODES_TO_SURFACE) |
| 60 | +contact.set_friction_coefficient(static=0.5, dynamic=0.5) |
| 61 | +surf1 = ContactSurface(PartSet([3])) |
| 62 | +surf2 = ContactSurface(PartSet([2])) |
| 63 | +surf2.set_penalty_stiffness_scale_factor(0.06667) |
| 64 | +contact.set_slave_surface(surf1) |
| 65 | +contact.set_master_surface(surf2) |
| 66 | +airbagdeploy.contacts.add(contact) |
55 | 67 |
|
56 |
| - platemat = MatRigid(mass_density=7.84e-4,young_modulus=30e6,center_of_mass_constraint=1,translational_constraint=7,rotational_constraint=7) |
57 |
| - cylindermat = MatRigid(mass_density=1.96e-4,young_modulus=30e6) |
58 |
| - airbagmat = MatFabric(mass_density=1e-4,young_modulus_longitudinal_direction=2e6,young_modulus_transverse_direction=2e6,shear_modulus=1.53e6) |
59 |
| - |
60 |
| - plate = ShellPart(1) |
61 |
| - plate.set_material(platemat) |
62 |
| - plate.set_element_formulation(ShellFormulation.BELYTSCHKO_TSAY) |
63 |
| - plate.set_thickness(0.5) |
64 |
| - airbagdeploy.parts.add(plate) |
| 68 | +platemat = MatRigid( |
| 69 | + mass_density=7.84e-4, |
| 70 | + young_modulus=30e6, |
| 71 | + center_of_mass_constraint=1, |
| 72 | + translational_constraint=7, |
| 73 | + rotational_constraint=7, |
| 74 | +) |
| 75 | +cylindermat = MatRigid(mass_density=1.96e-4, young_modulus=30e6) |
| 76 | +airbagmat = MatFabric( |
| 77 | + mass_density=1e-4, |
| 78 | + young_modulus_longitudinal_direction=2e6, |
| 79 | + young_modulus_transverse_direction=2e6, |
| 80 | + shear_modulus=1.53e6, |
| 81 | +) |
65 | 82 |
|
66 |
| - cylinder = ShellPart(2) |
67 |
| - cylinder.set_material(cylindermat) |
68 |
| - cylinder.set_element_formulation(ShellFormulation.BELYTSCHKO_TSAY) |
69 |
| - cylinder.set_thickness(0.5) |
70 |
| - airbagdeploy.parts.add(cylinder) |
| 83 | +plate = ShellPart(1) |
| 84 | +plate.set_material(platemat) |
| 85 | +plate.set_element_formulation(ShellFormulation.BELYTSCHKO_TSAY) |
| 86 | +plate.set_thickness(0.5) |
| 87 | +airbagdeploy.parts.add(plate) |
71 | 88 |
|
72 |
| - airbagpart = ShellPart(3) |
73 |
| - airbagpart.set_material(airbagmat) |
74 |
| - airbagpart.set_element_formulation(ShellFormulation.FULLY_INTEGRATED_BELYTSCHKO_TSAY_MEMBRANE) |
75 |
| - airbagpart.set_thickness(0.015) |
76 |
| - airbagpart.set_integration_points(4) |
77 |
| - airbagdeploy.parts.add(airbagpart) |
78 |
| - |
79 |
| - airbag_solution.set_output_database(abstat=2.0e-4,glstat=2.0e-4,matsum=2.0e-4,rcforc=2.0e-4,rbdout=2.0e-4,rwforc=2.0e-4) |
80 |
| - airbag_solution.create_database_binary(dt=5e-4, ieverp=1) |
81 |
| - airbag_solution.save_file() |
| 89 | +cylinder = ShellPart(2) |
| 90 | +cylinder.set_material(cylindermat) |
| 91 | +cylinder.set_element_formulation(ShellFormulation.BELYTSCHKO_TSAY) |
| 92 | +cylinder.set_thickness(0.5) |
| 93 | +airbagdeploy.parts.add(cylinder) |
| 94 | + |
| 95 | +airbagpart = ShellPart(3) |
| 96 | +airbagpart.set_material(airbagmat) |
| 97 | +airbagpart.set_element_formulation(ShellFormulation.FULLY_INTEGRATED_BELYTSCHKO_TSAY_MEMBRANE) |
| 98 | +airbagpart.set_thickness(0.015) |
| 99 | +airbagpart.set_integration_points(4) |
| 100 | +airbagdeploy.parts.add(airbagpart) |
| 101 | + |
| 102 | +airbag_solution.set_output_database( |
| 103 | + abstat=2.0e-4, glstat=2.0e-4, matsum=2.0e-4, rcforc=2.0e-4, rbdout=2.0e-4, rwforc=2.0e-4 |
| 104 | +) |
| 105 | +airbag_solution.create_database_binary(dt=5e-4, ieverp=1) |
| 106 | +airbag_solution.save_file() |
0 commit comments