TA14 : Heat Transfer in a Bar with Variable Sheet Thickness
1. PROBLEM DESCRIPTION
A varying thickness metal bar with given geometry is subjected to two temperature boundary conditions from both ends. They are fixed at 100°C and 200°C. Thermal conductivity is given. Temperature value at the middle of the metal bar is asked.
Material Properties 
Geometric Properties 
Loading 

k = 60.5 W/m°C 
Plate Dimensions : 10 X 50 mm 
Temperature at 1 mm edge=100°C 
Thickness Variation : 1 mm to 4 mm 
Temperature at 4 mm edge=200°C 
2. MODEL SETUP AND SOLUTION
The following sections describe the setup and solution steps for this tutorial:
2.1. Preparation
To run this tutorial;
You must sign up and log in. —>>>>> TwinAPI
After login, Click Personel Projects>>New Project button on the screen and then we will create a project page by giving the project name.
(Let us name our analysis “HTwithVariableThickness”)
You can see the project page on your Personel Project Part.
Our screen is a blank python page without any script. We will be doing a tutorial by using Simularge’s Library.
We import our libraries from the Simularge Libraries to our empty Python page that we almost will use in each tutorial.
1from TwinAPI.SimulationTools import Solver
2from TwinAPI.SimulationTools import Mesher
Material Properties is a significant factor that affects the result. Therefore, we should define it to the problem easily. The Libraries that has to be imported for the problem is given below.
1from TwinAPI.MaterialLibrary import MaterialManager
2from TwinAPI.MaterialLibrary.Units import units
2.2. General Settings
After the necessary libraries are imported into the analysis, analysis are defined.
Defined name of Analysis as “HTwedge”
1HTwedge= Solver.Analysis()
Calculix is used on this particular problem in TwinAPI. Hence, we are defining Calculix to run this analysis.
1HTwedge.SetSolver("Calculix")
Analysis is defined successfully into TwinAPI System.
2.3. Geometry/Mesh
There is two different options to define geometry on TwinAPI System. Creating your own geometry on TwinAPI by using Mesher Library, (that belongs to Simularge’s libraries) or you can import your own CAD Geometry. Here the latter approach is demostrated.
1material = MaterialManager.Material("TwinAPI","wedge")
2material.SetThermalData("conductivityX",35,units["btu/hrftf"])
3
4wedge=Mesher.MeshFromCad('wedgeHTv1.step',0.5,1,1,SurfaceExtract=True)
5
6HTwedge.AddPart(wedge, material)
7HTwedge.Assemble()
With this script we import the geometry from a step file using import function and defining mesh size as 0.5 as can be seen from the code. We add the defined material properties and geometry from the cad together and assemble them.
If you are not sure about the created geometry and want to see geometry before starting analysis;
Click Preview Button
2.4. Material
For material properties following structure is followed, first we call the “material” class in the Material Manager library and name the material “wedge” for specific material properties. We define conductivity alone in this problem, as it is sufficient.
1material = MaterialManager.Material("TwinAPI","wedge")
2material.SetThermalData("conductivityX",35,units["btu/hrftf"])
After defining the material into our system, we should combine geometry defined above and our material using Addpart method.
1HTwedge.AddPart(wedge, material)
2HTwedge.Assemble()
2.5. Boundary Conditions
After adding material and geometry to the analysis, we are ready to set the boundary conditions.
First of all, we need to call a method to create a step. Step1’s name can be changed.
1Step1=Solver.CreateStep("new")
We need to choose whether this step is computed depending on time or not.Explained problem is SteadyState. Therefore,below code should be written.
1Step1.Time("SteadyState",[0,1,0.1])
If the problem was transient,type of problem and time of analysis should be written in a similar manner with below code.
1Step1.Time("Transient",[0,10,0.1])
The type of boundary conditions required for the problem are temperature. In the problem edge surfaces are subjected to constant temperature boundary condition.
1Step1.AddBC("Temperature",[wedge.Surface2],[212],"F")
2Step1.AddBC("Temperature",[wedge.Surface4],[392],"F")
2.6. Solution
After defining our boundary conditions, we need to combine our defined domain and the steps containing boundary conditions.To complete this task;
Now, problem is ready to be solved.
1HTwedge.Solve()
Before going into PostProcessing stage, we can review what we have done.
2.7. Processing
Click Run Button and gears rotate until the problem is solved. At the right side there is output log where you can see details regarding the meshing of the geometry.
2.8. PostProcessing
After the Problem is solved;
We can see results by clicking Result Button
If we want to see detailed result about problem;
Output Tab shows us the results that are printed.
1TempCent=HTwedge.Result(Variable="Temperature", Loc=[25,5,0],Print=True)
Code above is used to print the temperature at the middle of the bar.
3. SUMMARY
In this tutorial, how to set up and solve a problem involving temperature and natural convection on an extruded slice with TwinAPI is demonstrated.
Table below shows a comparison of Ansys Mechanical Result and TwinAPI result of the exact same problem.
Target 
ANSYS 
SIMULARGETwinAPI 
Ratio: SIMULARGE/Target 
Ratio: SIMULARGE/ANSYS 


Temperature, °F 
330.944 °F 
330.962 °F 
331°F 
0.99 
0.99 
4. SOURCE CODE
1from TwinAPI.SimulationTools import Solver
2from TwinAPI.SimulationTools import Mesher
3from TwinAPI.MaterialLibrary import MaterialManager
4from TwinAPI.MaterialLibrary.Units import units
5
6HTwedge = Solver.Analysis()
7HTwedge.SetSolver("Calculix")
8material = MaterialManager.Material("TwinAPI","wedge")
9material.SetThermalData("conductivityX",35,units["btu/hrftf"])
10
11
12wedge=Mesher.MeshFromCad('wedgeHTv1.step',0.5,1,1,SurfaceExtract=True)
13
14HTwedge.AddPart(wedge, material)
15HTwedge.Assemble()
16
17Step1=Solver.CreateStep("new")
18Step1.Time("SteadyState",[0,1,0.1])
19
20Step1.AddBC("Temperature",[wedge.Surface2],[212],"F")
21Step1.AddBC("Temperature",[wedge.Surface4],[392],"F")
22
23
24HTwedge.Build([Step1])
25HTwedge.Solve()
26TempCent=HTwedge.Result(Variable="Temperature", Loc=[25,5,0],Print=True)
Keywords: Heat Transfer, Conductivity, Temperature, Heat Transfer Problem Reference: Frank P. Incropera and David P. DeWitt, Heat and Mass Transfer, John Wiley & Sons, Inc, 2002, 5th Edition pg. 5.
Author: Ahmet Taha Yayman