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

Adding some doc examples 01 #536

Merged
merged 2 commits into from
Jun 22, 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
78 changes: 78 additions & 0 deletions doc/source/api/core/meshing/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,84 @@ Workflow Example
session.meshing.workflow.TaskObject['Import Geometry'].Execute()
session.meshing.tui.mesh.check_mesh()
exit()

Existing Fluent meshing workflows journals can also be converted to the
session based PyFluent scripts with some manual modifications.
For example:

Fluent Journal:

.. code-block::

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

Equivalent PyFluent Journal:

.. code:: python

session.meshing.workflow.InitializeWorkflow(WorkflowType="Watertight Geometry")
session.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 = {
"CFDSurfaceMeshControls": {"MaxSize": 0.3}
}
session.meshing.workflow.TaskObject["Generate the Surface Mesh"].Execute()
session.meshing.workflow.TaskObject["Describe Geometry"].UpdateChildTasks(
SetupTypeChanged=False
)
session.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(
SetupTypeChanged=True
)
session.meshing.workflow.TaskObject["Describe Geometry"].Execute()
session.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 = {
"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 = {
"VolumeFill": "poly-hexcore",
"VolumeFillControls": {
"HexMaxCellLength": 0.3,
},
}
session.meshing.workflow.TaskObject["Generate the Volume Mesh"].Execute()

TUI Commands Example
--------------------
Expand Down
43 changes: 41 additions & 2 deletions doc/source/api/core/solver/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,38 @@ Additional Metadata
-------------------

Settings objects have some additional metadata which can be accessed using the
``get_attr`` and ``get_attrs`` methods. For example, the list of allowed values
at a particular state for the viscous model can be accessed as follows:
``get_attr`` and ``get_attrs`` methods.

Example(1): The list of allowed values at a particular state for the viscous
model can be accessed as follows:

.. code-block::

>>> root.setup.models.viscous.model.get_attr('allowed-values')
['inviscid', 'laminar', 'k-epsilon-standard', 'k-omega-standard', 'mixing-length', 'spalart-allmaras', 'k-kl-w', 'transition-sst', 'reynolds-stress', 'scale-adaptive-simulation', 'detached-eddy-simulation', 'large-eddy-simulation']

.. code-block::

>>> root.setup.models.viscous.model.get_attrs(['allowed-values'])
{'allowed-values': ['inviscid', 'laminar', 'k-epsilon', 'k-omega', 'mixing-length', 'spalart-allmaras', 'k-kl-w', 'transition-sst', 'reynolds-stress', 'scale-adaptive-simulation', 'detached-eddy-simulation', 'large-eddy-simulation']}

Example(2): The list of zone surfaces can be accessed as follows:

.. code-block::

>>> root.solution.report_definitions.flux["mass_flow_rate"] = {}
>>> root.solution.report_definitions.flux[
"mass_flow_rate"
].zone_names.get_attr("allowed-values")
['symmetry-xyplane', 'hot-inlet', 'cold-inlet', 'outlet', 'wall-inlet', 'wall-elbow', 'interior--elbow-fluid']

.. code-block::

>>> root.solution.report_definitions.flux["mass_flow_rate"] = {}
>>> root.solution.report_definitions.flux[
"mass_flow_rate"
].zone_names.get_attrs(["allowed-values"])
{'allowed-values': ['symmetry-xyplane', 'hot-inlet', 'cold-inlet', 'outlet', 'wall-inlet', 'wall-elbow', 'interior--elbow-fluid']}

Attributes are dynamic and the values can change depending on the application
state.
Expand All @@ -164,6 +189,20 @@ is active at a particular time. ``get_active_child_names`` returns the list of
active children. ``get_active_command_names`` returns the list of active
commands.

Example(1): The list of active child names can be accessed as follows:

.. code-block::

>>> root.setup.models.get_active_child_names()
['energy', 'multiphase', 'viscous']

Example(2): The list of valid commands can be accessed as follows:

.. code-block::

>>> root.solution.run_calculation.get_active_command_names()
['iterate']

Settings Objects Root
---------------------
:ref:`Settings root<root>`