Skip to content

Commit c9c33f1

Browse files
committed
Commit edited example files through ICFD and other misc. edits
1 parent 41c2ded commit c9c33f1

32 files changed

+206
-150
lines changed

README.rst

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ PyDYNA
22
######
33

44
PyDYNA is a Pythonic package for providing a more convenient and complete way to
5-
build an Ansys DYNA input deck, submit it to the Ansys LS-Dyna solver, and
5+
build an Ansys DYNA input deck, submit it to the Ansys LS-DYNA solver, and
66
finally postprocess the results.
77

88
Overview
9-
--------
9+
========
1010
In the PyDYNA installation, the ``docker`` directory has two child
1111
directories:
1212

1313
- ``pre``: Provides the interface for creating DYNA input decks.
14-
This service includes highly abstracted APIs for setting up
15-
LSN-DYNA input decks. Included are DynaMech, DynaIGA, DynaICFD,
16-
DynaSALE, DynaEM, and DynaAirbag.
14+
This service includes highly abstracted APIs for setting up
15+
LSN-DYNA input decks. Included are DynaMech, DynaIGA, DynaICFD,
16+
DynaSALE, DynaEM, and DynaAirbag.
1717
- ``solver``: Contains the code for interfacing directly with
1818
the Ansys LS-DYNA solver. Because LS-DYNA is primarily a batch
1919
solver with very limited interactive capabilities, the code in
@@ -23,7 +23,7 @@ directories:
2323
input files to the container, start LS-DYNA and monitor its progress,
2424
and then retrieve results (RST) files.
2525

26-
Once you have results, you can use the Data Processing Framework (DPF),
26+
Once you have results, you can use the Ansys Data Processing Framework (DPF),
2727
which is designed to provide numerical simulation users and engineers
2828
with a toolbox for accessing and transforming simulation data. DPF
2929
can access data from Ansys solver result files and from several
@@ -74,7 +74,7 @@ For more information, see Python's
7474
PyDYNA has three installation modes: user, developer, and offline.
7575

7676
Install in user mode
77-
^^^^^^^^^^^^^^^^^^^^
77+
~~~~~~~~~~~~~~~~~~~~
7878

7979
Before installing PyDYNA in user mode, make sure you have the latest version of
8080
`pip`_ with this command:
@@ -105,7 +105,7 @@ Then, install PyDYNA with this command:
105105
pip install ansys-dyna-core --index-url=https://${PRIVATE_PYPI_ACCESS_TOKEN}@pkgs.dev.azure.com/pyansys/_packaging/pyansys/pypi/simple/
106106
107107
Install in developer mode
108-
^^^^^^^^^^^^^^^^^^^^^^^^^
108+
~~~~~~~~~~~~~~~~~~~~~~~~~
109109

110110
Installing PyDYNA in developer mode allows you to modify the source and enhance it.
111111

@@ -123,11 +123,12 @@ Start by cloning and installing the repository with these commands:
123123
pip install -e .
124124
125125
Install in offline mode
126-
^^^^^^^^^^^^^^^^^^^^^^^
126+
~~~~~~~~~~~~~~~~~~~~~~~
127+
127128
If you lack an internet connection on your installation machine (or you do not have access
128129
to the private Ansys PyPI packages repository), you should install PyDYNA by downloading
129130
the wheelhouse archive for your corresponding machine architecture from the
130-
`Releases Page <https://github.com/pyansys/pydyna/releases>`_ .
131+
`Releases Page <https://github.com/pyansys/pydyna/releases>`_.
131132

132133
Each wheelhouse archive contains all the Python wheels necessary to install
133134
PyDYNA from scratch on Windows and Linux for Python 3.8 through 3.11. You can install

doc/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ PyDYNA documentation |version|
1515
{% if build_api %}
1616
autoapi/index
1717
{% endif %}
18-
contributing
1918
{% if build_examples %}
2019
examples/index
2120
{% endif %}
21+
contributing

