Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 49 additions & 21 deletions examples/01-parametric/parametric_static_mixer_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
- Instantiates a design point study
- Accesses and modifies the input parameters of
the base design point (DP)
- Updates the current DP
- Accesses output parameters of the base DP
- Updates design points
- Creates, updates, and deletes more DPs
- Creates, renames, duplicates and deletes parametric studies
"""
Expand All @@ -20,7 +19,7 @@

import ansys.fluent.core as pyfluent
from ansys.fluent.core import examples
from ansys.fluent.parametric import ParametricStudy
from ansys.fluent.parametric import ParametricProject, ParametricStudy
from ansys.fluent.post import set_config
from ansys.fluent.post.pyvista import Graphics

Expand Down Expand Up @@ -128,30 +127,19 @@
study_1.update_current_design_point()

###########################################################################
# Change value of specific design points
# Add a new design point

design_point_1 = study_1.add_design_point()
design_point_1_input_parameters = study_1.design_points["DP1"].input_parameters
design_point_1_input_parameters["inlet1_temp"] = 450
design_point_1_input_parameters["inlet1_vel"] = 0.25
design_point_1_input_parameters["inlet2_vel"] = 0.25
design_point_1_input_parameters["inlet1_temp"] = 500
design_point_1_input_parameters["inlet1_vel"] = 1
design_point_1_input_parameters["inlet2_vel"] = 1
study_1.design_points["DP1"].input_parameters = design_point_1_input_parameters

###########################################################################
# Add another design point with different values of the input parameters

design_point_2 = study_1.add_design_point()
design_point_2_input_parameters = study_1.design_points["DP2"].input_parameters
design_point_2_input_parameters["inlet1_temp"] = 500
design_point_2_input_parameters["inlet1_vel"] = 1
design_point_2_input_parameters["inlet2_vel"] = 1
study_1.design_points["DP2"].input_parameters = design_point_2_input_parameters


##########################################################################
# Duplicate design points

design_point_3 = study_1.duplicate_design_point(design_point_2)
design_point_2 = study_1.duplicate_design_point(design_point_1)

#########################################################################
# Update all design points for study 1
Expand Down Expand Up @@ -184,7 +172,7 @@
##########################################################################
# Delete design points

study_1.delete_design_points([design_point_1, design_point_2])
study_1.delete_design_points([design_point_1])

##########################################################################
# Create a new parametric study by duplicating the current one
Expand All @@ -202,12 +190,52 @@
study_1.delete()

#########################################################################
# Save parametric project
# Save the parametric project and close Fluent

project_filepath = str(Path(pyfluent.EXAMPLES_PATH) / "static_mixer_study.flprj")

session.solver.tui.file.parametric_project.save_as(project_filepath)

session.exit()

#########################################################################
# Launch Fluent again and read the previously saved project

session = pyfluent.launch_fluent(precision="double", processor_count=2)
project_filepath_read = str(Path(pyfluent.EXAMPLES_PATH) / "static_mixer_study.flprj")

proj = ParametricProject(
session.solver.root.file.parametric_project,
session.solver.root.parametric_studies,
project_filepath_read,
)

#########################################################################
# Save the current project

proj.save()

#########################################################################
# Save the current project to a different file name

project_filepath_save_as = str(
Path(pyfluent.EXAMPLES_PATH) / "static_mixer_study_save_as.flprj"
)
proj.save_as(project_filepath=project_filepath_save_as)

#########################################################################
# Export the current project

project_filepath_export = str(
Path(pyfluent.EXAMPLES_PATH) / "static_mixer_study_export.flprj"
)
proj.export(project_filepath=project_filepath_export)

#########################################################################
# Archive the current project

proj.archive()

#########################################################################
# Close Fluent

Expand Down
67 changes: 0 additions & 67 deletions examples/01-parametric/parametric_static_mixer_2.py

This file was deleted.

80 changes: 0 additions & 80 deletions examples/01-parametric/parametric_static_mixer_3.py

This file was deleted.