diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 681f8abc76cc..16c624b10b3a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -107,7 +107,7 @@ jobs: needs: [docs-style] runs-on: [self-hosted, pyfluent] env: - DOC_DEPLOYMENT_IMAGE_TAG: v23.2.0 + DOC_DEPLOYMENT_IMAGE_TAG: v24.1.0 steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/nightly-dev-doc-build.yml b/.github/workflows/nightly-dev-doc-build.yml index 82d30e7b2d17..ea7d854d9eea 100644 --- a/.github/workflows/nightly-dev-doc-build.yml +++ b/.github/workflows/nightly-dev-doc-build.yml @@ -7,7 +7,7 @@ on: env: DOCUMENTATION_CNAME: 'fluent.docs.pyansys.com' - DOC_DEPLOYMENT_IMAGE_TAG: v23.2.0 + DOC_DEPLOYMENT_IMAGE_TAG: v24.1.0 ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }} PYFLUENT_TIMEOUT_FORCE_EXIT: 30 PYFLUENT_LAUNCH_CONTAINER: 1 diff --git a/.github/workflows/release-doc-build.yml b/.github/workflows/release-doc-build.yml index d917fd14f923..3d3dcc3d6c32 100644 --- a/.github/workflows/release-doc-build.yml +++ b/.github/workflows/release-doc-build.yml @@ -9,7 +9,7 @@ on: env: DOCUMENTATION_CNAME: 'fluent.docs.pyansys.com' - DOC_DEPLOYMENT_IMAGE_TAG: v23.2.0 + DOC_DEPLOYMENT_IMAGE_TAG: v24.1.0 ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }} PYFLUENT_TIMEOUT_FORCE_EXIT: 30 PYFLUENT_LAUNCH_CONTAINER: 1 diff --git a/doc/source/_static/exhaust_system_016.png b/doc/source/_static/exhaust_system_016.png index ae9ae6c76593..bf82ed1a06fc 100644 Binary files a/doc/source/_static/exhaust_system_016.png and b/doc/source/_static/exhaust_system_016.png differ diff --git a/doc/source/_static/exhaust_system_017.png b/doc/source/_static/exhaust_system_017.png index 2c9ee4633eac..102cbdd89ae4 100644 Binary files a/doc/source/_static/exhaust_system_017.png and b/doc/source/_static/exhaust_system_017.png differ diff --git a/doc/source/_static/exhaust_system_018.png b/doc/source/_static/exhaust_system_018.png index 8f0d1d4bcfc8..d7562551f77f 100644 Binary files a/doc/source/_static/exhaust_system_018.png and b/doc/source/_static/exhaust_system_018.png differ diff --git a/doc/source/_static/exhaust_system_settings.png b/doc/source/_static/exhaust_system_settings.png new file mode 100644 index 000000000000..3a4a21efb9f8 Binary files /dev/null and b/doc/source/_static/exhaust_system_settings.png differ diff --git a/doc/source/_static/mixing_elbow_014.png b/doc/source/_static/mixing_elbow_014.png index 978aa3cda90f..909a7f8ae6a0 100644 Binary files a/doc/source/_static/mixing_elbow_014.png and b/doc/source/_static/mixing_elbow_014.png differ diff --git a/doc/source/_static/mixing_elbow_015.png b/doc/source/_static/mixing_elbow_015.png index 4287f8021dd4..845f4c9bb2c2 100644 Binary files a/doc/source/_static/mixing_elbow_015.png and b/doc/source/_static/mixing_elbow_015.png differ diff --git a/doc/source/_static/mixing_elbow_016.png b/doc/source/_static/mixing_elbow_016.png index bea5846c65f6..f9f2dc3c1084 100644 Binary files a/doc/source/_static/mixing_elbow_016.png and b/doc/source/_static/mixing_elbow_016.png differ diff --git a/doc/source/_static/mixing_elbow_tui_016.png b/doc/source/_static/mixing_elbow_tui_016.png new file mode 100644 index 000000000000..adb5bff58ab7 Binary files /dev/null and b/doc/source/_static/mixing_elbow_tui_016.png differ diff --git a/examples/00-fluent/exhaust_system.py b/examples/00-fluent/exhaust_system.py index 83b6ac7c56a3..8c29dcbdd03e 100644 --- a/examples/00-fluent/exhaust_system.py +++ b/examples/00-fluent/exhaust_system.py @@ -58,7 +58,11 @@ # Launch Fluent as a service in meshing mode with double precision running on # two processors. -meshing = pyfluent.launch_fluent(precision="double", processor_count=2, mode="meshing") +meshing = pyfluent.launch_fluent( + precision="double", + processor_count=4, + mode="meshing", +) ############################################################################### # Initialize workflow @@ -551,13 +555,6 @@ solver.tui.mesh.check() -############################################################################### -# Set units for length -# ~~~~~~~~~~~~~~~~~~~~ -# Set the units for length. - -solver.tui.define.units("length", "mm") - ############################################################################### # Select turbulence model # ~~~~~~~~~~~~~~~~~~~~~~~ @@ -615,10 +612,31 @@ # solver.tui.report.volume_integrals.volume("fluid-region-1","()","yes","volume.vrp") +############################################################################### +# Write the case and data files +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +solver.tui.file.write_case_data("exhaust_system.cas.h5", "yes") + +############################################################################### +# Configure graphics picture export +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Since Fluent is being run without the GUI, we will need to export plots as +# picture files. Edit the picture settings to use a custom resolution so that +# the images are large enough. + +picture = solver.tui.display.set.picture +# use-window-container TUI option not available inside containers +if not solver.connection_properties.inside_container: + picture.use_window_resolution("no") +picture.x_resolution("1920") +picture.y_resolution("1440") + ############################################################################### # Create path lines # ~~~~~~~~~~~~~~~~~ -# Create path lines highlighting the flow field. +# Create path lines highlighting the flow field, display it, then export the +# image for inspection. ############################################################################### # .. image:: /_static/exhaust_system_016.png @@ -642,6 +660,12 @@ "()", "quit", ) +solver.tui.display.objects.display("pathlines-1") + +views = solver.tui.display.views +views.restore_view("isometric") +views.auto_scale() +solver.tui.display.save_picture("pathlines-1.png") ############################################################################### # Create iso-surface @@ -654,7 +678,7 @@ "()", "fluid-region-1", "()", - "380", + "0.38", "()", ) @@ -662,7 +686,7 @@ # Create contours of velocity magnitude # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Create contours of the velocity magnitude throughout the manifold -# along with the mesh. +# along with the mesh. Display it and export the image for inspection. ############################################################################### # .. image:: /_static/exhaust_system_017.png @@ -686,13 +710,19 @@ "quit", "quit", ) - solver.tui.display.objects.create("mesh", "mesh-1", "surfaces-list", "*", "()", "quit") +solver.tui.display.objects.display("contour-velocity") + +views.restore_view("right") +views.auto_scale() +solver.tui.display.save_picture("contour-velocity.png") + ############################################################################### # Create scene # ~~~~~~~~~~~~ -# Create a scene containing the mesh and the contours. +# Create a scene containing the mesh and the contours. Display it and export +# the image for inspection. ############################################################################### # .. image:: /_static/exhaust_system_018.png @@ -714,6 +744,13 @@ "quit", "quit", ) +solver.tui.display.objects.display("scene-1") + +camera = solver.tui.display.views.camera +camera.position("1.70", "1.14", "0.29") +camera.up_vector("-0.66", "0.72", "-0.20") +views.auto_scale() +solver.tui.display.save_picture("scene-1.png") ######################################################################### # Close Fluent diff --git a/examples/00-fluent/exhaust_system_settings_api.py b/examples/00-fluent/exhaust_system_settings_api.py new file mode 100644 index 000000000000..6a8367997922 --- /dev/null +++ b/examples/00-fluent/exhaust_system_settings_api.py @@ -0,0 +1,747 @@ +""".. _ref_exhaust_system_settings_api: + +Fault-tolerant meshing workflow using settings objects +------------------------------------------------------ +This example sets up and solves a three-dimensional turbulent fluid flow +in a manifold exhaust system, which is common in the automotive industry, +using the PyFluent Settings API. Predicting the flow field in the area of the +mixing region is important to designing the junction properly. + +This example uses the guided workflow for fault-tolerant meshing because it +is appropriate for geometries that can have imperfections, such as gaps and +leakages. + +**Workflow tasks** + +The fault-tolerant meshing workflow guides you through these tasks: + +- Import a CAD geometry and manage individual parts +- Generate a surface mesh +- Cap inlets and outlets +- Extract a fluid region +- Define leakages +- Extract edge features +- Set up size controls +- Generate a volume mesh + +**Problem description** + +In the manifold exhaust system, air flows through the three inlets +with a uniform velocity of 1 m/s. The air then exits through the outlet. +A small pipe is placed in the main portion of the manifold where edge +extraction is considered. The example also includes a known small leakage +to demonstrate the automatic leakage detection aspects of the meshing workflow. +""" + +############################################################################### +# Example Setup +# ------------- +# Before you can use the fault-tolerant meshing workflow, you must set up the +# example and initialize this workflow. +# +# Perform required imports +# ~~~~~~~~~~~~~~~~~~~~~~~~ +# Perform required imports, which includes downloading and importing +# the geometry file. + +# sphinx_gallery_thumbnail_path = '_static/exhaust_system_settings.png' +import ansys.fluent.core as pyfluent +from ansys.fluent.core import examples + +import_file_name = examples.download_file( + "exhaust_system.fmd", "pyfluent/exhaust_system" +) + +############################################################################### +# Launch Fluent +# ~~~~~~~~~~~~~ +# Launch Fluent as a service in meshing mode with double precision running on +# two processors. + +meshing = pyfluent.launch_fluent( + precision="double", + processor_count=2, + mode="meshing", +) + +############################################################################### +# Initialize workflow +# ~~~~~~~~~~~~~~~~~~~ +# Initialize the fault-tolerant meshing workflow. + +meshing.workflow.InitializeWorkflow(WorkflowType="Fault-tolerant Meshing") + +############################################################################### +# Fault-folerant meshing workflow +# ------------------------------- +# The fault-tolerant meshing workflow guides you through the many tasks that +# follow. +# +# Import CAD and manage parts +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Import the CAD geometry file (``exhaust_system.fmd``) and selectively manage some +# parts. + +meshing.PartManagement.InputFileChanged( + FilePath=import_file_name, IgnoreSolidNames=False, PartPerBody=False +) +meshing.PMFileManagement.FileManager.LoadFiles() +meshing.PartManagement.Node["Meshing Model"].Copy( + Paths=[ + "/dirty_manifold-for-wrapper," + "1/dirty_manifold-for-wrapper,1/main,1", + "/dirty_manifold-for-wrapper," + "1/dirty_manifold-for-wrapper,1/flow-pipe,1", + "/dirty_manifold-for-wrapper," + "1/dirty_manifold-for-wrapper,1/outpipe3,1", + "/dirty_manifold-for-wrapper," + "1/dirty_manifold-for-wrapper,1/object2,1", + "/dirty_manifold-for-wrapper," + "1/dirty_manifold-for-wrapper,1/object1,1", + ] +) +meshing.PartManagement.ObjectSetting["DefaultObjectSetting"].OneZonePer.set_state( + "part" +) +cad_import = meshing.workflow.TaskObject["Import CAD and Part Management"] +cad_import.Arguments.set_state( + { + "Context": 0, + "CreateObjectPer": "Custom", + "FMDFileName": import_file_name, + "FileLoaded": "yes", + "ObjectSetting": "DefaultObjectSetting", + "Options": { + "Line": False, + "Solid": False, + "Surface": False, + }, + } +) +cad_import.Execute() + +############################################################################### +# Describe geometry and flow +# ~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Describe the geometry and the flow characteristics. + +describe_geom = meshing.workflow.TaskObject["Describe Geometry and Flow"] +describe_geom.Arguments.set_state( + { + "AddEnclosure": "No", + "CloseCaps": "Yes", + "FlowType": "Internal flow through the object", + } +) +describe_geom.UpdateChildTasks(SetupTypeChanged=False) +describe_geom.Arguments.set_state( + { + "AddEnclosure": "No", + "CloseCaps": "Yes", + "DescribeGeometryAndFlowOptions": { + "AdvancedOptions": True, + "ExtractEdgeFeatures": "Yes", + }, + "FlowType": "Internal flow through the object", + } +) +describe_geom.UpdateChildTasks(SetupTypeChanged=False) +describe_geom.Execute() + +############################################################################### +# Enclose openings +# ~~~~~~~~~~~~~~~~ +# Enclose (cap) any openings in the geometry. + +############################################################################### +# .. image:: /_static/exhaust_system_011.png +# :width: 400pt +# :align: center + +############################################################################### +# .. image:: /_static/exhaust_system_012.png +# :width: 400pt +# :align: center +capping = meshing.workflow.TaskObject["Enclose Fluid Regions (Capping)"] +capping.Arguments.set_state( + { + "CreatePatchPreferences": { + "ShowCreatePatchPreferences": False, + }, + "PatchName": "inlet-1", + "SelectionType": "zone", + "ZoneSelectionList": ["inlet.1"], + } +) +capping.Arguments.set_state( + { + "CreatePatchPreferences": { + "ShowCreatePatchPreferences": False, + }, + "PatchName": "inlet-1", + "SelectionType": "zone", + "ZoneLocation": [ + "1", + "351.68205", + "-361.34322", + "-301.88668", + "396.96205", + "-332.84759", + "-266.69751", + "inlet.1", + ], + "ZoneSelectionList": ["inlet.1"], + } +) +capping.AddChildToTask() + +capping.InsertCompoundChildTask() +capping.Arguments.set_state({}) +meshing.workflow.TaskObject["inlet-1"].Execute() +capping.Arguments.set_state( + { + "PatchName": "inlet-2", + "SelectionType": "zone", + "ZoneSelectionList": ["inlet.2"], + } +) +capping.Arguments.set_state( + { + "PatchName": "inlet-2", + "SelectionType": "zone", + "ZoneLocation": [ + "1", + "441.68205", + "-361.34322", + "-301.88668", + "486.96205", + "-332.84759", + "-266.69751", + "inlet.2", + ], + "ZoneSelectionList": ["inlet.2"], + } +) +capping.AddChildToTask() + +capping.InsertCompoundChildTask() +capping.Arguments.set_state({}) +meshing.workflow.TaskObject["inlet-2"].Execute() +capping.Arguments.set_state( + { + "PatchName": "inlet-3", + "SelectionType": "zone", + "ZoneSelectionList": ["inlet"], + } +) +capping.Arguments.set_state( + { + "PatchName": "inlet-3", + "SelectionType": "zone", + "ZoneLocation": [ + "1", + "261.68205", + "-361.34322", + "-301.88668", + "306.96205", + "-332.84759", + "-266.69751", + "inlet", + ], + "ZoneSelectionList": ["inlet"], + } +) +capping.AddChildToTask() + +capping.InsertCompoundChildTask() +capping.Arguments.set_state({}) +meshing.workflow.TaskObject["inlet-3"].Execute() +capping.Arguments.set_state( + { + "PatchName": "outlet-1", + "SelectionType": "zone", + "ZoneSelectionList": ["outlet"], + "ZoneType": "pressure-outlet", + } +) +capping.Arguments.set_state( + { + "PatchName": "outlet-1", + "SelectionType": "zone", + "ZoneLocation": [ + "1", + "352.22702", + "-197.8957", + "84.102381", + "394.41707", + "-155.70565", + "84.102381", + "outlet", + ], + "ZoneSelectionList": ["outlet"], + "ZoneType": "pressure-outlet", + } +) +capping.AddChildToTask() + +capping.InsertCompoundChildTask() +capping.Arguments.set_state({}) +meshing.workflow.TaskObject["outlet-1"].Execute() + +############################################################################### +# Extract edge features +# ~~~~~~~~~~~~~~~~~~~~~ +# Extract edge features. +edge_features = meshing.workflow.TaskObject["Extract Edge Features"] +edge_features.Arguments.set_state( + { + "ExtractMethodType": "Intersection Loops", + "ObjectSelectionList": ["flow_pipe", "main"], + } +) +edge_features.AddChildToTask() + +edge_features.InsertCompoundChildTask() +edge_group = meshing.workflow.TaskObject["edge-group-1"] +edge_group.Arguments.set_state( + { + "ExtractEdgesName": "edge-group-1", + "ExtractMethodType": "Intersection Loops", + "ObjectSelectionList": ["flow_pipe", "main"], + } +) +edge_features.Arguments.set_state({}) + +edge_group.Execute() + +############################################################################### +# Identify regions +# ~~~~~~~~~~~~~~~~ +# Identify regions. +identify_regions = meshing.workflow.TaskObject["Identify Regions"] +identify_regions.Arguments.set_state( + { + "SelectionType": "zone", + "X": 377.322045740589, + "Y": -176.800676988458, + "Z": -37.0764628583475, + "ZoneSelectionList": ["main.1"], + } +) +identify_regions.Arguments.set_state( + { + "SelectionType": "zone", + "X": 377.322045740589, + "Y": -176.800676988458, + "Z": -37.0764628583475, + "ZoneLocation": [ + "1", + "213.32205", + "-225.28068", + "-158.25531", + "541.32205", + "-128.32068", + "84.102381", + "main.1", + ], + "ZoneSelectionList": ["main.1"], + } +) +identify_regions.AddChildToTask() + +identify_regions.InsertCompoundChildTask() +fluid_region_1 = meshing.workflow.TaskObject["fluid-region-1"] +fluid_region_1.Arguments.set_state( + { + "MaterialPointsName": "fluid-region-1", + "SelectionType": "zone", + "X": 377.322045740589, + "Y": -176.800676988458, + "Z": -37.0764628583475, + "ZoneLocation": [ + "1", + "213.32205", + "-225.28068", + "-158.25531", + "541.32205", + "-128.32068", + "84.102381", + "main.1", + ], + "ZoneSelectionList": ["main.1"], + } +) +identify_regions.Arguments.set_state({}) + +fluid_region_1.Execute() +identify_regions.Arguments.set_state( + { + "MaterialPointsName": "void-region-1", + "NewRegionType": "void", + "ObjectSelectionList": ["inlet-1", "inlet-2", "inlet-3", "main"], + "X": 374.722045740589, + "Y": -278.9775145640143, + "Z": -161.1700719416913, + } +) +identify_regions.AddChildToTask() + +identify_regions.InsertCompoundChildTask() + +identify_regions.Arguments.set_state({}) + +meshing.workflow.TaskObject["void-region-1"].Execute() + +############################################################################### +# Define thresholds for leakages +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Define thresholds for potential leakages. +leakage_threshold = meshing.workflow.TaskObject["Define Leakage Threshold"] +leakage_threshold.Arguments.set_state( + { + "AddChild": "yes", + "FlipDirection": True, + "PlaneDirection": "X", + "RegionSelectionSingle": "void-region-1", + } +) +leakage_threshold.AddChildToTask() + +leakage_threshold.InsertCompoundChildTask() +leakage_1 = meshing.workflow.TaskObject["leakage-1"] +leakage_1.Arguments.set_state( + { + "AddChild": "yes", + "FlipDirection": True, + "LeakageName": "leakage-1", + "PlaneDirection": "X", + "RegionSelectionSingle": "void-region-1", + } +) +leakage_threshold.Arguments.set_state( + { + "AddChild": "yes", + } +) +leakage_1.Execute() + +############################################################################### +# Review region settings +# ~~~~~~~~~~~~~~~~~~~~~~ +# Review the region settings. +update_region = meshing.workflow.TaskObject["Update Region Settings"] +update_region.Arguments.set_state( + { + "AllRegionFilterCategories": ["2"] * 5 + ["1"] * 2, + "AllRegionLeakageSizeList": ["none"] * 6 + ["6.4"], + "AllRegionLinkedConstructionSurfaceList": ["n/a"] * 6 + ["no"], + "AllRegionMeshMethodList": ["none"] * 6 + ["wrap"], + "AllRegionNameList": [ + "main", + "flow_pipe", + "outpipe3", + "object2", + "object1", + "void-region-1", + "fluid-region-1", + ], + "AllRegionOversetComponenList": ["no"] * 7, + "AllRegionSourceList": ["object"] * 5 + ["mpt"] * 2, + "AllRegionTypeList": ["void"] * 6 + ["fluid"], + "AllRegionVolumeFillList": ["none"] * 6 + ["tet"], + "FilterCategory": "Identified Regions", + "OldRegionLeakageSizeList": [""], + "OldRegionMeshMethodList": ["wrap"], + "OldRegionNameList": ["fluid-region-1"], + "OldRegionOversetComponenList": ["no"], + "OldRegionTypeList": ["fluid"], + "OldRegionVolumeFillList": ["hexcore"], + "RegionLeakageSizeList": [""], + "RegionMeshMethodList": ["wrap"], + "RegionNameList": ["fluid-region-1"], + "RegionOversetComponenList": ["no"], + "RegionTypeList": ["fluid"], + "RegionVolumeFillList": ["tet"], + } +) +update_region.Execute() + + +############################################################################### +# Set mesh control options +# ~~~~~~~~~~~~~~~~~~~~~~~~ +# Set mesh control options. + +meshing.workflow.TaskObject["Choose Mesh Control Options"].Execute() + +############################################################################### +# Generate surface mesh +# ~~~~~~~~~~~~~~~~~~~~~ +# Generate the surface mesh. + +############################################################################### +# .. image:: /_static/exhaust_system_013.png +# :width: 500pt +# :align: center + +meshing.workflow.TaskObject["Generate the Surface Mesh"].Execute() + +############################################################################### +# Confirm and update boundaries +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Confirm and update the boundaries. + +meshing.workflow.TaskObject["Update Boundaries"].Execute() + +############################################################################### +# Add boundary layers +# ~~~~~~~~~~~~~~~~~~~ +# Add boundary layers. + +meshing.workflow.TaskObject["Add Boundary Layers"].AddChildToTask() + +meshing.workflow.TaskObject["Add Boundary Layers"].InsertCompoundChildTask() + +meshing.workflow.TaskObject["aspect-ratio_1"].Arguments.set_state( + { + "BLControlName": "aspect-ratio_1", + } +) +meshing.workflow.TaskObject["Add Boundary Layers"].Arguments.set_state({}) + +meshing.workflow.TaskObject["aspect-ratio_1"].Execute() + +############################################################################### +# Generate volume mesh +# ~~~~~~~~~~~~~~~~~~~~ +# Generate the volume mesh. + +############################################################################### +# .. image:: /_static/exhaust_system_014.png +# :width: 500pt +# :align: center +volume_mesh_gen = meshing.workflow.TaskObject["Generate the Volume Mesh"] +volume_mesh_gen.Arguments.set_state( + { + "AllRegionNameList": [ + "main", + "flow_pipe", + "outpipe3", + "object2", + "object1", + "void-region-1", + "fluid-region-1", + ], + "AllRegionSizeList": ["11.33375"] * 7, + "AllRegionVolumeFillList": ["none"] * 6 + ["tet"], + "EnableParallel": True, + } +) +volume_mesh_gen.Execute() + +############################################################################### +# Check mesh +# ~~~~~~~~~~ +# Check the mesh. + +meshing.tui.mesh.check_mesh() + +############################################################################### +# Solve and postprocess +# --------------------- +# Once you have completed the fault tolerate meshing workflow, you can solve and +# postprcess the results. +# +# Switch to solution mode +# ~~~~~~~~~~~~~~~~~~~~~~~ +# Switch to the solution mode. + +solver = meshing.switch_to_solver() + +solver.mesh.check() + +############################################################################### +# Select turbulence model +# ~~~~~~~~~~~~~~~~~~~~~~~ +# Select the kw sst turbulence model. + +viscous = solver.setup.models.viscous + +viscous.model = "k-omega" +viscous.k_omega_model = "sst" + +############################################################################### +# Set velocity and turbulence boundary conditions for first inlet +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Set the velocity and turbulence boundary conditions for the first inlet +# (``inlet-1``). + +boundary_conditions = solver.setup.boundary_conditions + +boundary_conditions.velocity_inlet["inlet-1"] = { + "momentum": { + "velocity_specification_method": "Magnitude, Normal to Boundary", + "velocity": { + "value": 1, + }, + }, +} + +############################################################################### +# Set same boundary conditions for other velocity inlets +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Set the same boundary conditions for the other velocity inlets (``inlet_2`` +# and ``inlet_3``). + +boundary_conditions.copy( + from_="inlet-1", + to=["inlet-2", "inlet-3"], +) + +############################################################################### +# Set boundary conditions at outlet +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Set the boundary conditions at the outlet (``outlet-1``). + +boundary_conditions.pressure_outlet["outlet-1"].turbulence.turbulent_intensity = 0.05 + +############################################################################### +# Turn on residual plots +# ~~~~~~~~~~~~~~~~~~~~~~ +# Activate plotting of the solution residuals. + +solver.solution.monitor.residual.options.plot = True + +############################################################################### +# Initialize flow field +# ~~~~~~~~~~~~~~~~~~~~~ +# Initialize the flow field using hybrid initialization. + +solver.solution.initialization.hybrid_initialize() + +############################################################################### +# Start calculation +# ~~~~~~~~~~~~~~~~~ +# Start the calculation by requesting 100 iterations. + +############################################################################### +# .. image:: /_static/exhaust_system_015.png +# :width: 500pt +# :align: center + +solver.solution.run_calculation.iterate(iter_count=100) + +############################################################################### +# Write the case and data files +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +solver.file.write( + file_type="case-data", + file_name="exhaust_system.cas.h5", +) + +############################################################################### +# Configure graphics picture export +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Since Fluent is being run without the GUI, we will need to export plots as +# picture files. Edit the picture settings to use a custom resolution so that +# the images are large enough. + +graphics = solver.results.graphics +# use_window_resolution option not available inside containers +if not solver.connection_properties.inside_container: + graphics.picture.use_window_resolution = False +graphics.picture.x_resolution = 1920 +graphics.picture.y_resolution = 1440 + +############################################################################### +# Create path lines +# ~~~~~~~~~~~~~~~~~ +# Create path lines highlighting the flow field, display it, then export the +# image for inspection. + +############################################################################### +# .. image:: /_static/exhaust_system_016.png +# :width: 500pt +# :align: center + +graphics.pathline["pathlines-1"] = { + "field": "time", + "accuracy_control": { + "tolerance": 0.001, + }, + "skip": 5, + "release_from_surfaces": ["inlet-1", "inlet-2", "inlet-3"], +} +graphics.pathline["pathlines-1"].display() + +graphics.views.restore_view(view_name="isometric") +graphics.views.auto_scale() +graphics.picture.save_picture(file_name="pathlines-1.png") + +############################################################################### +# Create iso-surface +# ~~~~~~~~~~~~~~~~~~ +# Create an iso-surface through the manifold geometry. + +solver.results.surfaces.iso_surface["surf-x-coordinate"] = { + "field": "x-coordinate", + "zones": ["fluid-region-1"], + "iso_values": [0.38], +} + +############################################################################### +# Create contours of velocity magnitude +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Create contours of the velocity magnitude throughout the manifold +# along with the mesh. Display it and export the image for inspection. + +############################################################################### +# .. image:: /_static/exhaust_system_017.png +# :width: 500pt +# :align: center + +graphics.contour["contour-velocity"] = { + "field": "velocity-magnitude", + "surfaces_list": ["surf-x-coordinate"], + "node_values": False, + "range_option": { + "option": "auto-range-on", + "auto_range_on": { + "global_range": False, + }, + }, +} +graphics.mesh["mesh-1"] = { + "surfaces_list": "*", +} +graphics.contour["contour-velocity"].display() + +graphics.views.restore_view(view_name="right") +graphics.views.auto_scale() +graphics.picture.save_picture(file_name="contour-velocity.png") + +############################################################################### +# Create scene +# ~~~~~~~~~~~~ +# Create a scene containing the mesh and the contours. Display it and export +# the image for inspection. + +############################################################################### +# .. image:: /_static/exhaust_system_018.png +# :width: 500pt +# :align: center + +solver.results.scene["scene-1"] = {} +scene1 = solver.results.scene["scene-1"] +scene1.graphics_objects["mesh-1"] = { + "transparency": 90, +} +scene1.graphics_objects["contour-velocity"] = {} +scene1.display() + +graphics.views.camera.position(xyz=[1.70, 1.14, 0.29]) +graphics.views.camera.up_vector(xyz=[-0.66, 0.72, -0.20]) +graphics.picture.save_picture(file_name="scene-1.png") + +######################################################################### +# Close Fluent +# ~~~~~~~~~~~~ +# Close Fluent. + +solver.exit() diff --git a/examples/00-fluent/external_compressible_flow.py b/examples/00-fluent/external_compressible_flow.py index f1290ac950f7..f7be562c090e 100644 --- a/examples/00-fluent/external_compressible_flow.py +++ b/examples/00-fluent/external_compressible_flow.py @@ -244,9 +244,10 @@ # model : k-omega # k-omega model : sst -solver.setup.models.viscous.model = "k-omega" +viscous = solver.setup.models.viscous -solver.setup.models.viscous.k_omega_model = "sst" +viscous.model = "k-omega" +viscous.k_omega_model = "sst" ############################################################################### # Define materials @@ -301,9 +302,9 @@ pressure_farfield.flow_direction[2] = 0.053382 -pressure_farfield.turb_intensity = 0.05 +pressure_farfield.turbulent_intensity = 0.05 -pressure_farfield.turb_viscosity_ratio = 10 +pressure_farfield.turbulent_viscosity_ratio_real = 10 ############################################################################### # Operating Conditions diff --git a/examples/00-fluent/mixing_elbow.py b/examples/00-fluent/mixing_elbow.py index 884f0d5339cb..efeddcf64c8b 100644 --- a/examples/00-fluent/mixing_elbow.py +++ b/examples/00-fluent/mixing_elbow.py @@ -53,7 +53,11 @@ # Launch Fluent as a service in meshing mode with double precision running on # two processors. -meshing = pyfluent.launch_fluent(precision="double", processor_count=2, mode="meshing") +meshing = pyfluent.launch_fluent( + precision="double", + processor_count=2, + mode="meshing", +) ############################################################################### @@ -214,16 +218,6 @@ solver.tui.mesh.check() -############################################################################### -# Set working units for mesh -# ~~~~~~~~~~~~~~~~~~~~~~~~~~ -# Set the working units for the mesh to inches. Because the default SI units are -# used for everything except length, you do not have to change any other units -# in this example. If you want working units for length to be other than inches -# (for example, millimeters), make the appropriate change. - -solver.tui.define.units("length", "in") - ############################################################################### # Enable heat transfer # ~~~~~~~~~~~~~~~~~~~~ @@ -423,11 +417,25 @@ solver.tui.file.write_data("mixing_elbow1.dat.h5") +############################################################################### +# Configure graphics picture export +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Since Fluent is being run without the GUI, we will need to export plots as +# picture files. Edit the picture settings to use a custom resolution so that +# the images are large enough. + +picture = solver.tui.display.set.picture +# use-window-container TUI option not available inside containers +if not solver.connection_properties.inside_container: + picture.use_window_resolution("no") +picture.x_resolution("1920") +picture.y_resolution("1440") + ############################################################################### # Create definition for velocity magnitude contours # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Create and display a definition for the velocity magnitude contours on the -# symmetry plane. +# symmetry plane. Then display it and export the image for inspection. # # - Set ``"contour"`` to ``"contour-vel"``. # - Set ``"field"`` to ``"velocity-magnitude"``. @@ -451,6 +459,13 @@ "quit", ) +solver.tui.display.objects.display("contour-vel") + +views = solver.tui.display.views +views.restore_view("front") +views.auto_scale() +solver.tui.display.save_picture("contour-vel.png") + ############################################################################### # .. image:: /_static/mixing_elbow_014.png # :width: 500pt @@ -460,7 +475,7 @@ # Create definition for temperature contours # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Create and display a definition for temperature contours on the symmetry -# plane. +# plane. Then display it and export the image for inspection. # # - Set ``"contour"`` to ``"contour-temp"``. # - Set ``"field"`` to ``"temperature"``. @@ -484,6 +499,13 @@ "quit", ) +solver.tui.display.objects.display("contour-temp") + +views = solver.tui.display.views +views.restore_view("front") +views.auto_scale() +solver.tui.display.save_picture("contour-temp.png") + ############################################################################### # .. image:: /_static/mixing_elbow_015.png # :width: 500pt @@ -492,7 +514,8 @@ ############################################################################### # Create velocity vectors # ~~~~~~~~~~~~~~~~~~~~~~~ -# Create and display velocity vectors on the symmetry-xyplane plane. +# Create and display velocity vectors on the symmetry-xyplane plane. Then +# display it and export the image for inspection. # # - Set ``"vector"`` to ``"vector-vel"``. # - Set ``"style"`` to ``"arrow"``. @@ -517,8 +540,15 @@ "quit", ) +solver.tui.display.objects.display("vector-vel") + +views = solver.tui.display.views +views.restore_view("front") +views.auto_scale() +solver.tui.display.save_picture("vector-vel.png") + ############################################################################### -# .. image:: /_static/mixing_elbow_016.png +# .. image:: /_static/mixing_elbow_tui_016.png # :width: 500pt # :align: center diff --git a/examples/00-fluent/mixing_elbow_settings_api.py b/examples/00-fluent/mixing_elbow_settings_api.py index cc3c9d46ce18..07c9de40a57d 100644 --- a/examples/00-fluent/mixing_elbow_settings_api.py +++ b/examples/00-fluent/mixing_elbow_settings_api.py @@ -39,7 +39,11 @@ # Launch Fluent as a service in solver mode with double precision running on # two processors. -solver = pyfluent.launch_fluent(precision="double", processor_count=2, mode="solver") +solver = pyfluent.launch_fluent( + precision="double", + processor_count=2, + mode="solver", +) ############################################################################### # Import mesh and perform mesh check @@ -50,18 +54,8 @@ # in the mesh are reported. Ensure that the minimum volume is not negative because # Fluent cannot begin a calculation when this is the case. -solver.file.read(file_type="case", file_name=import_file_name) -solver.tui.mesh.check() - -############################################################################### -# Set working units for mesh -# ~~~~~~~~~~~~~~~~~~~~~~~~~~ -# Set the working units for the mesh to inches. Because the default SI units are -# used for everything except length, you do not have to change any other units -# in this example. If you want working units for length to be other than inches -# (for example, millimeters), make the appropriate change. - -solver.tui.define.units("length", "in") +solver.file.read_case(file_name=import_file_name) +solver.mesh.check() ############################################################################### # Enable heat transfer @@ -100,11 +94,11 @@ # Temperature: 293.15 [K] cold_inlet = solver.setup.boundary_conditions.velocity_inlet["cold-inlet"] -cold_inlet.vmag = 0.4 -cold_inlet.ke_spec = "Intensity and Hydraulic Diameter" -cold_inlet.turb_intensity = 0.05 -cold_inlet.turb_hydraulic_diam = "4 [in]" -cold_inlet.t = 293.15 +cold_inlet.momentum.velocity.value = 0.4 +cold_inlet.turbulence.turbulent_specification = "Intensity and Hydraulic Diameter" +cold_inlet.turbulence.turbulent_intensity = 0.05 +cold_inlet.turbulence.hydraulic_diameter = "4 [in]" +cold_inlet.thermal.t.value = 293.15 # hot inlet (hot-inlet), Setting: Value: # Velocity Specification Method: Magnitude, Normal to Boundary @@ -115,23 +109,25 @@ # Temperature: 313.15 [K] hot_inlet = solver.setup.boundary_conditions.velocity_inlet["hot-inlet"] -hot_inlet.vmag = 1.2 -hot_inlet.ke_spec = "Intensity and Hydraulic Diameter" -hot_inlet.turb_hydraulic_diam = "1 [in]" -hot_inlet.t = 313.15 +hot_inlet.momentum.velocity.value = 1.2 +hot_inlet.turbulence.turbulent_specification = "Intensity and Hydraulic Diameter" +hot_inlet.turbulence.hydraulic_diameter = "1 [in]" +hot_inlet.thermal.t.value = 313.15 # pressure outlet (outlet), Setting: Value: # Backflow Turbulent Intensity: 5 [%] # Backflow Turbulent Viscosity Ratio: 4 -solver.setup.boundary_conditions.pressure_outlet["outlet"].turb_viscosity_ratio = 4 +solver.setup.boundary_conditions.pressure_outlet[ + "outlet" +].turbulence.turbulent_viscosity_ratio_real = 4 ############################################################################### # Disable plotting of residuals during calculation # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Disable plotting of residuals during the calculation. -solver.tui.solve.monitors.residual.plot("no") +solver.solution.monitor.residual.options.plot = False ############################################################################### # Initialize flow field @@ -145,22 +141,44 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~ # Solve for 150 iterations. -solver.solution.run_calculation.iterate.argument_names solver.solution.run_calculation.iterate(iter_count=150) +############################################################################### +# Configure graphics picture export +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# Since Fluent is being run without the GUI, we will need to export plots as +# picture files. Edit the picture settings to use a custom resolution so that +# the images are large enough. + +graphics = solver.results.graphics +# use_window_resolution option not available inside containers +if not solver.connection_properties.inside_container: + graphics.picture.use_window_resolution = False +graphics.picture.x_resolution = 1920 +graphics.picture.y_resolution = 1440 + ############################################################################### # Create velocity vectors # ~~~~~~~~~~~~~~~~~~~~~~~ -# Create and display velocity vectors on the ``symmetry-xyplane`` plane -solver.results.graphics.vector["velocity_vector_symmetry"] = {} +# Create and display velocity vectors on the ``symmetry-xyplane`` plane, then +# export the image for inspection. + +graphics = solver.results.graphics + +graphics.vector["velocity_vector_symmetry"] = {} velocity_symmetry = solver.results.graphics.vector["velocity_vector_symmetry"] velocity_symmetry.print_state() -velocity_symmetry.field = "temperature" +velocity_symmetry.field = "velocity-magnitude" velocity_symmetry.surfaces_list = [ "symmetry-xyplane", ] velocity_symmetry.scale.scale_f = 4 velocity_symmetry.style = "arrow" +velocity_symmetry.display() + +graphics.views.restore_view(view_name="front") +graphics.views.auto_scale() +graphics.picture.save_picture(file_name="velocity_vector_symmetry.png") ############################################################################### # .. image:: /_static/mixing_elbow_016.png @@ -174,8 +192,8 @@ solver.solution.report_definitions.flux["mass_flow_rate"] = {} mass_flow_rate = solver.solution.report_definitions.flux["mass_flow_rate"] -mass_flow_rate.zone_names.get_attr("allowed-values") -mass_flow_rate.zone_names = [ +mass_flow_rate.boundaries.allowed_values() +mass_flow_rate.boundaries = [ "cold-inlet", "hot-inlet", "outlet", diff --git a/examples/00-fluent/modeling_cavitation.py b/examples/00-fluent/modeling_cavitation.py index 245207105590..d3e8f9fdf7e9 100644 --- a/examples/00-fluent/modeling_cavitation.py +++ b/examples/00-fluent/modeling_cavitation.py @@ -44,7 +44,7 @@ import ansys.fluent.core as pyfluent from ansys.fluent.core import examples -cav_file = examples.download_file("cav.msh", "pyfluent/cavitation") +cav_file = examples.download_file("cav.msh.gz", "pyfluent/cavitation") ############################################################################### # Launch a Fluent session in the 2d solution mode with double precision running @@ -79,7 +79,10 @@ ############################################################################### # Enable the k-ω SST turbulence model. -solver.setup.models.viscous = {"model": "k-omega", "k_omega_model": "sst"} +solver.setup.models.viscous = { + "model": "k-omega", + "k_omega_model": "sst", +} ############################################################################### # Define materials @@ -89,18 +92,23 @@ # the copy by changing the density to 0.02558 kg/m3 and the viscosity to # 1.26e-06 kg/m–s. -water = { - "density": {"option": "constant", "value": 1000}, - "viscosity": {"option": "constant", "value": 0.001}, +solver.setup.materials.fluid["water"] = { + "density": { + "option": "constant", + "value": 1000, + }, + "viscosity": { + "option": "constant", + "value": 0.001, + }, } -solver.setup.materials.fluid["water"] = water - solver.setup.materials.database.copy_by_name(type="fluid", name="water-vapor") -water_vapor = {"density": {"value": 0.02558}, "viscosity": {"value": 1.26e-06}} - -solver.setup.materials.fluid["water-vapor"] = water_vapor +solver.setup.materials.fluid["water-vapor"] = { + "density": {"value": 0.02558}, + "viscosity": {"value": 1.26e-06}, +} ############################################################################### # Phases @@ -137,21 +145,28 @@ inlet_1 = solver.setup.boundary_conditions.pressure_inlet["inlet_1"].phase -in_mixture = { - "direction_spec": "Normal to Boundary", - "gauge_total_pressure": {"value": 500000}, - "gauge_pressure": {"value": 449000}, - "turb_intensity": 0.05, - "ke_spec": "Intensity and Viscosity Ratio", - "turb_viscosity_ratio": 10, +inlet_1["mixture"] = { + "momentum": { + "gauge_total_pressure": {"value": 500000}, + "supersonic_or_initial_gauge_pressure": {"value": 449000}, + "direction_specification_method": "Normal to Boundary", + }, + "turbulence": { + "turbulent_specification": "Intensity and Viscosity Ratio", + "turbulent_intensity": 0.05, + "turbulent_viscosity_ratio_real": 10, + }, } -inlet_1["mixture"] = in_mixture ############################################################################### # Before copying inlet_1's boundary conditions to inlet_2, set the vapor fraction # to 0. -inlet_1["vapor"] = {"volume_fraction": {"value": 0}} +inlet_1["vapor"] = { + "multiphase": { + "volume_fraction": {"value": 0}, + }, +} solver.setup.boundary_conditions.copy(from_="inlet_1", to="inlet_2") @@ -161,16 +176,22 @@ outlet = solver.setup.boundary_conditions.pressure_outlet["outlet"].phase -out_mixture = { - "gauge_pressure": {"value": 95000}, - "turb_intensity": 0.05, - "ke_spec": "Intensity and Viscosity Ratio", - "turb_viscosity_ratio": 10, +outlet["mixture"] = { + "momentum": { + "gauge_pressure": {"value": 95000}, + }, + "turbulence": { + "turbulent_specification": "Intensity and Viscosity Ratio", + "turbulent_intensity": 0.04, + "turbulent_viscosity_ratio_real": 10, + }, } -outlet["mixture"] = out_mixture - -outlet["vapor"] = {"volume_fraction": {"value": 0}} +outlet["vapor"] = { + "multiphase": { + "volume_fraction": {"value": 0}, + }, +} ############################################################################### # Operating Conditions @@ -188,7 +209,7 @@ methods = solver.solution.methods -discretization_scheme = { +methods.discretization_scheme = { "k": "first-order-upwind", "mom": "quick", "mp": "quick", @@ -196,8 +217,6 @@ "pressure": "presto!", } -methods.discretization_scheme = discretization_scheme - ############################################################################### # For the pressure velocity coupling scheme choose 'Coupled'. Set the pseudo # time step method to 'global time step' and enable 'High Order Term Relaxation'. @@ -219,17 +238,22 @@ # 1e-05 for x-velocity, y-velocity, k, omega, and vf-vapor. Enable the specified # initial pressure then initialize the solution with hybrid initialization. -solver.tui.solve.monitors.residual.plot("yes") +solver.solution.monitor.residual.options.plot = True -solver.tui.solve.monitors.residual.convergence_criteria( - 1e-05, 1e-05, 1e-05, 1e-05, 1e-05, 1e-05 -) +resid_eqns = solver.solution.monitor.residual.equations -solver.solution.initialization.hybrid_init_options.general_settings.initial_pressure = ( - True -) +resid_eqns["continuity"].absolute_criteria = 1e-5 +resid_eqns["x-velocity"].absolute_criteria = 1e-5 +resid_eqns["y-velocity"].absolute_criteria = 1e-5 +resid_eqns["k"].absolute_criteria = 1e-5 +resid_eqns["omega"].absolute_criteria = 1e-5 +resid_eqns["vf-vapor"].absolute_criteria = 1e-5 + +initialization = solver.solution.initialization -solver.solution.initialization.hybrid_initialize() +initialization.initialization_type = "hybrid" +initialization.hybrid_init_options.general_settings.initial_pressure = True +initialization.hybrid_initialize() ############################################################################### # Save and Run @@ -237,75 +261,92 @@ # Save the case file 'cav.cas.h5'. Then, start the calculation by requesting # 500 iterations. Save the final case file and the data. -solver.file.write(file_name="cav", file_type="case") +solver.file.write_case(file_name="cav") solver.solution.run_calculation.iterate(iter_count=500) -solver.file.write(file_name="cav", file_type="case-data") +solver.file.write_case_data(file_name="cav") ############################################################################### # Post Processing # ~~~~~~~~~~~~~~~ +# Since Fluent is being run without the GUI, we will need to export plots as +# picture files. Edit the picture settings to use a custom resolution so that +# the images are large enough. + +graphics = solver.results.graphics +# use_window_resolution option not available inside containers +if not solver.connection_properties.inside_container: + graphics.picture.use_window_resolution = False +graphics.picture.x_resolution = 1920 +graphics.picture.y_resolution = 1440 + +############################################################################### +# Create contour plots +# ~~~~~~~~~~~~~~~~~~~~ # Create a contour plot for static pressure, turbulent kinetic energy and the # volume fraction of water vapor. For each plot enable banded coloring and # filled option. -solver.results.graphics.contour.create("contour_static_pressure") +graphics = solver.results.graphics -contour_static_pressure = { - "coloring": {"option": "banded", "smooth": False}, +graphics.contour["contour_static_pressure"] = { + "coloring": { + "option": "banded", + "smooth": False, + }, "field": "pressure", "filled": True, } -solver.results.graphics.contour["contour_static_pressure"] = contour_static_pressure - ############################################################################### # Mirror the display around the symmetry plane to show the full model. solver.tui.display.set.mirror_zones(["symm_2", "symm_1"]) -solver.results.graphics.contour["contour_static_pressure"].display() +graphics.contour["contour_static_pressure"].display() -solver.results.graphics.picture.save_picture(file_name="contour_static_pressure.png") +graphics.picture.save_picture(file_name="contour_static_pressure.png") ############################################################################### # .. image:: /_static/cavitation_model_012.png # :width: 500pt # :align: center -solver.results.graphics.contour.create("contour_tke") +graphics.contour.create("contour_tke") -contour_tke = { - "coloring": {"option": "banded", "smooth": False}, +graphics.contour["contour_tke"] = { + "coloring": { + "option": "banded", + "smooth": False, + }, "field": "turb-kinetic-energy", "filled": True, } -solver.results.graphics.contour["contour_tke"] = contour_tke +graphics.contour["contour_tke"].display() -solver.results.graphics.contour["contour_tke"].display() - -solver.results.graphics.picture.save_picture(file_name="contour_tke.png") +graphics.picture.save_picture(file_name="contour_tke.png") ############################################################################### # .. image:: /_static/cavitation_model_011.png # :width: 500pt # :align: center -solver.results.graphics.contour.create("contour_vf_vapor") +graphics.contour.create("contour_vf_vapor") -contour_vf_vapor = { - "coloring": {"option": "banded", "smooth": False}, +graphics.contour["contour_vf_vapor"] = { + "coloring": { + "option": "banded", + "smooth": False, + }, "field": "vapor-vof", "filled": True, } -solver.results.graphics.contour["contour_vf_vapor"] = contour_vf_vapor - -solver.results.graphics.contour["contour_vf_vapor"].display() +graphics.contour["contour_vf_vapor"].display() -solver.results.graphics.picture.save_picture(file_name="contour_vf_vapor.png") +graphics.picture.save_picture(file_name="contour_vf_vapor.png") ############################################################################### # .. image:: /_static/cavitation_model.png @@ -314,6 +355,6 @@ # Save case to 'cav.cas.h5' and exit -solver.file.write(file_name="cav", file_type="case") +solver.file.write_case(file_name="cav") solver.exit()