docker/pre/README.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Build the Docker image for the ``pre`` service
2-
==============================================
2+
----------------------------------------------
33

44
You must build the Docker image for the PyDNA ``pre`` service and then
55
run the image as a container.
66

77
Prerequisites
8-
-------------
8+
~~~~~~~~~~~~~
99

1010
* Ensure that you have cloned the PyDYNA repository locally with these commands:
1111

@@ -28,7 +28,7 @@ Prerequisites
2828

2929

3030
Build the Docker image
31-
----------------------
31+
~~~~~~~~~~~~~~~~~~~~~~
3232

3333
Once all prerequisites are met, perform these steps to build the Docker image:
3434

@@ -57,7 +57,8 @@ Once all prerequisites are met, perform these steps to build the Docker image:
5757
5858
5959
Run the image as a container
60-
----------------------------
60+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
61+
6162
Perform these steps to run the image as a container:
6263

6364
#. Run this Docker command:

docker/solver/README.rst

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Build the Docker image for the ``solver`` service
2-
=================================================
2+
-------------------------------------------------
33

44
You must build the Docker image for the PyDNA ``solver`` service and then
55
run the image as a container.
66

77
Prerequisites
8-
-------------
8+
~~~~~~~~~~~~~
99

1010
* Ensure that you have cloned the PyDYNA repository locally with these commands:
1111

@@ -22,7 +22,7 @@ Prerequisites
2222

2323
* If you are building the image on Windows, ensure that the Windows Subsystem for Linux (WSL)
2424
is installed. For installation information, see Microsoft's
25-
`Install Linux on Windows with WSL <https://learn.microsoft.com/en-us/windows/wsl/install>`.
25+
`Install Linux on Windows with WSL <https://learn.microsoft.com/en-us/windows/wsl/install>`_.
2626

2727
* Download the latest Linux release artifacts for the Linux Docker container:
2828
`mppdyna_docker_centos7.zip <https://github.com/ansys/pydyna/releases/download/v0.2.1/mppdyna_docker_centos7.zip>`_.
@@ -31,7 +31,7 @@ Prerequisites
3131

3232

3333
Build the Docker image
34-
----------------------
34+
~~~~~~~~~~~~~~~~~~~~~~
3535

3636
Once all prerequisites are met, perform these steps to build the Docker image:
3737

@@ -59,14 +59,15 @@ Once all prerequisites are met, perform these steps to build the Docker image:
5959
6060
6161
Run the image as a container
62-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
62+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
63+
6364
Perform these steps to run the image as a container:
6465

6566
#. In the ``docker-compose.yml`` file, replace ``<license_server_name>`` with the correct
66-
license server hosting the DYNA license.
67-
If you are using Ansy Flexlm license
67+
license server hosting the DYNA license.
68+
If you are using Ansy Flexlm license
6869

69-
* Run this Docker command:
70+
#. Run this Docker command:
7071

7172
.. code:: bash
7273

examples/Airbag/README.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Airbag examples
22
~~~~~~~~~~~~~~~~
33

4-
These examples show how to create Airbag model.
4+
These examples show how to create and use an airbag model.

examples/Airbag/airbag_deploy.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
"""
2-
Airbag deploy example
3-
---------------------
4-
2+
Airbag deploy
3+
-------------
54
This example shows how to create an airbag deploy model with the PyDNYA ``pre`` service.
65
The executable file for LS-DYNA is ``ls-dyna_smp_d_R13.0_365-gf8a97bda2a_winx64_ifort190.exe``.
76
87
"""
98
###############################################################################
109
# Perform required imports
1110
# ~~~~~~~~~~~~~~~~~~~~~~~~
12-
# Import required imports.
11+
# Peform required imports.
1312

1413
import os
1514
import sys
@@ -31,7 +30,7 @@
3130
)
3231

