FEMlabnew PDF

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Scientific Computing III 1 (5)

Institutionen for
informationsteknologi Lab - Introduction to Finite Element Methods
Teknisk databehandling and COMSOL Multiphysics
Besoksadress:
MIC hus 2, Polacksbacken
Lagerhyddsvagen 2

Postadress:
Using a finite element method to compute the shape
Box 337
751 05 Uppsala
of a soap film
Telefon:
018471 0000 (vaxel) We are now going to consider a soap film in a wire frame. The minimal
Telefax: surface connecting the wire frame (the soap film) is a solution (u) to the
01852 30 49 following partial differential equation (Laplaces equation),

u(x; y ) = 0; (x; y ) 2 ;
Hemsida:

u(x; y ) = r(x; y ); (x; y ) 2  :


http:/www.it.uu.se/
(1)

Department of The computational domain is a bounded domain in the xy -plane. The


Information Technology boundary of ,  is a projection of the wire frame into the plane. The
given boundary values (r ) are the positions of the wire frame in the third
Scientific Computing

Visiting address: dimension going out of the xy -plane.


MIC bldg 2, Polacksbacken

For a given domain and function r (x; y ), in general this problem has no
Lagerhyddsvagen 2

Postal address: analytical solution. Instead we use numerical approximations, in this case
Box 337
SE-751 05 Uppsala
the finite element method (FEM).
SWEDEN

Telephone:
+46 18471 0000 (switch)
FEM for PDEs
Telefax:
+46 1852 30 49
One of the most important features of finite element methods is that they
Web page:
http:/www.it.uu.se/ are based on unstructured grids. (Finite difference methods use structured
grids.) This means that FEM is more flexible with respect to the geometry.
For example, in two dimensions, we dont need the computational domain
to be rectangular or something that can be mapped onto a rectangle.

A FEM solution to problem (1) has the general form

X
N
uh(x; y ) = j j (x; y );
j =1
where j are coefficients and j (x; y ) are basis functions. The subscript h
refers to the mesh that was used and is computed as the largest distance
between two neighboring points in the mesh. The coefficients j are found
by solving a linear system of equations.
2 (5)

An example of an unstructured mesh and one basis function j (x; y ) are


shown in the figures below. Basis functions can be of different types. The
type shown below is called a linear hat function.
Mesh with h = 0.17583
1

0.5

A linear hat function


1

0 0.5
y

0
1

0.5 0.5 1
0.5
0
0
1 0.5
0.5
1 0.5 0 0.5 1 y
x 1 1 x

Introduction to COMSOL Multiphysics


 Start COMSOL Multiphysics by clicking at, Start, All Programs,
Matlab7 Comsol, comsol. In the folder list, in the window that
opens, choose COMSOL Multiphysics, PDE modes, Classi-
cal PDEs. Select Laplaces Equation and press OK. Draw your
boundary  by clicking Draw, Draw objects, Line. The domain
should be closed and simply connected, i.e., the boundary cannot in-
tersect itself. You draw the lines using the left button of the mouse
and connect the last line to the starting point, i.e. close the boundary,
using the right button.

 After drawing the domain we need to specify the boundary func-


tion r (x; y ). Click on Physics, Boundary Settings. Click on the
first number in the list to the left. Each number refers to a bounda-
ry segment, to see which one, you can move the window and look
at the boundary segments you have drawn. We want to set u = r
at the boundary. This type of boundary condition is called a Di-
richlet boundary condition. Chose Dirichlet boundary condition.
In COMSOL Multiphysics this type of boundary conditions are gi-
ven by the formula h  u = r , where h is a function that should not
be confused with the mesh size. In our case h = 1 since u = r .
Now specify the boundary function r (x; y ) for the first boundary
segment (e.g. x*y+1). Continue in the same way until you have spe-
cified r (x; y ) for all boundary segments, then click OK. You can
mark several boundary segments using the ctrl key.

 If you want to change the parameters in PDE or set intial values in the
