Skip to content

Small example fixes and improvements #1412

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions doc/source/_static/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@import url("default.css");

.red {
color: red;
}

.green {
color: green;
}

.blue {
color: blue;
}
6 changes: 6 additions & 0 deletions doc/source/_templates/layout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{% extends "!layout.html" %}

{% block extrahead %}
<link rel="stylesheet" type="text/css" href="{{ pathto('_static/custom.css', 1) }}" />

{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ Start this example by launching MAPDL and loading the model.
start(mapdl, 'linear_non_prestressed')
mapdl.title("linear_non_prestressed, Solving brake squeal problem using linear non pre-stressed modal solve")

_ = mapdl.eplot(
mapdl.eplot(
vtk=True, cpos="xy", show_edges=True, show_axes=False, line_width=2, background="w"
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
.. _tech_demo_28:

.. role:: red

.. role:: blue

.. role:: green

Friction Stir Welding (FSW) Simulation
***************************************
Expand Down Expand Up @@ -451,7 +456,7 @@ model the contact surface on the top surface of the workpiece, and the
p.show()

**Figure 28.4: Contact Pair Between Tool and Workpiece.**
``CONTA174`` in blue, and ``TARGE170`` in red.
``CONTA174`` in :blue:`blue`, and ``TARGE170`` in :red:`red`.


Two real constants are specified to model friction-induced heat generation.
Expand Down Expand Up @@ -570,7 +575,7 @@ The following contact settings are used for the ``CONTA174`` elements:

**Figure 28.5: Rigid Surface Constrained.**
Pilot node or master with applied boundary conditions and the constrained
top surface of the tool (blue).**
top surface of the tool (:blue:`blue`).**


.. code:: python
Expand Down Expand Up @@ -858,7 +863,7 @@ perpendicular direction (z direction).
pl.show()

**Figure 28.7: Mechanical Boundary Conditions:**
X-direction (``UX``) in red, Y-direction (``UY``) in green, and Z-direction (``UZ``) in blue.
X-direction (``UX``) in :red:`red`, Y-direction (``UY``) in :green:`green`, and Z-direction (``UZ``) in :blue:`blue`.


.. code:: python
Expand Down Expand Up @@ -1392,7 +1397,7 @@ load step is shown in the following figure:


**Figure 28.21: Contact Status at Interface with Bonding Temperature 1000 °C**
Elements can be in near-contact (blue), sliding (green) or sticking (red) states.
Elements can be in near-contact (:blue:`blue`), sliding (:green:`green`) or sticking (:red:`red`) states.


The sticking portion of the interface shows the bonding or welding region of
Expand All @@ -1410,7 +1415,7 @@ welding region would increase, as shown in this figure:
pl.show()

**Figure 28.22: Contact Status at Interface with Bonding Temperature 900 °C**
Elements can be in near-contact (blue), sliding (green) or sticking (red) states.
Elements can be in near-contact (:blue:`blue`), sliding (:green:`green`) or sticking (:red:`red`) states.


28.7.4. Heat Generation
Expand Down
6 changes: 3 additions & 3 deletions examples/00-mapdl-examples/2d_plate_with_a_hole.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
plate_with_hole_anum = mapdl.asba(rect_anum, circ_anum)

# finally, plot the lines of the plate
_ = mapdl.lplot(cpos="xy", line_width=3, font_size=26, color_lines=True, background="w")
mapdl.lplot(cpos="xy", line_width=3, font_size=26, color_lines=True, background="w")

###############################################################################
# Meshing
Expand All @@ -97,7 +97,7 @@

mapdl.esize(plate_esize)
mapdl.amesh(plate_with_hole_anum)
_ = mapdl.eplot(
mapdl.eplot(
vtk=True, cpos="xy", show_edges=True, show_axes=False, line_width=2, background="w"
)

Expand Down Expand Up @@ -137,7 +137,7 @@
mapdl.f("ALL", "FX", 1000)

# finally, be sure to select all nodes again to solve the entire solution
_ = mapdl.allsel()
mapdl.allsel(mute=True)


###############################################################################
Expand Down
10 changes: 4 additions & 6 deletions examples/00-mapdl-examples/3d_notch.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
mapdl.vext(cut_area, dz=thickness)

# Checking volume plot
_ = mapdl.vplot(vtk=True, show_lines=True, show_axes=True, smooth_shading=True)
mapdl.vplot(vtk=True, show_lines=True, show_axes=True, smooth_shading=True)


###############################################################################
Expand Down Expand Up @@ -124,9 +124,7 @@
mapdl.esize() # this is tough to automate
mapdl.et(1, "SOLID186")
mapdl.vsweep("all")
_ = mapdl.eplot(
vtk=True, show_edges=True, show_axes=False, line_width=2, background="w"
)
mapdl.eplot(vtk=True, show_edges=True, show_axes=False, line_width=2, background="w")


###############################################################################
Expand Down Expand Up @@ -175,7 +173,7 @@
mapdl.f("ALL", "FX", 1000)

# finally, be sure to select all nodes again to solve the entire solution
_ = mapdl.allsel(mute=True)
mapdl.allsel(mute=True)


###############################################################################
Expand All @@ -185,7 +183,7 @@
mapdl.run("/SOLU")
mapdl.antype("STATIC")
mapdl.solve()
_ = mapdl.finish()
mapdl.finish(mute=True)


###############################################################################
Expand Down
4 changes: 2 additions & 2 deletions examples/00-mapdl-examples/pyvista_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@
###############################################################################
# Animate a high frequency mode
#
# Get a smoother plot by disabling movie_filename and increasing ``nangles``.
# Get a smoother plot by disabling movie_filename and increasing ``n_frames``.
# Enable a continuous plot looping with ```loop=True```.

result.animate_nodal_displacement(
18,
loop=False,
add_text=False,
nangles=30,
n_frames=30,
displacement_factor=0.4,
show_axes=False,
background="w",
Expand Down
2 changes: 1 addition & 1 deletion examples/01-apdlmath-examples/eigen_solve.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def get_res(i):
plt.xlabel("Frequency #")
plt.ylabel("Errors (%)")
ax.bar(x, mapdl_acc, label="MAPDL Results")

plt.show()

###############################################################################
# stop mapdl
Expand Down
2 changes: 2 additions & 0 deletions examples/02-geometry/00-keypoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,7 @@
)

###############################################################################
#
# stop mapdl
#
mapdl.exit()
14 changes: 7 additions & 7 deletions examples/02-geometry/02-areas.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,13 @@ def generate_random_area():
# Note that the `cpos` keyword argument can be used to describe the
# camera direction from the following:
#
# - 'iso' - Isometric view
# - 'xy' - XY Plane view
# - 'xz' - XZ Plane view
# - 'yx' - YX Plane view
# - 'yz' - YZ Plane view
# - 'zx' - ZX Plane view
# - 'zy' - ZY Plane view
# - ``iso`` - Isometric view
# - ``xy`` - XY Plane view
# - ``xz`` - XZ Plane view
# - ``yx`` - YX Plane view
# - ``yz`` - YZ Plane view
# - ``zx`` - ZX Plane view
# - ``zy`` - ZY Plane view

mapdl.aplot(quality=1, show_bounds=True, cpos="iso", show_lines=True)

Expand Down
13 changes: 8 additions & 5 deletions examples/03-tips-n-tricks/00-example-template.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,15 @@
After this preamble is complete, the first code block begins.
"""

# Your code goes here...
from ansys.mapdl.core import launch_mapdl

# start MAPDL and enter the pre-processing routine
# start MAPDL
mapdl = launch_mapdl()
mapdl
print(mapdl)

# Your code goes here...
# mapdl.prep7()
# mapdl...

###############################################################################
# Section Title
Expand All @@ -63,7 +66,6 @@
mapdl.clear()
mapdl.prep7()
print(mapdl)
mapdl

###############################################################################
# Plots and images
Expand All @@ -88,6 +90,7 @@
ax.plot(x, y)
ax.set_xlabel("x")
ax.set_ylabel("y")
plt.show()

###############################################################################
# Animations
Expand All @@ -106,5 +109,5 @@
# notebook, the example html and the demo script will all be auto-generated via ``sphinx-gallery``.

###############################################################################
# stop mapdl
# Stopping mapdl
mapdl.exit()
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from ansys.mapdl.core import launch_mapdl

mapdl = launch_mapdl()
mapdl
print(mapdl)

###############################################################################
# The Geometry (a box)
Expand Down Expand Up @@ -102,9 +102,7 @@
for k in [k2, k3, k6, k7]:
mapdl.kesize(k, 0.2)
mapdl.amesh("ALL")
_ = mapdl.eplot(
vtk=True, show_edges=True, show_axes=False, line_width=2, background="w"
)
mapdl.eplot(vtk=True, show_edges=True, show_axes=False, line_width=2, background="w")


###############################################################################
Expand Down
2 changes: 1 addition & 1 deletion examples/04-general-fea/00-how_finite_element_works.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ def evaluate(self):
mapdl.d(node_id, dof, 1)
mapdl.solve()

_ = mapdl.finish()
mapdl.finish()

###############################################################################
# The columns of the stiffness matrix appear as nodal force reactions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
# Output control for values extrapolated to the element
# and section nodes:
# Same as KEYOPT(9) = 1 plus stresses and strains at all section nodes
_ = mapdl.keyopt(1, 9, 3)
mapdl.keyopt(1, 9, 3, mute=True)


###############################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@

mapdl.clear()
mapdl.verify()
_ = mapdl.prep7()
mapdl.prep7(mute=True)


###############################################################################
Expand Down Expand Up @@ -353,7 +353,7 @@
(2.03485925, 0.21270071036846988, 5.0),
(0.0, 0.0, 1.0),
]
_ = mapdl.eplot(cpos=cpos)
mapdl.eplot(cpos=cpos)


###############################################################################
Expand Down Expand Up @@ -408,7 +408,7 @@

# Select all nodes.
mapdl.nsel("ALL")
_ = mapdl.finish()
mapdl.finish(mute=True)


###############################################################################
Expand Down Expand Up @@ -436,7 +436,7 @@ def solution(deflect):

# Load Step 3
solution(deflect=defl_ls3)
_ = mapdl.finish()
mapdl.finish(mute=True)


###############################################################################
Expand All @@ -445,7 +445,7 @@ def solution(deflect):
# Enter post-processing.

# Enter the post-processing routine.
_ = mapdl.post1()
mapdl.post1(mute=True)


###############################################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
(-0.4135015240403764, -0.4134577015789461, 0.8112146563156641),
]

_ = mapdl.eplot(show_node_numbering=True, line_width=5, cpos=cpos, font_size=40)
mapdl.eplot(show_node_numbering=True, line_width=5, cpos=cpos, font_size=40)


###############################################################################
Expand Down