10 views

Uploaded by widhisaputrawijaya

Good

- Strand7 Demonstration
- Steel Plate Analysis by Finite Elements
- Linear Planar Sytems in ODE
- Invisible elastic bolt model concept for finite element analysis of bolted connections
- rr311403-finite-element-method
- FEM-06 Boundary Conditions
- MITRES2_002S10_lec03
- Introduction to Acoustics
- Matrices
- Rr410104 Finite Element Methods
- Linear Algebra Libre
- saalm 33 rd degree of zion
- 66859_91826v00_FEM_final
- FEA Theory
- pro076-010
- The Interaction of an Underwater Explosion Bubble and an Elastic-plastic Structure
- Data Manipulation With R
- chap1
- [Ivor Horton] Beginning C From Novice to Professi(Ben-ok.org)
- Notes for Cive1620 Large Type Part 1&2 Full2008 4up

You are on page 1of 2

Niall Madden

21 March 2012 (Rev 12.03.24)

Outline

As with finite difference methods, we denote the mesh

width as hi = xi xi1 . Since here the mesh is uniform,

we can write h = hi .

Today we want to develop some Matlab code to implement a simple finite element methods for a one-dimensional

problem:

u 00 + p(x)u 0 + r(x)u = f(x)

x := (0, 1),

(1)

below is for the simple case:

The code

from http://tinyurl.com/845fnul

especially in computational fluid dynamics).

2.1

the program does and why it was written.

space. However, its written in such a way so that

it is not difficult to use higher-order polynomials.

1

2

3

is, we specify the value of the solution on the boundary. Alternatively, one could specify the first derivative, called a Neumann condition. Or some combination, giving a Robin condition.

4

5

6

7

8

9

10

u(1) = 0. However, it is very easy to adjust the

code to change this.

%% Solve1dFeLinear.m 21/03/2012

% Written by Niall Madden for the course on

% Mathematics of the Finite Element Method.

% An implementation of a Finite Element Method

% for a onedimensional problem on a uniform

% mesh, with linear basis elements.

% The problem (in strong form) is:

%

u'' + r u=f(x) on Omega=(0,1)

% u(0)=u(1)=0;

% See also Integrate.m

2.2

to extend this code so that it works for arbitrary

meshes.

u(0) = u(1) = 0.

(2)

the code.

would be better to implement this as a function.

8. The error is estimated in the L2 -norm. To date, our

mathematical p

analysis has been for energy norms:

h

ku u kB := B(u uh , u uh ).

13

14

15

16

17

Ive now posted a simple integrator to the webpage.

It uses 2-point Gaussian quadrature.).

18

19

20

fprintf('\n

u'' + r u=f(x) on (0,1) \n');

fprintf('using linear basis elements \n');

r=1/4; % r is constant

f=@(x)(4*exp(x));

u=@(x)16/3*((exp(x/2).*(exp(1)exp(1/2)) ...

exp(x/2).*(exp(1)exp(1/2)))./(exp(1/2) ...

exp(1/2)) exp(x));

2.5

2.3

2.5

the particular finite element discretization well be using: that is we need to choose a mesh, and some basis

functions for our space. Here we are going to use a uniform mesh, so it is specified just by giving N, the number

of intervals on the mesh.

28

29

30

N=25;

h = 1/N; % Assuming mesh is uniform

x = linspace(0,1,N+1)'; % mesh is a column vector

(f, i )

37

38

66

67

68

69

70

71

@(x)( x/h );};

Dphi = {@(x)( x*01/h );

@(x)( x*0+1/h ); };

xi1

A = sparse(N+1, N+1);

F = zeros(N+1,1);

for i=1:N

A(i:i+1,i:i+1) = A(i:i+1,i:i+1) + E2 + r*E0;

F(i:i+1) = F(i:i+1) + E0*f(x(i:i+1));

end

54

55

56

57

58

59

60

the error correctly, instead the L2 error is given. You

should adjust the code to estimate the error in the energy

norm.

82

xi1

83

85

53

2.7

84

52

j=i1

that each contributes to two rows and to two columns of

the matrix. So well represent these contributions as a

