diff --git a/doc/changelog.d/5273.documentation.md b/doc/changelog.d/5273.documentation.md new file mode 100644 index 00000000000..13f2ec40bd4 --- /dev/null +++ b/doc/changelog.d/5273.documentation.md @@ -0,0 +1 @@ +Update script formatting [skip tests] diff --git a/doc/changelog.d/5283.documentation.md b/doc/changelog.d/5283.documentation.md new file mode 100644 index 00000000000..e758cdecded --- /dev/null +++ b/doc/changelog.d/5283.documentation.md @@ -0,0 +1 @@ +Minor Updates - axial_fan_performance_curve_workflow.py [skip tests] diff --git a/examples/00-fluent/axial_fan_performance_curve_workflow.py b/examples/00-fluent/axial_fan_performance_curve_workflow.py index 7c7498ce4fb..8f7970221dc 100644 --- a/examples/00-fluent/axial_fan_performance_curve_workflow.py +++ b/examples/00-fluent/axial_fan_performance_curve_workflow.py @@ -18,6 +18,7 @@ # This example demonstrates an end-to-end PyFluent workflow for simulating an axial fan and performing a parametric study to generate its performance curve. # # The workflow includes: +# # * Importing a CFD mesh # * Defining input parameters for the parametric study # * Configuring the Fluent solver and physical models @@ -36,9 +37,8 @@ # Solution Setup # --------------- # -# %% # Import required libraries and download required files -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ import os @@ -50,14 +50,14 @@ # Download the example mesh file import_file_name = examples.download_file( - "axial_fan.msh", - "pyfluent/axial_fan_perfrormance_curve", + "axial_fan.msh.h5", + "pyfluent/axial_fan_performance_curve", save_path=os.getcwd(), ) # %% # Launch Fluent -# ^^^^^^^^^^^^^^ +# ^^^^^^^^^^^^^ # Launch Fluent in solution mode with double precision running on eight processors. solver = pyfluent.launch_fluent( @@ -70,7 +70,7 @@ # %% # Read mesh file and perform mesh check -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # Import the mesh and perform a mesh check. solver.settings.file.read_mesh(file_name=import_file_name) @@ -78,7 +78,7 @@ # %% # Creat input parameters -# ^^^^^^^^^^^^^^^^^^^^^ +# ^^^^^^^^^^^^^^^^^^^^^^ # Create named expressions for the pressure outlet boundary condition and for the fan rotational speed, and set them as input parameters. # Pressure outlet value is set to 0.0 Pa (atmospheric gauge pressure) and rotational speed is set to 155.534 rad/s. @@ -96,7 +96,7 @@ # %% # Solver setup -# ^^^^^^^^^^^^^ +# ^^^^^^^^^^^^ # Set the solver type to pressure-based, and analysis type to steady state, and activate gravity in the negative x-direction. # General: Solver Type: Pressure-Based @@ -110,9 +110,9 @@ solver.settings.setup.general.operating_conditions.gravity.components = [-9.81, 0, 0] # %% -# Models: Turbulance/Viscous Model -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -# Set the turbulance/viscous model to SST k-omega model. +# Turbulence/Viscous model +# ^^^^^^^^^^^^^^^^^^^^^^^^ +# Set the turbulence/viscous model to SST k-omega model. # Activate curvature correction, production Kato-Launder, and production limiter options. viscous = solver.settings.setup.models.viscous @@ -124,9 +124,9 @@ solver.settings.setup.models.viscous.options.production_limiter.enabled = True # %% -# Cell Zones -# ^^^^^^^^^^^ -# Activate the Multiple Reference Frame (MRF) model for the 'rotating-fan' zone, +# Cell zones +# ^^^^^^^^^^ +# Activate the Multiple Reference Frame (MRF) model for the 'rotating-fan' zone, # specify the Y-axis as axis of rotation, and set the rotational speed using the previously defined input parameter. # Keep the default setting for the remaining cell zones. @@ -153,9 +153,9 @@ # %% # Boundary conditions -# ^^^^^^^^^^^^^^^^^^^^ -# Set the 'inlet' boundary as pressure-inlet boundary condition type, and assign to it a pressure value of 0.0 Pa (atmospheric gauge pressure). -# Set the 'pressure-outlet' boundary as pressure-outlet boundary condition type, and assign to it the previously defined input parameter. +# ^^^^^^^^^^^^^^^^^^^ +# Set the 'inlet' boundary as pressure-inlet boundary condition type, and assign to it a pressure value of 0.0 Pa (atmospheric gauge pressure). +# Set the 'pressure-outlet' boundary as pressure-outlet boundary condition type, and assign to it the previously defined input parameter. # Keep the remaining boundaries as no-slip wall boundary condition type (default settings - no changes) boundary_conditions = solver.settings.setup.boundary_conditions @@ -180,7 +180,7 @@ # %% # Solution methods and controls -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # Set the pressure-velocity coupling scheme and spatial discretization methods. Also, set the under-relaxation factors. # Solution methods @@ -207,7 +207,7 @@ # %% # Create report definitions and output parameters -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # Create report definitions for computed quantities of interest including, inlet volume flow rate, total-to-static pressure difference, and torque. # Report definition: Inlet volume flow rate @@ -290,7 +290,7 @@ # %% # Set the number of iterations for the calculation and enable convergence condition check -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # Set the number of solution iterations to 2500, and enable the convergence condition check. solver.settings.solution.run_calculation.parameters.iter_count = 2500 @@ -299,25 +299,24 @@ # %% # Save case file -# ^^^^^^^^^^^^^^^^ +# ^^^^^^^^^^^^^^ # Write the case with all settings in place. solver.settings.file.write_case(file_name="axial_fan.cas.h5") # %% -# Parametric study: Construct the fan performance curve -# ------------------------------------------------------ +# Parametric Study: Construct the Fan Performance Curve +# ----------------------------------------------------- # -# %% # Initialize parametric study -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ # Initialize a parametric design point study from a Fluent session. solver.settings.parametric_studies.initialize(project_filename="project_axial_fan") # %% # Access and modify input parameters -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # Access and modify the input parameters of the base design point. # Set the pressure at the outlet boundary to 25 Pa, and keep the fan's rotational speed at 155.534 rad/s. @@ -331,7 +330,7 @@ # %% # Add new design points -# ^^^^^^^^^^^^^^^^^^^^^^^ +# ^^^^^^^^^^^^^^^^^^^^^ # Create four new design points and assign outlet pressure and rotational # speed to each one. # The fan's rotational speed is set constant in this study. @@ -378,36 +377,35 @@ # %% # Save the current parametric project -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ solver.settings.file.parametric_project.save() # %% # Update all design points -# ^^^^^^^^^^^^^^^^^^^^^^^^^^ +# ^^^^^^^^^^^^^^^^^^^^^^^^ # Update all design points by running the CFD simulation for every design point. solver.settings.parametric_studies["axial_fan-Solve"].design_points.update_all() # %% # Save current parametric project -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ solver.settings.file.parametric_project.save() # %% # Export the design table -# ^^^^^^^^^^^^^^^^^^^^^^^^^ +# ^^^^^^^^^^^^^^^^^^^^^^^ # Export the design point table to a CSV file. -# parametric_table_save_path = os.path.join(working_directory, 'design_point_table_study.csv') solver.settings.parametric_studies.export_design_table( filepath="../../../design_point_table_study.csv" ) # %% # Plotting fan performance curve -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ # Plot the computed total-to-static pressure rise versus the inlet volume flow rate. # Load the design point study results data from the CSV file @@ -435,9 +433,9 @@ # %% # Close Fluent -# ^^^^^^^^^^^^^^ +# ^^^^^^^^^^^^ # Close Fluent session. solver.exit() -# sphinx_gallery_thumbnail_path = '/_static/axial_fan_performance_curve/problem_schematic.png' +# sphinx_gallery_thumbnail_path = '_static/axial_fan_performance_curve/problem_schematic.png'