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

TestProblem9.h

Go to the documentation of this file.
00001 // Copyright (C) 2003 Johan Hoffman and Anders Logg.
00002 // Licensed under the GNU GPL Version 2.
00003 
00004 #include <dolfin.h>
00005 
00006 using namespace dolfin;
00007 
00008 class TestProblem9 : public ODE
00009 {
00010 public:
00011   
00012   TestProblem9() : ODE(3)
00013   {
00014     dolfin_info("A mixed stiff/nonstiff test problem.");
00015 
00016     // Parameters
00017     lambda = 1000.0;
00018 
00019     // Final time
00020     T = 30.0;
00021 
00022     // Compute sparsity
00023     sparse();
00024   }
00025 
00026   real u0(unsigned int i)
00027   {
00028     if ( i == 0 )
00029       return 0.0;
00030 
00031     if ( i == 1 )
00032       return 1.0;
00033 
00034     return 1.0;
00035   }
00036 
00037   real f(const Vector& u, real t, unsigned int i)
00038   {
00039     if ( i == 0 )
00040       return u(1);
00041 
00042     if ( i == 1 )
00043       return -(1.0-u(2))*u(0);
00044 
00045     return -lambda * (u(0)*u(0) + u(1)*u(1)) * u(2);
00046   }
00047 
00048   Element::Type method(unsigned int i)
00049   {
00050     if ( i == 2 )
00051       return Element::dg;
00052     
00053     return Element::cg;
00054   }
00055 
00056   unsigned int order(unsigned int i)
00057   {
00058     if ( i == 2 )
00059       return 0;
00060     
00061     return 1;
00062   }
00063 
00064 private:
00065 
00066   real lambda;
00067 
00068 };


Documentation automatically generated with Doxygen on 10 Sep 2004.