Skip to content

Commit fca9b75

Browse files
andrinrOliverLittlewoodapaleyesdionhaefnerNolanBlack
authored
doc: ansys shapeopt showcase (#404)
<!-- Please use a PR title that conforms to *conventional commits*: "<commit_type>: Describe your change"; for example: "fix: prevent race condition". Some other commit types are: fix, feat, ci, doc, refactor... For a full list of commit types visit https://www.conventionalcommits.org/en/v1.0.0/ --> #### Relevant issue or PR <!-- If the changes resolve an issue or follow some other PR, link to them here. Only link something if it is directly relevant. --> #### Description of changes <!-- Add a high-level description of changes, focusing on the *what* and *why*. --> #### Testing done <!-- Describe how the changes were tested; e.g., "CI passes", "Tested manually in stagingrepo#123", screenshots of a terminal session that verify the changes, or any other evidence of testing the changes. --> --------- Co-authored-by: Oliver Littlewood <[email protected]> Co-authored-by: Andrei Paleyes <[email protected]> Co-authored-by: Andrei Paleyes <[email protected]> Co-authored-by: Dion Häfner <[email protected]> Co-authored-by: Nolan Black <[email protected]>
1 parent 809ff10 commit fca9b75

File tree

14 files changed

+3984
-25
lines changed

14 files changed

+3984
-25
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/tmp_img
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Ansys Tesseract Integration
2+
3+
This directory contains an example Tesseract configuration and scripts demonstrating how to use Tesseract-JAX with Ansys spaceclaim and PyMAPDL. The overall workflow is illustrated below:
4+
5+
![Workflow](imgs/workflow_1.png)
6+
7+
The main entry point of this demo is `optimization.ipynb`. The evolution of the mesh over the optimization on two different initial conditions can be seen here:
8+
9+
| Grid IC | Random IC |
10+
|----------|----------|
11+
| ![Workflow](imgs/mesh_grid_adam.gif) | ![Workflow](imgs/mesh_rnd_adam.gif) |
12+
13+
where the loss decay is plotted here:
14+
15+
![Workflow](imgs/loss.png)
16+
## Get Started
17+
18+
### Prerequisites
19+
20+
A Windows machine A with:
21+
1. Ansys SpaceClaim + MAPDL installed with an active license.
22+
2. Python with a virtual environment (e.g. via conda, venv).
23+
3. Two open ports.
24+
4. Known IP address, obtain it by running
25+
26+
```powershell
27+
(Get-NetIPAddress -AddressFamily IPv4 -InterfaceAlias "Wi-Fi","Ethernet" | Where-Object {$_.IPAddress -notlike "169.254.*" -and $_.IPAddress -ne $null}).IPAddress
28+
```
29+
30+
A machine B, ideally running linux, with:
31+
1. Docker installed and running.
32+
2. Python with a virtual environment (e.g. via conda, venv).
33+
34+
### SpaceClaim Tesseract setup
35+
36+
In Windows Powershell, install the the required dependencies by running:
37+
38+
```bash
39+
pip install tesseract-core[runtime] trimesh
40+
```
41+
42+
Clone this repository, navigate to `demo/_showcase/ansys-shapeopt/spaceclaim` and start the Tesseract runtime server with:
43+
44+
```bash
45+
tesseract-runtime serve --port <port_number_1> --host 0.0.0.0
46+
```
47+
Note that we do not build a Tesseract Docker image for SpaceClaim in this example. Instead, we use an existing SpaceClaim installation directly from the host machine. More details about this Tesseract can be found [here](https://docs.pasteurlabs.ai/projects/tesseract-core/latest/content/examples/ansys_integration/spaceclaim_tess.html).
48+
49+
### PyMAPDL Server
50+
51+
On machine A, run the following Powershell command to start Ansys with gRPC server enabled:
52+
53+
```powershell
54+
Start-Process -FilePath "F:\ANSYS Inc\v242\ansys\bin\winx64\ANSYS242.exe" -ArgumentList "-grpc", "-port", "<port_number_2>"
55+
```
56+
57+
replace "v242" with your Ansys version and ensure the path is correct. More details about PyMAPDL Tesseract can be found [here](https://docs.pasteurlabs.ai/projects/tesseract-core/latest/content/examples/ansys_integration/pymapdl_tess.html).
58+
59+
### Building Tesseracts
60+
61+
On machine B, navigate to `demo/_showcase/ansys-shapeopt/` and run
62+
63+
```bash
64+
pip install -r requirements.txt
65+
```
66+
67+
and build the needed tesseracts using
68+
69+
```bash
70+
tesseract build spaceclaim
71+
tesseract build pymapdl
72+
tesseract build sdf_fd
73+
```
74+
75+
### Run the notebook
76+
77+
At this stage you are ready to run the main notebook [optimization.ipynb](optimization.ipynb).
31.6 KB
Loading
1.63 MB
Loading
1.58 MB
Loading
2.06 MB
Loading

0 commit comments

Comments
 (0)