Icepak Example

This example shows how you can use PyAEDT to create an Graphic Card setup in Icepak and postprocess results. The example file is an Icepak Project with a model already created and with materials assigned.

# sphinx_gallery_thumbnail_path = 'Resources/Icepak.png'

Launch AEDT in Graphical Mode

This examples launches AEDT 2021.1 in graphical mode.

import os
import tempfile
import shutil
from pyaedt import examples, generate_unique_name
from pyaedt import Icepak

Open Project

Download Project, opens it and save to TEMP Folder.

project_full_name = examples.download_icepak()

tmpfold = tempfile.gettempdir()


temp_folder = os.path.join(tmpfold, generate_unique_name("Example"))
project_temp_name = os.path.join(temp_folder, "Graphic_Card.aedt")
if not os.path.exists(temp_folder):
    os.makedirs(temp_folder)
shutil.copy2(project_full_name, project_temp_name)

ipk = Icepak(project_temp_name, specified_version="2021.1")
ipk.save_project(os.path.join(temp_folder, "Graphics_card.aedt"))
ipk.autosave_disable()

Out:

Launching PyAEDT outside Electronics Desktop with CPython and Pythonnet
Launching AEDT installation C:\Program Files\AnsysEM\AnsysEM21.1\Win64
===================================================================================
pyaedt info: Launching AEDT with module Pythonnet.
pyaedt info:: Ansoft.ElectronicsDesktop.2021.1 Started with process ID 4472.
pyaedt info: Logger Started on C:\Users\ansys\Documents\Ansoft\pyaedt20211026_142145.log
pyaedt info: pyaedt v0.4.0
pyaedt info: Python version 3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)]
pyaedt info: Project Graphic_Card has been opened.
pyaedt info: Active design is set to IcepakDesign1
pyaedt.generic.LoadAEDTFile._read_aedt_file: 0.015527s
pyaedt info: AEDT Load time 0.015526533126831055
pyaedt info: Design Loaded
pyaedt info: Successfully loaded project materials !
pyaedt info: Materials Loaded
pyaedt info: Saving Graphic_Card Project

True

Create Source Blocks

Create Source block on CPU and MEMORIES

ipk.create_source_block("CPU", "25W")
ipk.create_source_block(["MEMORY1", "MEMORY1_1"], "5W")

Out:

pyaedt info: Block on ['CPU'] with 25W Power, created correctly.
pyaedt info: Block on ['MEMORY1', 'MEMORY1_1'] with 5W Power, created correctly.

<pyaedt.modules.Boundary.BoundaryObject object at 0x000001CD71F9ECD0>

Assign Boundaries

Assign Opening and Grille

region = ipk.modeler.primitives["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)

Out:

pyaedt info: Face List boundary_faces created
pyaedt info: Opening Assigned
pyaedt info: Face List boundary_faces created
pyaedt info: Grille Assigned

<pyaedt.modules.Boundary.BoundaryObject object at 0x000001CD1C2D0280>

Mesh Operations

Assign Mesh Region to HeatSink and CPU

mesh_region = ipk.mesh.assign_mesh_region(objectlist=["HEAT_SINK", "CPU"])
mesh_region.UserSpecifiedSettings = True
mesh_region.MaxElementSizeX = "3.35mm"
mesh_region.MaxElementSizeY = "1.75mm"
mesh_region.MaxElementSizeZ = "2.65mm"
mesh_region.MaxLevels = "2"
mesh_region.update()

Out:

True

Setup

Create Point Monitor and Setup

ipk.assign_point_monitor(point_position=["-35mm", "3.6mm", "-86mm"], monitor_name="TemperatureMonitor1")
ipk.assign_point_monitor(point_position=["80mm", "14.243mm", "-55mm"], monitor_type="Speed")
setup1 = ipk.create_setup()
setup1.props["Flow Regime"] = "Turbulent"
setup1.props["Convergence Criteria - Max Iterations"] = 5
setup1.props["Linear Solver Type - Pressure"] = "flex"
setup1.props["Linear Solver Type - Temperature"] = "flex"
setup1.update()
ipk.save_project(r"C:\temp\Graphic_card.aedt")

Out:

pyaedt info: Saving Graphics_card Project

True

Solve and PostProcess

Solve Project and plot Temperatures

quantity_name = "SurfTemperature"
surflist = [i.id for i in ipk.modeler.primitives["CPU"].faces]
surflist += [i.id for i in ipk.modeler.primitives["MEMORY1"].faces]
surflist += [i.id for i in ipk.modeler.primitives["MEMORY1_1"].faces]
surflist += [i.id for i in ipk.modeler.primitives["ALPHA_MAIN_PCB"].faces]

plot5 = ipk.post.create_fieldplot_surface(surflist, "SurfTemperature")

ipk.analyze_nominal()
ipk.release_desktop(True, True)

Out:

pyaedt info: Solving design setup MySetupAuto
pyaedt info: Key Desktop/ActiveDSOConfigurations/Icepak correctly changed.
pyaedt info: Design setup MySetupAuto solved correctly

True

Total running time of the script: ( 1 minutes 40.223 seconds)

Gallery generated by Sphinx-Gallery