3332
###############################################################################
34-
# Manually start the ``pre`` server
33+
# Manually start the ``pre`` service
3534
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3635
# Copy the ``pyDyna/src/ansys/dyna/core/pre/Server``folder to a desired location.
3736
# Start the ``pre``service at this location by running this command:
@@ -41,7 +40,7 @@
4140
# Once the ``pre`` servic is running, you can connect a client to it using
4241
# the hostname and the port. This example uses the default local host and port
4342
# (``"localhost"`` and ``"50051"`` respectively).
44-
43+
#
4544
from ansys.dyna.core.pre.dynamaterial import MatRigid, MatFabric
4645
from ansys.dyna.core.pre import examples
4746
# sphinx_gallery_thumbnail_path = '_static/pre/airbag/airbag.png'
@@ -50,7 +49,6 @@
5049
if len(sys.argv) > 1:
5150
hostname = sys.argv[1]
5251

53-
5452
###############################################################################
5553
# Start the solution workflow
5654
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -63,6 +61,7 @@
6361
path = examples.airbag_deploy + os.sep
6462
fns.append(path + "airbag_deploy.k")
6563
airbag_solution.open_files(fns)
64+
6665
###############################################################################
6766
# Create standard explicit control cards
6867
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -80,9 +79,9 @@
8079
###############################################################################
8180
# Define *AIRBAG_SIMPLE_AIRBAG_MODEL* as a keyword
8281
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
83-
# Using the ``Airbag`` function in the ``DynaMech`` class, create
82+
# Use the ``Airbag`` function in the ``DynaMech`` class to define
8483
# *AIRBAG_SIMPLE_AIRBAG_MODEL* as a keyword. While LS-DYNA has many different
85-
# airbag models, PyDNYA currently supports only one airbag model:
84+
# airbag models, PyDYNA currently supports only one airbag model,
8685
# SIMPLE_AIRBAG_MODEL. If you have an urgent need for PyDYNA to support
8786
# another airbag model, email `[email protected] <mailto:[email protected]>`_.
8887

@@ -108,9 +107,9 @@
108107
airbagdeploy.add(rigidwall)
109108

110109
###############################################################################
111-
# Define a contact *NODES_TO_SURFACE*
112-
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
113-
# Define a contact NODES_TO_SURFACE by passing a master part set and a slave
110+
# Define a node-to-surface contact
111+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
112+
# Define a node-to-surface contact by passing a master part set and a slave
114113
# part set.
115114

116115
contact = Contact(category=ContactCategory.NODES_TO_SURFACE)
@@ -178,10 +177,10 @@
178177
airbagdeploy.parts.add(airbagpart)
179178

180179
###############################################################################
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()``
180+
# Define database outputs
181+
# ~~~~~~~~~~~~~~~~~~~~~~~
182+
# Use the ``set_output_database()`` and ``create_database_binary()`` methods to define the
183+
# output frequency of the ASCII and binary D3PLOT files. Then, use the ``save_file()``
185184
# method to write out the model as an input DYNA key file.
186185

