Dirichlet boundary condition does not work for "pointwise"

Asked by Murtazo Nazarov

The Dirichlet boundary condition does not work if I chose the "pointwise" setting:

In Stokes demo I define my subdomain as:

  class Corner : public SubDomain
  {
  public:
    bool inside(const double* x, bool on_boundary) const
    {
      return on_boundary &&
        (std::abs(x[0] - 1.0) < 0.1 + DOLFIN_EPS ) &&
 (std::abs(x[1] - 1.0) < 0.1 + DOLFIN_EPS);
    }
  };

Then I apply for zero BC for pressure in this subdomain:
  Corner cr;
  Constant zero(2, 0.0);
  DirichletBC bc(W1, zero, cr, "pointwise");
  // DirichletBC bc(W1, zero, cr, "geometric");

However "geometric" and "topological" options it works.

/murtazo

Question information

Language:
English Edit question
Status:
Answered
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Andy R Terrel (andy-terrel) said :
#1

I believe this comes from the fact that the pointwise call always sets on_boundary to be false:

http://bazaar.launchpad.net/~dolfin-core/dolfin/main/annotate/head%3A/dolfin/fem/DirichletBC.cpp#L653

Also this method for a pinpoint will constrain more of the pressure than you want, for better results do:

class Corner : public SubDomain
  {
  public:
    bool inside(const double* x, bool on_boundary) const
    {
      return (std::abs(x[0] - 1.0) < DOLFIN_EPS ) &&
                (std::abs(x[1] - 1.0) < DOLFIN_EPS);
    }
  };

Of course you have to apply this as pointwise because the geometric and topological searches only look at facets and this is only hitting one point.

-- Andy

Revision history for this message
Murtazo Nazarov (murtazo) said :
#2

It seems subdomain marker does not mark vertices, or?

Revision history for this message
Murtazo Nazarov (murtazo) said :
#3

Ok, if you remove on_boundary you might end up to apply BC to the interior points, which is wrong. I agree that for several points you can use "geometrical" or "topological" options, but this should work with "pointwise" as well.

Revision history for this message
Andy R Terrel (andy-terrel) said :
#4

> It seems subdomain marker does not mark vertices, or?

Subdomain markers can mark vertices, but if you use topological or geometrical they only mark facets (so object with topological dimension one less than the mesh). Thus to mark just vertices you could create a submesh then mark the system based on that, or at least you were able to in the past. But the easiest to get going it just to use a pointwise search that will mark all dof that relate.

> Ok, if you remove on_boundary you might end up to apply BC to the interior points, which is wrong. I agree that for several points you can use "geometrical" or "topological" options, but this should work with "pointwise" as well.

The problem is that there is not a separate iteration over the boundary and interior for the pointwise search. I guess that could be the bug, but you are currently able to limit yourself to the points needed with the x coords so you don't have to worry about getting the interior if you define it correctly.

Can you help with this problem?

Provide an answer of your own, or ask Murtazo Nazarov for more information if necessary.

To post a message you must log in.