Skip to content
Snippets Groups Projects
Select Git revision
  • 2d6f739cda36d735e2e87b50d01d8cfbe7b7ddee
  • master default protected
  • release/1.0
3 results

dg.hh

Blame
  • inhomogeneousbulkproblem.hh 1.67 KiB
    #ifndef __DUNE_MMDG_INHOMOGENEOUSBULKPROBLEM_HH__
    #define __DUNE_MMDG_INHOMOGENEOUSBULKPROBLEM_HH__
    
    #include <dune/mmdg/problems/dgproblem.hh>
    
    template<class Coordinate, class Scalar = double>
    class InhomogeneousBulkProblem : public DGProblem<Coordinate, Scalar>
    {
      public:
        static constexpr int dim = Coordinate::dimension;
        using Base = DGProblem<Coordinate, Scalar>;
        using Matrix = typename Base::Matrix;
    
        //the exact solution at position pos
        //1d: f(x)     = x,
        //2d: f(x,y)   = x*y,
        //3d: f(x,y,z) = x*y*z
        virtual Scalar exactSolution (const Coordinate& pos) const
        {
          return pos * Coordinate(1.0);
        }
    
        //exact solution is implemented
        bool hasExactSolution() const
        {
          return true;
        };
    
        //source term at position pos
        virtual Scalar q (const Coordinate& pos) const
        {
          return pos * Coordinate(2.0);
        }
    
        //permeability tensor at position pos
        virtual Matrix K (const Coordinate& pos) const
        {
          Matrix permeability(0.0);
    
          for (int i = 0; i < dim; i++)
          {
            permeability[i][i] = 1.0 + pos[i] * pos[i];
          }
    
          return permeability;
        }
    
        //returns the recommended quadrature order to compute an integral
        //over x * q(x)
        virtual int quadratureOrder_q () const
        {
          return 10;
        }
    
        //returns the recommended quadrature order to compute an integral
        //over x * boundary(x)
        virtual int quadratureOrderBoundary () const
        {
          return 10;
        }
    
        //returns the recommended quadrature order to compute an integral
        //over an entry K[i][j] of the permeability tensor
        virtual int quadratureOrder_K () const
        {
          return 10;
        }
    };
    
    #endif