Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc/userguide 02 #589

Merged
merged 3 commits into from
Jul 6, 2022
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
8 changes: 6 additions & 2 deletions codegen/settingsgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import os
import pickle
import pprint
import shutil

from ansys.fluent.core.solver import flobject

Expand Down Expand Up @@ -306,8 +307,11 @@ def generate():
"settings",
)
)
if not os.path.exists(parent_dir):
os.makedirs(parent_dir)

# Clear previously generated data
if os.path.exists(parent_dir):
shutil.rmtree(parent_dir)
os.makedirs(parent_dir)

session = launch_fluent()
sinfo = session._settings_service.get_static_info()
Expand Down
122 changes: 105 additions & 17 deletions doc/source/user_guide/boundary_conditions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,131 @@ The following example demonstrates how you can define boundary conditions using

.. code:: python

import ansys.fluent.core as pyfluent
session = pyfluent.launch_fluent(precision='double', processor_count=2)
session.solver.tui.file.read_case(case_file_name='file.cas.h5')
session.solver.tui.define.boundary_conditions.set.velocity_inlet(
"cold-inlet", [], "vmag", "no", 0.4, "quit"
'cold-inlet',
[],
'vmag',
'no',
0.4,
'quit'
)
session.solver.tui.define.boundary_conditions.set.velocity_inlet(
"cold-inlet", [], "ke-spec", "no", "no", "no", "yes", "quit"
'cold-inlet',
[],
'ke-spec',
'no',
'no',
'no',
'yes',
'quit'
)
session.solver.tui.define.boundary_conditions.set.velocity_inlet(
"cold-inlet", [], "turb-intensity", 5, "quit"
'cold-inlet',
[],
'turb-intensity',
5,
'quit'
)
session.solver.tui.define.boundary_conditions.set.velocity_inlet(
"cold-inlet", [], "turb-hydraulic-diam", 4, "quit"
'cold-inlet',
[],
'turb-hydraulic-diam',
4,
'quit'
)
session.solver.tui.define.boundary_conditions.set.velocity_inlet(
"cold-inlet", [], "temperature", "no", 293.15, "quit"
'cold-inlet',
[],
'temperature',
'no',
293.15,
'quit'
)

Copying Boundary Conditions
~~~~~~~~~~~~~~~~~~~~~~~~~~~
define/boundary-conditions/copy-bc TUI: Copies boundary conditions to other zones.

.. code:: python

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

Listing Zones
~~~~~~~~~~~~~
define/boundary-conditions/list-zones TUI: Prints out the types and IDs of all
zones in the console window.

.. code:: python

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

Modifying Cell Zone Conditions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code:: python

#Enabling Laminar Zone
session.solver.tui.define.boundary_conditions.fluid(
'elbow-fluid',
'no',
'no',
'no',
'no',
'no',
0,
'no',
0,
'no',
0,
'no',
0,
'no',
0,
'no',
1,
'no',
'yes',
'yes',
'no',
'no',
'no'
)

Settings Objects
----------------
The following example demonstrates how you can define boundary conditions using
:ref:`ref_settings`:

Defining Boundary Conditions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code:: python

session.solver.root.setup.boundary_conditions.velocity_inlet["cold-inlet"].vmag = {
"option": "constant or expression",
"constant": 0.4,
session.solver.root.setup.boundary_conditions.velocity_inlet['cold-inlet'].vmag = {
'option': 'constant or expression',
'constant': 0.4,
}
session.solver.root.setup.boundary_conditions.velocity_inlet[
"cold-inlet"
].ke_spec = "Intensity and Hydraulic Diameter"
'cold-inlet'
].ke_spec = 'Intensity and Hydraulic Diameter'
session.solver.root.setup.boundary_conditions.velocity_inlet[
"cold-inlet"
'cold-inlet'
].turb_intensity = 5
session.solver.root.setup.boundary_conditions.velocity_inlet[
"cold-inlet"
].turb_hydraulic_diam = "4 [in]"
session.solver.root.setup.boundary_conditions.velocity_inlet["cold-inlet"].t = {
"option": "constant or expression",
"constant": 293.15,
}
'cold-inlet'
].turb_hydraulic_diam = '4 [in]'
session.solver.root.setup.boundary_conditions.velocity_inlet['cold-inlet'].t = {
'option': 'constant or expression',
'constant': 293.15,
}

