This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Pointwise Dirichlet in C++

0 votes

Dear all,

I've read this question on how to create a Dirichlet boundary condition. I've tried and failed, but I don't know what I am doing wrong.

The test is simple, I have to clamp a vertex in one direction, or both, and here's my vertex detect class:

class vertexDetect : public SubDomain
{
public:

    vertexDetect(Point p) : p_(p) {}

    bool inside(const Array<double>& x, bool on_boundary) const
    {
        return (p_.distance(x) < GEOMETRIC_TOL);
    }

private:

    Point p_;
};

When setting the BCs, I simply do this:

Constant clamped(0.0, 0.0);

vertexDetect vd(Point(2.0, 0.0));

DirichletBC bcTest(*V, clamped, vd, "pointwise");

std::vector<const DirichletBC*> bcs { &bcRight, &bcTest };

Unfortunately, the domain moves where it shouldn't.

Am I missing something?

Thanks!

asked Feb 8, 2016 by senseiwa FEniCS User (2,620 points)

You need to provide short but complete code.

...