Programmierpraktikum NPDGL I
Funktionen

finite_difference.cc-Dateireferenz

#include "model.hh"
#include "finite_difference.hh"

Funktionen

double solve (Model &model, Grid &grid)
 ode solver for finite_difference example
void main (int argc, char **argv)
 main file of finite_difference.cc

Ausführliche Beschreibung

This file implements a finite difference/finite volume scheme solving the PDE:

\begin{align} \partial_t u(x,t) + \partial_x f(u(x,t)) &= 0 & \text{in }&\Omega\times[0,T] \\ u(x,0) &= u_0(x) &\text{in }&\Omega \\ u(x,t) &= u_{dir}(x,t) &\text{auf }&\Gamma_{in} \times [0,T] \end{align}

Numerical scheme

The numerical scheme is implemented as a finite volume scheme on a numerical 1D grid \({\cal T}_h = \{e_i\}_{i=0}^H\) with grid cells (intervals) \(e_i\) such that \(\cup_{i=0}^H {\bar e}_i = \Omega:= [a,b]\).

A finite volume discrete function in space \(u_h:\Omega \to \mathbb{R}\) is then given by

\[ u_h(x) = \sum_{i=0}^H U_i \chi_{e_i}(x) \]

with indicator functions \(\chi_{e_i}\) which are one on grid cells and zero otherwise, and a Dof vector \(U:= \{U_i\}_{i=0}^H \in \mathbb{R}^H\).

For the numerical scheme we consider three steps:

  1. the projection of the initial data function \(u_0\):

    \[ u_h^0 = {\cal P}_h[u_0] \]

  2. the discretization in space ( \( \partial_x f(u(x,t)) \)) by a discrete space operator \( {\cal L}_h \)

    \[ {\cal L}_h[u_h] \approx \partial_x f(u_h) \]

    and
  3. the time evolution (discretization in the time domain) by an Euler scheme

    \[ u_h^{k+1} = u_h^{k} + \Delta t^k {\cal L}_h[u_h^k] \]

    .
Initial data projection:
This is realized by the class InitialProjection
Discretization in Space:
This is realized by the class DiscreteSpaceOperator
Time evolution
This is realized by the solve() function in this file.

Dokumentation der Funktionen

void main ( int  argc,
char **  argv 
)

main file of finite_difference.cc

Usage: ./finite_difference a b N

Beispiele:
test_projection.cc und test_spaceoperator.cc.