[dune-pdelab] Time and solution dependent boundary conditions

conf86 at web.de conf86 at web.de
Sat Jul 11 21:31:43 CEST 2015


Hello,

I already asked about "Initial conditions for instationary problems" which I (hopefully) understood (thanks to Jö Fahlke again which I forgot the last time).

Now I am trying to set both time dependent dirichlet boundary values and dirichlet boundary values that depend on the solution itself. 

I currently have:

 template<typename GV, typename RF>
 class BCExtension : public 
 Dune::PDELab::GridFunctionBase< Dune::PDELab::GridFunctionTraits <GV,RF,1,Dune::FieldVector<RF,1> >, BCExtension<GV,RF> > 
 {
   const GV& gv;
   RF time;
  
  public:
   typedef Dune::PDELab::GridFunctionTraits<GV,RF,1,Dune::FieldVector<RF,1> > Traits;

   //! construct from grid view
   BCExtension (const GV& gv_) : gv(gv_) {}

   //! evaluate extended function on element
   inline void evaluate (const typename Traits::ElementType& e,
                         const typename Traits::DomainType& xlocal,
                         typename Traits::RangeType& y) const
  {
     const int dim = Traits::GridViewType::Grid::dimension;
     typedef typename Traits::GridViewType::Grid::ctype ctype;
     Dune::FieldVector<ctype,dim> x = e.geometry().global(xlocal);

     y = x[0] + x[1]; //initial (t=0) and boundary values (all t) for any given domain
 
   }

    //! get a reference to the grid view
   inline const GV& getGridView () {return gv;}

   void setTime(double t) {time = t;}
 };
 
But I don't know how to access the solution u here.

I have found the setTime() function in some other code, but I didn't fully understand how I can use a time variable now.
Can I simply set e.g. y = x[0]*time + x[1] ? 
Jö Fahlke pointed out that there are some more steps involved, so I guess this is not enough.


Thank you in advance!




More information about the dune-pdelab mailing list