# TA3: Temperature Distribution in a Short Solid Cylinder

## 1. PROBLEM DESCRIPTION

A short solid cylinder which is the radius and Length equal exposed to the surface temperatures as a shown. Cylinders’s top surface temperature and Cylinders’s bottom surface temperature was given. Wall temperature of Cylinder is Equal to Bottom temperature.Determine the temperature distribution within the cylinder. Problem was solved that assuming axisymmetric problem. Properties and BC Value

Material Properties

Geometric Properties

k = 1 Btu/hr-ft-°F

r = 6 in = 0.5 ft

Ttop = 40°F

L = 6 in = 0.5 ft

Tbottom=Twall=0°F

## 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’s name of Analysis “TempDistCylinder”)

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 blank Python page that we almost will use in each tutorial.

```1from TwinAPI.SimulationTools import Solver
2from TwinAPI.SimulationTools import Mesher
```

Since we will use air as a fluid in this tutorial, We have to import fluid properties from Simularge’s libraries. (Air is used as a fluid in this problem. We can only choose water apart from air.)

```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 “TempDistCylinder”

```1TempDistCylinder= Solver.Analysis(Verbose=True)
```
1. Calculix is used on solid mechanics problems in TwinAPI. Hence, we are defining Calculix to run this analysis.

```1TempDistCylinder.SetSolver("Calculix")
```

Analysis is defined successfully into TwinAPI System. ### 2.3. Geometry/Mesh

There is two different options to define geometry on TwinAPI System. Create own geometry on TwinAPI by using Mesher Library that belong to Simularge’s libraries or You can import own CAD Geometry.

``` 1    LengthX=0.5
2    LengthY=0.5
3    NodeX=5
4    NodeY=5
5    typeX="uniform"
6    dir1=""
7    typeY=type1
8    dir2=dir1
9    box1=Mesher.Quad2D(LengthX, nx, typeX, dir1, LengthY, NodeY, typeY, dir2)
10    box1=Mesher.Tetralizer(box1)
```

With the script given above, you can create your box geometry and mesh.

LengthX= Length of X Direction

NodeX= Node Number of X Direction

typeX= Mesh type of X direction.

All of given above is valid for Y and Z Direction.

We create a box geometry that name is “box1” from given inputs.

Note

We told you that you can also create this geometry import 3D CAD file apart from using MESHER. Code should be written like this;

```1 Box1=Mesher.MeshFromCad('Box.step',20000,1,1e4,SurfaceExtract=True)
```

If we are not sure how created geometry and want to see geometry before starting analysis;

Click Preview Button  ### 2.4. Material

Before we started,There are lots of parameters to impact to result of problem. We are going to explain which parameters are requirement for problem first. Later, We would give an parameters instances which can be used.

If your material is isotropic thats means all properties is equal with different direction. However Anisotropic Material Properties is not the same value with different direction. Only Thermal Conductivitiy of material will impact amount of heat transfer in this problem.

We call the Material class in the Material Manager library and name the material “TwinAPI”. At the same time, we give the information that the material behaves as a metal by typing “metal”.

```1    material = MaterialManager.Material("TwinAPI","metal")
2
3    material.SetThermalData("conductivity",1,units["btu/hr*ft*F"])
```

We will make an example to understand better what can be used parameters in Material Library.

```1 material.SetThermalData("specificHeat",7,units["j/kgk"])
2
3 material.SetThermalData("expansionCoefficient",10,units["1/k"])
4
5 material.SetGeneralData("density",5,units["kg/m3"])
```

After defining the material into our system, we should combine geometry define above and material using Addpart method.

```1TempDistCylinder.AddPart(box1,material,Type="Axisymmetric")
2
3TempDistCylinder.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 change.

```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,0.5,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])
```
1. The boundary conditions required for the problem are only temperature. Since our problem is axisymmetric, we use the right or left boundary condition of the geometry for the wall. Top and Bottom Boundary conditions name is same.

```1    Step1.AddBC("Temperature",[box1.top],,"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;

```1TempDistCylinder.Build([Step1])
```

Now,Problem is ready to be solved.

```1TempDistCylinder.Solve()
```

Before going to be PostProcess Stage, we can review what we have done. ### 2.7. Processing

1. Click Run Button and gears rotate on right side while problem is being solved. ### 2.8. Post-Processing

1. After Problem solved;

We can see result;

Click Result Button  1. If we want to see detailed result about problem; Output Tab shows us the results that we desire to see. If Print=False,We couldn’t see anything in the Output section. ```1TempDistCylinder.Result(Variable="Temperature", Loc=[0,0.125,0],Print=True)
``` Log tab tells us respectively what happened in analysis.

Error tab shows us if there is an error in script, It tells us what the error is and where it is.

Files tab can upload the files to be imported from the Upload command and check them from Files.

Graph tab shows us analysis result can be viewed graphically. (It will be shown in other examples.)

## 3. SUMMARY

In this tutorial, we learned how to set up and solve an axisymmetric problem for cylinder in TwinAPI. We also learned how to perform postprocessing in an engineering manner.

With table given below shows that comparasion of Ansys Mechanical Result and TwinAPI result.

Comparison

T,°F Centerline

Target

ANSYS

SIMULARGE-TwinAPI

Ratio: SIMULARGE/Target

Ratio: SIMULARGE/ANSYS

0.125

6.8

7.4

6.88

1.01

0.93

0.250

15.6

16.4

15.5

1.00

0.94

0.375

26.8

27.4

26.8

1.00

0.98

## 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
6TempDistCylinder = Solver.Analysis()
7TempDistCylinder.SetSolver("Calculix")
8
9lx=0.5
10ly=0.5
11nx=5
12ny=5
13type1="uniform"
14dir1=""
15type2=type1
16dir2=dir1
17box1=Mesher.Quad2D(lx, nx, type1, dir1, ly, ny, type2, dir2)
18material = MaterialManager.Material("TwinAPI","metal")
19
20material.SetThermalData("conductivityX",1,units["btu/hrftf"])
21
23
24TempDistCylinder.Assemble()
25Step1=Solver.CreateStep("new")
27
30
31
32
33TempDistCylinder.Build([Step1])
34TempDistCylinder.Solve()
35
36TempDistCylinder.Result(Variable="Temperature", Loc=[0,0.125,0])
37
38TempDistCylinder.Result(Print=True)
```

Keywords: Heat Transfer, Conduction, Temperature, Heat Transfer Coefficient, Short Cylinder, Axisymmetric Problem

Problem Reference: P. J. Schneider, Conduction Heat Transfer, 2nd Printing, Addison-Wesley Publishing Co., Inc., Reading, MA, 1957, pg. 134, fig. 6-7.