Skip to content
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

Adding dynamic plots in documentation #2241

Draft
wants to merge 42 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
47549f4
maint: changing `pyproject.toml` and `conf.py`
clatapie Aug 11, 2023
4d82389
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 11, 2023
e12f559
Merge branch 'main' into doc/add-dynamic-plots
clatapie Aug 14, 2023
2dbc00f
maint: updating `pyproject.toml`
clatapie Aug 14, 2023
d14efa2
Merge branch 'doc/add-dynamic-plots' of https://github.com/ansys/pyma…
clatapie Aug 14, 2023
9e70504
Merge branch 'main' into doc/add-dynamic-plots
clatapie Aug 16, 2023
41f948b
fix: `pyvista.BUILDING_GALLERY` set to True
clatapie Aug 16, 2023
20540dc
Merge branch 'main' into doc/add-dynamic-plots
clatapie Aug 17, 2023
52bde87
Merge branch 'main' into doc/add-dynamic-plots
clatapie Aug 18, 2023
fda24ca
Merge branch 'main' into doc/add-dynamic-plots
clatapie Aug 18, 2023
8093a59
Merge branch 'main' into doc/add-dynamic-plots
clatapie Aug 28, 2023
d3331d2
Merge branch 'main' into doc/add-dynamic-plots
clatapie Sep 6, 2023
e72e57e
Apply suggestions from code review
clatapie Sep 6, 2023
da94c2e
doc: cleaning the code
clatapie Sep 6, 2023
1cf1245
Merge branch 'main' into doc/add-dynamic-plots
clatapie Oct 5, 2023
4558229
doc: adding `trame` dependency
clatapie Oct 5, 2023
44f3aa2
Update the image cache
clatapie Oct 5, 2023
a307f99
Empty comment to trigger CICD
clatapie Oct 5, 2023
63e9e0a
Update the image cache
clatapie Oct 5, 2023
bb330e6
Empty comment to trigger CICD
clatapie Oct 6, 2023
59f46df
fix: `troubleshoot.rst`
clatapie Oct 6, 2023
dde9f96
Merge branch 'main' into doc/add-dynamic-plots
clatapie Oct 6, 2023
8b59c67
Merge branch 'main' into doc/add-dynamic-plots
clatapie Oct 9, 2023
69ab620
fix: temp cicd
clatapie Oct 9, 2023
44176c6
Merge branch 'main' into doc/add-dynamic-plots
clatapie Oct 9, 2023
77ef233
doc: fixing `troubleshoot.rst` file
clatapie Oct 9, 2023
2e4c772
Update the image cache
clatapie Oct 9, 2023
10d615c
maint: fixing doc build
clatapie Oct 9, 2023
8423843
doc: fixing internal links
clatapie Oct 9, 2023
fcb9a69
doc: fixing internal links
clatapie Oct 9, 2023
7238bd3
Update the image cache
clatapie Oct 9, 2023
85d5bf6
Merge branch 'main' into doc/add-dynamic-plots
clatapie Oct 13, 2023
ff8b254
Update pyproject.toml
clatapie Oct 27, 2023
f86d1b6
Merge branch 'main' into doc/add-dynamic-plots
clatapie Oct 27, 2023
b234f14
Merge branch 'main' into doc/add-dynamic-plots
germa89 Feb 15, 2024
aa5cfc9
Minimizing changes
germa89 Feb 15, 2024
4f5aa32
removing old file
germa89 Feb 15, 2024
4348efe
Merge branch 'main' into doc/add-dynamic-plots
clatapie Feb 19, 2024
a51f9bd
Merge branch 'main' into doc/add-dynamic-plots
clatapie Feb 21, 2024
2251e38
Merge branch 'main' into doc/add-dynamic-plots
clatapie Feb 21, 2024
ea2f9ea
chore: merge remote-tracking branch 'origin/main' into doc/add-dynami…
germa89 Nov 25, 2024
5482de7
chore: adding changelog file 2241.documentation.md [dependabot-skip]
pyansys-ci-bot Nov 25, 2024
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
12 changes: 5 additions & 7 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
)
import numpy as np
import pyvista
from pyvista.plotting.utilities.sphinx_gallery import DynamicScraper
from sphinx.application import Sphinx
from sphinx_gallery.sorting import FileNameSortKey

