Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

TestProblem8.h

Go to the documentation of this file.
00001 // Copyright (C) 2003 Johan Jansson.
00002 // Licensed under the GNU GPL Version 2.
00003 //
00004 // Modified by Anders Logg 2003, 2004.
00005 
00006 #include <dolfin.h>
00007 
00008 using namespace dolfin;
00009 
00010 class TestProblem8 : public ODE
00011 {
00012 public:
00013   
00014   TestProblem8() : ODE(3)
00015   {
00016     dolfin_info("System of fast and slow chemical reactions, taken from the book by");
00017     dolfin_info("Hairer and Wanner, page 3.");
00018 
00019     // Final time
00020     T = 0.3;
00021 
00022     // Compute sparsity
00023     sparse();
00024   }
00025 
00026   real u0(unsigned int i)
00027   {
00028     if ( i == 0 )
00029       return 1.0;
00030     else
00031       return 0.0;
00032   }
00033   
00034   real f(const Vector& u, real t, unsigned int i)
00035   {
00036     //if ( i == 1 )
00037     // dolfin_info("t = %.16e u = [%.16e %.16e %.16e]", t, u(0), u(1), u(2));
00038 
00039     if ( i == 0 )
00040       return -0.04 * u(0) + 1.0e4 * u(1) * u(2);
00041     
00042     if ( i == 1 )
00043       return 0.04 * u(0) - 1.0e4 * u(1) * u(2) - 3.0e7 * u(1) * u(1);
00044     
00045     return 3.0e7 * u(1) * u(1);
00046   }
00047   
00048 };


Documentation automatically generated with Doxygen on 10 Sep 2004.