@@ -7,7 +7,7 @@ build up ansys-dyna input deck, submit to solver and finally post processing the
7
7
8
8
Project Overview
9
9
----------------
10
- There are 3 related packages here, pre and solver are all under the ansys/dyna / directory,
10
+ There are 3 related packages here, pre and solver are all under the ansys/pydyna / directory,
11
11
while pyDPF is used for post-processing.
12
12
13
13
pre contains highly abstracted APIs for setting up a LS-DYNA input deck, so far,
@@ -35,8 +35,33 @@ leaving a Python environment.
35
35
Visit the `DPF-Post Documentation <https://postdocs.pyansys.com >`_ for a
36
36
detailed description of the package.
37
37
38
- Installation
39
- ------------
38
+ Install PyDyna-Pre Docker
39
+ -------------------------
40
+
41
+ Launching the PyDyna-Pre service locally, the only requirement is that:
42
+
43
+ * Docker is installed on your machine.
44
+
45
+ .. caution ::
46
+
47
+ The PyDyna-Pre service is currently available only as a Linux Docker image.
48
+ make sure that your Docker engine is configured to run Linux Docker images.
49
+
50
+ Please refer to ``docker/README.rst `` to install PyDyna-Pre service docker container
51
+
52
+ Install PyDyna-Solver Docker
53
+ ----------------------------
54
+
55
+ Once pydyna is installed, the docker-compose.yml file to build and launch the dyna solver docker can be located
56
+ under ``docker ``. The yml file can be copied locally. To run the docker the following command can be used
57
+
58
+ .. code :: bash
59
+
60
+ docker-compose up
61
+
62
+
63
+ Install the package
64
+ -------------------
40
65
41
66
PyDyna has three installation modes: user, developer, and offline.
42
67
@@ -98,31 +123,21 @@ archive from the `Releases Page <https://github.com/pyansys/pydyna/releases>`_ f
98
123
corresponding machine architecture.
99
124
100
125
Each wheelhouse archive contains all the Python wheels necessary to install PyDyna from scratch on Windows
101
- and Linux, from Python 3.7 to 3.10 . You can install this on an isolated system with a fresh Python
126
+ and Linux, from Python 3.6,3.8 and 3.9 . You can install this on an isolated system with a fresh Python
102
127
installation or on a virtual environment.
103
128
104
- For example, on Linux with Python 3.7 , unzip the wheelhouse archive and install it with:
129
+ For example, on Linux with Python 3.8 , unzip the wheelhouse archive and install it with:
105
130
106
131
.. code :: bash
107
132
108
- unzip ansys-dyna-core-v0.3.dev0-wheelhouse-Linux-3.7 .zip wheelhouse
133
+ unzip ansys-dyna-core-v0.3.dev0-wheelhouse-Linux-3.8 .zip wheelhouse
109
134
pip install ansys-dyna-core -f wheelhouse --no-index --upgrade --ignore-installed
110
135
111
136
If you are on Windows with Python 3.9, unzip the corresponding wheelhouse to a wheelhouse directory
112
137
and install using the preceding command.
113
138
114
139
Consider installing using a `virtual environment <https://docs.python.org/3/library/venv.html >`_.
115
140
116
- Install Solver Docker
117
- ^^^^^^^^^^^^^^^^^^^^^
118
-
119
- Once pydyna is installed, the docker-compose.yml file to build and launch the dyna solver docker can be located
120
- under /src/ansys/dyna/core/solver/. The yml file can be copied locally. To run the docker the following command can be used
121
-
122
- .. code :: bash
123
-
124
- docker-compose up
125
-
126
141
Documentation
127
142
-------------
128
143
For comprehesive information on PyDyna, see the latest release
@@ -138,28 +153,80 @@ Here is a basic pre-processing example:
138
153
139
154
.. code :: python
140
155
141
- from ansys.dyna.core.pre.dynasolution import *
142
- from ansys.dyna.core.pre.dynaiga import *
143
- from ansys.dyna.core.pre.dynamaterial import *
144
- hostname = " localhost"
145
- iga_solution = DynaSolution(hostname)
146
- fns = []
147
- path = os.getcwd() + os.sep + " input" + os.sep + " iga_sample" + os.sep
148
- fns.append(path + " maino.k" )
149
- fns.append(path + " rkrwelds.key" )
150
- fns.append(path + " 27parts.key" )
151
- iga_solution.open_files(fns)
152
- iga_solution.set_termination(20 )
153
- iga_solution.create_database_binary(dt = 0.1 )
154
- iga = DynaIGA()
155
- iga_solution.add(iga)
156
- iga.set_timestep(timestep_size_for_mass_scaled = - 0.0004 )
157
- ...
158
- selfcontact = Contact(type = ContactType.AUTOMATIC )
159
- selfcontact.set_friction_coefficient(static = 0.2 )
160
- surf1= ContactSurface(PartSet(igaparts))
161
- selfcontact.set_slave_surface(surf1)
162
- iga_solution.save_file()
156
+ import os
157
+ import sys
158
+ from ansys.dyna.core.pre.dynasolution import DynaSolution
159
+ from ansys.dyna.core.pre.dynaicfd import (
160
+ DynaICFD,
161
+ ICFDAnalysis,
162
+ MatICFD,
163
+ ICFDPart,
164
+ ICFDDOF ,
165
+ Curve,
166
+ ICFDVolumePart,
167
+ MeshedVolume,
168
+ )
169
+ from ansys.dyna.core.pre import examples
170
+ # sphinx_gallery_thumbnail_path = '_static/pre/icfd/cylinderflow.png'
171
+
172
+ hostname = " localhost"
173
+ if len (sys.argv) > 1 :
174
+ hostname = sys.argv[1 ]
175
+
176
+ icfd_solution = DynaSolution(hostname)
177
+ # Import the initial mesh data(nodes and elements)
178
+ fns = []
179
+ path = examples.cylinder_flow + os.sep
180
+ fns.append(path + " cylinder_flow.k" )
181
+ icfd_solution.open_files(fns)
182
+ # Set total time of simulation
183
+ icfd_solution.set_termination(termination_time = 100 )
184
+
185
+ icfd = DynaICFD()
186
+ icfd_solution.add(icfd)
187
+
188
+ icfdanalysis = ICFDAnalysis()
189
+ icfdanalysis.set_timestep()
190
+ icfd.add(icfdanalysis)
191
+
192
+ # define model
193
+ mat = MatICFD(flow_density = 1.0 , dynamic_viscosity = 0.005 )
194
+
195
+ part_inflow = ICFDPart(1 )
196
+ part_inflow.set_material(mat)
197
+ part_inflow.set_prescribed_velocity(dof = ICFDDOF .X, motion = Curve(x = [0 , 10000 ], y = [1 , 1 ]))
198
+ part_inflow.set_prescribed_velocity(dof = ICFDDOF .Y, motion = Curve(x = [0 , 10000 ], y = [0 , 0 ]))
199
+ icfd.parts.add(part_inflow)
200
+
201
+ part_outflow = ICFDPart(2 )
202
+ part_outflow.set_material(mat)
203
+ part_outflow.set_prescribed_pressure(pressure = Curve(x = [0 , 10000 ], y = [0 , 0 ]))
204
+ icfd.parts.add(part_outflow)
205
+
206
+ part_symmetric = ICFDPart(3 )
207
+ part_symmetric.set_material(mat)
208
+ part_symmetric.set_free_slip()
209
+ icfd.parts.add(part_symmetric)
210
+
211
+ part_wall = ICFDPart(4 )
212
+ part_wall.set_material(mat)
213
+ part_wall.set_non_slip()
214
+ part_wall.compute_drag_force()
215
+ part_wall.set_boundary_layer(number = 3 )
216
+ icfd.parts.add(part_wall)
217
+
218
+ partvol = ICFDVolumePart(surfaces = [1 , 2 , 3 , 4 ])
219
+ partvol.set_material(mat)
220
+ icfd.parts.add(partvol)
221
+ # define the volume space that will be meshed,The boundaries
222
+ # of the volume are the surfaces "spids"
223
+ meshvol = MeshedVolume(surfaces = [1 , 2 , 3 , 4 ])
224
+ icfd.add(meshvol)
225
+
226
+ icfd_solution.create_database_binary(dt = 1 )
227
+ icfd_solution.save_file()
228
+
229
+ For more examples, visit https://dyna.docs.pyansys.com/version/stable/examples/index.html
163
230
164
231
Here is a basic solving example:
165
232
0 commit comments