Expand All @@ -21,22 +22,18 @@
pyvista.set_error_output_file("errors.txt")

# Ensure that offscreen rendering is used for docs generation
pyvista.BUILDING_GALLERY = True
pyvista.OFF_SCREEN = True

# must be less than or equal to the XVFB window size
try:
pyvista.global_theme.window_size = np.array([1024, 768])
except AttributeError:
# for compatibility with pyvista < 0.40
pyvista.rcParams["window_size"] = np.array([1024, 768])
pyvista.global_theme.window_size = np.array([1024, 768])

# Save figures in specified directory
pyvista.FIGURE_PATH = os.path.join(os.path.abspath("./images/"), "auto-generated/")
if not os.path.exists(pyvista.FIGURE_PATH):
os.makedirs(pyvista.FIGURE_PATH)

# necessary when building the sphinx gallery
pyvista.BUILDING_GALLERY = True
pymapdl.BUILDING_GALLERY = True

# suppress annoying matplotlib bug
Expand Down Expand Up @@ -73,6 +70,7 @@
extensions = [
"jupyter_sphinx",
"numpydoc",
"pyvista.ext.viewer_directive",
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.coverage",
Expand Down Expand Up @@ -238,7 +236,7 @@
"backreferences_dir": None,
# Modules for which function level galleries are created. In
"doc_module": "ansys-mapdl-core",
"image_scrapers": ("pyvista", "matplotlib"),
"image_scrapers": (DynamicScraper(), "matplotlib"),
"ignore_pattern": "flycheck*",
"thumbnail_size": (350, 350),
"remove_config_comments": True,
Expand Down
5 changes: 3 additions & 2 deletions doc/source/getting_started/running_mapdl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,10 @@ Note that you must have started MAPDL in gRPC mode on the computer with
the mentioned IP address/hostname for this to work.

If you have MAPDL installed on your local host, you
can use the :func:`launch_mapdl() <ansys.mapdl.core.launch_mapdl>` method to both start and connect to MAPDL.
can use the :func:`launch_mapdl() <ansys.mapdl.core.launch_mapdl>` method to both start and
connect to MAPDL.

If you have any problem launching PyMAPDL, see :ref:`debugging_launch_mapdl`.
If you have any problem launching PyMAPDL, see :ref:`Launching issues <ref_launching_issue>`.

If you are connecting to an MAPDL Docker image, the procedure is the same.
Just make sure that you specify the mapped port instead of the internal Docker image port.
Expand Down
2 changes: 1 addition & 1 deletion doc/source/user_guide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -222,4 +222,4 @@ with it. For example:
recommended.


For stability considerations, see :ref:`ref_pymapdl_stability`.
For stability considerations, see :ref:`PyMAPDL stability <ref_pymapdl_stability>`.
3 changes: 2 additions & 1 deletion doc/source/user_guide/parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ ROUT``, you can access it with this code:
For a full list of the methods and attributes available to the
``Parameters`` class, see :ref:`ref_parameters_api`.

For additional information on PyMAPDL array limitations, see :ref:`ref_numpy_arrays_in_mapdl`.
For additional information on PyMAPDL array limitations, see
:ref:`Issues when importing and exporting numpy arrays in MAPDL <ref_issues_np_mapdl>`.

.. _ref_special_named_param:

Expand Down
94 changes: 42 additions & 52 deletions doc/source/user_guide/troubleshoot.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@



.. _ref_troubleshooting:


=======================
Troubleshooting PyMAPDL
=======================

Expand All @@ -13,9 +9,8 @@ To help you resolve any problems that you might have when using PyMAPDL,
some of the most common problems and frequently asked questions are posted here.


*****************
Debug in PyMAPDL
*****************
----------------

If you are having trouble with PyMAPDL, you can record some internal
logs into a file using a logger.
Expand Down Expand Up @@ -43,11 +38,10 @@ If you believe you have found a bug, open an issue on the
`PyMAPDL Issues page <pymapdl_issues_>`_.


.. _debugging_launch_mapdl:
.. _ref_launching_issue:

****************
Launching issues
****************
----------------

There are several issues that can cause MAPDL not to launch, including:

Expand All @@ -63,7 +57,7 @@ There are several issues that can cause MAPDL not to launch, including:


Connection timeout
==================
~~~~~~~~~~~~~~~~~~

In some networks, MAPDL might take longer than expected to connect to the license server or to the remote instance.
In those cases, you might see the following message:
Expand Down Expand Up @@ -93,12 +87,11 @@ Or if you are connecting to a remote instance you can use:


Testing MAPDL launching
=======================
~~~~~~~~~~~~~~~~~~~~~~~

In some cases, it may be necessary to run the launch command manually from the command line.

On Windows
----------
**On Windows**

Open up a command prompt and run the version-dependent command:

Expand All @@ -109,8 +102,7 @@ Open up a command prompt and run the version-dependent command:
.. note:: PowerShell users can run the preceding command without quotes.


On Linux
--------
**On Linux**

Run the version-dependent command:

Expand Down Expand Up @@ -153,7 +145,7 @@ If this command doesn't launch MAPDL, look at the command output:
.. vale on

Licensing issues
================
~~~~~~~~~~~~~~~~

Incorrect license server configuration can prevent MAPDL from being able to get a valid license.
In such cases, you might see output **similar** to:
Expand Down Expand Up @@ -184,7 +176,7 @@ for maintaining Ansys licensing or have a personal install of Ansys, see the onl
For more comprehensive information, download the :download:`ANSYS Licensing Guide <lic_guide.pdf>`.

Incorrect licensing environment variables
-----------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The license server can be also specified using the environment variable :envvar:`ANSYSLMD_LICENSE_FILE`.
The following code examples show how you can see the value of this environment variable on
Expand All @@ -209,7 +201,7 @@ either Windows or Linux.
.. _vpn_issues_troubleshooting:

Virtual private network (VPN) issues
====================================
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

From ANSYS 2022 R2 to ANSYS 2021 R1, MAPDL has issues launching when VPN software is running.
One issue stems from MPI communication and can be solved by either passing
Expand Down Expand Up @@ -248,18 +240,14 @@ On Windows, you can find the license configuration file that points to the licen
.. _missing_dependencies_on_linux:

Missing dependencies on Linux
=============================
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Some Linux installations might be missing required dependencies. If
you get errors like ``libXp.so.6: cannot open shared object file: No
such file or directory``, you are likely missing some necessary
dependencies.


.. _installing_mapdl_on_centos7:

CentOS 7
--------
**CentOS 7**

On CentOS 7, you can install missing dependencies with:

Expand All @@ -268,10 +256,7 @@ On CentOS 7, you can install missing dependencies with:
yum install openssl openssh-clients mesa-libGL mesa-libGLU motif libgfortran


.. _installing_mapdl_on_ubuntu:

Ubuntu
------
**Ubuntu**

On Ubuntu 22.04, use this code to install the needed dependencies:

Expand Down Expand Up @@ -300,8 +285,8 @@ using this code:
apt-get install -y libxp6


Ubuntu 20.04 and older
----------------------

**Ubuntu 20.04 and older**

If you are using Ubuntu 16.04, you can install ``libxp16`` with this code:

Expand Down Expand Up @@ -333,7 +318,7 @@ then installs it via the ``dpkg`` package.
.. _conflicts_student_version:

Conflicts with student version
==============================
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Although you can install Ansys together with other Ansys products or versions, on Windows, you
should not install a student version of an Ansys product together with its non-student version.
Expand All @@ -353,7 +338,8 @@ to the correct location.
``SMP`` mode, unless another MPI option is specified.

Incorrect environment variables
===============================
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you are using a non-standard install, you might need to manually set the
environment variables ``ANSYSXXX_DIR``, ``AWP_ROOTXXX``, and
``CADOE_LIBDIRXXX`` to the correct location.
Expand Down Expand Up @@ -387,7 +373,8 @@ shown. For Ansys MAPDL 2022 R2, ``222`` appears where ``XXX`` is shown.
.. vale on

Using a proxy server
====================
~~~~~~~~~~~~~~~~~~~~

In some rare cases, you might experience some problems to connect to the MAPDL instance if you are
using a proxy.
When `gRPC <grpc_>`_ is used in a proxy environment, if a local address is specified (that is ``127.0.0.1``)
Expand All @@ -399,7 +386,8 @@ to connect to MAPDL instance.


Firewall settings
=================
~~~~~~~~~~~~~~~~~

MAPDL and Python should have the correct firewall settings to allow communication between the two.
If you are using a firewall, you should allow MAPDL to receive inbound connections to the following ports:

Expand All @@ -425,8 +413,12 @@ For more information on how to **configure your firewall on Ubuntu Linux**, plea
link `Security-Firewall | Ubuntu <ubuntu_firewall_>`_.


Location of the executable file
-------------------------------

Manually set the location of the executable file
================================================
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you have a non-standard install, PyMAPDL might be unable find
your MAPDL installation. If this is the case, provide the location of MAPDL
as the first parameter to :func:`launch_mapdl() <ansys.mapdl.core.launch_mapdl>`.
Expand All @@ -450,7 +442,7 @@ as the first parameter to :func:`launch_mapdl() <ansys.mapdl.core.launch_mapdl>`


Default location of the executable file
---------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The first time that you run PyMAPDL, it detects the
available Ansys installations.
Expand Down Expand Up @@ -520,20 +512,18 @@ method lists higher versions first and student versions last.
information, see :ref:`conflicts_student_version`.


.. _ref_pymapdl_limitations:

*********************
PyMAPDL usage issues
*********************
--------------------

.. _ref_numpy_arrays_in_mapdl:
.. _ref_issues_np_mapdl:

Issues when importing and exporting numpy arrays in MAPDL
=========================================================
Issues when importing and exporting NumPy arrays in MAPDL
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Because of the way MAPDL is designed, there is no way to store an
array where one or more dimensions are zero.
This can happens in numpy arrays, where its first dimension can be
This can happens in NumPy arrays, where its first dimension can be
set to zero. For example:

.. code:: pycon
Expand Down Expand Up @@ -583,22 +573,20 @@ to one, have the same shape if later retrieved.
True



.. _ref_pymapdl_stability:

*****************
PyMAPDL stability
*****************
-----------------

Recommendations
===============
~~~~~~~~~~~~~~~

When connecting to an instance of MAPDL using gRPC (default), there are some cases
where the MAPDL server might exit unexpectedly. There
are several ways to improve MADPL performance and stability:

Use ``mute`` to improve stability
-----------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

When possible, pass ``mute=True`` to individual MAPDL commands or
set it globally with the :func:`Mapdl.mute
Expand All @@ -610,14 +598,16 @@ verbosity as needed.


Issues
======
~~~~~~

.. note::

MAPDL 2021 R1 has a stability issue with the :func:`Mapdl.input()
<ansys.mapdl.core.Mapdl.input>` method. Avoid using input files if
possible. Attempt to use the :func:`Mapdl.upload()
<ansys.mapdl.core.Mapdl.upload>` method to upload nodes and elements and read them
in via the :func:`Mapdl.nread() <ansys.mapdl.core.Mapdl.nread>` and
possible. Attempt to use the
:func:`Mapdl.upload() <ansys.mapdl.core.Mapdl.upload>` method to upload
nodes and elements and read them in via the
:func:`Mapdl.nread() <ansys.mapdl.core.Mapdl.nread>` and
:func:`Mapdl.eread() <ansys.mapdl.core.Mapdl.eread>` methods.


Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,18 @@ doc = [
"pypandoc==1.11",
"pytest-sphinx==0.5.0",
"pythreejs==2.4.2",
"pyvista[trame]==0.42.3",
"pyvista[jupyter,trame]==0.42.3",
clatapie marked this conversation as resolved.
Show resolved Hide resolved
"sphinx-autobuild==2021.3.14",
"sphinx-autodoc-typehints==1.24.0",
"sphinx-copybutton==0.5.2",
"sphinx-gallery==0.14.0",
"sphinxcontrib-websupport==1.2.6",
"sphinxemoji==0.2.0",
"sphinx-reredirects==0.1.2",
"trame==3.2.6",
"vtk==9.2.6",
"sphinx-toolbox",
"sphinxcontrib-websupport",
]

[tool.flit.module]
Expand Down
Loading