Nonlinear finite elements/Homework 2/Solutions

From testwiki
Revision as of 02:29, 29 May 2018 by imported>MaintenanceBot (Special:LintErrors/obsolete-tag)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search



Problem 1: Classification of PDEs

Given:

(1)u,xx=αu,t(2)u,xxxx=αu,tt

Solution

Part 1

Template:Font

Equation (1) models the one dimensional heat problem where u(x,t) represents temperature at x at time t and α represents the thermal diffusivity.

Equation (2) models the transverse vibrations of a beam. The variable u(x,t) represents the displacement of the point on the beam corresponding to position x at time t. α is ρAEI where E is Young's modulus, I is area moment of inertia, ρ is mass density, and A is area of cross section.

Part 2

Template:Font

u,xx=αu,t2ux2=αutu,xxxx=αu,tt4ux4=α2ut2

Part 3

Template:Font

Equation (1) is parabolic for all values of α.

We can see why by writing it out in the form given in the notes on Partial differential equations.

(1)2ux2+(0)2uxt+(0)2ut2+(0)ux+(α)ut+(0)u=0

Hence, we have a=1, b=0, c=0, d=0, e=α, f=0, and g=0. Therefore,

b24ac=0(1)(0)=0parabolic

Equation (2) is hyperbolic for positive values of α, parabolic when α is zero, and elliptic when α is less than zero.

Problem 2: Models of Physical Problems

Given:

ddx(a(x)du(x)dx)+c(x)u(x)=f(x)for x(O,L)

Solution

  • Heat transfer: :kAd2Tdx2+apβT=f
  • Flow through porous medium: :μd2ϕdx2=f
  • Flow through pipe: :1Rd2Pdx2=0
  • Flow of viscous fluids: :μd2vzdx2=dPdx
  • Elastic cables: :Td2udx2=f
  • Elastic bars: :EAd2udx2=f
  • Torsion of bars: :GJd2θdx2=0
  • Electrostatics: :εd2ϕdx2=ρ

Problem 4: Least Squares Method

Given:

The residual over an element is

Re(x,c1e,c2e,,cne):=ddx(aduhedx)+cuhef(x)

where

uhe(x)=j=1ncjeφje(x).

In the least squares approach, the residual is minimized in the following sense

cixaxb[Re(x,c1e,c2e,,cne)]2dx=0,i=1,2,,n.

Solution

Part 1

Template:Font

We have,

cixaxb[Re]2dx=xaxb2ReRecidx=0.

Hence the weighting functions are of the form

wi(x)=Reci

Part 2

Template:Font

To make the typing of the following easier, I have gotten rid of the subscript h and the superscript e. Please note that these are implicit in what follows.

We start with the approximate solution

u(x)=j=1ncjφj(x).

The residual is

R=ddx[a(jcjdφjdx)]+c(jcjφj)f(x).

The derivative of the residual is

Rci=ddx[a(jcjcidφjdx)]+c(jcjciφj)f(x).

For simplicity, let us assume that a is constant, and c=0. Then, we have

R=a(jcjd2φjdx2)f,

and

Rci=a(jcjcid2φjdx2).

Now, the coefficients ci are independent. Hence, their derivatives are

