ansys / ansys/pysystem-coupling

pysyc error when adding MAPDL participant as session on Linux 25R2

Open
#516 5 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
12
Forks
6
Avg merge
1d 18m
Merged PRs (30d)
6

Description

### 🔍 Before submitting the issue

- [x] I have searched among the existing issues
- [x] I am using a Python virtual environment

### 🐞 Description of the bug

I can connect MAPDL participant as session on windows 25R2 but not linux. I get:

pysyTraceback (most recent call last):
File "/lus01/pshutche/Antenna/Cylinder-vortex-shedding/pysyc-slurm/main.py", line 30, in
solid = syc.setup.add_participant(participant_session = mechanical)
File "/lus01/pshutche/AirbusHeli/pyenv/lib/python3.10/site-packages/ansys/systemcoupling/core/adaptor/impl/types.py", line 757, in __call__
return self.sycproxy.execute_injected_cmd(
File "/lus01/pshutche/AirbusHeli/pyenv/lib/python3.10/site-packages/ansys/systemcoupling/core/adaptor/impl/syc_proxy.py", line 128, in execute_injected_cmd
return cmd(**kwargs)
File "/lus01/pshutche/AirbusHeli/pyenv/lib/python3.10/site-packages/ansys/systemcoupling/core/adaptor/impl/injected_commands.py", line 93, in
"add_participant": lambda **kwargs: _wrap_add_participant(
File "/lus01/pshutche/AirbusHeli/pyenv/lib/python3.10/site-packages/ansys/systemcoupling/core/adaptor/impl/injected_commands.py", line 136, in _wrap_add_participant
return part_mgr.add_participant(
File "/lus01/pshutche/AirbusHeli/pyenv/lib/python3.10/site-packages/ansys/systemcoupling/core/participant/manager.py", line 84, in add_participant
part_state.participant_analysis_type = participant_session.get_analysis_type()
File "/lus01/pshutche/AirbusHeli/pyenv/lib/python3.10/site-packages/ansys/systemcoupling/core/participant/mapdl.py", line 72, in get_analysis_type
raise MapdlRuntimeError(f"Unsupported analysis type: {analysis_type}")
NameError: name 'MapdlRuntimeError' is not defined. Did you mean: 'RuntimeError'?

### 📝 Steps to reproduce

Submission script:

#!/bin/bash -l
#
# Set slurm options as needed
#
#SBATCH --mail-user="paul.hutcheson@ansys.com"
#SBATCH --mail-type=ALL
#SBATCH --job-name Cylinder
#SBATCH --nodes=1
#SBATCH --partition=ottc02
# --exclusive
#SBATCH --ntasks-per-node=32
#SBATCH --output=%x-%j.out
#SBATCH --error=%x-%j.err
#SBATCH --export=ALL
# There is more flexibility with slurm:
# --nodes=1
# --ntasks-per-node=32
# --ntasks=32
#
# An example script to submit a co-simulation into a queue system
#
# Set DISPLAY variable
export DISPLAY=ottvnc5:3
#
# Optionally set paths to ANSYS and system coupling areas
export AWP_ROOT252=/ott/apps/software/v252

#export SYSC_ROOT=${AWP_ROOT251}/SystemCoupling
export SYSC_ROOT=${AWP_ROOT252}/SystemCoupling
#
# print job start time and Slurm job resources
#
date
echo "SLURM_JOB_ID : "$SLURM_JOB_ID
echo "SLURM_JOB_NODELIST : "$SLURM_JOB_NODELIST
echo "SLURM_JOB_NUM_NODES : "$SLURM_JOB_NUM_NODES
echo "SLURM_NODELIST : "$SLURM_NODELIST
echo "SLURM_NTASKS : "$SLURM_NTASKS
echo "SLURM_TASKS_PER_NODE : "$SLURM_TASKS_PER_NODE
echo "working directory : "$SLURM_SUBMIT_DIR
#
#echo "Running System Coupling"
echo " System coupling main execution host is $HOSTNAME"
echo " Current working directory is $PWD"
echo " ANSYS install root is $AWP_ROOT252"
echo " System coupling root is $SYSC_ROOT"
echo " Run script is $1"
echo

# Activate python environment
source ~/pyenv/bin/activate

# Call python script
python main.py

pysyc script "main.py":

import ansys.fluent.core as pyfluent
import ansys.mapdl.core as pymapdl
import ansys.systemcoupling.core as pysystemcoupling

Fluent_folder = "Fluent_1"
Fluent_case = "Fluent-overset-laminar.cas.h5"
Fluent_cores = 32
#Fluent_ui_mode = "no_gui_or_graphics" # -g
Fluent_ui_mode = "no_gui" # -gu
Mechanical_folder = "Mechanical_2"
Mechanical_input = "Mechanical.dat"
Mechanical_cores = 16
#Mechanical_install = "/ott/apps/daily_builds/linx64/v252_Certified_Daily/ansys_inc/v252/ansys/bin/ansys252"

# Start Mechanical
mechanical = pymapdl.launch_mapdl(nproc = Mechanical_cores,override = True, run_location = Mechanical_folder)

# Read input file
mechanical.input(Mechanical_input)

# Read scheduler options for Fluent

# Start Fluent as session
fluent = pyfluent.launch_fluent(case_file_name = Fluent_case, processor_count = Fluent_cores, ui_mode = Fluent_ui_mode, cwd = Fluent_folder, graphics_driver = "null")

# Start System Coupling
syc = pysystemcoupling.launch(start_output=True)

# Connect participants
solid = syc.setup.add_participant(participant_session = mechanical)
fluid = syc.setup.add_participant(participant_session = fluent)

# Create interface
fsi_interface = syc.setup.add_interface(
side_one_participant=solid,side_one_regions=['FSIN_1'],
side_two_participant=fluid,side_two_regions=['fsi'])

# Create data transfers
force_transfer_name = syc.setup.add_data_transfer(
interface=fsi_interface,
target_side="One",
target_variable="FORC",
source_variable="force",
)

displacement_transfer_name = syc.setup.add_data_transfer(
interface=fsi_interface,
target_side="Two",
source_variable="INCD",
target_variable="displacement",
)

# Set timestep
syc.setup.solution_control.time_step_size = 1e-3
syc.setup.solution_control.end_time = 1e-3
syc.setup.solution_control.maximum_iterations = 1
syc.solution.solve()

# End parametric sweep

syc.solution.shutdown()
#fluent.exit()
#mechanical.exit()
syc.exit()

### 💻 Which operating system are you using?

Linux

### 📀 Which ANSYS version are you using?

25R2

### 🐍 Which Python version are you using?

3.10

### 📦 Installed packages

```shell
aiohappyeyeballs==2.6.1
aiohttp==3.11.18
aiosignal==1.3.2
ansys-api-fluent==0.3.35
ansys-api-mapdl==0.5.2
ansys-api-platform-instancemanagement==1.1.2
ansys-api-systemcoupling==0.2.0
ansys-api-tools-filetransfer==0.1.1
ansys-fluent-core==0.30.2
ansys-mapdl-core==0.70.2
ansys-mapdl-reader==0.54.2
ansys-math-core==0.2.2
ansys-platform-instancemanagement==1.1.2
ansys-systemcoupling-core==0.10.1
ansys-tools-filetransfer==0.1.1
ansys-tools-path==0.7.1
ansys-tools-visualization-interface==0.9.1
ansys-units==0.4.0
appdirs==1.4.4
async-timeout==5.0.1
attrs==24.2.0
certifi==2025.1.31
charset-normalizer==3.4.1
click==8.1.8
colorama==0.4.6
contourpy==1.3.1
cpylog==1.5.0
cycler==0.12.1
defusedxml==0.7.1
docker==7.1.0
docopt-ng==0.9.0
fonttools==4.56.0
frozenlist==1.6.0
geomdl==5.3.1
googleapis-common-protos==1.69.2
grpcio==1.71.0
grpcio-health-checking==1.62.3
grpcio-status==1.62.3
idna==3.10
importlib_metadata==8.6.1
joblib==1.4.2
kiwisolver==1.4.8
matplotlib==3.10.1
more-itertools==10.7.0
msgpack==1.1.0
multidict==6.4.3
nltk==3.9.1
numpy==1.26.4
packaging==24.2
pandas==2.2.3
pexpect==4.9.0
pillow==11.1.0
platformdirs==4.3.7
pooch==1.8.2
propcache==0.3.1
protobuf==4.25.6
psutil==7.0.0
ptyprocess==0.7.0
pyansys-tools-report==0.8.2
pyansys-tools-versioning==0.6.0
pyiges==0.3.1
pyNastran==1.4.1
pyparsing==3.2.1
python-dateutil==2.9.0.post0
pytz==2025.1
pyvista==0.45.0
PyYAML==6.0.2
regex==2024.11.6
requests==2.32.3
scipy==1.15.2
scooby==0.10.0
six==1.17.0
tabulate==0.9.0
tqdm==4.67.1
trame==3.9.0
trame-client==3.8.1
trame-common==0.2.0
trame-server==3.4.0
trame-vtk==2.8.15
trame-vuetify==3.0.1
typing_extensions==4.13.2
tzdata==2025.1
urllib3==2.3.0
vtk==9.4.2
websockets==15.0.1
wslink==2.3.3
yarl==1.20.0
zipp==3.21.0
```

Contributor guide

Open the contributing guide

Research direction

Start with ansys/systemcoupling/core/participant/mapdl.py and inspect get_analysis_type(), which the traceback identifies as the failing entry point. Reproduce the provided main.py submission on Linux with Python 3.10 and System Coupling 25R2; done means MAPDL participant setup no longer raises NameError and reports or handles the analysis type correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.