Modifying Cell Zone Conditions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code:: python

#Enabling Laminar Zone
session.solver.root.setup.cell_zone_conditions.fluid['elbow-fluid'] = {'laminar' : True}
46 changes: 43 additions & 3 deletions doc/source/user_guide/general_settings.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,53 @@
Applying General Settings
=========================
PyFluent supports defining general settings using the TUI API and
PyFluent supports defining general settings using the :ref:`ref_solver_tui_commands` and
:ref:`ref_settings`.

Solver TUI Commands
-------------------
The following example demonstrates how you can define units using
The following examples demonstrate how you can use solver meshing commands
and setup units using
:ref:`ref_solver_tui_commands`:

Checking Mesh
~~~~~~~~~~~~~
mesh/check TUI: Performs various mesh consistency checks and displays a
report in the console that lists the domain extents, the volume statistics,
the face area statistics, and any warnings, as well as details about the
various checks and mesh failures (depending on the setting specified for
mesh/check-verbosity).

.. code:: python

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

Reporting Mesh Quality
~~~~~~~~~~~~~~~~~~~~~~
mesh/quality TUI: Displays information about the quality of the mesh in the
console, including the minimum orthogonal quality and the maximum aspect ratio.
The level of detail displayed depends on the setting specified for
mesh/check-verbosity.

.. code:: python

session.solver.tui.mesh.quality()

Scaling Mesh
~~~~~~~~~~~~
mesh/scale TUI: Prompts for the scaling factors in each of the active Cartesian
coordinate directions.

.. code:: python

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

Defining Units
~~~~~~~~~~~~~~
define/units TUI: Sets unit conversion factors.

.. code:: python

session.solver.tui.define.units("length", "in")
session.solver.tui.define.units('length', 'in')
6 changes: 3 additions & 3 deletions doc/source/user_guide/launching_ansys_fluent.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,23 @@ The following example demonstrates how you can select double precision in soluti

.. code:: python

solver_session = pyfluent.launch_fluent(precision="double")
solver_session = pyfluent.launch_fluent(precision='double')

Dimension
~~~~~~~~~
The following example demonstrates how you can select double precision and 2D in solution mode:

.. code:: python

solver_session = pyfluent.launch_fluent(precision="double", version="2d")
solver_session = pyfluent.launch_fluent(precision='double', version='2d')

Number of Processors
~~~~~~~~~~~~~~~~~~~~
The following example demonstrates how you can select the number of processors:

.. code:: python

solver_session = pyfluent.launch_fluent(precision="double", version="2d", processor_count=2)
solver_session = pyfluent.launch_fluent(precision='double', version='2d', processor_count=2)

API Reference
-------------
Expand Down
57 changes: 31 additions & 26 deletions doc/source/user_guide/materials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,38 @@ Solver TUI Commands
The following example demonstrates how you can define materials using
the :ref:`ref_solver_tui_commands`:

define/materials TUI: Enters the materials menu.

.. code:: python

session.solver.tui.define.materials.copy("fluid", "water-liquid")
import ansys.fluent.core as pyfluent
session = pyfluent.launch_fluent(precision='double', processor_count=2)
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(
"elbow-fluid",
"yes",
"water-liquid",
"no",
"no",
"no",
"no",
"0",
"no",
"0",
"no",
"0",
"no",
"0",
"no",
"0",
"no",
"1",
"no",
"no",
"no",
"no",
"no",
'elbow-fluid',
'yes',
'water-liquid',
'no',
'no',
'no',
'no',
'0',
'no',
'0',
'no',
'0',
'no',
'0',
'no',
'0',
'no',
'1',
'no',
'no',
'no',
'no',
'no',
)

Settings Objects
Expand All @@ -44,5 +49,5 @@ The following example demonstrates how you can define materials using

.. code:: python

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