General: configuration files#
This example shows how you can use PyAEDT to export configuration files and re-use them to import in a new project. A configuration file is supported by these applications:
2D Extractor and Q3D Extractor
Icepak (in AEDT)
Mechanical (in AEDT)
The following sections are covered:
Mesh operations (except Icepak)
Setup and optimetrics
Boundaries and excitations
When a boundary is attached to a face, the tool tries to match it with a
FaceByPosition on the same object name on the target design. If, for
any reason, this face position has changed or the object name in the target
design has changed, the boundary fails to apply.
Perform required imports#
Perform required imports from PyAEDT.
import os import pyaedt
Set non-graphical mode#
Set non-graphical mode.
"PYAEDT_NON_GRAPHICAL" is needed to generate
You can set
non_graphical either to
Download the project, open it, and save it to the temporary folder.
Create source blocks#
Create a source block on the CPU and memories.
ipk.create_source_block(object_name="CPU", input_power="25W") ipk.create_source_block(object_name=["MEMORY1", "MEMORY1_1"], input_power="5W")
<pyaedt.modules.Boundary.BoundaryObject object at 0x0000028BEC1BBD30>
Assign the opening and grille.
region = ipk.modeler["Region"] ipk.assign_openings(air_faces=region.bottom_face_x.id) ipk.assign_grille(air_faces=region.top_face_x.id, free_area_ratio=0.8)
<pyaedt.modules.Boundary.BoundaryObject object at 0x0000028BF4E2CCD0>
Create the setup. Properties can be set up from the
with getters and setters. They don’t have to perfectly match the property
setup1 = ipk.create_setup() setup1["FlowRegime"] = "Turbulent" setup1["Max Iterations"] = 5 setup1["Solver Type Pressure"] = "flex" setup1["Solver Type Temperature"] = "flex" ipk.save_project(r"C:\temp\Graphic_card.aedt")
Export project to step file#
Export the current project to the step file.
Export configuration files#
Export the configuration files. You can optionally disable the export and import sections.
conf_file = ipk.configurations.export_config() ipk.close_project()
Create an Icepak project and import the step.
app = pyaedt.Icepak(projectname="new_proj_Ipk") app.modeler.import_3d_cad(file_path)
Import and apply configuration file#
Import and apply the configuration file. You can apply all or part of the
JSON file that you import using options in the
Close the project.
Total running time of the script: ( 0 minutes 28.885 seconds)