Skip to content
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e55ed22
Added sum and sum_if in reduction.py
prmukherj Sep 11, 2023
37203e9
Added fallback for earlier version.
prmukherj Sep 14, 2023
fa05302
Rename for consistency.
prmukherj Sep 14, 2023
978e535
Merge branch 'main' into feat/add_sum_and_sum_if_in_reduction
prmukherj Sep 14, 2023
8592ce8
Update ansys-api-fluent
prmukherj Sep 14, 2023
f63a321
Update documentation.
prmukherj Sep 15, 2023
8ac2ec8
Add documentation for new format.
prmukherj Sep 15, 2023
0e501f2
Weighted average for vector return types.
prmukherj Sep 15, 2023
1347bfa
Upgrade version.
prmukherj Sep 18, 2023
f49087d
Fix for vector as expression.
prmukherj Sep 18, 2023
9ecc55c
Update reduction return type to variant.
prmukherj Sep 20, 2023
b70e2f4
Update tests for reduction.
prmukherj Sep 20, 2023
4e1602b
Remove unused code.
prmukherj Sep 20, 2023
bdcf0f0
fix _test_min
prmukherj Sep 20, 2023
a4ac29f
Merge branch 'main' into feat/add_sum_and_sum_if_in_reduction
prmukherj Sep 20, 2023
3e67e38
Updated test min.
prmukherj Sep 20, 2023
e278ea3
Ignore errorenous test.
prmukherj Sep 20, 2023
63217e1
Merge branch 'main' of https://github.com/pyansys/pyfluent into main
prmukherj Sep 22, 2023
dd9942b
Update typing in topy.
prmukherj Sep 22, 2023
b14ae9e
Update docstring in topy.
prmukherj Sep 22, 2023
d5ac7fb
Updates to pass journal filepaths and topy.
prmukherj Sep 22, 2023
b42344d
Merge branch 'main' into maint/update_topy_arg
prmukherj Oct 3, 2023
613aa99
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 3, 2023
0e90c23
Remove warning.
prmukherj Oct 3, 2023
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
42 changes: 25 additions & 17 deletions src/ansys/fluent/core/launcher/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import subprocess
import tempfile
import time
from typing import Any, Dict, Optional, Union
from typing import Any, Dict, List, Optional, Union

from ansys.fluent.core.fluent_connection import FluentConnection
from ansys.fluent.core.launcher.fluent_container import (
Expand Down Expand Up @@ -426,13 +426,11 @@ def _generate_launch_string(
return launch_string


def scm_to_py(topy):
def scm_to_py(topy, journal_filepaths):
"""Convert journal filenames to Python filename."""
if not isinstance(topy, (str, list)):
raise TypeError("Journal name should be of str or list type.")
fluent_jou_arg = "".join([f'-i "{journal}" ' for journal in journal_filepaths])
if isinstance(topy, str):
topy = [topy]
fluent_jou_arg = "".join([f'-i "{journal}" ' for journal in topy])
return f" {fluent_jou_arg} -topy={topy}"
return f" {fluent_jou_arg} -topy"


Expand All @@ -451,7 +449,7 @@ def launch_fluent(
version: Optional[str] = None,
precision: Optional[str] = None,
processor_count: Optional[int] = None,
journal_filepath: Optional[str] = None,
journal_filepaths: Optional[List[str]] = None,
start_timeout: int = 60,
additional_arguments: Optional[str] = None,
env: Optional[Dict[str, Any]] = None,
Expand Down Expand Up @@ -492,8 +490,9 @@ def launch_fluent(
Number of processors. The default is ``None``, in which case ``1``
processor is used. In job scheduler environments the total number of
allocated cores is clamped to value of ``processor_count``.
journal_filepath : str, optional
Name of the journal file to read. The default is ``None``.
journal_filepaths : str, optional
The string path to a Fluent journal file, or a list of such paths. Fluent will execute the
journal(s). The default is ``None``.
start_timeout : int, optional
Maximum allowable time in seconds for connecting to the Fluent
server. The default is ``60``.
Expand Down Expand Up @@ -550,9 +549,9 @@ def launch_fluent(
If True, Fluent will start with GPU Solver.
cwd : str, Optional
Working directory for the Fluent client.
topy : str or list, optional
The string path to a Fluent journal file, or a list of such paths. Fluent will execute the
journal(s) and write the equivalent Python journal(s).
topy : bool or str, optional
A boolean flag to write the equivalent Python journal(s) from the journal(s) passed.
Can optionally take the file name of the new python journal file.
start_watchdog : bool, optional
When ``cleanup_on_exit`` is True, ``start_watchdog`` defaults to True,
which means an independent watchdog process is run to ensure
Expand Down Expand Up @@ -640,7 +639,7 @@ def launch_fluent(
"topy",
"case_filepath",
"lightweight_mode",
"journal_filepath",
"journal_filepaths",
"case_data_filepath",
]
invalid_arg_names = list(
Expand Down Expand Up @@ -677,8 +676,17 @@ def launch_fluent(
kwargs = _get_subprocess_kwargs_for_fluent(env)
if cwd:
kwargs.update(cwd=cwd)
if journal_filepaths:
if not isinstance(journal_filepaths, (str, list)):
raise TypeError("Journal name should be a list of strings.")
if isinstance(journal_filepaths, str):
journal_filepaths = [journal_filepaths]
if topy:
launch_string += scm_to_py(topy)
if not journal_filepaths:
raise RuntimeError(
"Please provide the journal files to be converted as 'journal_filepaths' argument."
)
launch_string += scm_to_py(topy, journal_filepaths)

if _is_windows():
# Using 'start.exe' is better, otherwise Fluent is more susceptible to bad termination attempts
Expand Down Expand Up @@ -726,11 +734,11 @@ def launch_fluent(
session.tui.file.read_case(case_filepath)
else:
session.read_case(case_filepath, lightweight_mode)
if journal_filepath:
if journal_filepaths:
if meshing_mode:
session.tui.file.read_journal(journal_filepath)
session.tui.file.read_journal(*journal_filepaths)
else:
session.file.read_journal(file_name_list=[str(journal_filepath)])
session.file.read_journal(file_name_list=journal_filepaths)
if case_data_filepath:
if not meshing_mode:
session.file.read(
Expand Down