Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
df68d26
Add get and create methods to objects
Gobot1234 Jan 27, 2026
61d4c66
Update src/ansys/fluent/core/solver/settings_builtin_bases.py
Gobot1234 Jan 28, 2026
f274df3
add a test case
Gobot1234 Jan 28, 2026
4e5c6be
check get on non creatable objects
Gobot1234 Jan 28, 2026
269c59e
chore: adding changelog file 4866.added.md [dependabot-skip]
pyansys-ci-bot Jan 28, 2026
c40e9ed
chore: adding changelog file 4866.added.md [dependabot-skip]
pyansys-ci-bot Jan 28, 2026
91882b2
Update src/ansys/fluent/core/solver/flobject.py
Gobot1234 Jan 28, 2026
9430310
fix tests + warning and fmt
Gobot1234 Jan 28, 2026
c38d797
generate the types for this
Gobot1234 Jan 28, 2026
9d6dacc
slightly fix up generation
Gobot1234 Jan 28, 2026
73cafbe
add all
Gobot1234 Jan 28, 2026
d42a24a
add some more tests
Gobot1234 Jan 28, 2026
779bb60
Apply suggestions from code review
Gobot1234 Jan 28, 2026
51664a4
Apply suggestions from code review
Gobot1234 Jan 29, 2026
c3c5aee
Merge branch 'main' into jhilton/create-and-find
Gobot1234 Feb 3, 2026
20ce7f9
add more tests and fix the data
Gobot1234 Feb 3, 2026
ae11446
Merge branch 'jhilton/create-and-find' of https://github.com/ansys/py…
Gobot1234 Feb 3, 2026
fedf799
touch of work still doesnt work
Gobot1234 Feb 13, 2026
fb48b06
add all as an alias for allowed_values
Gobot1234 Mar 16, 2026
a81582c
Merge branch 'main' into jhilton/create-and-find
Gobot1234 Apr 24, 2026
dae1864
Apply suggestions from code review
Gobot1234 May 5, 2026
644de8b
update docs
Gobot1234 May 12, 2026
a173cd8
make stuff actually work
Gobot1234 May 12, 2026
4be2437
remove unsupported tests
Gobot1234 May 12, 2026
83f560d
chore: adding changelog file 4866.added.md [dependabot-skip]
pyansys-ci-bot May 12, 2026
61e1717
add some comments
Gobot1234 May 13, 2026
f22c11d
Update src/ansys/fluent/core/codegen/builtin_settingsgen.py
Gobot1234 May 13, 2026
2a8df61
Potential fix for pull request finding
Gobot1234 May 13, 2026
e48d985
remove warning as it's too noisy
Gobot1234 May 14, 2026
4bf9cdf
more service fixes
Gobot1234 May 14, 2026
f9724f6
chore: adding changelog file 4866.added.md [dependabot-skip]
pyansys-ci-bot May 14, 2026
a29e52c
add missing reciprocals
Gobot1234 May 14, 2026
95558fe
remove kwarg setting source
Gobot1234 May 14, 2026
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
1 change: 1 addition & 0 deletions doc/changelog.d/4866.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add get and create methods and **kwargs support for create
8 changes: 4 additions & 4 deletions doc/source/cheatsheet/cheat_sheet.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ session = pyfluent.Solver.from_connection(ip, port, password)
### File I/O

```{python}
ReadCase(settings_source=solver)(
ReadCase(solver)(
file_name="<case_file>")
ReadCaseData(settings_source=solver)(
ReadCaseData(solver)(
file_name="<data_file>")

WriteCase(settings_source=solver)(
WriteCase(solver)(
file_name="<output_case_file>")
WriteCaseData(settings_source=solver)(
WriteCaseData(solver)(
file_name="<output_case_file>")
```

Expand Down
12 changes: 6 additions & 6 deletions doc/source/user_guide/fields/field_data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ To obtain surface vertex coordinates for a given surface, create a
>>> from ansys.fluent.core.solver import VelocityInlet

>>> vertices_request = SurfaceFieldDataRequest(
>>> surfaces=[VelocityInlet(settings_source=solver_session, name="inlet")],
>>> surfaces=[VelocityInlet(solver_session).get("inlet")],
>>> data_types=[SurfaceDataType.Vertices],
>>> )
>>> vertices_data = field_data.get_field_data(vertices_request)
Expand All @@ -66,7 +66,7 @@ in the ``data_types`` list.
.. code-block:: python

