Skip to content

Commit 5e57a31

Browse files
germa89Revathyvenugopal162PipKat
authored
Reorganizing the headers (#1689)
* Adding option to publish to dev from the CI before merging * Reorg in docs * Fixing vale * Resetting cache * Fixing doc building warnings. * fixing links * Apply suggestions from code review Co-authored-by: Revathy Venugopal <[email protected]> * Apply suggestions from code review from Kathy Thank you a lot Kathy! Co-authored-by: Kathy Pippert <[email protected]> * Disabling Windows tests. * Using an if instead of comments * Update doc/source/user_guide/troubleshoot.rst * line * Apply suggestions from code review * Apply suggestions from code review Co-authored-by: Kathy Pippert <[email protected]> * removing the graphviz * fixing pdf building Co-authored-by: Revathy Venugopal <[email protected]> Co-authored-by: Kathy Pippert <[email protected]>
1 parent 8feecfc commit 5e57a31

36 files changed

+346
-276
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ name: CI
33
on:
44
pull_request:
55
workflow_dispatch:
6+
inputs:
7+
test_dev_docs:
8+
description: 'Publish the documentation before merging'
9+
type: boolean
10+
required: false
611
push:
712
tags:
813
- "*"
@@ -97,8 +102,8 @@ jobs:
97102

98103
- name: "Install OS packages"
99104
run: |
100-
sudo apt update
101-
sudo apt install zip pandoc libgl1-mesa-glx xvfb texlive-latex-extra latexmk
105+
sudo apt update
106+
sudo apt install zip pandoc libgl1-mesa-glx xvfb texlive-latex-extra latexmk graphviz
102107
103108
- name: "Cache pip"
104109
uses: actions/cache@v3
@@ -552,7 +557,7 @@ jobs:
552557

553558
upload_dev_docs:
554559
name: "Upload dev documentation"
555-
if: github.ref == 'refs/heads/main'
560+
if: ${{ github.ref == 'refs/heads/main' || github.event.inputs.publish == 'true' }}
556561
runs-on: ubuntu-latest
557562
needs: [docs_build]
558563
steps:

.github/workflows/nightly-doc-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- name: Install OS packages
3434
run: |
3535
sudo apt-get update
36-
sudo apt-get install libgl1-mesa-glx xvfb pandoc -qy
36+
sudo apt-get install libgl1-mesa-glx xvfb pandoc graphviz -qy
3737
3838
- name: Install ansys-mapdl-core
3939
run: |

doc/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pdf:
3838
@$(SPHINXBUILD) -M latex "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
3939
python validate_png.py # clean-up GIFs mislabeled as PNG
4040
cd $(BUILDDIR)/latex && latexmk -r latexmkrc -pdf *.tex -interaction=nonstopmode || true
41-
(test -f $(BUILDDIR)/latex/*.pdf && echo pdf exists) || exit 1
41+
(test -f $(BUILDDIR)/latex/pymapdl-Documentation-*.pdf && echo pdf exists) || exit 1
4242

4343
checklinks:
4444
$(SPHINXBUILD) -b linkcheck $(SPHINXOPTS) $(LINKCHECKDIR)

doc/source/api/index.rst

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
2+
.. _ref_index_api:
3+
4+
API reference
5+
=============
6+
7+
This page gives an overview of the API of several public PyMAPDL
8+
classes, functions, and attributes. You can find them
9+
on the left sidebar.
10+
11+
While these methods might include some MAPDL commands, they are generally
12+
specific to PyMAPDL methods and classes. PyMAPDL methods extend existing
13+
MAPDL methods in a Pythonic manner. For a mapping of MAPDL commands to
14+
PyMAPDL, see :ref:`ref_mapdl_commands`.
15+
16+
17+
.. toctree::
18+
:maxdepth: 2
19+
:hidden:
20+
21+
commands
22+
database
23+
geometry
24+
helper
25+
inline
26+
krylov
27+
logging
28+
mapdl
29+
math
30+
mesh
31+
parameters
32+
plotting
33+
pool
34+
post
35+
solution
36+
xpl
37+
building_example
38+
unit_testing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

doc/source/conf.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
"sphinx_copybutton",
6464
"sphinx_gallery.gen_gallery",
6565
"sphinxemoji.sphinxemoji",
66+
"sphinx.ext.graphviz",
6667
]
6768

6869
# Intersphinx mapping
@@ -205,6 +206,11 @@
205206
"url": "https://github.com/pyansys/pymapdl/discussions",
206207
"icon": "fa fa-comment fa-fw",
207208
},
209+
{
210+
"name": "Contribute",
211+
"url": "https://mapdl.docs.pyansys.com/release/dev/getting_started/contribution.html",
212+
"icon": "fa fa-wrench",
213+
},
208214
],
209215
"switcher": {
210216
"json_url": f"https://{cname}/release/versions.json",

doc/source/contribution_and_api/index.rst renamed to doc/source/getting_started/contribution.rst

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.. _ref_contributing:
22

3-
====================
4-
Contributing and API
5-
====================
3+
============
4+
Contributing
5+
============
66

77
Overall guidance on contributing to a PyAnsys library appears in the
88
`Contributing <dev_guide_contributing_>`_ topic
@@ -102,40 +102,3 @@ This way, it's not possible for you to push code that fails the style checks. Fo
102102
flake8...................................................................Passed
103103
codespell................................................................Passed
104104

105-
106-
.. _ref_index_api:
107-
108-
API reference
109-
=============
110-
This page gives an overview of the API of several public PyMAPDL
111-
classes, functions, and attributes. You can find them
112-
on the left sidebar.
113-
114-
While these methods might include some MAPDL commands, they are generally
115-
specific to PyMAPDL methods and classes. PyMAPDL methods extend existing
116-
MAPDL methods in a Pythonic manner. For a mapping of MAPDL commands to
117-
PyMAPDL, see :ref:`ref_mapdl_commands`.
118-
119-
120-
.. toctree::
121-
:maxdepth: 2
122-
:hidden:
123-
124-
commands
125-
database
126-
geometry
127-
helper
128-
inline
129-
krylov
130-
logging
131-
mapdl
132-
math
133-
mesh
134-
parameters
135-
plotting
136-
pool
137-
post
138-
solution
139-
xpl
140-
building_example
141-
unit_testing

doc/source/getting_started/docker.rst

Lines changed: 131 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.. _pymapdl_docker:
22

3-
************************
4-
Use MAPDL through Docker
5-
************************
3+
*****************
4+
Docker containers
5+
*****************
66
You can run MAPDL within a container on any OS using Docker and
77
connect to it via PyMAPDL.
88

@@ -17,7 +17,9 @@ in a containerized environment such as Docker or Singularity:
1717
Configure the Docker registry
1818
=============================
1919

20-
There is a Docker image hosted on the
20+
**Only for images in private repositories.**
21+
22+
There are several Docker images hosted on the
2123
`PyMAPDL GitHub <pymapdl_repo_>`_ repository that you
2224
can download using your GitHub credentials.
2325

@@ -43,38 +45,79 @@ with:
4345
cat GH_TOKEN.txt | docker login ghcr.io -u $GH_USERNAME --password-stdin
4446
4547
48+
.. _run_an_mapdl_image:
49+
4650
Run an MAPDL image
4751
===================
4852

4953
You can now launch MAPDL directly from Docker with a short script or
50-
directly from the command line. Because this image contains no license
51-
server, you must enter your license server IP address in the
52-
``LICENSE_SERVER`` environment variable. With that, you can launch
53-
MAPDL with:
54-
55-
.. code::
54+
directly from the command line.
55+
You can then use your host Python environment to connect to that MAPDL
56+
instance.
57+
58+
.. graphviz::
59+
60+
digraph {
61+
node [];
62+
subgraph cluster_frontend {
63+
label="*HOST*";
64+
Python;
65+
subgraph cluster_backend {
66+
MAPDL;
67+
label="*DOCKER*";
68+
}
69+
}
70+
Python -> MAPDL
71+
MAPDL -> Python
72+
}
73+
74+
Because this image does not contain a license server, you must enter your
75+
license server IP address in the ``ANSYSLMD_LICENSE_FILE`` environment variable.
76+
77+
Additionally, you run a Docker image of PyMAPDL with:
5678

57-
58-
VERSION=v21.1.0
79+
.. code:: pwsh
5980
60-
IMAGE=ghcr.io/pyansys/pymapdl/mapdl:$VERSION
61-
docker run -e ANSYSLMD_LICENSE_FILE=$LICENSE_SERVER -p 50052:50052 $IMAGE -smp
81+
docker run -e ANSYSLMD_LICENSE_FILE=1055@host.docker.internal --restart always --name mapdl -p 50053:50052 ghcr.io/pyansys/pymapdl/mapdl -smp > log.txt
6282
6383
First time you run it, Docker logins into the *ghcr.io* registry and
64-
pulls the image which can take some time.
84+
pulls the image, which can take some time.
6585
There are several images in the registry, each corresponding to a different
66-
version of MAPDL. It is recommended to use the latest version of MAPDL for
67-
the Ubuntu systems (any image tagged as ``Ubuntu``).
86+
version of MAPDL. For Ubuntu systems (any image tagged as ``Ubuntu``), you should
87+
use the latest version of MAPDL.
88+
89+
To rerun it, you should restart the container or just delete it and run it again using:
90+
91+
.. code:: pwsh
92+
93+
docker stop mapdl
94+
docker container prune
95+
96+
docker run -e ANSYSLMD_LICENSE_FILE=1055@host.docker.internal --restart always --name mapdl -p 50053:50052 ghcr.io/pyansys/pymapdl/mapdl -smp > log.txt
97+
98+
You can use the Docker flag ``--rm`` to automatically clean up the container
99+
and remove the file system when the container exits.
68100

69-
Note that port `50052` (local to the container) is being mapped to
70-
50052 on the host. This makes it possible to launch several MAPDL
71-
instances with different port mappings to allow for multiple instances
72-
of MAPDL.
101+
This creates a log file (``log.txt``) in your current directory location.
102+
103+
Notice that the WSL internal gRPC port (``50052``) is being mapped to a
104+
different Windows host port (``50053``) to avoid port conflicts with local
105+
MAPDL instances running on the host.
106+
You could additionally launch more Docker containers in different ports if
107+
you want to run multiple simulations at the same time.
108+
The module ``ansys-mapdl-core-pool`` does not work when you are connecting
109+
to an MAPDL Docker image.
110+
111+
.. note:: Ensure that your port ``50053`` is open in your firewall.
73112

74113
You can provide additional command line parameters to MAPDL by simply
75114
appending to the Docker command.
76115
For example, you can increase the number of processors (up to the
77-
number available on the host machine) with the `-np` switch.
116+
number available on the host machine) with the ``-np`` switch.
117+
118+
You should use a script file (batch ``'.bat'`` or PowerShell ``'.ps'``)
119+
to run the preceding commands all at once.
120+
78121

79122
Once you have launched MAPDL you should see:
80123

@@ -90,6 +133,7 @@ Once you have launched MAPDL you should see:
90133
Server listening on : 0.0.0.0:50052
91134
92135
136+
93137
Using ``docker-compose`` to launch MAPDL
94138
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
95139

@@ -135,9 +179,12 @@ use:
135179
The license server is not intended to be used in production.
136180
It is only intended for testing/debugging purposes.
137181
Its access is limited to collaborators of the PyAnsys project.
138-
If you would like to have access to it, please contact PyAnsys support at
182+
If you would like to have access to the license server, contact PyAnsys support at
139183
`[email protected] <pyansys_support_>`_.
140184

185+
186+
.. _pymapdl_connect_to_MAPDL_container:
187+
141188
Connect to the MAPDL container from Python
142189
==========================================
143190

@@ -165,6 +212,67 @@ Verify your connection with:
165212
MAPDL Version: RELEASE 2021 R1 BUILD 21.0
166213
PyMAPDL Version: Version: 0.57.0
167214
215+
216+
To connect to an existing MAPDL instance, you can use the :func:`launch_mapdl() <ansys.mapdl.core.launch_mapdl>` method with the argument ``start_instance=False``:
217+
218+
.. code:: python
219+
220+
from ansys.mapdl.core import launch_mapdl
221+
222+
mapdl = launch_mapdl(port=50053, start_instance=False)
223+
224+
225+
Because of the linking between host ports and Docker ports (``-p`` argument),
226+
you do not need to specify the IP address when connecting to a local container.
227+
However, if you are trying to connect to a WSL local distribution, you must
228+
specify the IP address of the WSL instance (normally ``127.0.0.1``) because
229+
no port mapping is done between both.
230+
231+
Here is an example:
232+
233+
.. code:: python
234+
235+
from ansys.mapdl.core import Mapdl
236+
237+
mapdl = Mapdl(ip='127.0.0.1', port=50053)
238+
239+
240+
You can also specify the port and IP address using environment variables that are read when
241+
launching the MAPDL instance:
242+
243+
.. code:: bash
244+
245+
export PYMAPDL_START_INSTANCE=False
246+
export PYMAPDL_PORT=50053
247+
export PYMAPDL_IP=127.0.0.1
248+
249+
250+
251+
Launch Docker with UPF capabilities
252+
===================================
253+
254+
If you want to specify a custom Python UPF routine, you must have the
255+
environment variables ``ANS_USER_PATH`` and ``ANS_USE_UPF`` defined. The
256+
former should be equal to the path where the UPF routines are located, and the
257+
latter should be equal to ``TRUE``.
258+
259+
In WSL, you can do this using:
260+
261+
.. code:: bash
262+
263+
export ANS_USER_PATH=/home/user/UPFs # Use your own path to your UPF files.
264+
export ANS_USE_UPF=TRUE
265+
266+
You can then run the Docker image with:
267+
268+
.. code:: bash
269+
270+
docker run -e [email protected] -e ANS_USER_PATH='/ansys_jobs/upf' -e ANS_USE_UPF='TRUE' --restart always --name mapdl -p 50053:50052 ghcr.io/pyansys/pymapdl/mapdl -smp 1>log.txt
271+
272+
.. warning:: The use of UPFs with Docker images or PyMAPDL is still in the alpha state.
273+
274+
275+
168276
Additional considerations
169277
=========================
170278

File renamed without changes.

doc/source/getting_started/index.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,15 @@ For more information on getting a licensed copy of Ansys, visit
1313
:hidden:
1414
:maxdepth: 2
1515

16-
running_mapdl
16+
learning
1717
versioning
18+
running_mapdl
1819
docker
19-
using_julia
2020
wsl
21+
using_julia
22+
faq
23+
contribution
24+
2125

2226
************
2327
Installation

0 commit comments

Comments
 (0)