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

TestProblem7.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 TestProblem7 : public ODE
00009 {
00010 public:
00011   
00012   TestProblem7() : ODE(101)
00013   {
00014     // Mesh size
00015     h = 1.0 / (static_cast<real>(N) - 1);
00016 
00017     // Final time
00018     T = 1.0;
00019 
00020     dolfin_info("The heat equation on [0,1] with h = %f", h);
00021     
00022     // Compute sparsity
00023     sparse();
00024   }
00025   
00026   real u0(unsigned int i)
00027   {
00028     return 0.0;
00029   }
00030 
00031   real f(const Vector& u, real t, unsigned int i)
00032   {
00033     // Boundary values
00034     if ( i == 0 || i == (N-1) )
00035       return 0.0;
00036     
00037     // Heat source
00038     real source = 0.0;
00039     if ( i == N/2 )
00040       source = 100.0;
00041 
00042     return (u(i-1) - 2.0*u(i) + u(i+1)) / (h*h) + source;
00043   }
00044   
00045 private:
00046   
00047   real h;
00048 
00049 };


Documentation automatically generated with Doxygen on 10 Sep 2004.