ansys / pyfluent-parametric

Pythonic interface to Ansys Fluent parametric
https://parametric.fluent.docs.pyansys.com
MIT License
19 stars 6 forks source link

Fluent cannot compile code for session.project.save_as #121

Open egravenh opened 1 year ago

egravenh commented 1 year ago

🔍 Before submitting the issue

🐞 Description of the bug

session.project.save_as(project_filepath=proj_path) gives the following error:

RuntimeError: Unable to compile python code: Error Object: ()

This is only reproducible for Fluent 23.1. 22.2 works fine.

📝 Steps to reproduce

Requirements (develop versions): ansys-fluent-core ansys-fluent-parametric

Set environment variables: PYFLUENT_FLUENT_ROOT = %AWP_ROOT231%\fluent

Enter the following in a python interpreter:

import os from pathlib import Path import shutil

import ansys.fluent.core as pyfluent from ansys.fluent.core import examples

from ansys.fluent.parametric import ParametricSession, ParametricSessionLauncher, ParametricProject, ParametricStudy, DesignPoint

Step1: Read flprz

Launch Fluent in 3D and double precision

temporary_resource_path = os.path.join( pyfluent.EXAMPLES_PATH, "test_parametric_project_resources" ) if os.path.exists(temporary_resource_path): shutil.rmtree(temporary_resource_path, ignore_errors=True) if not os.path.exists(temporary_resource_path): os.mkdir(temporary_resource_path) flprz_filename = examples.download_file( "project-elbow-param.flprz", "pyfluent/mixing_elbow" ) session = ParametricSession( project_filepath=flprz_filename, launcher=ParametricSessionLauncher(precision="double", processor_count=2), )

Save project

proj_path = str( Path(temporary_resource_path) / "project-elbow-param.flprj" ) session.project.save_as(project_filepath=proj_path)

💻 Which operating system are you using?

Windows

🐍 Which Python version are you using?

3.10

📦 Installed packages

ansys-fluent-core
ansys-fluent-parametric
raph-luc commented 11 months ago

Same issue here on Windows, works fine on Linux

Edit: to clarify, I get RuntimeError: Unable to compile python code when calling solver_session.file.parametric_project.save_as() on Windows

raph-luc commented 11 months ago

Related, failing on GitHub:

Calling solver_session.file.parametric_project.save_as(), results in

RuntimeError: Failed to save the project
Error Object: #f

https://github.com/ansys/pyfluent-parametric/actions/runs/6239679282/job/16938116145?pr=237 https://github.com/ansys/pyfluent-parametric/actions/runs/6238517356/job/16934511115 https://github.com/ansys/pyfluent-parametric/actions/runs/6239350946/job/16937115443

gRPC call that fails is:

DEBUG    pyfluent.networking:interceptors.py:43 GRPC_TRACE: rpc = /ansys.api.fluent.v0.settings.Settings/ExecuteCommand, request = {'pathInfo': {'root': 'fluent', 'path': 'file/parametric-project'}, 'command': 'save-as', 'args': {'valueMap': {'m': {'project-filename': {'string': '/home/runner/.local/share/ansys_fluent_core/examples/parametric_workflow_resources/static_mixer_study.flprj'}}}}}

Note this does not fail locally when I test it using Linux, but it does fail on GitHub (same Fluent build/container), and also when using Windows

Note also that ParametricProject.save_as() redirects to session.file.parametric_project.save_as() in the way that we currently use it


Using TUI solver_session.tui.file.parametric_project.save_as() also doesn't work on GitHub: https://github.com/ansys/pyfluent-parametric/actions/runs/6240017889/job/16939190403?pr=237, nor on Windows

But it (again) works locally on Linux for some reason