[dune-pdelab] Dirichlet conditions on curved boundaries

conf86 at web.de conf86 at web.de
Thu Jun 4 12:11:36 CEST 2015


> This only determines the value of the dirichlet boundary condition, but is
> does not determine whether there is actually a dirichlet boundary condition at
> this point.  That happens in example02_bctype.hh:
> 
> ======================================================================
> class BCTypeParam
>   : public Dune::PDELab::DirichletConstraintsParameters
> {
> public:
>   //! Test whether boundary is Dirichlet-constrained
>   template<typename I>
>   bool isDirichlet(const I & intersection,
>                    const Dune::FieldVector<typename I::ctype, I::dimension-1> & coord
>                    ) const
>   {
>     Dune::FieldVector<typename I::ctype, I::dimension>
>       xg = intersection.geometry().global( coord );
> 
>     if( xg[0]>1.0-1E-6 )
>       return false; // no Dirichlet b.c. on the eastern boundary
> 
>     return true;  // Dirichlet b.c. on all other boundaries
>   }
> 
> };
> ======================================================================
> (Note that this code excerpt is from oktober last year, It is probably very
> close to the latest version but I'm in a train and can't fetch the latest
> revision)
> 
> So in the case of a unit circle, this will set the BCType to dirichlet only on
> one point at (x,y)=(1,0).

Thank you for your answer. I think I got this right.
In the case of only Dirichlet, I would simply return true. 
And if I wanted one half of the circle (x<0) to be Neumann I would write
 if (xg[0]<-1E-6) return false 

So, I don't have to specify exactly where the boundary is?




More information about the dune-pdelab mailing list