Next: Reduction of Parabolic Equations
Up: Finite Difference Schemes
Previous: Finite Difference Schemes
  Contents
Can have tremendous effect on solution. Choice dictated by physics
and well-posedness.
Numerical approximations to boundary condition's must be done with
great care since they are potentially capable of making an otherwise
stable scheme unstable.
There's usually no difficulty implementing Dirichlet type boundary
conditions: take boundary conditions at
for simplicity:
No problem with periodic boundary condition's: assume other boundary
at
if there are
gridpoints.
What about Neumann? Take
and
as boundaries:
Consider first
and
A first-order
approximation would be
and
.
Using ghost values
and
, a second-order
approximation
One can also use a
-order approximation, the 1-sided
and a similiar expression can be found for the other boundary.
Remarks
- The choice of boundary conditions is dictated by the physics and
mathematical well-posedness.
However, the discrete version depends on numerical stability
considerations. ALWAYS CHECK FOR STABILITY AT ENDPOINTS.
- This is not a theorem, but in general you want to use the same
order of finite difference approximation to the boundary conditions as
you did for the interior points. What happens if you go with lower
order? You defeat the purpose of using a high order scheme. What happens
when you go higher order? In general, you get an ill-poosed linear
algebraic problem.
- Using one-sided derivatives is ok, but these are prone to generate
ill-posed linear algebraic problems if you use mix them. This will be
apparent when you do your stability study at the end points.
Note on Advection-Diffusion Equation (UPWINDING IS IMPORTANT)
We're not considering this important equation, other than by an
example that illustrates one of the important facets that makes this
equation tricky to approximate. We'll take as example the forward-
time/central-space scheme.
There are a couple of things we're going to learn: upwinding, and also
mixing explicit and implicit methods when you have you're solving a
problem of mixed type.
We'll work by example:
|
(140) |
 |
as an approximation to
|
(141) |
take  |
not because its a good algorithm, but because it illustrates the point
to be made very simply:
Scheme (141) is
order accurate and
order
accurate overall because of stability requirement
Note that this restriction is rather severe on the time step, since
getting good resolution in space by making
small might mean really
tiny
, which means long computing times.
Now,
The
is a ratio of the importance of inertial (wave-like or
signal-propagating effects to diffusion effects). So that if
we have a diffusion dominated problem, etc.
Solving for
and taking the absolute value of both sides yields
Since we require that
|
(142) |
 |
for parabolic equation approximations, by setting
we satisfy
(143).
Hence we need to satisfy two conditions
the second is a restriction on mesh spacing and could be very restrictive.
If
is the stability condition, what does
do?
It guarantees that the scheme will behave qualitatively like a
parabolic equation approximation. What you will see if you set
is the appearance of spurious oscillations
they
usually do not grow excessively and they result from inadequate
resolution.
One way to avoid the restriction on mesh-spacing is to use ``upwind
differencing.'' The scheme then is
|
(143) |
 |
or
If
scheme satisfies
(143). This is satisfied if
Oscillations are eliminated but now we have 1-order accuracy in
space. When
small and a large (typical) this condition is much less
restrictive than
. Note, however that (144) can be
written as
Remark
- Note that upwinding direction was given by
. If
, the
derivative would involve
and
values of
instead.
- What if
has different signs for different parts of the domain?
Use a switching in your code to check for upwinding direction and then
change the derivative to the relative upwind direction.
- One way to avoid oscillations due to constraints on the Peclet
number and at the same time get larger time steps for asymptotic
stability is to compute the problem by using an explicit upwind in the
advective term
, which will generate a mild restriction on mesh
spacing
, and then go implicit in the diffusive term
, such as
Crank Nicholson. The resulting code will be quite robust.
Next: Reduction of Parabolic Equations
Up: Finite Difference Schemes
Previous: Finite Difference Schemes
  Contents
Juan Restrepo
2003-05-02