[dune-pdelab] Dirichlet conditions on curved boundaries

Jö Fahlke jorrit at jorrit.de
Mon Jun 8 15:20:50 CEST 2015


Am Thu,  4. Jun 2015, 12:11:36 +0200 schrieb conf86 at web.de:
> Date: Thu, 4 Jun 2015 12:11:36 +0200
> From: conf86 at web.de
> To: dune-pdelab at dune-project.org
> Subject: Re: [dune-pdelab] Dirichlet conditions on curved boundaries
> 
> > 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?

Yes, is is not necessary to restrict your function to the boundary.  It will
only ever be called on the boundary (within limits of the roundoff errors, of
course), so it does not matter what it returns anywhere else.

Regards,
Jö.

-- 
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 is the first age that's paid much attention to the future, which
is a little ironic since we may not have one.
-- Arthur C Clarke
-------------- 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/20150608/eb3451ed/attachment.sig>


More information about the dune-pdelab mailing list