>>> faces_normal_and_centroid_request = SurfaceFieldDataRequest(
>>> surfaces=[VelocityInlet(settings_source=solver_session, name="inlet")],
>>> surfaces=[VelocityInlet(solver_session).get("inlet")],
>>> data_types=[SurfaceDataType.FacesNormal, SurfaceDataType.FacesCentroid],
>>> )
>>> faces_normal_and_centroid_data = field_data.get_field_data(faces_normal_and_centroid_request)
Expand Down Expand Up @@ -102,7 +102,7 @@ NGons (with more than 4 vertices).
.. code-block:: python

>>> faces_connectivity_request = SurfaceFieldDataRequest(
>>> surfaces=[VelocityInlet(settings_source=solver_session, name="inlet")],
>>> surfaces=[VelocityInlet(solver_session).get("inlet")],
>>> data_types=[SurfaceDataType.FacesConnectivity],
>>> flatten_connectivity=True,
>>> )
Expand Down Expand Up @@ -130,7 +130,7 @@ To retrieve scalar field data, such as absolute pressure, use ``ScalarFieldDataR

>>> absolute_pressure_request = ScalarFieldDataRequest(
>>> field_name=VariableCatalog.ABSOLUTE_PRESSURE,
>>> surfaces=[VelocityInlet(settings_source=solver_session, name="inlet")],
>>> surfaces=[VelocityInlet(solver_session).get("inlet")],
>>> )
>>> absolute_pressure_data = field_data.get_field_data(absolute_pressure_request)

Expand All @@ -152,7 +152,7 @@ To obtain vector field data, such as velocity vectors, use ``VectorFieldDataRequ

>>> velocity_request = VectorFieldDataRequest(
>>> field_name=VariableCatalog.VELOCITY,
>>> surfaces=VelocityInlets(settings_source=solver_session),
>>> surfaces=VelocityInlets(solver_session).get("inlet"),
>>> )
>>> velocity_vector_data = field_data.get_field_data(velocity_request)
# Shape: (262, 3) - Velocity vectors for 262 faces, each with components (vx, vy, vz) for 'inlet'.
Expand All @@ -171,7 +171,7 @@ To obtain pathlines field data, use ``PathlinesFieldDataRequest``:
>>> from ansys.fluent.core import PathlinesFieldDataRequest
>>> velocity_pathlines_request = PathlinesFieldDataRequest(
>>> field_name=VariableCatalog.VELOCITY_X,
>>> surfaces=[VelocityInlet(settings_source=solver_session, name="inlet")]
>>> surfaces=[VelocityInlet(solver_session).get("inlet")],
>>> flatten_connectivity=True,
>>> )
>>> velocity_path_lines_data = field_data.get_field_data(velocity_pathlines_request)
Expand Down
6 changes: 3 additions & 3 deletions doc/source/user_guide/fields/reduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
>>> # Compute the minimum of absolute pressure across multiple solvers
>>> reduction.minimum(
... expression=VariableCatalog.ABSOLUTE_PRESSURE,
... locations=VelocityInlets(settings_source=solver1) + VelocityInlets(settings_source=solver2),
... locations=VelocityInlets(solver1) + VelocityInlets(solver2),
... )
101343.2241809384

Expand All @@ -80,14 +80,14 @@
.. code-block:: python

>>> from ansys.fluent.core.solver import VelocityInlet
>>> solver_session.fields.reduction.area(locations=[VelocityInlet(settings_source=solver_session, name="inlet1")])
>>> solver_session.fields.reduction.area(locations=[VelocityInlet(solver_session).get("inlet1")])
0.002555675491754098

>>> reduction.area(locations=["inlet1"], ctxt=solver_session)
0.002555675491754098


Reduction functions: capabilities

Check warning on line 90 in doc/source/user_guide/fields/reduction.rst

View workflow job for this annotation

GitHub Actions / Documentation Style Check

[vale] reported by reviewdog 🐶 [Google.Headings] 'Reduction functions: capabilities' should use sentence-style capitalization. Raw Output: {"message": "[Google.Headings] 'Reduction functions: capabilities' should use sentence-style capitalization.", "location": {"path": "doc/source/user_guide/fields/reduction.rst", "range": {"start": {"line": 90, "column": 1}}}, "severity": "WARNING"}
----------------------------------