domain you can click Physics, Subdomain Settings. (In this case
the PDE does not have any parameters and it is a time-independent
3 (5)

problem. Here there is no point of setting any inital values or para-


meters but in the general case we need to do this.)

 The next step is to construct a triangulation of the domain. Click on


Mesh, Initialize mesh.

 We are ready to solve the problem, click Solve, Solve Problem.


To see a three dimensional picture of the surface click Postproces-
sing, Quick plots, 3D surface.

 Refine the mesh by clicking Mesh, Refine mesh, and solve the
problem again. Do you see any difference in the solution?

Solving an Application

As a new employed engineer you have been assigned a task to control the
temperature in a critical part of a machine. It is important that temperature
does not exceed a certain threshold in the part. To calculate the temperature
you will need to solve the heat equation in 2D.

Heat equation

Heat is transfered spontaneously from higher to lower temperature. The


heat transport can take place by three different ways, through heat conduc-
tion (electrons), convection (flow of media), and by radiation (photons).
We will only study heat conduction and disregard the other phenomena.

Consider a homogeneous, isotropical, and solid body with the volume


and boundary . We define the heat flow G=G(r,t) (function of the space
coordinates r and of time t) as a vector field and the temperature T=T(r,t)
as a scalar field. The temperature differences in the body will give a heat
flow going from warmer to colder parts in the body along the temperature
gradients. The fundamental law for heat conduction is Fouriers law:

G= rT
where  is a material parameter. For homogenous and isotropical material
 is a constant scalar. As we have a solid body there is no convection in the
body. Moreover, we will disregard that  can be temperature dependent.

By using the principle of constant energy in a closed system the continuity


equation for energy can be derived, see any book in thermo dynamics. If
heat is added to the volume this will result in a temperature change in the
body. The added heat can come either as an inflow from the boundaries
4 (5)

or be produced inside the volume (e.g. from chemical reactions). This is


described by
T
v  + r  G = h in
t
where v is the specific heat capacity for the material and  is the density.
These are constants for homogenous material. The source term h = h(r; t)
represents the produced heat per volume and time unit. Using Fouriers law
we get, r  G = r  (rT ) = T , which gives us the heat equation

T 
= T + h
t 
where

= :
v 
Together with boundary conditions on the heat equation above describes
the temperature distribution in a homogenous isotropical solid body.

The Problem

We will solve the heat equation under stationary conditions (we have tem-
perature equilibrium, i.e. no time dependency) and without any heat sour-
ces inside the body. Figure 1 defines the geometry of the body. The tem-
perature field is independent of the z-direction (consider an outstretched
body in the z-direction). On the boundaries 1 we have heat exchange with
2

2 0.7 2
3

0.4 1 0.4 3 1
3 0.4
2 3 2
0.6 0.4
0.6

Figur 1: Computational domain with boundaries.

the outside media, e.g. cooling by convection, airflow with temperature T0 .


At the boundary we have that the normal component of the heat flow is:
Gn = (T T0 ), where is the heat transfer coefficient and T0 the exter-
nal temperature. This is called the Newtons law for heat transfer. The heat
transfer coefficient depends on the temperature, the speed of the flow, the
5 (5)

surface structure, etc and is usually determined by experiments. Fouriers


law gives us now the boundary condition
T
 = (T T0 )
n
On the boundaries 3 we will have the same boundary condition but with
the external temperature T1 . The boundaries 2 are perfect insulators, the
normal component of the heat flow is zero, Gn = 0. With Fouriers law we
get
T
=0
n

Task

Solve the linear stationary heat equation with COMSOL Multiphysics.


Model a body exactly as described in Figure 1. In the middle of the body,
on boundary 3 , we have a heat flow with temperature T1 = 310K. Outside
the body, on boundary 1 , we have cooling with temperature T0 = 200K.
What is the maximum temperature in the body? Use the parameters  = 3
and = 2. Make sure that your answer does not depend on the discretiza-
tion of the domain. How much must we cool on the boundary 1 in order to
have a maximum temperature of 280K in the body, experiment both with
the temperature T0 and the heat transfer parameter .

You might also like