2 2 matrix. I use E2 to represent the contribution

from second-order term, and E0 the contribution from

the zero-order term. That is,

Z xi

Z xi

0 0

E2ij =

j i dx.

E0ij =

j i dx.

51

i+1

X

f(xj )j (x), i (x) =

f(xj ) j , i .

The differential equation has homogeneous boundary conditions. They are enforced explicitly as follows:

73

2.4

N

X

j=0

2.6

36

of exposition, Im building the matrix one interval at a

time. This is very slow, but easier to understand than

using a more complicated sparse construct. Im a little

lazy in how the right-hand side is formed. Instead of

computing either the exact integral (f, i ), or a quadrature approximation to that, I use the piecewise linear

interpolant to f. That is, the ith term in the right-hand

side is

them on a reference element [0, h]:

x

x

1 (x) = 1

2 (x) = .

h

h

They are stored in a call array. Im indexing from 1,

rather than 0, since that is what Matlab supports. Of

course we also need the derivatives. Although they are

constant in this case, Im representing them as functions.

This is because you might like to use higher-order elements.

35

THE CODE

E2 = zeros(2,2);

E0 = zeros(2,2);

for i=1:2

for j=1:2

E2(i,j) = Integrate(@(X)(Dphi{j}(X).*...

Dphi{i}(X)),0,h);

E0(i,j) = Integrate(@(X)(phi{j}(X).*...

phi{i}(X)),0,h);

end

end

86

87

88

89

construct. This is because I want to use the E0 matrix

for forming the right-hand side, as is explained below.

2

L2Error=0;

Diff = @(X)(u(X) interp1(x,U,X));

for i=1:N

L2Error = L2Error + ...

Integrate(@(X)(Diff(X).2), x(i),x(i+1));

end

L2Error = sqrt(L2Error);

fprintf('N=%6d, L2Error=%8.3d\n', N, L2Error);

- Strand7 DemonstrationUploaded bymorganflexer
- Steel Plate Analysis by Finite ElementsUploaded bysupperpainintheneck
- Linear Planar Sytems in ODEUploaded byPiyush Patel
- Invisible elastic bolt model concept for finite element analysis of bolted connectionsUploaded byMilmxmen
- rr311403-finite-element-methodUploaded bySRINIVASA RAO GANTA
- FEM-06 Boundary ConditionsUploaded byNick Ramirez Parra
- MITRES2_002S10_lec03Uploaded byDaniel
- Introduction to AcousticsUploaded byncharala
- MatricesUploaded byManish
- Rr410104 Finite Element MethodsUploaded bySrinivasa Rao G
- Linear Algebra LibreUploaded byAkash Deep
- saalm 33 rd degree of zionUploaded byObamael Mo-buff
- 66859_91826v00_FEM_finalUploaded byدزيكرو جاريمان
- FEA TheoryUploaded byabdulla_alazzawi
- pro076-010Uploaded byEmanuel Gevara
- The Interaction of an Underwater Explosion Bubble and an Elastic-plastic StructureUploaded byPhan Nguyen
- Data Manipulation With RUploaded bySandip Darji
- chap1Uploaded byAbhiKhan
- [Ivor Horton] Beginning C From Novice to Professi(Ben-ok.org)Uploaded byCi
- Notes for Cive1620 Large Type Part 1&2 Full2008 4upUploaded bysjeyarajah21
- Chapter 2 ReviewUploaded bytree5215
- FEA in Practice 400Uploaded bySanjay Jaiswal
- A06Uploaded byKerim Hadžić
- CompositesMechanicsChapter 14Uploaded bySena Koçak
- zoho.pdfUploaded byloga surya
- ComputabilityUploaded byAnonymous erhFIZ
- 105A_syllabusUploaded byGuanda Fu
- ECE1250S14_M2LectProbs.pdfUploaded byel_ruso__83
- FEM QuizUploaded bymkdev2004
- full BookUploaded byRedEyes Adil