The following reduction functions are available in PyFluent:
Expand Down Expand Up @@ -301,7 +301,7 @@
.. code-block:: python

>>> cent = reduction.centroid(
>>> locations=VelocityInlets(settings_source=solver1) + VelocityInlets(settings_source=solver2)
>>> locations=VelocityInlets(solver1) + VelocityInlets(solver2)
>>> )
>>> cent.array
(np.float64(-0.35755705583644837), np.float64(-0.1570620132480841), np.float64(-0.023607876218682954))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Boundary conditions
>>> file_name = examples.download_file("mixing_elbow.cas.h5", "pyfluent/mixing_elbow")
>>> solver_session = pyfluent.launch_fluent()
>>> solver_session.settings.file.read_case(file_name=file_name)
>>> cold_inlet = pyfluent.VelocityInlet(settings_source=solver_session, name="cold-inlet")
>>> cold_inlet = pyfluent.VelocityInlet(solver_session, name="cold-inlet")
>>> cold_inlet.momentum.velocity.set_state(0.4)
>>> inlet_turbulence = cold_inlet.turbulence
>>> turbulence_specification = inlet_turbulence.turbulence_specification
Expand All @@ -33,5 +33,5 @@ Cell zone conditions

.. code:: python

>>> elbow_fluid = pyfluent.solver.FluidCellZone(settings_source=solver_session, name="elbow-fluid")
>>> elbow_fluid = pyfluent.solver.FluidCellZone(solver_session, name="elbow-fluid")
>>> elbow_fluid.laminar.set_state(True)
4 changes: 2 additions & 2 deletions doc/source/user_guide/solver_settings/set_up/materials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Copy material from database
>>> file_name = examples.download_file("mixing_elbow.cas.h5", "pyfluent/mixing_elbow")
>>> solver_session = pyfluent.launch_fluent()
>>> solver_session.settings.file.read_case(file_name=file_name)
>>> materials = pyfluent.Materials(settings_source=solver_session)
>>> materials = pyfluent.Materials(solver_session)
>>> fluids = materials.fluid
>>> fluids.make_a_copy(from_="air",to="air-2")
>>> air_copy = fluids["air-2"]
Expand All @@ -34,7 +34,7 @@ Copy material from database
'sutherland',
'kinetic-theory']
>>> air_copy.viscosity.value.set_state(1.81e-05)
>>> elbow_fluid = pyfluent.solver.FluidCellZone(settings_source=solver_session, name="elbow-fluid")
>>> elbow_fluid = pyfluent.solver.FluidCellZone(solver_session, name="elbow-fluid")
>>> elbow_fluid.material.set_state("air-2")


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Setting up and querying the model
.. code:: python

>>> import ansys.fluent.core as pyfluent
>>> battery = pyfluent.solver.Battery(settings_source=solver_session)
>>> battery = pyfluent.solver.Battery(solver_session)
>>> battery.enabled.set_state(True)
>>> battery.solution_method.allowed_values()
['cht-coupling', 'fmu-cht-coupling', 'circuit-network', 'msmd', 'msmd-rom']
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Setting up and querying the model
.. code:: python

>>> import ansys.fluent.core as pyfluent
>>> dpm = pyfluent.solver.DiscretePhase(settings_source=solver_session)
>>> dpm = pyfluent.solver.DiscretePhase(solver_session)
>>> dpm_models = dpm.physical_models
>>> dpm_models.virtual_mass_force.enabled.get_state()
>>> dpm_models.virtual_mass_force.virtual_mass_factor.is_active()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Setting up and querying the model
>>> file_name = examples.download_file("mixing_elbow.cas.h5", "pyfluent/mixing_elbow")
>>> solver_session = pyfluent.launch_fluent()
>>> solver_session.settings.file.read_case(file_name=file_name)
>>> energy = pyfluent.solver.Energy(settings_source=solver_session)
>>> energy = pyfluent.solver.Energy(solver_session)
>>> energy.enabled.get_state()
True
>>> from pprint import pprint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Setting up and querying the model
.. code:: python

