← Back to team overview

dolfin team mailing list archive

pointwise DirichletBC in python

 

I am getting a nasty error trying to use a pointwise DirichletBC in
python.  Basically I'm trying to make a pinpoint for the stokes
equations, code and error follow below.  Thanks for any help anyone
might have.

-- Andy




from dolfin import *

class NoSlipDomain(SubDomain):
    def inside(self, x, on_boundary):
        return on_boundary

class PinPoint(SubDomain):
    def inside(self, x, on_boundary):
        return x[0] < DOLFIN_EPS and x[1] <DOLFIN_EPS

mesh = UnitSquare(8, 8, "crossed");

sub_domains = MeshFunction("uint", mesh, mesh.topology().dim() - 1)
sub_domains.set_all(3)
noslip_domain = NoSlipDomain()
noslip_domain.mark(sub_domains, 0)
pinpoint = PinPoint()
pinpoint.mark(sub_domains, 1)

V = VectorFunctionSpace(mesh, "CG", 2)
Q = FunctionSpace(mesh, "CG", 1)
W = V + Q

noslip = Expression(("x[0] * x[0] * x[1]", "-x[0] * x[1] * x[1]"), V=V)
bc0 = DirichletBC(W.sub(0), noslip, sub_domains, 0)

zero = Constant(mesh, 0.0)
bc1 = DirichletBC(W.sub(1), zero, sub_domains, 1, "pointwise")
bc = [bc0, bc1]

(v, q) = TestFunctions(W)
(u, p) = TrialFunctions(W)
f = Expression(("-2*x[1] + 1.0", "2*x[0] + 1.0"), V=V)
a = (inner(grad(v), grad(u)) - div(v)*p + q*div(u))*dx
L = inner(v, f)*dx

problem = VariationalProblem(a, L, bc)
U = problem.solve()




Solving linear variational problem
  Matrix of size 1235 x 1235 has 35065 nonzero entries.
  Sorting sparsity pattern.
  Applying boundary conditions to linear system.
python: dolfin/fem/DirichletBC.cpp:597: void
dolfin::DirichletBC::compute_bc_pointwise(std::map<unsigned int,
double, std::less<unsigned int>, std::allocator<std::pair<const
unsigned int, double> > >&, dolfin::BoundaryCondition::LocalData&)
const: Assertion `user_sub_domain' failed.
[ketan:24695] *** Process received signal ***
[ketan:24695] Signal: Aborted (6)
[ketan:24695] Signal code:  (-6)
[ketan:24695] [ 0] /lib/libpthread.so.0 [0x7f2daf399a80]
[ketan:24695] [ 1] /lib/libc.so.6(gsignal+0x35) [0x7f2dae9deeb5]
[ketan:24695] [ 2] /lib/libc.so.6(abort+0x183) [0x7f2dae9e03d3]
[ketan:24695] [ 3] /lib/libc.so.6(__assert_fail+0xe9) [0x7f2dae9d7da9]
[ketan:24695] [ 4]
/stage/csrg/aterrel/FEniCS/build/lib/libdolfin.so.0(_ZNK6dolfin11DirichletBC20compute_bc_pointwiseERSt3mapIjdSt4lessIjESaISt4pairIKjdEEERNS_17BoundaryCondition9LocalDataE+0x69a)
[0x7f2daa89b7fa]
[ketan:24695] [ 5]
/stage/csrg/aterrel/FEniCS/build/lib/libdolfin.so.0(_ZNK6dolfin11DirichletBC10compute_bcERSt3mapIjdSt4lessIjESaISt4pairIKjdEEERNS_17BoundaryCondition9LocalDataE+0x10e)
[0x7f2daa89c3de]
[ketan:24695] [ 6]
/stage/csrg/aterrel/FEniCS/build/lib/libdolfin.so.0(_ZNK6dolfin11DirichletBC5applyEPNS_13GenericMatrixEPNS_13GenericVectorEPKS3_+0x89)
[0x7f2daa89c6d9]
[ketan:24695] [ 7]
/stage/csrg/aterrel/FEniCS/build/lib/libdolfin.so.0(_ZN6dolfin18VariationalProblem12solve_linearERNS_8FunctionE+0x894)
[0x7f2daa8bfe94]
[ketan:24695] [ 8]
/stage/csrg/aterrel/FEniCS/build/lib/python2.5/site-packages/dolfin/_cpp.so
[0x7f2dacc9d48c]
[ketan:24695] [ 9] python(PyObject_Call+0x13) [0x418743]
[ketan:24695] [10] python [0x41f5e8]
[ketan:24695] [11] python(PyObject_Call+0x13) [0x418743]
[ketan:24695] [12] python(PyEval_EvalFrameEx+0x3843) [0x48f483]
[ketan:24695] [13] python(PyEval_EvalCodeEx+0x6ad) [0x492b3d]
[ketan:24695] [14] python(PyEval_EvalFrameEx+0x5432) [0x491072]
[ketan:24695] [15] python(PyEval_EvalCodeEx+0x6ad) [0x492b3d]
[ketan:24695] [16] python(PyEval_EvalCode+0x32) [0x492d32]
[ketan:24695] [17] python(PyRun_FileExFlags+0x108) [0x4b2708]
[ketan:24695] [18] python(PyRun_SimpleFileExFlags+0x1ab) [0x4b29ab]
[ketan:24695] [19] python(Py_Main+0xac2) [0x414542]
[ketan:24695] [20] /lib/libc.so.6(__libc_start_main+0xe6) [0x7f2dae9cb1a6]
[ketan:24695] [21] python [0x413989]
[ketan:24695] *** End of error message ***
Aborted