187186
airbag_solution.set_output_database(

examples/Airbag/airbag_post.py

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,73 @@
11
"""
2-
Airbag deploy post processing example
3-
-------------------------------------
4-
5-
This example show how to animate the d3plot and display the stress on the airbag.
2+
Airbag deploy postprocessing
3+
----------------------------
4+
This example shows how to animate the d3plot and display the stress on the airbag.
65
76
"""
7+
###############################################################################
8+
# Perform required imports
9+
# ~~~~~~~~~~~~~~~~~~~~~~~~
10+
# Import required imports.
11+
#
812
from ansys.dpf import core as dpf
913
from ansys.dpf.core import examples
14+
1015
###############################################################################
1116
# Connect to DPF
1217
# ~~~~~~~~~~~~~~
18+
# Connect to DPF Server.
19+
#
1320
dpf.connect_to_server()
1421

1522
###############################################################################
1623
# Load the model
1724
# ~~~~~~~~~~~~~~
18-
# Load the model and print the contents of the model. All parts in the model are shell parts.
19-
# Model info lists the result components as well as the number of states available in the d3plot
25+
# Load the model and print the contents of the model. All parts in the model
26+
# are shell parts. Model information includes the result components and the
27+
# number of states available in the d3plot.
2028
#
2129
""" ds = dpf.DataSources()
2230
ds.set_result_file_path(r'D:\PYDYNA_BETA_V.0.1\example-data\pydyna\Airbag\d3plot', 'd3plot')
2331
model = dpf.Model(ds)
2432
print(model) """
2533

2634
###############################################################################
27-
# Let's extract the stress on all the parts. The stress field container is scoped to all time frequencies
28-
# so as to be able to animate the change in stress on the airbag fabric.
35+
# Extract stress on all parts
36+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~
37+
# Extract the stress on all the parts. The stress fields container is scoped to
38+
# all time frequencies to be able to animate the change in stress on the
39+
# airbag fabric.
2940
#
3041
""" stress = model.results.stress.on_all_time_freqs()
3142
stress.inputs.data_sources(ds)
3243
stress.inputs.requested_location.connect("Nodal")
3344
fieldsStr = stress.outputs.fields_container()"""
3445

3546
###############################################################################
36-
# Since the shell stress is reported at three through thickness points as default
37-
# in the d3plot file, the next few lines depicts how the stress
38-
# can be extracted on the mid integration point.
47+
# Extract stress on mid integration point
48+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
49+
# In the d3plot file, the shell stress is reported at three through-thickness
50+
# points by default. Extract the stress on the mid integration point.
3951
#
4052
""" shell_layer_extract = dpf.operators.utility.change_shell_layers()
4153
shell_layer_extract.inputs.fields_container.connect(fieldsStr)
4254
shell_layer_extract.inputs.e_shell_layer.connect(dpf.common.shell_layers.mid.value)
4355
fields_top = shell_layer_extract.outputs.fields_container_as_fields_container() """
4456

4557
###############################################################################
46-
# Plot the deformed state at 9ms
58+
# Plot deformed state
59+
# ~~~~~~~~~~~~~~~~~~~
60+
# Plot the deformed state at 9ms.
4761
#
4862
""" N = fields_top[19]
4963
D = model.results.displacement(time_scoping=[19]).eval()
5064
N.plot(deform_by=D[0],show_edges=False) """
5165

5266
###############################################################################
53-
# Finally display the stress field and set the mesh to deform by the displacement of the nodes.
67+
# Display stress field and set mesh
68+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69+
# Display the stress field and set the mesh to deform by the displacement of
70+
# the nodes.
5471
#
5572
""" disp = model.results.displacement.on_all_time_freqs.eval()
5673
fields_top.animate(deform_by=disp,show_edges=False) """

examples/EM/README.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
EM examples
22
~~~~~~~~~~~~
33

4-
These examples show how to create electromagnetic model.
4+
These examples show how to create and use electromagnetic models.

examples/EM/em_resistive_heating.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
Resistive heating
33
=================
44
5-
This example introduces the user to the minimum number of keywords required to turn on the EM resistive heating solver. \n
6-
LS-DYNA version : ls-dyna_smp_d_R13.1_138-g8429c8a10f_winx64_ifort190.exe
5+
This example shows the minimum number of keywords required to turn on the
6+
EM resistive heating solver. The executable file for LS-DYNA is
7+
``ls-dyna_smp_d_R13.1_138-g8429c8a10f_winx64_ifort190.exe``.
78
"""
89

910
import os

examples/EM/em_resistive_heating_2d.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"""
22
Resistive heating 2D
33
====================
4+
This example of a simple metal bar imposes potential on both ends. The executable
5+
file for LS-DYNA is ``ls-dyna_smp_d_R13.1_138-g8429c8a10f_winx64_ifort190.exe``.
46
5-
This example features a simple metal bar where potential is imposed on both ends. \n
6-
LS-DYNA version : ls-dyna_smp_d_R13.1_138-g8429c8a10f_winx64_ifort190.exe
77
"""
88

99
import os

0 commit comments

Comments
 (0)