>>> import ansys.fluent.core as pyfluent
>>> radiation = pyfluent.solver.Radiation(settings_source=solver_session)
>>> radiation = pyfluent.solver.Radiation(solver_session)
>>> from pprint import pprint
>>> pprint(radiation.get_state(), width=1)
{'model': 'none',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Setting up and querying the model
>>> import ansys.fluent.core as pyfluent
>>> solver_session = pyfluent.launch_fluent()
>>> solver_session.settings.file.read_case(file_name=file_name)
>>> species = pyfluent.solver.Species(settings_source=solver_session)
>>> species = pyfluent.solver.Species(solver_session)
>>> species.get_state()
{'model': {'option': 'off', 'number_vol_spec': False}}
>>> from pprint import pprint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Setting up and querying the model
.. code:: python

>>> import ansys.fluent.core as pyfluent
>>> viscous = pyfluent.solver.Viscous(settings_source=solver_session)
>>> viscous = pyfluent.solver.Viscous(solver_session)
>>> from pprint import pprint
>>> pprint(viscous.get_state(), width=1)
{'k_omega_model': 'sst',
Expand Down
45 changes: 22 additions & 23 deletions doc/source/user_guide/solver_settings/solution.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ Steady or transient solution model

.. code:: python

>>> setup = pyfluent.solver.Setup(settings_source=solver_session)
>>> setup = pyfluent.solver.Setup(solver_session)
>>> solver_time = setup.general.solver.time
>>> solver_time.get_state()
>>> solver_time()
'steady'
>>> solver_time.allowed_values()
>>> solver_time.all()
['steady', 'unsteady-1st-order']
>>> solver_time.set_state("unsteady-1st-order")

Expand All @@ -23,39 +23,39 @@ Pressure-based or density-based solver

.. code:: python

>>> setup = pyfluent.solver.Setup(settings_source=solver_session)
>>> solver_type = setup.general.solver.type
>>> solver_type.get_state()
>>> setup = pyfluent.solver.Setup(solver_session)
>>> solver = setup.general.solver
>>> solver.type()
'pressure-based'
>>> solver_type.allowed_values()
>>> solver.type.all()
['pressure-based', 'density-based-implicit', 'density-based-explicit']
>>> solver_session.settings.setup.general.solver.type.set_state("density-based-explicit")
>>> solver_type.get_state()
>>> solver.type = "density-based-explicit"
>>> solver.type()
'density-based-explicit'


Velocity coupling scheme and gradient options
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code:: python

>>> methods = pyfluent.solver.Methods(settings_source=solver_session)
>>> methods = pyfluent.solver.Methods(solver_session)
>>> flow_scheme = methods.p_v_coupling.flow_scheme
>>> flow_scheme.allowed_values()
>>> flow_scheme.all()
['SIMPLE', 'SIMPLEC', 'PISO', 'Coupled']
>>> flow_scheme.set_state("Coupled")
>>> gradient_scheme = methods.gradient_scheme
>>> gradient_scheme.allowed_values()
>>> gradient_scheme.all()
['green-gauss-node-based', 'green-gauss-cell-based', 'least-square-cell-based']
>>> gradient_scheme.set_state("green-gauss-node-based")


Solution controls
Solution controls
~~~~~~~~~~~~~~~~~

.. code:: python

>>> controls = pyfluent.solver.Controls(settings_source=solver_session)
>>> controls = pyfluent.solver.Controls(solver_session)
>>> p_v_controls = controls.p_v_controls
>>> explicit_momentum_under_relaxation = p_v_controls.explicit_momentum_under_relaxation
>>> explicit_momentum_under_relaxation.min()
Expand All @@ -75,16 +75,15 @@ Create a report definition

.. code:: python

>>> rep_defs = pyfluent.solver.ReportDefinitions(settings_source=solver_session)
>>> surface_report_definitions = rep_defs.surface
>>> defn_name = "outlet-temp-avg"
>>> surface_report_definitions[defn_name] = {}
>>> outlet_temperature = surface_report_definitions[defn_name]
>>> outlet_temperature.report_type.set_state("surface-massavg")
>>> outlet_temperature.field.set_state("temperature")
>>> rep_defs = pyfluent.solver.ReportDefinitions(solver_session)
>>> outlet_temperature = rep_defs.surface.create(
... name="outlet-temp-avg",
... report_type="surface-massavg",
... field="temperature",
... )


Initialize and solve
Initialize and solve
~~~~~~~~~~~~~~~~~~~~

.. code:: python
Expand Down
Loading
Loading