# 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. Properties and BC

Material Properties

Geometric Properties

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

2.2. General Settings

2.3. Geometry/Mesh

2.4. Material

2.5. Boundary Conditions

2.6. Solution

2.7. Processing

2.8. Post-Processing

### 2.1. Preparation

To run this tutorial;

2. 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”)

1. You can see the project page on your Personel Project Part.

2. Our screen is a blank python page without any script. We will be doing a tutorial by using Simularge’s Library.  1. 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.

1. Defined name of Analysis as “HTwedge”

```1HTwedge= Solver.Analysis()
```
1. 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
5
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.

1. First of all, we need to call a method to create a step. Step1’s name can be changed.

```1Step1=Solver.CreateStep("new")
```
1. We need to choose whether this step is computed depending on time or not.Explained problem is Steady-State. 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],,"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 Post-Processing stage, we can review what we have done.  ### 2.7. Processing

1. 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. Post-Processing

1. After the Problem is solved;

We can see results by clicking Result Button

1. 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.

Comparison

Target

ANSYS

SIMULARGE-TwinAPI

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
13
15HTwedge.Assemble()
16
17Step1=Solver.CreateStep("new")