Note
Go to the end to download the full example code.
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.
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.upload(import_file_name)
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()
/home/ansys/actions-runner/_work/pyfluent/pyfluent/src/ansys/fluent/core/session.py:357: PyFluentUserWarning: You have directly called the upload() method of the session. Please be advised that for the current version of Fluent, many API methods automatically handle file uploads and downloads internally. You may not need to explicitly call upload() in most cases. However, there are exceptions, particularly in PMFileManagement, where complex file interactions require explicit use of upload() method for relevant files.
warnings.warn(self._file_transfer_api_warning("upload()"), PyFluentUserWarning)
loading data from '/mnt/pyfluent/exhaust_system.fmd' ...
classifying 115 edge occurrences ...
classified 67 feature edge edges by feature angle
classified 0 single-connected edges as feature edge(s)
classified 0 multi-connected edges as feature edge(s)
classified 0 sheet edges as feature edge(s)
classified 0 wire edges as feature edge(s)
classified 10 feature edges by group criteria
processing 8 zones ...
post-processing 0 zones for feature edge extraction ...
classifying 2 edge occurrences ...
classified 1 feature edge edge by feature angle
classified 0 single-connected edges as feature edge(s)
classified 0 multi-connected edges as feature edge(s)
classified 0 sheet edges as feature edge(s)
classified 0 wire edges as feature edge(s)
classified 10 feature edges by group criteria
processing 5 zones ...
post-processing 0 zones for feature edge extraction ...
classifying 13 edge occurrences ...
classified 8 feature edge edges by feature angle
classified 0 single-connected edges as feature edge(s)
classified 0 multi-connected edges as feature edge(s)
classified 0 sheet edges as feature edge(s)
classified 0 wire edges as feature edge(s)
classified 10 feature edges by group criteria
processing 8 zones ...
post-processing 0 zones for feature edge extraction ...
classifying 13 edge occurrences ...
classified 8 feature edge edges by feature angle
classified 0 single-connected edges as feature edge(s)
classified 0 multi-connected edges as feature edge(s)
classified 0 sheet edges as feature edge(s)
classified 0 wire edges as feature edge(s)
classified 10 feature edges by group criteria
processing 8 zones ...
post-processing 0 zones for feature edge extraction ...
classifying 50 edge occurrences ...
classified 16 feature edge edges by feature angle
classified 0 single-connected edges as feature edge(s)
classified 0 multi-connected edges as feature edge(s)
classified 0 sheet edges as feature edge(s)
classified 0 wire edges as feature edge(s)
classified 10 feature edges by group criteria
processing 8 zones ...
post-processing 0 zones for feature edge extraction ...
"Meshing objects are created"
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.
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()
removed 128 faces.
64 boundary nodes.
0 faces removed.
---------------- Patching of inlet-1 complete.
removed 128 faces.
64 boundary nodes.
0 faces removed.
---------------- Patching of inlet-2 complete.
removed 128 faces.
64 boundary nodes.
0 faces removed.
---------------- Patching of inlet-3 complete.
removed 128 faces.
64 boundary nodes.
0 faces removed.
---------------- Patching of outlet-1 complete.
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()
S_ExtractEdges:
ExtractEdgesName : edge-group-1
ExtractMethodType : Intersection Loops
SelectionType : object
ObjectSelectionList: (flow_pipe main)
GeomObjectSelectionList: ()
ZoneSelectionList: ()
ZoneLocation:()
LabelSelectionList : ()
FeatureAngleLocal : 40
IndividualCollective : collectively
SharpAngle : 110
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()
S_MaterialPoints:
AddChild: yes
MaterialPointsName : fluid-region-1
MptMethodType : Centroid of Objects
NewRegionType : fluid
LinkConstruction : no
SelectionType : zone
ZoneSelectionList : (main.1)
ZoneLocation : (1 213.32205 -225.28068 -158.25531 541.32205 -128.32068 84.102381 main.1)
LabelSelectionList : ()
ObjectSelectionList : ()
GraphicalSelection : #t
ShowCoordinates : #f
X : 377.32205
Y : -176.80068
Z : -37.076463
OffsetX : 0
OffsetY : 0
OffsetZ : 0
Material point fluid-region-1 is created.
S_MaterialPoints:
AddChild: yes
MaterialPointsName : void-region-1
MptMethodType : Centroid of Objects
NewRegionType : void
LinkConstruction : no
SelectionType : object
ZoneSelectionList : ()
ZoneLocation : ()
LabelSelectionList : ()
ObjectSelectionList : (inlet-1 inlet-2 inlet-3 main)
GraphicalSelection : #t
ShowCoordinates : #f
X : 374.72205
Y : -278.97751
Z : -161.17007
OffsetX : 0
OffsetY : 0
OffsetZ : 0
Material point void-region-1 is created.
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()
S_LeakageDetection:
AddChild: yes
LeakageName: leakage-1
SelectionType: identified region
DeadRegionsList: ()
RegionSelectionSingle: (void-region-1)
DeadRegionsSize: 6.4
PlaneClippingValue: 50
PlaneDirection: X
FlipDirection: #t
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()
---------------- Regions Updated
Set mesh control options#
Set mesh control options.
meshing.workflow.TaskObject["Choose Mesh Control Options"].Execute()
(WrapSizeFieldFileName) not found in dict
(TargeSizeFieldFileName) not found in dict
Generate surface mesh#
Generate the surface mesh.
meshing.workflow.TaskObject["Generate the Surface Mesh"].Execute()
Writing "/mnt/pyfluent/FM_7ebf35b53b3b_152/TaskObject16.msh.h5" ...
writing 19 node zones
writing 11 edge zones
writing 13 face zones
done.Writing "/mnt/pyfluent/FM_7ebf35b53b3b_152//ftm-wf-out-exhaust_system.msh.h5" ...
writing 19 node zones
writing 11 edge zones
writing 13 face zones
done.Scoped sizing written to the file "/mnt/pyfluent/FM_7ebf35b53b3b_152//ftm-wf-out-exhaust_system-target.szcontrol" successfully
Scoped sizing written to the file "/mnt/pyfluent/FM_7ebf35b53b3b_152//ftm-wf-out-exhaust_system-initial.szcontrol" successfully
Reading "/mnt/pyfluent/FM_7ebf35b53b3b_152//ftm-wf-out-exhaust_system-target.sf"...
Read 41961 vertices
initializing octree...
refining octree...
projecting...
Wrap-v2 projection mode set to 1
Projection completed in 0.270000 s, 184240.740741 nodes/sec
Index exceed valid range, 2.
No grid of ID, 2.
Min mesh size 0.000000 is too small.Max mesh size 0.000000 is too small. initializing octree...
refining octree...
Reading "/mnt/pyfluent/FM_7ebf35b53b3b_152//ftm-wf-out-exhaust_system-target.sf"...
Read 41961 vertices
Found 0 nodes with invalid normals
Found 0 nodes with invalid normals
Found 0 faces with invalid dihedral angle
Gentle Improve for wrapper-surf-fluid-region-1 in 0.0033400655 minutes (5.5668023e-05 hours)
Gentle Improve for wrapper-surf-fluid-region-1 in 0.0011383136 minutes (1.8972225e-05 hours)
Gentle Improve for wrapper-surf-fluid-region-1 in 0.0012110154 minutes (2.0183921e-05 hours)
Reading "/mnt/pyfluent/FM_7ebf35b53b3b_152/ftm-wf-out-exhaust_system.msh.h5" ...
3D mesh
nodes: 23303
edges: 4754
faces: 33738
cells: 0
reading 19 node zones
reading 11 edge zones
reading 13 face zones
appending mesh...
done.
generating pointers...done.
extracting boundary entities...
37422 boundary nodes.
61954 boundary faces.
14 boundary face zones.
done.
Surface Mesh:
==============================================================================
Wrapping Method ----------------------------------standard
Computed SF in -----------------------------------0.021922115 minutes (0.00036536859 hours).
Automatic closing of holes (inner wrap) in -----0.055575951 minutes (0.00092626585 hours).
Wrapped all material point regions in ------------0.17325859 minutes (0.0028876431 hours).
Surface mesh all fluid objects in ----------------0 minutes (0 hours).
Surface Improved in ------------------------------0.044071448 minutes (0.00073452413 hours).
Surface Improved (resolve_int) in ----------------0.0069824497 minutes (0.00011637416 hours).
Connected all fluid mesh objects in --------------4.2637189e-06 minutes (7.1061982e-08 hours).
Compute Volume-Fill Regions in -------------------0 minutes (0 hours).
Solid surface mesh generated and Improved in -----0 minutes (0 hours).
==============================================================================
Total (surface mesh) 0.30184901 minutes (0.0050308169 hours)
------------------------- --------------------- -------------------- ---------------- ----------
name skewed-cells (> 0.80) averaged-skewness maximum-skewness face count
------------------------- --------------------- -------------------- ---------------- ----------
fluid-region-1 0 0.037079067 0.78417367 28216
------------------------- --------------------- -------------------- ---------------- ----------
name skewed-cells (> 0.80) averaged-skewness maximum-skewness face count
------------------------- --------------------- -------------------- ---------------- ----------
Overall Summary 0 0.037079067 0.78417367 28216
Confirm and update boundaries#
Confirm and update the boundaries.
meshing.workflow.TaskObject["Update Boundaries"].Execute()
---------------- Boundary Conditions Updated
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.
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()
Writing "/mnt/pyfluent/FM_7ebf35b53b3b_152/TaskObject23.msh.h5" ...
writing 21 node zones
writing 11 edge zones
writing 22 face zones
done.
Warning: growing more than 1 layer of prisms may take a long time.
warning: material point fluid-region-1 ignored because face zone label with same name exists.
done
creating backup for object "fluid-region-1"...done.
Generating initial mesh...
the existing Size Field will be used.
Refining mesh...
All cells met the target quality.
No cells below quality 0.0001.
Release: (24 2 0 2024)
Build Time: May 13 2024 11:01:42 EDT
Build ID: 10192
Mesh Info for exhaust_system:
Total cell count: 254944
Wall-Clock Usage (Estimate) for exhaust_system:
Surface Mesh:
==============================================================================
Wrapping Method ----------------------------------standard
Computed SF in -----------------------------------0.021922115 minutes (0.00036536859 hours).
Automatic closing of holes (inner wrap) in -----0.055575951 minutes (0.00092626585 hours).
Wrapped all material point regions in ------------0.17325859 minutes (0.0028876431 hours).
Surface mesh all fluid objects in ----------------0 minutes (0 hours).
Surface Improved in ------------------------------0.044071448 minutes (0.00073452413 hours).
Surface Improved (resolve_int) in ----------------0.0069824497 minutes (0.00011637416 hours).
Connected all fluid mesh objects in --------------4.2637189e-06 minutes (7.1061982e-08 hours).
Compute Volume-Fill Regions in -------------------0 minutes (0 hours).
Solid surface mesh generated and Improved in -----0 minutes (0 hours).
==============================================================================
Total (surface mesh) 0.30184901 minutes (0.0050308169 hours)
Volume Mesh:
==============================================================================
Quality Method -----------------------------------Orthogonal
Continuous Prisms generated and Improved in ------0.051287035 minutes (0.00085478392 hours).
Volume-fill in -----------------------------------0.054777896 minutes (0.00091296494 hours).
Solid volume mesh generated and Improved in ------0 minutes (0 hours).
Rezoned and final volume mesh improve in ---------0.012323932 minutes (0.00020539886 hours).
==============================================================================
Total (volume mesh) 0.11838886 minutes (0.0019731477 hours)
==============================================================================
Total 0.42023787 minutes (0.0070039646 hours)
==============================================================================
Memory Usage for exhaust_system:
------------------------------------------------------------------------------
| Virtual Mem Usage (GB) | Resident Mem Usage(GB) |
ID | Current Peak | Current Peak | Page Faults
------------------------------------------------------------------------------
host | 1.79498 1.79737 | 0.530254 0.532242 | 8
n0 | 4.5246 4.87589 | 0.446835 1.14616 | 1085
n1 | 3.89361 3.9501 | 0.232159 0.232159 | 189
------------------------------------------------------------------------------
Total | 10.2132 10.6234 | 1.20925 1.91056 | 1282
------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
| Virtual Mem Usage (GB) | Resident Mem Usage(GB) | System Mem (GB)
Hostname | Current Peak | Current Peak |
------------------------------------------------------------------------------------------------
7ebf35b53b3b | 10.2132 10.6234 | 1.20925 1.91056 | 31.3416
------------------------------------------------------------------------------------------------
Total | 10.2132 10.6234 | 1.20925 1.91056 |
------------------------------------------------------------------------------------------------
Quality Report for exhaust_system:
Report of Cell Orthogonal Quality:
Region Name Quality<0.100 Quality<0.040 Min Quality Cell Count
------------------------- -------------- -------------- ------------- ----------
fluid-region-1 2 0 0.065 254944
Region Name Quality<0.100 Quality<0.040 Min Quality Cell Count
------------------------- -------------- -------------- ------------- ----------
Overall Summary 2 0 0.065 254944
Parallel Partitions:
General Info:
Total faces : 598508
Total cells : 254944
Participating nodes : (0)
Non-participating nodes : (1)
Faces Info:
node 0 : 598508 (100.0%) faces => 476186 triangular, 122322 quadrilateral
Cells Info:
node 0 : 254944 (100.0%) cells => 173575 tetrahedral, 81369 wedge
Check mesh#
Check the mesh.
meshing.tui.mesh.check_mesh()
Domain extents.
x-coordinate: min = 2.133220e+02, max = 5.413220e+02.
y-coordinate: min = -3.613432e+02, max = -1.283207e+02.
z-coordinate: min = -3.692476e+02, max = 8.410238e+01.
Volume statistics.
minimum volume: 1.144296e-01.
maximum volume: 3.218042e+02.
total volume: 5.479143e+06.
Face area statistics.
minimum face area: 4.247814e-03.
maximum face area: 1.743890e+04.
average face area: 1.214504e+01.
Checking number of nodes per edge.
Checking number of nodes per face.
Checking number of nodes per cell.
Checking number of faces/neighbors per cell.
Checking cell faces/neighbors.
Checking isolated cells.
Checking face handedness.
Checking periodic face pairs.
Checking face children.
Checking face zone boundary conditions.
Checking for invalid node coordinates.
Checking poly cells.
Checking zones.
Checking neighborhood.
Checking modified centroid.
Checking non-positive or too small area.
Checking face zones thread type.
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()
Preparing...
deleting exterior entities...done.
unused zone boundary-node-17173 removed
unused zone boundary-node-17174 removed
*********************************************
Info: Your license enables 4-way parallel execution.
For faster simulations, please start the application with the appropriate parallel options.
*********************************************
Transferring mesh
creating threads... done
transferring nodes... done
transferring cells... done
transferring faces... done
post mesh transfer operations... done
done
Building...
mesh
auto partitioning mesh by Metis (fast),
distributing mesh
parts..,
faces..,
nodes..,
cells..,
bandwidth reduction using Reverse Cuthill-McKee: 99399/1555 = 63.9222
materials,
interface,
domains,
zones,
outlet-1
inlet-3
inlet-2
inlet-1
interior--fluid-region-1
main.1
flow-pipe
outpipe3.1
object2.1
object1.1
fluid-region-1
surfaces,
parallel,
Done.
Mesh is now scaled to meters.
Domain Extents:
x-coordinate: min (m) = 2.154117e-01, max (m) = 5.349967e-01
y-coordinate: min (m) = -3.600511e-01, max (m) = -1.293207e-01
z-coordinate: min (m) = -3.626890e-01, max (m) = 8.410238e-02
Volume statistics:
minimum volume (m3): 1.144296e-10
maximum volume (m3): 3.218042e-07
total volume (m3): 5.479143e-03
Face area statistics:
minimum face area (m2): 4.376851e-07
maximum face area (m2): 1.004804e-04
Checking mesh.....................................
Done.
Note: Settings to improve the robustness of pathline and
particle tracking have been automatically enabled.
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"],
)
Copy inlet-1 boundary conditions to inlet-2
Copy inlet-1 boundary conditions to 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
/home/ansys/actions-runner/_work/pyfluent/pyfluent/src/ansys/fluent/core/solver/flobject.py:599: DeprecatedSettingWarning: Note: A newer syntax is available to perform the last operation:
solver.setup.boundary_conditions.pressure_outlet['outlet-1'].turbulence.backflow_turbulent_intensity = 0.05
warnings.warn(
/home/ansys/actions-runner/_work/pyfluent/pyfluent/src/ansys/fluent/core/solver/flobject.py:605: DeprecatedSettingWarning:
Execute the following code to suppress future warnings like the above:
>>> import warnings
>>> warnings.filterwarnings("ignore", category=DeprecatedSettingWarning)
warnings.warn(
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()
Initialize using the hybrid initialization method.
Checking case topology...
-This case has both inlets & outlets
-Pressure information is not available at the boundaries.
Case will be initialized with constant pressure
iter scalar-0
1 1.000000e+00
2 1.886826e-04
3 2.976111e-05
4 7.135616e-06
5 4.943363e-06
6 2.097743e-06
7 4.540569e-06
8 1.147279e-06
9 1.794886e-06
10 5.654136e-07
Hybrid initialization is done.
Start calculation#
Start the calculation by requesting 100 iterations.
solver.solution.run_calculation.iterate(iter_count=100)
iter continuity x-velocity y-velocity z-velocity k omega time/iter
1 1.0000e+00 6.7418e-03 7.0694e-03 7.6976e-03 6.1154e-01 2.4642e+00 0:02:56 99
2 4.4833e-01 4.3935e-03 4.8473e-03 6.2646e-03 1.5854e-01 1.4572e-01 0:03:05 98
3 3.4778e-01 2.1989e-03 2.5633e-03 4.2732e-03 1.0596e-01 9.4538e-02 0:03:15 97
4 3.3726e-01 1.4369e-03 1.7859e-03 2.9289e-03 6.7911e-02 4.9773e-02 0:03:10 96
5 3.3060e-01 1.0284e-03 1.3192e-03 2.7360e-03 5.7997e-02 3.0470e-02 0:03:05 95
6 3.0177e-01 7.5285e-04 1.0452e-03 2.2205e-03 4.5130e-02 2.1640e-02 0:02:57 94
7 2.8441e-01 6.3555e-04 9.0600e-04 2.1031e-03 3.6571e-02 1.7475e-02 0:02:50 93
8 2.7115e-01 5.4613e-04 7.9723e-04 1.8930e-03 3.4003e-02 1.4616e-02 0:02:45 92
9 2.6300e-01 4.9449e-04 7.2689e-04 1.8194e-03 2.9212e-02 1.2101e-02 0:02:41 91
10 2.5467e-01 4.5576e-04 6.7209e-04 1.6906e-03 2.5669e-02 1.0116e-02 0:02:37 90
11 2.4456e-01 4.3103e-04 6.2969e-04 1.6334e-03 2.2100e-02 8.7913e-03 0:02:34 89
iter continuity x-velocity y-velocity z-velocity k omega time/iter
12 2.3250e-01 4.0031e-04 5.8518e-04 1.5243e-03 1.9822e-02 7.6612e-03 0:02:30 88
13 2.2151e-01 3.7506e-04 5.5014e-04 1.4455e-03 1.7574e-02 6.7422e-03 0:02:28 87
14 2.1178e-01 3.6052e-04 5.2275e-04 1.3554e-03 1.5824e-02 5.9711e-03 0:02:25 86
15 2.0318e-01 3.5049e-04 4.9832e-04 1.2749e-03 1.3909e-02 5.5931e-03 0:02:23 85
16 1.9556e-01 3.4204e-04 4.7550e-04 1.1779e-03 1.2525e-02 5.0598e-03 0:02:20 84
17 1.8978e-01 3.4969e-04 4.6821e-04 1.1136e-03 1.1441e-02 4.6735e-03 0:02:18 83
18 1.8413e-01 3.5355e-04 4.5687e-04 1.0297e-03 1.0285e-02 4.4034e-03 0:02:16 82
19 1.7874e-01 3.6234e-04 4.5549e-04 9.6792e-04 9.3925e-03 4.1395e-03 0:02:15 81
20 1.7336e-01 3.7288e-04 4.5835e-04 9.1258e-04 8.6909e-03 3.9563e-03 0:02:13 80
21 1.6815e-01 3.8238e-04 4.6124e-04 8.6381e-04 8.1392e-03 3.8180e-03 0:02:11 79
22 1.6310e-01 3.9194e-04 4.6523e-04 8.2043e-04 7.7027e-03 3.7144e-03 0:02:09 78
iter continuity x-velocity y-velocity z-velocity k omega time/iter
23 1.5850e-01 4.0019e-04 4.6742e-04 7.8069e-04 7.3627e-03 3.6847e-03 0:02:07 77
24 1.5338e-01 4.0693e-04 4.6845e-04 7.4360e-04 7.1837e-03 3.6419e-03 0:02:06 76
25 1.4846e-01 4.1247e-04 4.6816e-04 7.1219e-04 6.9706e-03 3.5397e-03 0:02:03 75
26 1.4343e-01 4.1338e-04 4.6352e-04 6.8001e-04 6.7116e-03 3.3734e-03 0:02:02 74
27 1.3871e-01 4.1202e-04 4.5615e-04 6.5267e-04 6.4315e-03 3.2018e-03 0:02:00 73
28 1.3359e-01 4.0536e-04 4.4413e-04 6.2377e-04 6.1107e-03 3.0672e-03 0:01:58 72
29 1.2899e-01 3.9623e-04 4.3083e-04 5.9738e-04 5.8117e-03 2.9287e-03 0:01:57 71
30 1.2404e-01 3.8285e-04 4.1374e-04 5.7114e-04 5.4870e-03 2.8008e-03 0:01:55 70
31 1.1991e-01 3.6822e-04 3.9590e-04 5.4790e-04 5.1916e-03 2.6525e-03 0:01:53 69
32 1.1568e-01 3.5132e-04 3.7561e-04 5.2277e-04 4.8260e-03 2.5055e-03 0:01:52 68
33 1.1170e-01 3.3306e-04 3.5624e-04 5.0030e-04 4.5415e-03 2.3853e-03 0:01:50 67
iter continuity x-velocity y-velocity z-velocity k omega time/iter
34 1.0810e-01 3.1432e-04 3.3755e-04 4.7858e-04 4.2329e-03 2.2487e-03 0:01:48 66
35 1.0529e-01 2.9596e-04 3.2007e-04 4.5868e-04 3.9387e-03 2.1150e-03 0:01:46 65
36 1.0213e-01 2.7753e-04 3.0281e-04 4.3686e-04 3.6150e-03 1.9525e-03 0:01:45 64
37 9.9215e-02 2.6007e-04 2.8713e-04 4.1714e-04 3.3286e-03 1.8437e-03 0:01:43 63
38 9.6112e-02 2.4349e-04 2.7183e-04 3.9452e-04 3.0415e-03 1.6985e-03 0:01:42 62
39 9.3473e-02 2.2944e-04 2.5804e-04 3.7596e-04 2.8013e-03 1.5999e-03 0:01:40 61
40 9.0926e-02 2.1663e-04 2.4430e-04 3.5447e-04 2.5649e-03 1.4950e-03 0:01:39 60
41 8.8429e-02 2.0597e-04 2.3176e-04 3.3734e-04 2.3638e-03 1.4068e-03 0:01:38 59
42 8.6004e-02 1.9672e-04 2.1953e-04 3.1911e-04 2.1816e-03 1.3191e-03 0:01:36 58
43 8.3401e-02 1.8910e-04 2.0846e-04 3.0379e-04 2.0288e-03 1.2553e-03 0:01:34 57
44 8.1065e-02 1.8216e-04 1.9832e-04 2.8991e-04 1.9224e-03 1.2056e-03 0:01:32 56
iter continuity x-velocity y-velocity z-velocity k omega time/iter
45 7.8636e-02 1.7642e-04 1.8979e-04 2.7821e-04 1.8103e-03 1.1682e-03 0:01:31 55
46 7.6544e-02 1.7171e-04 1.8283e-04 2.6946e-04 1.7706e-03 1.1478e-03 0:01:29 54
47 7.4352e-02 1.6759e-04 1.7742e-04 2.6162e-04 1.7031e-03 1.1229e-03 0:01:28 53
48 7.2500e-02 1.6465e-04 1.7316e-04 2.5602e-04 1.6996e-03 1.1070e-03 0:01:26 52
49 7.0515e-02 1.6195e-04 1.6977e-04 2.5074e-04 1.6784e-03 1.0910e-03 0:01:24 51
50 6.8661e-02 1.6012e-04 1.6730e-04 2.4714e-04 1.6799e-03 1.0825e-03 0:01:23 50
51 6.7139e-02 1.5817e-04 1.6534e-04 2.4331e-04 1.6737e-03 1.0760e-03 0:01:21 49
52 6.5776e-02 1.5686e-04 1.6318e-04 2.4077e-04 1.6719e-03 1.0641e-03 0:01:19 48
53 6.4596e-02 1.5541e-04 1.6142e-04 2.3802e-04 1.6658e-03 1.0595e-03 0:01:17 47
54 6.3405e-02 1.5406e-04 1.5951e-04 2.3486e-04 1.6512e-03 1.0414e-03 0:01:16 46
55 6.2298e-02 1.5221e-04 1.5742e-04 2.3182e-04 1.6401e-03 1.0326e-03 0:01:14 45
iter continuity x-velocity y-velocity z-velocity k omega time/iter
56 6.1197e-02 1.5033e-04 1.5522e-04 2.2790e-04 1.6135e-03 1.0089e-03 0:01:12 44
57 6.0197e-02 1.4800e-04 1.5319e-04 2.2404e-04 1.5926e-03 1.0031e-03 0:01:11 43
58 5.9176e-02 1.4553e-04 1.5087e-04 2.1955e-04 1.5516e-03 9.7462e-04 0:01:09 42
59 5.8275e-02 1.4312e-04 1.4871e-04 2.1538e-04 1.5297e-03 9.6861e-04 0:01:07 41
60 5.7431e-02 1.4008e-04 1.4592e-04 2.1004e-04 1.4886e-03 9.4153e-04 0:01:06 40
61 5.6669e-02 1.3723e-04 1.4357e-04 2.0583e-04 1.4693e-03 9.3786e-04 0:01:04 39
62 5.5824e-02 1.3382e-04 1.4073e-04 2.0088e-04 1.4351e-03 9.1581e-04 0:01:02 38
63 5.4908e-02 1.3119e-04 1.3867e-04 1.9697e-04 1.4280e-03 9.2132e-04 0:01:01 37
64 5.3961e-02 1.2834e-04 1.3634e-04 1.9316e-04 1.4067e-03 9.0390e-04 0:00:59 36
65 5.3099e-02 1.2653e-04 1.3468e-04 1.9067e-04 1.4149e-03 9.0923e-04 0:00:57 35
66 5.2255e-02 1.2492e-04 1.3290e-04 1.8877e-04 1.4184e-03 9.0004e-04 0:00:56 34
iter continuity x-velocity y-velocity z-velocity k omega time/iter
67 5.1326e-02 1.2389e-04 1.3132e-04 1.8726e-04 1.4395e-03 9.1417e-04 0:00:54 33
68 5.0501e-02 1.2268e-04 1.3026e-04 1.8647e-04 1.4523e-03 9.0340e-04 0:00:52 32
69 4.9613e-02 1.2196e-04 1.2897e-04 1.8520e-04 1.4698e-03 9.1213e-04 0:00:51 31
70 4.8758e-02 1.2123e-04 1.2831e-04 1.8449e-04 1.4741e-03 9.0030e-04 0:00:49 30
71 4.7914e-02 1.2019e-04 1.2690e-04 1.8295e-04 1.4799e-03 8.9886e-04 0:00:48 29
72 4.7155e-02 1.1899e-04 1.2605e-04 1.8210e-04 1.4729e-03 8.8811e-04 0:00:46 28
73 4.6333e-02 1.1751e-04 1.2430e-04 1.7983e-04 1.4631e-03 8.7960e-04 0:00:44 27
74 4.5469e-02 1.1604e-04 1.2313e-04 1.7869e-04 1.4466e-03 8.7170e-04 0:00:43 26
75 4.4650e-02 1.1422e-04 1.2123e-04 1.7641e-04 1.4286e-03 8.5824e-04 0:00:41 25
76 4.3930e-02 1.1251e-04 1.2009e-04 1.7537e-04 1.4068e-03 8.5256e-04 0:00:39 24
77 4.3343e-02 1.1055e-04 1.1846e-04 1.7265e-04 1.3825e-03 8.3935e-04 0:00:38 23
iter continuity x-velocity y-velocity z-velocity k omega time/iter
78 4.2828e-02 1.0892e-04 1.1742e-04 1.7158e-04 1.3619e-03 8.3421e-04 0:00:36 22
79 4.2525e-02 1.0728e-04 1.1604e-04 1.6906e-04 1.3361e-03 8.2104e-04 0:00:34 21
80 4.2332e-02 1.0592e-04 1.1556e-04 1.6815e-04 1.3216e-03 8.1590e-04 0:00:33 20
81 4.2180e-02 1.0485e-04 1.1465e-04 1.6598e-04 1.2960e-03 8.1204e-04 0:00:33 19
82 4.2152e-02 1.0400e-04 1.1442e-04 1.6565e-04 1.2857e-03 8.1009e-04 0:00:31 18
83 4.2218e-02 1.0353e-04 1.1400e-04 1.6404e-04 1.2588e-03 8.0806e-04 0:00:29 17
84 4.2412e-02 1.0313e-04 1.1401e-04 1.6389e-04 1.2437e-03 8.0265e-04 0:00:27 16
85 4.2615e-02 1.0289e-04 1.1341e-04 1.6235e-04 1.2130e-03 8.0008e-04 0:00:25 15
86 4.2906e-02 1.0243e-04 1.1324e-04 1.6181e-04 1.1938e-03 7.9395e-04 0:00:23 14
87 4.2910e-02 1.0213e-04 1.1241e-04 1.5999e-04 1.1614e-03 7.9305e-04 0:00:22 13
88 4.2705e-02 1.0128e-04 1.1160e-04 1.5916e-04 1.1397e-03 7.8441e-04 0:00:20 12
iter continuity x-velocity y-velocity z-velocity k omega time/iter
89 4.2491e-02 1.0045e-04 1.1010e-04 1.5689e-04 1.1083e-03 7.7885e-04 0:00:18 11
90 4.2205e-02 9.8946e-05 1.0866e-04 1.5505e-04 1.0849e-03 7.6966e-04 0:00:16 10
91 4.1767e-02 9.7578e-05 1.0620e-04 1.5178e-04 1.0626e-03 7.6507e-04 0:00:15 9
92 4.1414e-02 9.5664e-05 1.0429e-04 1.4932e-04 1.0510e-03 7.6196e-04 0:00:13 8
93 4.0974e-02 9.3764e-05 1.0197e-04 1.4665e-04 1.0498e-03 7.6072e-04 0:00:11 7
94 4.0478e-02 9.1822e-05 1.0054e-04 1.4532e-04 1.0608e-03 7.6488e-04 0:00:10 6
95 3.9664e-02 9.0039e-05 9.8699e-05 1.4373e-04 1.0795e-03 7.6090e-04 0:00:08 5
96 3.8952e-02 8.8867e-05 9.7508e-05 1.4332e-04 1.0981e-03 7.6884e-04 0:00:07 4
97 3.8208e-02 8.7681e-05 9.5866e-05 1.4286e-04 1.1259e-03 7.7028e-04 0:00:05 3
98 3.7663e-02 8.7012e-05 9.4769e-05 1.4311e-04 1.1488e-03 7.7952e-04 0:00:03 2
99 3.7032e-02 8.6199e-05 9.3444e-05 1.4372e-04 1.1792e-03 7.8071e-04 0:00:02 1
iter continuity x-velocity y-velocity z-velocity k omega time/iter
100 3.6574e-02 8.5899e-05 9.2456e-05 1.4410e-04 1.1980e-03 7.8597e-04 0:00:00 0
Write the case and data files#
solver.file.write(
file_type="case-data",
file_name="exhaust_system.cas.h5",
)
Fast-loading "/ansys_inc/v242/fluent/fluent24.2.0/addons/afd/lib/hdfio.bin"
Done.
Writing to 7ebf35b53b3b:"/mnt/pyfluent/exhaust_system.cas.h5" in NODE0 mode and compression level 1 ...
Grouping cells for Laplace smoothing ...
254944 cells, 1 zone ...
598508 faces, 23 zones ...
93848 nodes, 1 zone ...
Done.
Writing boundary layer flags ...
Done.
Done.
Writing to 7ebf35b53b3b:"/mnt/pyfluent/exhaust_system.dat.h5" in NODE0 mode and compression level 1 ...
Writing results.
Done.
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 active inside containers or Ansys Lab environment
if graphics.picture.use_window_resolution.is_active():
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.
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")
number tracked = 164, escaped = 139, incomplete = 25
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.
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.
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()
Total running time of the script: (4 minutes 17.672 seconds)