diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 53bc0fbe6842..718a8928e483 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -142,6 +142,7 @@ jobs: env: ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }} PYFLUENT_FLUENT_PORT: 63084 + PYFLUENT_START_INSTANCE: 0 - name: Upload HTML Documentation uses: actions/upload-artifact@v2 diff --git a/ansys/fluent/core/launcher/launcher.py b/ansys/fluent/core/launcher/launcher.py index 1db2064de869..8eb85c587c58 100644 --- a/ansys/fluent/core/launcher/launcher.py +++ b/ansys/fluent/core/launcher/launcher.py @@ -78,7 +78,7 @@ def launch_fluent( start_timeout: int = 100, additional_arguments: str = "", env: Dict[str, Any] = None, - start_instance: bool = True, + start_instance: bool = None, ip: str = None, port: int = None, cleanup_on_exit: bool = True, @@ -118,7 +118,9 @@ def launch_fluent( start_instance : bool, optional When False, connect to an existing Fluent instance at ``ip`` and ``port``, which default to ``'127.0.0.1'`` at 63084. - Otherwise, launch a local instance of Fluent. Default is True. + Otherwise, launch a local instance of Fluent. Default is True + which can be overwritten by the environment variable + ``PYFLUENT_START_INSTANCE=<0 or 1>``. ip : str, optional IP address to connect to existing Fluent instance. Used only @@ -142,6 +144,8 @@ def launch_fluent( Fluent session. """ argvals = locals() + if start_instance is None: + start_instance = bool(int(os.getenv("PYFLUENT_START_INSTANCE", "1"))) if start_instance: exe_path = _get_fluent_exe_path() launch_string = exe_path diff --git a/examples/00-fluent/mixing_elbow_settings_api.py b/examples/00-fluent/mixing_elbow_settings_api.py index dc6b9a6a230a..121f134a7a55 100644 --- a/examples/00-fluent/mixing_elbow_settings_api.py +++ b/examples/00-fluent/mixing_elbow_settings_api.py @@ -39,7 +39,8 @@ ############################################################################### -# First, connect with a Fluent server +# First, download the geometry file and start Fluent as a service with +# Meshing Mode, Double Precision, Number of Processors 4 import ansys.fluent.core as pyfluent from ansys.fluent.core import examples @@ -48,7 +49,10 @@ import_filename = examples.download_file( "mixing_elbow.pmdb", "pyfluent/mixing_elbow" ) -s = pyfluent.launch_fluent(start_instance=False) + +s = pyfluent.launch_fluent( + meshing_mode=True, precision="double", processor_count="4" +) ############################################################################### diff --git a/examples/00-fluent/mixing_elbow_tui_api.py b/examples/00-fluent/mixing_elbow_tui_api.py index 352699dbe739..6a615b55ce91 100644 --- a/examples/00-fluent/mixing_elbow_tui_api.py +++ b/examples/00-fluent/mixing_elbow_tui_api.py @@ -38,7 +38,8 @@ ############################################################################### -# First, connect with a Fluent server +# First, download the geometry file and start Fluent as a service with +# Meshing Mode, Double Precision, Number of Processors 4 import ansys.fluent.core as pyfluent from ansys.fluent.core import examples @@ -47,7 +48,10 @@ import_filename = examples.download_file( "mixing_elbow.pmdb", "pyfluent/mixing_elbow" ) -s = pyfluent.launch_fluent(start_instance=False) + +s = pyfluent.launch_fluent( + meshing_mode=True, precision="double", processor_count="4" +) ###############################################################################