~njansson/dolfin/hpc

« back to all changes in this revision

Viewing changes to demo/ode/stiff/TestProblem6.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) 2004-2006 Anders Logg.
 
2
// Licensed under the GNU LGPL Version 2.1.
 
3
//
 
4
// First added:  2004
 
5
// Last changed: 2006-08-21
 
6
 
 
7
#include <cmath>
 
8
#include <dolfin.h>
 
9
 
 
10
using namespace dolfin;
 
11
 
 
12
class TestProblem6 : public ODE
 
13
{
 
14
public:
 
15
  
 
16
  TestProblem6() : ODE(2, 100.0)
 
17
  {
 
18
    message("Van der Pol's equation.");
 
19
 
 
20
    mu = 10.0;
 
21
  }
 
22
 
 
23
  void u0(uBlasVector& u)
 
24
  {
 
25
    u(0) = 2.0;
 
26
    u(1) = 0.0;
 
27
  }
 
28
 
 
29
  void f(const uBlasVector& u, real t, uBlasVector& y)
 
30
  {
 
31
    y(0) = u(1);
 
32
    y(1) = mu*(1.0 - u(0)*u(0))*u(1) - u(0);
 
33
  }
 
34
 
 
35
private:
 
36
 
 
37
  real mu;
 
38
 
 
39
};