![]() |
00001 // Copyright (C) 2002 Johan Hoffman and Anders Logg. 00002 // Licensed under the GNU GPL Version 2. 00003 00004 #ifndef __CONV_DIFF_H 00005 #define __CONV_DIFF_H 00006 00007 #include <dolfin/PDE.h> 00008 00009 namespace dolfin { 00010 00011 class ConvDiff : public PDE { 00012 public: 00013 00014 ConvDiff(Function& source, 00015 Function::Vector& previous, 00016 Function& diffusion, 00017 Function::Vector& convection) : PDE(2), up(1), b(3) 00018 { 00019 add(f, source); 00020 add(up, previous); 00021 add(a, diffusion); 00022 add(b, convection); 00023 } 00024 00025 real lhs(const ShapeFunction& u, const ShapeFunction& v) 00026 { 00027 return (u*v + k*((b,grad(u))*v + a*(grad(u),grad(v)))) * dx; 00028 } 00029 00030 real rhs(const ShapeFunction& v) 00031 { 00032 return (up(0)*v + k*f*v) * dx; 00033 } 00034 00035 private: 00036 ElementFunction f; // Source term 00037 ElementFunction::Vector up; // Function value at left end-point 00038 ElementFunction a; // Diffusivity 00039 ElementFunction::Vector b; // Convection 00040 }; 00041 00042 } 00043 00044 #endif
Documentation automatically generated with Doxygen on 10 Sep 2004.