[dune-pdelab] Dirichlet conditions on curved boundaries

Jö Fahlke jorrit at jorrit.de
Wed Jun 3 19:16:30 CEST 2015


Am Tue,  2. Jun 2015, 19:13:37 +0200 schrieb conf86 at web.de:
> Date: Tue, 2 Jun 2015 19:13:37 +0200
> From: conf86 at web.de
> To: dune-pdelab at dune-project.org
> Subject: [dune-pdelab] Dirichlet conditions on curved boundaries
> 
> Hi,
> 
> I have the unit circle as domain, now I am trying to define dirichlet boundary conditions (e.g. u=1.0) for it.
> I am currently using a modified version of example02_bcextension.hh from the course-examples in dune-pdelab-howto.
> 
> I was first thinking of something like this in bcextension.h: 
> 
>  inline void evaluate (const typename Traits::ElementType& e, const typename Traits::DomainType& xlocal, typename Traits::RangeType& y)
>  {
>   const int dim = Traits::GridViewType::Grid::dimension;
>   typedef typename Traits::GridViewType::Grid::ctype ctype;
>   Dune::FieldVector<ctype,dim> x = e.geometry().global(xlocal);
> 
>   if (abs(x[0]*x[0]+x[1]*x[1]-1.0)<1e-2) y = 1.0;
>  }

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).

Regards,
Jö.

> The code does compile and everything, but the result is unaffected from this boundary condition.
> 
> Is there better way to implement this, especially when using a boundary with unknown parametrization?
> In the main DUNE-Mailing list I got the hint to use IntersectionIterator, but I have no idea how that would work with PDELab.
> 
> 
> Thank you in advance!
> 
> _______________________________________________
> dune-pdelab mailing list
> dune-pdelab at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-pdelab
> 

-- 
Jorrit (Jö) Fahlke, Institute for Computational und Applied Mathematics,
University of Münster, Orleans-Ring 10, D-48149 Münster
Tel: +49 251 83 35146 Fax: +49 251 83 32729

This message is protected by DoubleROT13 encryption
Attempting to decode it violates the DMCA/WIPO acts
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 811 bytes
Desc: Digital signature
URL: <https://lists.dune-project.org/pipermail/dune-pdelab/attachments/20150603/06b18c17/attachment.sig>


More information about the dune-pdelab mailing list