~njansson/dolfin/hpc

« back to all changes in this revision

Viewing changes to src/demo/ode/stiff/TestProblem9.h

  • Committer: Johannes Ring
  • Date: 2008-03-05 22:43:06 UTC
  • Revision ID: johannr@simula.no-20080305224306-2npsdyhfdpl2esji
The BIG commit!

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Copyright (C) 2003-2006 Anders Logg.
2
 
// Licensed under the GNU LGPL Version 2.1.
3
 
//
4
 
// First added:  2003
5
 
// Last changed: 2006-08-21
6
 
 
7
 
#include <dolfin.h>
8
 
 
9
 
using namespace dolfin;
10
 
 
11
 
class TestProblem9 : public ODE
12
 
{
13
 
public:
14
 
  
15
 
  TestProblem9() : ODE(3, 30.0)
16
 
  {
17
 
    message("A mixed stiff/nonstiff test problem.");
18
 
 
19
 
    lambda = 1000.0;
20
 
  }
21
 
 
22
 
  void u0(uBlasVector& u)
23
 
  {
24
 
    u(0) = 0.0;
25
 
    u(1) = 1.0;
26
 
    u(2) = 1.0;
27
 
  }
28
 
  
29
 
  void f(const uBlasVector& u, real t, uBlasVector& y)
30
 
  {
31
 
    y(0) = u(1);
32
 
    y(1) = -(1.0 - u(2))*u(0);
33
 
    y(2) = -lambda * (u(0)*u(0) + u(1)*u(1)) * u(2);
34
 
  }
35
 
 
36
 
private:
37
 
 
38
 
  real lambda;
39
 
 
40
 
};