- 2016-08-openrec.pdfUploaded byawir
- Commissioning GuideUploaded byGlenn Sanchez Jr.
- 10.1.1.207.1091Uploaded bywidhisaputrawijaya
- AnsiUploaded bywidhisaputrawijaya
- Docs GulfpublishingUploaded bywidhisaputrawijaya
- 025A4Uploaded byFarhan Ahmed
- steam silencerUploaded byAntonio Perez
- Seminar-DPFlowAndLevelUploaded bySedhu Madhavan
- 01 - Fluid FlowUploaded bylouay
- 1692-2006(+A1)Uploaded bywidhisaputrawijaya
- amberlite_xad7hpUploaded bywidhisaputrawijaya
- start up list.pdfUploaded bymeg
- 92Uploaded bywidhisaputrawijaya
- 08 - Section-3 Three Phase SeparationUploaded byOladayo Siyanbola
- 33_1_TORONTO_06-88_0300Uploaded bywidhisaputrawijaya
- 1.Pipe and Tube SizingUploaded bywidhisaputrawijaya
- 10.1.1.207.1091Uploaded bywidhisaputrawijaya
- MembraneUploaded bywidhisaputrawijaya
- MembraneUploaded bywidhisaputrawijaya
- MembraneUploaded bywidhisaputrawijaya
- 4118-8827-1-SMUploaded bymantascita
- Liner Equal Percentage Valve CharecteristicsUploaded byAbdullah Khan
- 72713875 Slug Catcher SizingUploaded byporchfroggy
- 20130715_1._PE-D-ln10-422.002-PS-DAS-002-D0-E_WTIS_-_DATA_SHEET_FOR_CLOSED_DRAIN_...Uploaded bywidhisaputrawijaya
- 0EEA06 Calculation of Flow Rate for Orifice Venturi or Flow Nozzle Meter Si UnitsUploaded bywidhisaputrawijaya
- Design EquationsUploaded bymurakami27
- AnsiUploaded bywidhisaputrawijaya
- NET-BUploaded bywidhisaputrawijaya
- 8._analisakelayakanekonomi-Anondho_Uploaded byEdo Galisman
- 8._analisakelayakanekonomi-Anondho_Uploaded byEdo Galisman

- WAAS Presentation-Aca VulovicUploaded byRiyad_Yakine_7798
- Sanjeev EkkaluriUploaded byShashank
- Vision and Scope DocumentUploaded byAjay Kumar
- Dicţionar-Macedo-Român de I.DalametraUploaded byIoana Grecu
- Certificates, Certification Authorities and Public-Key InfrastructuresUploaded bysh0101
- imageprograf_pro2000Uploaded byIulian_D
- Odca Paas Interop Um Rev1.0Uploaded bykrt2833
- Synopsis.docxUploaded byMukesh Lal Sah
- Mindtree Sample Technical Placement PaperUploaded byPuli Naveen
- HomeUploaded byPramod Kumar
- Flex i HopperUploaded byRicardo Paul
- Kiva RobotUploaded byKLC12345
- Auditac Ac SystemUploaded bygrimripper
- d4pciUploaded byNavanath Divate
- Mphasis-BFL SoftwareUploaded by476
- RBS Progressive Architectures NewUploaded byamod
- Windows Alt Key CodesUploaded byAsogan Devaraj
- Oracle Workshop 1 SyllabusUploaded byAnonymous RyqwFMMuJM
- FTP LabUploaded byGrendizer69
- IN_NB_CO_MA_SOLUCIONARI_13.pdfUploaded bycomisariobonetti
- Cost Estimate WorkbookUploaded bykbaltimore
- PlatiniumUploaded byFabrice
- PAN OS 6.0 New FeaturesUploaded bySandra Viviana Salazar
- Telescope TechnologyUploaded bylinorusso
- boso_TM2430_PC2___GB_Uploaded byAdriano Coelho
- _TND_147b6c446d0f9c0d6f9a6bc786500862dce26509Uploaded bychandangupta86
- Seminar report on Virtual Laser KeyboardUploaded byAnimesh
- Manual Lantek 01Uploaded byramesh
- LoadRunner-Correlated Queries Chapter 8Uploaded byapi-3738664
- Introduction to Geographic Information Systems for Natural ResourUploaded byGotz Son