@@ -36,29 +36,26 @@ PyDYNA is a Pythonic package for providing a more convenient and complete way to
36
36
build an Ansys DYNA input deck, submit it to the Ansys LS-DYNA solver, and
37
37
finally postprocess the results.
38
38
39
- In the PyDYNA installation, the ``docker `` directory has two child
40
- directories:
41
-
42
- - ``pre ``: Contains the package with the ``ls-pre `` Docker image for the
43
- ``pre `` service. This service provides highly abstracted APIs for creating and
44
- setting up DYNA input decks for DynaMech, DynaIGA, DynaICFD, DynaSALE, DynaEM,
45
- and DynaAirbag.
46
- - ``solver ``: Contains the package with the ``dynasolver `` Docker image
47
- for the ``solver `` service. This service provides highly abstracted
48
- APIs for interacting directly with the Ansys LS-DYNA solver. Because LS-DYNA
49
- is primarily a batch solver with very limited interactive capabilities, the
50
- ``solver `` service is similarly limited. The target use case is that LS-DYNA is
51
- running in a container environment such as Docker or Kubernetes. Using this
52
- service, you can push input files to the container, start LS-DYNA
53
- and monitor its progress, and then retrieve Ansys solver results (RST)
54
- files.
39
+ PyDYNA contains two submodules, ``ansys.dyna.core.pre `` and ``ansys.dyna.core.solver ``
40
+
41
+ - ``pre ``: This module provides highly abstracted APIs for creating and
42
+ setting up DYNA input decks. There are many classes supported, namely,
43
+ DynaMech, DynaIGA, DynaICFD, DynaSALE, DynaEM,DynaNVH, DynaMaterial,
44
+ DynaISPH, DynaICFD and DynaAirbag. Each of these classes can be used to generate
45
+ LS-DYNA keywords. Since these classes have high-level abstraction, each function call
46
+ generates groups of keywords needed to define an input in LS-DYNA.
47
+ - ``solver ``: This API provides features to interact directly with the Ansys LS-DYNA solver.
48
+ LS-DYNA is primarily a batch solver with very limited interactive capabilities, the
49
+ ``solver `` service provides a way to push input files to the LS-DYNA solver, monitor the state
50
+ of the running job, change the value of a load curve and finally retrieve result files back from
51
+ the server
55
52
56
53
Once you have results, you can use the Ansys Data Processing Framework (DPF),
57
54
which is designed to provide numerical simulation users and engineers
58
55
with a toolbox for accessing and transforming simulation data. DPF
59
- can access data from Ansys solver RST files and from several
60
- files with neutral formats, including CSV, HDF5, and VTK. Using DPF's
61
- various operators, you can manipulate and transform this data.
56
+ can access data from Ansys solver files and from several files with neutral formats,
57
+ including CSV, HDF5, and VTK. Using DPF's various operators,
58
+ you can manipulate and transform this data.
62
59
63
60
The `ansys-dpf-post package <https://github.com/ansys/pydpf-post >`_ provides
64
61
a simplified Python interface to DPF, thus enabling rapid postprocessing
@@ -70,6 +67,9 @@ Documentation and issues
70
67
Documentation for the latest stable release of PyDyna is hosted at `PyDYNA documentation
71
68
<https://dyna.docs.pyansys.com/version/stable//> `_.
72
69
70
+ For examples on how to use PyDYNA, see `Examples <https://dyna.docs.pyansys.com/version/stable/examples/index.html >`_
71
+ in the PyDYNA documentation.
72
+
73
73
In the upper right corner of the documentation's title bar, there is an option for switching from
74
74
viewing the documentation for the latest stable release to viewing the documentation for the
75
75
development version or previously released versions.
@@ -81,150 +81,6 @@ you can post questions, share ideas, and get community feedback.
81
81
82
82
To reach the project support team, email `
[email protected] <
[email protected] >`_.
83
83
84
- Usage
85
- =====
86
- The next few sections show how to preprocess, solve, and postprocess a ball plate example.
87
-
88
- Preprocess
89
- ----------
90
- The following code preprocesses a ball plate example. In the repository, you can get the
91
- input file from ``src/ansys/dyna/core/pre/examples/explicit/ball_plate/ball_plate.k `` and
92
- the Python file from ``examples/Explicit/ball_plate.py ``.
93
-
94
- .. code :: python
95
-
96
- import os
97
- import sys
98
- from ansys.dyna.core.pre.dynasolution import DynaSolution
99
- from ansys.dyna.core.pre.dynamech import (
100
- DynaMech,
101
- Velocity,
102
- PartSet,
103
- ShellPart,
104
- SolidPart,
105
- NodeSet,
106
- Contact,
107
- ContactSurface,
108
- ShellFormulation,
109
- SolidFormulation,
110
- ContactType,
111
- AnalysisType
112
- )
113
- from ansys.dyna.core.pre.dynamaterial import (
114
- MatRigid,
115
- MatPiecewiseLinearPlasticity,
116
- )
117
- from ansys.dyna.core.pre import examples
118
-
119
- hostname = " localhost"
120
- if len (sys.argv) > 1 :
121
- hostname = sys.argv[1 ]
122
- solution = DynaSolution(hostname)
123
-
124
- fns = []
125
- path = examples.ball_plate + os.sep
126
- fns.append(path+ " ball_plate.k" )
127
- solution.open_files(fns)
128
-
129
- solution.set_termination(termination_time = 10 )
130
-
131
- ballplate = DynaMech(AnalysisType.NONE )
132
- solution.add(ballplate)
133
-
134
- matrigid = MatRigid(mass_density = 7.83e-6 , young_modulus = 207 , poisson_ratio = 0.3 )
135
- matplastic = MatPiecewiseLinearPlasticity(mass_density = 7.83e-6 , young_modulus = 207 , yield_stress = 0.2 , tangent_modulus = 2 )
136
-
137
- plate = ShellPart(1 )
138
- plate.set_element_formulation(ShellFormulation.BELYTSCHKO_TSAY )
139
- plate.set_material(matplastic)
140
- plate.set_thickness(1 )
141
- plate.set_integration_points(5 )
142
- ballplate.parts.add(plate)
143
-
144
- ball = SolidPart(2 )
145
- ball.set_material(matrigid)
146
- ball.set_element_formulation(SolidFormulation.CONSTANT_STRESS_SOLID_ELEMENT )
147
- ballplate.parts.add(ball)
148
-
149
- selfcontact = Contact(type = ContactType.AUTOMATIC )
150
- surf1 = ContactSurface(PartSet([1 , 2 ]))
151
- selfcontact.set_slave_surface(surf1)
152
- ballplate.contacts.add(selfcontact)
153
-
154
- spc = [34 ,35 ,51 ,52 ,68 ,69 ,85 ,86 ,102 ,103 ,119 ,120 ,136 ,137 ,153 ,154 ,170 ,171 ,187 ,188 ,204 ,205 ,221 ,222 ,238 ,239 ,255 ,256 ]
155
- for i in range (1 ,19 ):
156
- spc.append(i)
157
- for i in range (272 ,290 ):
158
- spc.append(i)
159
- ballplate.boundaryconditions.create_spc(NodeSet(spc),rx = False ,ry = False ,rz = False )
160
-
161
- for i in range (1 ,1652 ):
162
- ballplate.initialconditions.create_velocity_node(i,trans = Velocity(0 , 0 , - 10 ))
163
-
164
- solution.set_output_database(glstat = 0.1 , matsum = 0.1 , sleout = 0.1 )
165
- solution.create_database_binary(dt = 1 )
166
- serverpath = solution.save_file()
167
-
168
- serveroutfile = ' /' .join((serverpath," ball_plate.k" ))
169
- downloadpath = os.path.join(os.getcwd(), " output" )
170
- if not os.path.exists(downloadpath):
171
- os.makedirs(downloadpath)
172
- downloadfile = os.path.join(downloadpath," ball_plate.k" )
173
- solution.download(serveroutfile,downloadfile)
174
-
175
- Solve
176
- -----
177
- The following code solves this basic ball plate example. In the repository,
178
- you can get the Python file from ``examples/solver/ball_plate_solver.py ``.
179
-
180
- .. code :: python
181
-
182
- import ansys.dyna.core.solver as solver
183
-
184
- hostname = " localhost"
185
- port = " 5000"
186
- dyna= solver.DynaSolver(hostname,port) # connect to the container
187
- dyna.push(" ./output/ball_plate.k" ) # push an input file
188
- dyna.start(4 ) # start 4 ranks of mppdyna
189
- dyna.run(" i=ball_plate.k memory=10m ncycle=20000" ) # begin execution
190
-
191
-
192
- Postprocess
193
- -----------
194
- The following code postprocesses results from the solve of this basic ball plate example:
195
-
196
- .. code :: python
197
-
198
- from ansys.dpf import core as dpf
199
- import os
200
-
201
- ds = dpf.DataSources()
202
- data_path = os.path.join(os.getcwd(), ' d3plot' )
203
- ds.set_result_file_path(data_path, ' d3plot' )
204
-
205
- model = dpf.Model(ds)
206
- # Extract displacements for all time steps from d3plot
207
- D = model.results.displacement.on_all_time_freqs().eval()
208
- D.animate()
209
-
210
- stress = dpf.operators.result.stress()
211
- stress.inputs.data_sources(ds)
212
- stress.inputs.time_scoping([12 ])
213
- stress.connect(25 , [1 ])
214
- stress.inputs.requested_location.connect(" Nodal" )
215
- fields = stress.outputs.fields_container()
216
-
217
- shell_layer_extract = dpf.operators.utility.change_shell_layers()
218
- shell_layer_extract.inputs.fields_container.connect(fields)
219
- print (shell_layer_extract.inputs.e_shell_layer)
220
- shell_layer_extract.inputs.e_shell_layer.connect(0 )
221
- fields_top = shell_layer_extract.outputs.fields_container_as_fields_container()
222
- print (fields_top)
223
- fields_top.animate()
224
-
225
- For more examples, see `Examples <https://dyna.docs.pyansys.com/version/stable/examples/index.html >`_
226
- in the PyDYNA documentation.
227
-
228
84
License
229
85
=======
230
86
PyDYNA is licensed under the MIT license.
0 commit comments