Icepak: setup from Sherlock inputs#

This example shows how you can create an Icepak project from Sherlock files (STEP and CSV) and an AEDB board.

Perform required imports#

Perform required imports and set paths.

import time
import os
import pyaedt
import datetime

# Set paths
project_folder = pyaedt.generate_unique_folder_name()
input_dir = pyaedt.downloads.download_sherlock(destination=project_folder)

Set non-graphical mode#

Set non-graphical mode. You can set non_graphical value either to True or False.

non_graphical = False

Define variables#

Define input variables. The following code creates all input variables that are needed to run this example.

material_name = "MaterialExport.csv"
component_properties = "TutorialBoardPartsList.csv"
component_step = "TutorialBoard.stp"
aedt_odb_project = "SherlockTutorial.aedt"
aedt_odb_design_name = "PCB"
stackup_thickness = 2.11836
outline_polygon_name = "poly_14188"

Launch AEDT#

Launch AEDT 2023 R2 in graphical mode.

Initializing new desktop!
C:\actions-runner\_work\_tool\Python\3.10.5\x64\lib\ ResourceWarning: subprocess 9884 is still running
  _warn("subprocess %s is still running" %,

Create Icepak project#

Create an Icepak project.

ipk = pyaedt.Icepak(project_name)
Returning found desktop with PID 9884!

Delete region to speed up import#

Delete the region and disable autosave to speed up the import.

component_name = "from_ODB"

Import PCB from AEDB file#

Import a PCB from an AEDB file.

odb_path = os.path.join(input_dir, aedt_odb_project)
ipk.create_pcb_from_3dlayout(component_name=component_name, project_name=odb_path, design_name=aedt_odb_design_name,
C:\actions-runner\_work\pyaedt\pyaedt\testenv\lib\site-packages\pyaedt\ DeprecationWarning: ``extenttype`` was deprecated in 0.6.43. Use ``extent_type`` instead.

<pyaedt.modules.Boundary.NativeComponentObject object at 0x0000026980EE2080>

Create offset coordinate system#

Create an offset coordinate system to match ODB++ with the Sherlock STEP file.

ipk.modeler.create_coordinate_system(origin=[0, 0, stackup_thickness / 2], mode="view", view="XY")
<pyaedt.modeler.cad.Modeler.CoordinateSystem object at 0x00000269830FD990>

Import CAD file#

Import a CAD file.

ipk.modeler.import_3d_cad(file_path, refresh_all_ids=False)

Save CAD file#

Save the CAD file and refresh the properties from the parsing of the AEDT file.


Plot model#

Plot the model.

ipk.plot(show=False, export_path=os.path.join(project_folder, "Sherlock_Example.jpg"), plot_air_objects=False)
Sherlock Example
<pyaedt.generic.plot.ModelPlotter object at 0x0000026980EE01F0>

Delete PCB objects#

Delete the PCB objects.

ipk.modeler.delete_objects_containing("pcb", False)

Create region#

Create an air region.

ipk.modeler.create_air_region(*[20, 20, 300, 20, 20, 300])
<pyaedt.modeler.cad.object3d.Object3d object at 0x00000269831EF640>

Assign materials#

Assign materials from Sherlock file.

ipk.assignmaterial_from_sherlock_files(component_list, material_list)

Delete objects with no material assignments#

Delete objects with no materials assignments.

no_material_objs = ipk.modeler.get_objects_by_material("")

Assign power to component blocks#

Assign power to component blocks.

all_objects = ipk.modeler.object_names

Assign power blocks#

Assign power blocks from the Sherlock file.

total_power = ipk.assign_block_from_sherlock_file(csv_name=component_list)

Plot model#

Plot the model again now that materials are assigned.

ipk.plot(show=False, export_path=os.path.join(project_folder, "Sherlock_Example.jpg"), plot_air_objects=False)
Sherlock Example
<pyaedt.generic.plot.ModelPlotter object at 0x00000269C749FF10>

Set up boundaries#

Set up boundaries.

# Mesh settings that is tailored for PCB
# Max iterations is set to 20 for quick demonstration, please increase to at least 100 for better accuracy.

ipk.globalMeshSettings(3, gap_min_elements='1', noOgrids=True, MLM_en=True,
                            MLM_Type='2D', edge_min_elements='2', object='Region')

setup1 = ipk.create_setup()
setup1.props["Solution Initialization - Y Velocity"] = "1m_per_sec"
setup1.props["Radiation Model"] = "Discrete Ordinates Model"
setup1.props["Include Gravity"] = True
setup1.props["Secondary Gradient"] = True
setup1.props["Convergence Criteria - Max Iterations"] = 10
<pyaedt.modules.Boundary.BoundaryObject object at 0x00000269DD051270>

Create point monitor#

point1 = ipk.assign_point_monitor(ipk.modeler["COMP_U10"], monitor_name="Point1")
line = ipk.modeler.create_polyline([ipk.modeler["COMP_U10"].top_face_z.vertices[0].position, ipk.modeler["COMP_U10"].top_face_z.vertices[2].position], non_model=True)"Point1.Temperature", primary_sweep_variable="X")
<pyaedt.modules.report_templates.Standard object at 0x0000026980423B50>

Check for intersections#

Check for intersections using validation and fix them by assigning priorities.


Compute power budget#

power_budget, total ="W" )

Analyze the model#

ipk.analyze(num_cores=4, num_tasks=4)

Get solution data and plots#

plot1 =["COMP_U10"].faces, "SurfTemperature")"SurfPressure",ipk.modeler["COMP_U10"].faces,export_path=ipk.working_directory, show=False)
Sherlock Example
<pyaedt.generic.plot.ModelPlotter object at 0x0000026980422320>

Save project and release AEDT#

Save the project and release AEDT.


end = time.time() - start
print("Elapsed time: {}".format(datetime.timedelta(seconds=end)))
print("Project Saved in {} ".format(ipk.project_file))
Elapsed time: 0:18:06.386442
Project Saved in D:/Temp/pyaedt_prj_6O1/TutorialBoard.aedt


Total running time of the script: (18 minutes 46.391 seconds)

Gallery generated by Sphinx-Gallery