compare_ritz_to_galerkin.pdf
TRANSCRIPT
-
8/11/2019 compare_ritz_to_galerkin.pdf
1/7
Equivalence of finite element solution using Rayleigh Ritz method and Galerkinmethod for finding axial deformation of a simple cantilever beam, and on how todetermine if the approximate solution found is an exact solution.
by Nasser M. Abbasi
Student, Engineering Mechanics dept.
University of Wisconsin, Madison
oct 16, 2009
Abstract
Using a simple problem, it is shown that, using a global trial function, the Rayleigh Ritz variational
method and the Galerkin method give the same solution. These solutions are compared to the
exact solution. It is found that one can determine that the exact solution was reached by
increasing the order of the trial function polynomial until the solution returned by Rayleigh Ritz or
Galerkin method no longer changes.
The problem
A cantilever beam is loaded with traction load of q =c x (for some constant c). It is fixed on the left side. We need to
find axial deformation u (x)
Solving using variational Ritz method
Set up the potential energy pand Minimize it
p
0L 1
2A E
du
dx2
x
0Lqu
x
x
where u (x) is the trial function . The trial function needs to satisfy only the essential conditions, which in this prob-
lem is given as u (0) =0, so we start by assuming a trial function ux.ux a0 a1x a2x2
Since u0 0 , we find that a0 0 henceu a1x a2x
2
-
8/11/2019 compare_ritz_to_galerkin.pdf
2/7
This trial function has 2 degrees of freedom they are called the generalized degrees of freedom. The trial function
could have been selected to have only one degree of freedom i.e. ux a1 xand this would also have worked but 2degrees of freedom will give more accurate solution.
Start by defining the trial function
Remove"Global`"u Sumaix^i,i, 0, 2a0 x a1 x
2 a2
Make the trial function satisfy essential boundary condition
sol First Solveu. x 0 0, a0a0 0
u u. solx a1 x
2 a2
Set up the potential energy functional
0
L 1
2A x u2 x
0
L
c x u x
1
3
c L3 a1 1
2
A L a12
1
4
c L4 a2 A L2
a1a2 2
3
A L3 a22
Solveford
dai 0fori 1, 2inordertosolvefora1anda2
eq1 a1 0
c L3
3A L a1 A L
2a2 0
eq2 a2 0
c L4
4A L2 a1
4
3A L3 a2 0
sol First Solveeq1, eq2,a1, a2
a1 7 c L2
12 A , a2
c L
4 A
Nowthatwefounda1anda2wehavefoundoursolution
2 compare_ritz_to_galerkin.nb
Printed by Mathematica for Students
-
8/11/2019 compare_ritz_to_galerkin.pdf
3/7
solutionByRitzMethod u. 7 c L2 x
12 A
c L x2
4 A
Solving the problem using Galerkin method
In this method, we start with the differential equation itself and integrate it with a test function we call gx. Thedifferential equation for axial deformation with traction load qxis A E d2 u
dx2 qx, hence our starting point is to
solve the integral equation
I 0
L
AEd2 u
dx2 q g(x) x 0
We start by assuming a trial functionu a0 a1 x a2 x2. Now due to u0 0 we find thata0 0, hence
u a1 x a2 x2Next, we do integration by parts the above integral and obtain
I gx AE dudx
0
L
0
L
AEdu
dx q
dg(x)
dxx
0
L
q gx dx
But
gx AE dudx
0
L
gL AE duL dx
g0 AE du0dx
and now since a test function must also satisfy the essential conditions, henceg0 0 and also the trial functionsatisfies the natural boundary conditions at x L which is that there is no load at that point, hence this means
A Edu dx 0 since this is the load at the end. Hence the integral becomes
I 0
L
AEdu
dx q
dg(x)
dxx
0
L
q gx dx 0
We now pick the test function g(x). In Galerkin method, gix dudai hence g1x duda1 xand g2x duda2 x2so nowwe set up the 2 equations and solve for a1anda2
u x a1 x2 a2;
g1 x;
g2 x2;
q c x;
compare_ritz_to_galerkin.nb 3
Printed by Mathematica for Students
-
8/11/2019 compare_ritz_to_galerkin.pdf
4/7
-
8/11/2019 compare_ritz_to_galerkin.pdf
5/7
Compare the above solution to the one found above, we see that the approximate solution is
u 7cL2x
12A
cL x2
4A
while the exact solution is
uexactcL 2x
2A
cx3
6A
here is a plot of both solutions. AssumeA 1, c 1, E 1 andL , we obtain
Needs"PlotLegends`"
c 1; 1; L 1; A 1;
PlotsolutionExact, solutionByRitzMethod,x, 0, L, PlotStyle Red, Blue,PlotLegend
"exact", "FEM"
, LegendPosition
2, .4
0.2 0.4 0.6 0.8 1.0
0.05
0.10
0.15
0.20
0.25
0.30
FEM
exact
How can we improve the FEM solution, can we make it match the exact solution?
Make the trial function a polynomial of higher order. T ry
u a0 a1x a2x2 a3x
3
and repeat Ritz method. Instead of making the same steps as above, let us write a function which accepts a trial func-
tion uxand returns back the solution. Find define the function
findSolutionByRitzMethod u_, x_ : Moduleeqs, coeffVar, ,ClearA, , c, L;coeffVar FlattenNormalCoefficientArraysu, x;coeffVar SelectcoeffVar, UnsameQ, 0 &;
0
L 1
2ADu, x2 x
0
L
c x u x;
eqs TableD, coeffVari 0,i, 1, LengthcoeffVar;First Solveeqs, coeffVar
Now we can call the above function for the trial function shown above to dtermine the values of theai'
compare_ritz_to_galerkin.nb 5
Printed by Mathematica for Students
-
8/11/2019 compare_ritz_to_galerkin.pdf
6/7
-
8/11/2019 compare_ritz_to_galerkin.pdf
7/7
We see from the above that as more terms added to the trial function, after the cubic polynomial, the solution no
longer changes. This implies, at least in this example, that the exact solution was reached. (Need to find a formal
proof of this).
compare_ritz_to_galerkin.nb 7
Printed by Mathematica for Students