cjci={0forij1fori=j

Hence, the weighting functions are

Rci=ad2φidx2.

The product of these two quantities is

RRci=(ajcjd2φjdx2f)(ad2φidx2)=j[(a2d2φidx2d2φjdx2)cj]afd2φidx2.

Therefore,

xaxbRRcidx=0j[(xaxba2d2φidx2d2φjdx2dx)cj]xaxbafd2φidx2dx=0

These equations can be written as

Kijcj=fi

where

Kij=xaxba2d2φidx2d2φjdx2dx

and

fi=xaxbafd2φidx2dx.

Part 3

  1. Template:Font

For the least squares method to be a true "finite element" type of method we have to use finite element shape functions. For instance, if each element has two nodes we could choose

φ1=xbxhandφ2=xxah.

Another possiblity is set set of polynomials such as

φ={1,x,x2,x3}.

Problem 5: Heat Transefer

Given:

ddx(kdTdx)=q for x(0,L)

where T is the temperature, k is the thermal conductivity, and q is the heat generation. The Boundary conditions are

T(0)=T0kdTdx+β(TT)+q^|x=L=0

Solution

Part 1

Template:Font

First step is to write the weighted-residual statement

0=xaxbwie[ddx(kdThedx)q]dx

Second step is to trade differentiation from The to wie, using integration by parts. We obtain

0=xaxb(kwiedxdThedxwieq)dx[wiekdThedx]xaxb(3)

Rewriting (3) in using the primary variable T and secondary variable kdTdxQ as described in the text book to obtain the weak form

0=xaxb(kwiedxdThedxwieq)dxwie(xa)Qaewie(xb)Qbe(4)

From (4) we have the following

Kije=xaxbkNiedxdNjedxdxfie=xaxbqNiedxKijeTje=fie+Nie(xa)Qae+Nie(xb)Qbe

Part 2

Template:Font

The following inputs are used to solve for the solution of this problem:

  /prep7
  pi = 4*atan(1) !compute value for pi
  ET,1,LINK34!convection element
  ET,2,LINK32!conduction element
  R,1,1!AREA = 1
  MP,KXX,1,0.01!conductivity
  MP,HF,1,25 !convectivity
  emax = 2
  length = 0.1
  *do,nnumber,1,emax+1 !begin loop to creat nodes
     n,nnumber,length/emax*(nnumber-1),0
     n,emax+2,length,0!extra node for the convetion element
  *enddo
  type,2 !switch to conduction element
  *do,enumber,1,emax
     e,enumber,enumber+1
  *enddo
  TYPE,1 !switch to convection element
  e,emax+1,emax+2!creat zero length element
  D,1,TEMP,50
  D,emax+2,TEMP,5
  FINISH

  /solu
  solve
  fini

  /post1
  /output,p5,txt
  prnsol,temp
  prnld,heat
  /output,,
  fini

ANSYS gives the following results

Node Temperature
1 50.000
2 27.590
3 5.1793
Node Heat Flux
1 -4.4821
4 4.4821


Part 3

Template:Font

The following Maple code can be used to solve the problem.

> restart;
> with(linalg):
> L:=0.1:kxx:=0.01:beta:=25:T0:=50:Tinf:=5:
> # Number of elements
> element:=10:
> # Division length
> ndiv:=L/element:
> # Define node location
> for i from 1 to element+1 do
>   x[i]:=ndiv*(i-1);
> od:
> # Define shape function
> for j from 1 to element do
>   N[j][1]:=(x[j+1]-x)/ndiv;
>   N[j][2]:=(x-x[j])/ndiv; 
> od:
> # Create element stiffness matrix
> for k from 1 to element do
>   for i from 1 to 2 do
>     for j from 1 to 2 do
>       Kde[k][i,j]:=int(kxx*diff(N[k][i],x)*diff(N[k][j],x),x=x[k]..x[k+1]); 
>     od;
>   od;
> od;
> Kde[0][2,2]:=0:Kde[element+1][1,1]:=0:
> # Create global matrix for conduction Kdg and convection Khg
> Kdg:=Matrix(1..element+1,1..element+1,shape=symmetric):
> Khg:=Matrix(1..element+1,1..element+1,shape=symmetric):
> for k from 1 to element+1 do
>   Kdg[k,k]:=Kde[k-1][2,2]+Kde[k][1,1];
>   if (k <= element) then
>     Kdg[k,k+1]:=Kde[k][1,2];
>   end if;
> od:
> Khg[element+1,element+1]:=beta:
> # Create global matrix Kg = Kdg + Khg
> Kg:=matadd(Kdg,Khg):
> # Create T and F vectors
> Tvect:=vector(element+1):Fvect:=vector(element+1):
> for i from 1 to element do
>   Tvect[i+1]:=T[i+1]:
>   Fvect[i]:=f[i]:
> od:
> Tvect[1]:=T0:
> Fvect[element+1]:=Tinf*beta:
> # Solve the system Ku=f
> Ku:=multiply(Kg,Tvect):
> # Create new K matrix without first row and column from Kg
> newK:=Matrix(1..element,1..element):
> for i from 1 to element do
>   for j from 1 to element do
>     newK[i,j]:=coeff(Ku[i+1],Tvect[j+1]);
>   od;
> od;
> # Create new f matrix without f1
> newf:=vector(element,0):
> newf[1]:=-Ku[2]+coeff(Ku[2],T[2])*T[2]+coeff(Ku[2],T[3])*T[3]:
> newf[element]:=Tinf*beta:
> # Solve the system newK*T=newf
> solution:=multiply(inverse(newK),newf);
> exact := 50-448.2071713*x;
> with(plots):
> # Warning, the name changecoords has been redefined
> data := [[ x[n+1], solution[n]] <math>n=1..element]:
> FE:=plot(data, x=0..L, style=point,symbol=circle,legend="FE"):
> ELAS:=plot(exact,x=0..L,legend="exact",color=black):
> display({FE,ELAS},title="T(x) vs x",labels=["x","T(x)"]);

Template:Subpage navbar