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

WaveVector.h

Go to the documentation of this file.
00001 // Copyright (C) 2003 Johan Jansson.
00002 // Licensed under the GNU GPL Version 2.
00003 
00004 #ifndef __WAVEVECTOR_H
00005 #define __WAVEVECTOR_H
00006 
00007 #include <dolfin/PDE.h>
00008 
00009 namespace dolfin {
00010   
00011   class WaveVector : public PDE {
00012   public:
00013     
00014     WaveVector(Function::Vector& source,
00015                Function::Vector& uprevious,
00016                Function::Vector& wprevious) :
00017       PDE(2, 2), f(2), up(2), wp(2)
00018     {
00019       add(f,  source);
00020       add(up, uprevious);
00021       add(wp, wprevious);
00022     }
00023     
00024     real lhs(ShapeFunction::Vector& u, ShapeFunction::Vector& v)
00025     {
00026       return
00027         (1 / k * u(0) * v(0) + k *
00028          (u(0).ddx() * v(0).ddx() + u(0).ddy() * v(0).ddy())) * dx +
00029         (1 / k * u(1) * v(1) + k *
00030          (u(1).ddx() * v(1).ddx() + u(1).ddy() * v(1).ddy())) * dx;
00031     }
00032     
00033     real rhs(ShapeFunction::Vector& v)
00034     {
00035         return
00036           (k * f(0) * v(0) + wp(0) * v(0) + 1 / k * up(0) * v(0)) * dx +
00037           (k * f(1) * v(1) + wp(1) * v(1) + 1 / k * up(1) * v(1)) * dx;
00038     }
00039     
00040   private:
00041 
00042     ElementFunction::Vector f;  // Source term
00043     ElementFunction::Vector up; // Position value at left end-point
00044     ElementFunction::Vector wp; // Velocity value at left end-point
00045 
00046   };
00047 
00048 }
00049 
00050 #endif


Documentation automatically generated with Doxygen on 10 Sep 2004.