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

Wave.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 __WAVE_H
00005 #define __WAVE_H
00006 
00007 #include <dolfin/PDE.h>
00008 
00009 namespace dolfin {
00010   
00011   class Wave : public PDE {
00012   public:
00013     
00014     Wave(Function& source,
00015          Function& uprevious,
00016          Function& wprevious) : PDE(2)
00017     {
00018       add(f,  source);
00019       add(up, uprevious);
00020       add(wp, wprevious);
00021     }
00022     
00023     real lhs(const ShapeFunction& u, const ShapeFunction& v)
00024     {
00025       /*
00026       // dG(0) in time
00027 
00028       return (u*v + k * k *
00029               (grad(u), grad(v))) * dx;
00030       */
00031 
00033       // cG(1) in time
00034       
00035       return
00036         (2 / k * u * v + k / 2 * (grad(u), grad(v))) * dx;
00037         //(2 / k * u * v + k / 2 * (u.ddx() * v.ddx() + u.ddy() * v.ddy())) * dx;
00038       //*/
00039     }
00040     
00041     real rhs(const ShapeFunction& v)
00042     {
00043       /*
00044       // dG(0) in time
00045 
00046       return (k * k * f * v + k * wp * v + up * v) * dx;
00047       */
00048 
00050       // cG(1) in time
00051       
00052       return
00053         (k * f * v +
00054          2 / k * up * v -
00055          //k / 2 * (up.ddx() * v.ddx() + up.ddy() * v.ddy()) +
00056          k / 2 * (grad(up), grad(v)) +
00057          2 * wp * v) * dx;
00058       //*/
00059     }
00060     
00061   private:    
00062 
00063     ElementFunction f;  // Source term
00064     ElementFunction up; // Position value at left end-point
00065     ElementFunction wp; // Velocity value at left end-point
00066 
00067   };
00068 
00069 }
00070 
00071 #endif


Documentation automatically generated with Doxygen on 10 Sep 2004.