Specify solver settings#

PyFluent supports using Solver TUI commands and Solver settings objects to specify solver settings.

The examples on this page show how to use Solver TUI commands to specify solver settings.

Set steady or transient solution model#

This example shows a comparison between the TUI commands and the Python code for enabling and disabling the steady and unsteady (transient) solution model.

TUI command

/define/models/steady yes
/define/models/unsteady_1st_order yes

Python code

import ansys.fluent.core as pyfluent

solver = pyfluent.launch_fluent(precision="double", processor_count=2, mode="solver")
solver.tui.file.read_case("file.cas.h5")
solver.tui.define.models.steady("yes")
solver.tui.define.models.unsteady_1st_order("yes")

Set a pressure-based or density-based solver#

This example shows a comparison between the TUI commands and the Python code for enabling and disabling the pressure-based and density-based solver models.

TUI command

/define/models/solver/density-based-explicit yes
/define/models/solver/density-based-implicit yes
/define/models/solver/pressure-based yes

Python code

solver.tui.define.models.solver.density_based_explicit("yes")
solver.tui.define.models.solver.density_based_implicit("yes")
solver.tui.define.models.solver.pressure_based("yes")

Set gravitational acceleration#

This example shows a comparison between the TUI command and the Python code for setting the gravitational acceleration.

TUI command

/define/operating-conditions/gravity yes 0 -9.81 0

Python code

solver.tui.define.operating_conditions.gravity("yes","0","-9.81","0")