Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 1 addition & 4 deletions codegen/tuigen.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,7 @@ def __init__(
self._tui_module = "ansys.fluent.core." + self._tui_heading
if Path(self._tui_doc_dir).exists():
shutil.rmtree(Path(self._tui_doc_dir))
if meshing:
self.session = pyfluent.launch_fluent(mode="meshing")
else:
self.session = pyfluent.launch_fluent(mode="solver")
self.session = pyfluent.launch_fluent(mode="meshing" if meshing else "solver")
self._service = self.session.fluent_connection.datamodel_service_tui
self._main_menu = _TUIMenu([], "")

Expand Down
62 changes: 31 additions & 31 deletions doc/source/api/core/meshing/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ Workflow example
.. code:: python

import ansys.fluent.core as pyfluent
session = pyfluent.launch_fluent(mode="meshing")
session.start_transcript()
session.meshing.workflow.InitializeWorkflow(WorkflowType='Watertight Geometry')
session.meshing.workflow.TaskObject['Import Geometry'].Arguments = dict(FileName='cylinder.agdb')
session.meshing.workflow.TaskObject['Import Geometry'].Execute()
session.meshing.tui.mesh.check_mesh()
meshing = pyfluent.launch_fluent(mode="meshing")
meshing.start_transcript()
meshing.workflow.InitializeWorkflow(WorkflowType='Watertight Geometry')
meshing.workflow.TaskObject['Import Geometry'].Arguments = dict(FileName='cylinder.agdb')
meshing.workflow.TaskObject['Import Geometry'].Execute()
meshing.tui.mesh.check_mesh()
exit()

You can manually convert existing Fluent meshing workflow
Expand Down Expand Up @@ -53,60 +53,60 @@ and the equivalent PyFluent script.

.. code:: python

session.meshing.workflow.InitializeWorkflow(WorkflowType="Watertight Geometry")
session.meshing.workflow.TaskObject["Import Geometry"].Arguments = dict(
meshing.workflow.InitializeWorkflow(WorkflowType="Watertight Geometry")
meshing.workflow.TaskObject["Import Geometry"].Arguments = dict(
FileName=import_filename, LengthUnit="in"
)
session.meshing.workflow.TaskObject["Import Geometry"].Execute()
session.meshing.workflow.TaskObject["Add Local Sizing"].AddChildToTask()
session.meshing.workflow.TaskObject["Add Local Sizing"].Execute()
session.meshing.workflow.TaskObject["Generate the Surface Mesh"].Arguments = {
meshing.workflow.TaskObject["Import Geometry"].Execute()
meshing.workflow.TaskObject["Add Local Sizing"].AddChildToTask()
meshing.workflow.TaskObject["Add Local Sizing"].Execute()
meshing.workflow.TaskObject["Generate the Surface Mesh"].Arguments = {
"CFDSurfaceMeshControls": {"MaxSize": 0.3}
}
session.meshing.workflow.TaskObject["Generate the Surface Mesh"].Execute()
session.meshing.workflow.TaskObject["Describe Geometry"].UpdateChildTasks(
meshing.workflow.TaskObject["Generate the Surface Mesh"].Execute()
meshing.workflow.TaskObject["Describe Geometry"].UpdateChildTasks(
SetupTypeChanged=False
)
session.meshing.workflow.TaskObject["Describe Geometry"].Arguments = dict(
meshing.workflow.TaskObject["Describe Geometry"].Arguments = dict(
SetupType="The geometry consists of only fluid regions with no voids"
)
session.meshing.workflow.TaskObject["Describe Geometry"].UpdateChildTasks(
meshing.workflow.TaskObject["Describe Geometry"].UpdateChildTasks(
SetupTypeChanged=True
)
session.meshing.workflow.TaskObject["Describe Geometry"].Execute()
session.meshing.workflow.TaskObject["Update Boundaries"].Arguments = {
meshing.workflow.TaskObject["Describe Geometry"].Execute()
meshing.workflow.TaskObject["Update Boundaries"].Arguments = {
"BoundaryLabelList": ["wall-inlet"],
"BoundaryLabelTypeList": ["wall"],
"OldBoundaryLabelList": ["wall-inlet"],
"OldBoundaryLabelTypeList": ["velocity-inlet"],
}
session.meshing.workflow.TaskObject["Update Boundaries"].Execute()
session.meshing.workflow.TaskObject["Update Regions"].Execute()
session.meshing.workflow.TaskObject["Add Boundary Layers"].AddChildToTask()
session.meshing.workflow.TaskObject["Add Boundary Layers"].InsertCompoundChildTask()
session.meshing.workflow.TaskObject["smooth-transition_1"].Arguments = {
meshing.workflow.TaskObject["Update Boundaries"].Execute()
meshing.workflow.TaskObject["Update Regions"].Execute()
meshing.workflow.TaskObject["Add Boundary Layers"].AddChildToTask()
meshing.workflow.TaskObject["Add Boundary Layers"].InsertCompoundChildTask()
meshing.workflow.TaskObject["smooth-transition_1"].Arguments = {
"BLControlName": "smooth-transition_1",
}
session.meshing.workflow.TaskObject["Add Boundary Layers"].Arguments = {}
session.meshing.workflow.TaskObject["smooth-transition_1"].Execute()
session.meshing.workflow.TaskObject["Generate the Volume Mesh"].Arguments = {
meshing.workflow.TaskObject["Add Boundary Layers"].Arguments = {}
meshing.workflow.TaskObject["smooth-transition_1"].Execute()
meshing.workflow.TaskObject["Generate the Volume Mesh"].Arguments = {
"VolumeFill": "poly-hexcore",
"VolumeFillControls": {
"HexMaxCellLength": 0.3,
},
}
session.meshing.workflow.TaskObject["Generate the Volume Mesh"].Execute()
meshing.workflow.TaskObject["Generate the Volume Mesh"].Execute()

TUI commands example
--------------------

.. code:: python

import ansys.fluent.core as pyfluent
session = pyfluent.launch_fluent(mode="meshing")
session.meshing.tui.file.read_case("elbow.cas.gz")
session.meshing.tui.switch_to_solution_mode("yes")
session.solver.tui.define.models.unsteady_2nd_order("yes")
meshing_session = pyfluent.launch_fluent(mode="meshing")
meshing_session.tui.file.read_case("elbow.cas.gz")
solver_session = meshing_session.switch_to_solver()
solver_session.tui.define.models.unsteady_2nd_order("yes")
exit()

.. currentmodule:: ansys.fluent.core.meshing
Expand Down
4 changes: 2 additions & 2 deletions doc/source/api/core/solver/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ property of ``session.solver``.
.. code-block::

>>> import ansys.fluent.core as pyfluent
>>> session = pyfluent.launch_fluent(mode="solver")
>>> root = session.solver
>>> solver = pyfluent.launch_fluent(mode="solver")
>>> root = solver

The ``root`` object contains attributes such as ``file``, ``setup``,
``solution``, and ``results``. These objects are also instances of settings
Expand Down
12 changes: 6 additions & 6 deletions doc/source/getting_started/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,19 @@ You can launch Fluent from Python using the ``launch_fluent`` function:
.. code:: python

import ansys.fluent.core as pyfluent
session = pyfluent.launch_fluent(precision="double", processor_count=2, mode="solver")
session.check_health()
solver = pyfluent.launch_fluent(precision="double", processor_count=2, mode="solver")
solver.check_health()

Fluent is now active. You can send commands to it as a genuine Python class.
For example, if you wanted to read a case file, update a setting, and iterate the
solver:

.. code:: python

session.solver.tui.file.read_case(case_file_name='elbow.cas.h5')
session.solver.tui.define.models.unsteady_2nd_order("yes")
session.solver.tui.solve.initialize.initialize_flow()
session.solver.tui.solve.dual_time_iterate(2, 3)
solver.tui.file.read_case(case_file_name='elbow.cas.h5')
solver.tui.define.models.unsteady_2nd_order("yes")
solver.tui.solve.initialize.initialize_flow()
solver.tui.solve.dual_time_iterate(2, 3)

In addition to all TUI commands being available in this package, there are the
`ansys-fluent-parametric <https://github.com/pyansys/pyfluent-parametric>`_ and
Expand Down
32 changes: 16 additions & 16 deletions doc/source/user_guide/boundary_conditions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ Python code for defining velocity boundary conditions at inlets.
.. code:: python

import ansys.fluent.core as pyfluent
session = pyfluent.launch_fluent(precision='double', processor_count=2, mode="solver")
session.solver.tui.file.read_case(case_file_name='file.cas.h5')
session.solver.tui.define.boundary_conditions.set.velocity_inlet(
solver = pyfluent.launch_fluent(precision='double', processor_count=2, mode="solver")
solver.tui.file.read_case(case_file_name='file.cas.h5')
solver.tui.define.boundary_conditions.set.velocity_inlet(
'cold-inlet',
(),
'vmag',
'no',
0.4,
'quit'
)
session.solver.tui.define.boundary_conditions.set.velocity_inlet(
solver.tui.define.boundary_conditions.set.velocity_inlet(
'cold-inlet',
(),
'ke-spec',
Expand All @@ -48,21 +48,21 @@ Python code for defining velocity boundary conditions at inlets.
'yes',
'quit'
)
session.solver.tui.define.boundary_conditions.set.velocity_inlet(
solver.tui.define.boundary_conditions.set.velocity_inlet(
'cold-inlet',
(),
'turb-intensity',
5,
'quit'
)
session.solver.tui.define.boundary_conditions.set.velocity_inlet(
solver.tui.define.boundary_conditions.set.velocity_inlet(
'cold-inlet',
(),
'turb-hydraulic-diam',
4,
'quit'
)
session.solver.tui.define.boundary_conditions.set.velocity_inlet(
solver.tui.define.boundary_conditions.set.velocity_inlet(
'cold-inlet',
(),
'temperature',
Expand All @@ -86,7 +86,7 @@ Python code for copying boundary conditions to other zones.

.. code:: python

session.solver.tui.define.boundary_conditions.copy_bc('cold-inlet','hot-inlet','()')
solver.tui.define.boundary_conditions.copy_bc('cold-inlet','hot-inlet','()')

Listing zones
~~~~~~~~~~~~~
Expand All @@ -103,7 +103,7 @@ Python code for printing to the Fluent console the types and IDs of all zones.

.. code:: python

session.solver.tui.define.boundary_conditions.list_zones()
solver.tui.define.boundary_conditions.list_zones()

Modifying cell zone conditions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -121,7 +121,7 @@ Python code for modifying cell zone conditions.
.. code:: python

#Enabling Laminar Zone
session.solver.tui.define.boundary_conditions.fluid(
solver.tui.define.boundary_conditions.fluid(
'elbow-fluid',
'no',
'no',
Expand Down Expand Up @@ -159,20 +159,20 @@ Defining boundary conditions

.. code:: python

session.solver.setup.boundary_conditions.velocity_inlet['cold-inlet'].vmag = {
solver.setup.boundary_conditions.velocity_inlet['cold-inlet'].vmag = {
'option': 'constant or expression',
'constant': 0.4,
}
session.solver.setup.boundary_conditions.velocity_inlet[
solver.setup.boundary_conditions.velocity_inlet[
'cold-inlet'
].ke_spec = 'Intensity and Hydraulic Diameter'
session.solver.setup.boundary_conditions.velocity_inlet[
solver.setup.boundary_conditions.velocity_inlet[
'cold-inlet'
].turb_intensity = 5
session.solver.setup.boundary_conditions.velocity_inlet[
solver.setup.boundary_conditions.velocity_inlet[
'cold-inlet'
].turb_hydraulic_diam = '4 [in]'
session.solver.setup.boundary_conditions.velocity_inlet['cold-inlet'].t = {
solver.setup.boundary_conditions.velocity_inlet['cold-inlet'].t = {
'option': 'constant or expression',
'constant': 293.15,
}
Expand All @@ -185,4 +185,4 @@ Modifying cell zone conditions
.. code:: python

#Enabling Laminar Zone
session.solver.setup.cell_zone_conditions.fluid['elbow-fluid'] = {'laminar' : True}
solver.setup.cell_zone_conditions.fluid['elbow-fluid'] = {'laminar' : True}
12 changes: 6 additions & 6 deletions doc/source/user_guide/general_settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ the verbosity (level 0 to 3).
.. code:: python

import ansys.fluent.core as pyfluent
session = pyfluent.launch_fluent(precision='double', processor_count=2, mode="solver")
session.solver.tui.file.read_case(case_file_name='file.cas.h5')
session.solver.tui.mesh.check()
solver = pyfluent.launch_fluent(precision='double', processor_count=2, mode="solver")
solver.tui.file.read_case(case_file_name='file.cas.h5')
solver.tui.mesh.check()

Reporting mesh quality
----------------------
Expand All @@ -47,7 +47,7 @@ console, including the minimum orthogonal quality and maximum aspect ratio.

.. code:: python

session.solver.tui.mesh.quality()
solver.tui.mesh.quality()

Scaling mesh
------------
Expand All @@ -65,7 +65,7 @@ coordinate directions.

.. code:: python

session.solver.tui.mesh.scale(1,1,1)
solver.tui.mesh.scale(1,1,1)

Defining units
--------------
Expand All @@ -82,4 +82,4 @@ Python code for setting the unit conversion factors.

.. code:: python

session.solver.tui.define.units('length', 'in')
solver.tui.define.units('length', 'in')
10 changes: 5 additions & 5 deletions doc/source/user_guide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ users:

.. code:: python

tui = solver_session.solver.tui
tui = solver_session.tui

tui.file.read_case(case_file_name="pipe.cas.h5")

Expand All @@ -81,7 +81,7 @@ additional interface features that are not possible via the ``tui`` object:

.. code:: python

root = solver_session.solver
root = solver_session

root.file.read(file_type="case", file_name="pipe.cas.h5")

Expand All @@ -106,7 +106,7 @@ straightforward and familiar command and settings interactions are available:

.. code:: python

tui = meshing_session.meshing.tui
tui = meshing_session.tui

tui.mesh.prepare_for_solve("yes")

Expand All @@ -122,7 +122,7 @@ exposes directly:

.. code:: python

workflow = meshing_session.meshing.workflow
workflow = meshing_session.workflow

workflow.InitializeWorkflow(WorkflowType="Watertight Geometry")

Expand All @@ -132,7 +132,7 @@ exposes directly:

import_geometry.Execute()

meshing = meshing_session.meshing.meshing
meshing = meshing_session.meshing

meshing.GlobalSettings.LengthUnit.setState("mm")

Expand Down
4 changes: 1 addition & 3 deletions doc/source/user_guide/launching_ansys_fluent.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ This example shows how you can start Fluent in solution mode:

.. code:: python

solver_session_a = pyfluent.launch_fluent(mode="solver")

solver_session_b = pyfluent.launch_fluent(mode="solver")
solver_session = pyfluent.launch_fluent(mode="solver")

Meshing mode
~~~~~~~~~~~~
Expand Down
12 changes: 6 additions & 6 deletions doc/source/user_guide/materials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ Python code for defining the fluid material being modelled on a cell zone.
.. code:: python

import ansys.fluent.core as pyfluent
session = pyfluent.launch_fluent(precision='double', processor_count=2, mode="solver")
session.solver.tui.file.read_case(case_file_name='file.cas.h5')
session.solver.tui.define.materials.copy('fluid', 'water-liquid')
session.solver.tui.define.boundary_conditions.fluid(
solver = pyfluent.launch_fluent(precision='double', processor_count=2, mode="solver")
solver.tui.file.read_case(case_file_name='file.cas.h5')
solver.tui.define.materials.copy('fluid', 'water-liquid')
solver.tui.define.boundary_conditions.fluid(
'elbow-fluid',
'yes',
'water-liquid',
Expand Down Expand Up @@ -57,5 +57,5 @@ This example shows how you define materials using

.. code:: python

session.solver.setup.materials.copy_database_material_by_name(type='fluid', name='water-liquid')
session.solver.setup.cell_zone_conditions.fluid['elbow-fluid'].material = 'water-liquid'
solver.setup.materials.copy_database_material_by_name(type='fluid', name='water-liquid')
solver.setup.cell_zone_conditions.fluid['elbow-fluid'].material = 'water-liquid'
Loading