Anda di halaman 1dari 18

1

Intro to Finite Element


Modeling & COMSOL
(a mini-course)
CEE-268, Winter 2006
By Michael Cardiff
2
What is a model?
Straight from the OED:

a system or thing used as an example to
follow or imitate - a simplified description,
especially a mathematical one, of a system or
process, to assist calculations and
predictions.
3
What is a numerical model?
A model which estimates the solution to a hard
problem (usually a set of PDEs) through
numerical approximations.
A finite-difference example
2
2
2
=
c
c
x
y
0 ) 1 (
0 ) 0 (
=
=
y
y
x = 0
y = 0
x = 1
y = 0
?
Analytical Solution:
1. Integrate the
expression using
calculus tricks

2. Plug in BCs to get
values for integration
constants
A finite-difference example
2 ) ( ' '
2
1 2 3 5 . 1 5 . 2
) (
2 ) ( ' ) ( '
2
= ~ ~
A
+
A

x
y y y
x
x y x y
x y
x
y y
x y
A

~
1 2
) ( '
5 . 1 x
y y
x y
A

~
2 3
) ( '
5 . 2
x
4
x
0
x
1
x
2
x
3

x A
?
Numerical Solution:
1. Approximate
derivatives using
numerical tricks

2. Write all equations into
a single matrix and
solve.
A finite-difference example
0 ) (
0 ) (
) ( 2 2
... 1
1 1
0 0
2
1 1
= =
= =
A = +
=
+ +
+
n n
i i i
x y y
x y y
x y y y
n i f or
(
(
(
(
(
(

A
A
A
A
=
(
(
(
(
(
(

(
(
(
(
(
(

2
2
2
2
1
2
1
) ( 2
) ( 2
...
) ( 2
) ( 2
...
2 1
1 2 1
. . .
1 2 1
1 2
x
x
x
x
y
y
y
y
n
n
7
When should we use numerical
methods?
Necessary Assumptions for the methods we
have studied so far:

2-D problems, in plan view generally
Horizontal-only flow (Dupuit-Forchheimer
assumption)
Isotropic, homogeneous domain
Steady-state conditions (no change in time)
Darcys law applies in the full domain

8
When should we use numerical
methods?

To get approximate solutions to problems that
cannot be solved analytically, for example:
o Problems with complicated geometries and/or boundaries
o Problems with difficult to solve PDEs

To test the applicability of a simple rule under a
variety of conditions (for example, the Ghyben-
Herzberg relation)

To verify the correctness of an analytical solution
9
Issues to Remember
It may take a long time to get your
solution (or you may get a lack of
convergence!)
When/if you get a solution, it is only an
approximate solution.
The solutions may be highly dependent
on the data you give to COMSOL
(anisotropy, heterogeneity, etc)
Your data has errors.
10
COMSOL
Based on the Finite Element (FE) Method

(+) FE can handle complex geometries and boundary
conditions with ease. FD is basically restricted to
rectangular shapes.

(+) FD only tries to minimize error at discrete points, whereas
FE tries to minimize the error over the entire element (line
segments in 1-D, triangles in 2-D)

() The mathematics behind FE are more involved than FD.
11
COMSOL
COMSOL
Geometry (CAD)
PDE Definition
Discretization
PDE Solution
Post-Processing
12
COMSOL Geometry
Two options:
Simple UI for 1-D, 2-D,
and 3-D
Points, lines, planes,
circles, etc.
Object mathematics,
scaling, rotation,
reflection
Extrusion / Revolving
in 3-D
Import from standard
CAD software
VRML, dxf

13
COMSOL PDE Definition
Pre-defined
physical PDEs
(coupled
through multi-
physics)

OR

General PDE
solution mode
14
COMSOL PDE Definition
Define parameter values within
each shape (subdomain)
Hydraulic conductivity in
aquifer

Define boundary conditions
Head at specified boundary

Define known values at points
Known extraction rate at
point-source well

Couple physics as necessary
Solute transport
(advection/diffusion equation)
coupled to fluid velocity
(Darcys Law or N-S equations)

15
COMSOL Discretization
Automatic Meshing Options:

Element shape
(triangular, square)

Element type (Linear,
Quadratic, Cubic)

Mesh parameters (rate of
element growth, mesh
size sensitivity)

Advanced: moving
meshes / automatic
refinement
16
COMSOL PDE Solving
Options:

Transient (time
dependent) or Stationary
(steady state) solving

Great assortment of FE
algorithms
UMFPACK, GMRES,
Multi-grid, Conjugate
Gradient

Can solve individual parts
of problems, store
solutions, or iterate
17
COMSOL Post-Processing
For any given physics, many
variables will be output
Example: Darcys law will
have head, velocity,
pressure as output

Variety of standard
visualizations:
Surface, contour,
streamline, arrow, and
animated plots

Further analysis:
Subdomain / boundary
integration
Cross-sectional plots
18
COMSOL
Compared with other methods of modeling:

(+) Relatively easy to use graphical interface

(+) Uses state-of-the-art solvers and optimizers. Runs well on a
suitably-equipped (lots of RAM) desktop PC.

() Lots of default options / hidden parameters

() Interface changes based on what type of physics you are
solving for. Multiphysics gets even more cumbersome.