Analysis of Many Bodies in One Part with ANSYS ACT

Introduction

한 Part의 각 Body에 상응하는 조건을 정의하고 해석하기 위해 진행

Introduction
  1. Mechanical - Engineering Data: 물질에 대한 성질 정의
  2. Mecahnical - Geometry: 한 Part에 많은 Body 생성 (Python, SpaceClaim)
  3. Mechanical - Model: Mesh 생성
  4. Mechanical - Setup: 각 Body에 상응하는 경계조건 정의 (Python)
  5. Mechanical - Solution: 해석

Generating Many Bodies in One Part

위 사진과 같이 수많은 Body들을 직접 모델링하는 것은 불가능하기 때문에 SpaceClaim 내의 기능인 Scripting을 사용한다.
SpaceClaimScripting 기능은 IronPython을 기반으로 Coding 및 실행이 가능하다.

MakeManyBodiesInOnePart.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
def MakeBody(startPos, BodySize, Thickness):
selection = Part1
result = ComponentHelper.CreateNewComponent(selection, Info1)
result = SketchHelper.StartConstraintSketching()
plane = Plane.PlaneXY
result = ViewHelper.SetSketchPlane(plane)
point1 = Point2D.Create(MM(startPos[0]),MM(startPos[1]))
point2 = Point2D.Create(MM(startPos[0]+BodySize),MM(startPos[1]))
point3 = Point2D.Create(MM(startPos[0]+BodySize),MM(startPos[1]+BodySize))
result = SketchRectangle.Create(point1, point2, point3)
baseSel = SelectionPoint.Create(CurvePoint7)
targetSel = SelectionPoint.Create(DatumPoint2)
mode = InteractionMode.Solid
result = ViewHelper.SetViewMode(mode, Info3)
selection = Face2
options = ExtrudeFaceOptions()
options.ExtrudeType = ExtrudeType.Add
result = ExtrudeFaces.Execute(selection, MM(Thickness), options, Info4)

BS = 4
for i in range(0, Length of Web, BS): #MD
for j in range(0, Width of Web, BS): #CMD
MakeBody([i, j], BS, 0.1)
Many Bodies in One Part
  • Share Mophology - Share 필수
Share Mophology - Share

Setting Condition in Many Bodies

수많은 Body들의 초기조건 및 경계조건을 정의하기 위해 Ansys Mechanical 내의 기능인 Scripting을 사용한다.
Ansys MechanicalScripting 기능은 IronPython을 기반으로 Coding 및 실행이 가능하다.

SetPressureCondition.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
bodies = ExtAPI.DataModel.Tree.GetObjectsByType(DataModelObjectCategory.Body)

MD = 125
CMD = 38

Pressure = 2.7*9.81 / (0.1*150)

pressure_condition = DataModel.AnalysisList[0].AddPressure()
selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
s1 = [bodies[0].GetGeoBody().Faces[3]]
for i in range(1,CMD,1):
s1.append(bodies[i].GetGeoBody().Faces[3])
selection.Entities = s1
pressure_condition.Location = selection
pressure_condition.Magnitude.Output.SetDiscreteValue(0, Quantity(-Pressure, "MPa"))

pressure_condition = DataModel.AnalysisList[0].AddPressure()
selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
s2 = [bodies[MD*CMD-CMD].GetGeoBody().Faces[2]]
for i in range(MD*CMD-CMD+1,MD*CMD,1):
s2.append(bodies[i].GetGeoBody().Faces[3])
selection.Entities = s2
pressure_condition.Location = selection
pressure_condition.Magnitude.Output.SetDiscreteValue(0, Quantity(-Pressure, "MPa"))
SetThermalCondition.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import csv

bodies = ExtAPI.DataModel.Tree.GetObjectsByType(DataModelObjectCategory.Body)

MD = 125
CMD = 38

temp_csv = csv.reader(open('Temp.csv','r'))

temp = []

for t in temp_csv:
tmp = float(t[2])
temp.append(tmp)

x = 1

for j in range(0,MD,1):
for i in range(0,CMD,1):
thermal_condition = DataModel.AnalysisList[0].AddThermalCondition()
selection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
selection.Entities = [bodies[x-1].GetGeoBody()]
thermal_condition.Location = selection
thermal_condition.Magnitude.Output.SetDiscreteValue(0, Quantity(temp[x-1], "C"))
x = x + 1
Setting Thermal Condition