Hi,

I seem to have a problem with "manually" applying boundary 
conditions to the system of linear equations. In particular, 
I get the following error

    Traceback (most recent call last):
      File "testbc.py", line 38, in ?
        bc.apply(A, b, a)
      File
 
"/home/meg/src/dolfin/dolfin/local/lib/python2.4/site-packages/dolfin/dolfin.py",
    line 5742, in apply
        return _dolfin.DirichletBC_apply(*args)
    NotImplementedError: Wrong number of arguments for 
overloaded
    function 'DirichletBC_apply'.
      Possible C/C++ prototypes are:
        apply(dolfin::GenericMatrix &,dolfin::GenericVector
    &,dolfin::Form const &)
        apply(dolfin::GenericMatrix &,dolfin::GenericVector 
&,ufc::form
    const &)
        apply(dolfin::GenericMatrix &,dolfin::GenericVector
    &,dolfin::GenericVector const &,dolfin::Form const &)
        apply(dolfin::GenericMatrix &,dolfin::GenericVector
    &,dolfin::GenericVector const &,ufc::form const &)

with the following code

    from dolfin import *

    class Zero(Function):
        def __init__(self, element, mesh):
            Function.__init__(self, element, mesh)
        def eval(self, values, x):
            values[0] = 0.0

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

    def Mass(element, f):
        v = TestFunction(element)
        u = TrialFunction(element)
        a = v*u*dx
        L = v*f*dx
        return [a, L]

    # The element space
    element = FiniteElement("Lagrange", "triangle", 1)

    # The mesh, boundary and boundary conditions
    mesh = UnitSquare(2,2)
    boundary = DirichletBoundary()
    zero = Zero(element, mesh)
    bc = DirichletBC(zero, mesh, boundary)

    # Construct and assemble the forms
    [a, L] = Mass(element, zero)
    A = assemble(a, mesh)
    b = assemble(L, mesh)

    # Try applying boundary conditions:
    bc.apply(A, b, a)


Am I missing something obvious here?


In addition, if I try just using

    zero = Function(mesh, 0.0)

in the above, I get the following error from ffc. However, I 
guess that I could just have a look at that when I find some 
time myself...

    Traceback (most recent call last):
      File "testbc.py", line 33, in ?
        [a, L] = Mass(element, zero)
      File "testbc.py", line 18, in Mass
        L = v*f*dx
      File
 
"/home/meg/src/ffc/ffc_current/src/ffc/compiler/language/algebra.py",
    line 77, in __mul__
        return Form(self) * other
      File
 
"/home/meg/src/ffc/ffc_current/src/ffc/compiler/language/algebra.py",
    line 631, in __mul__
        w.monomials = [p*other for p in self.monomials]
      File
 
"/home/meg/src/ffc/ffc_current/src/ffc/compiler/language/algebra.py",
    line 446, in __mul__
        w1 = Monomial(other)
      File
 
"/home/meg/src/ffc/ffc_current/src/ffc/compiler/language/algebra.py",
    line 405, in __init__
        self.coefficients = [Coefficient(other, index)]
      File
 
"/home/meg/src/ffc/ffc_current/src/ffc/compiler/language/tokens.py",
    line 53, in __init__
        self.n0 = Index(function.n0)
      File
 
"/home/meg/src/dolfin/dolfin/local/lib/python2.4/site-packages/dolfin/dolfin.py",
    line 2733, in <lambda>
        __getattr__ = lambda self, name: _swig_getattr(self,
    cpp_Function, name)
      File
 
"/home/meg/src/dolfin/dolfin/local/lib/python2.4/site-packages/dolfin/dolfin.py",
    line 34, in _swig_getattr
        raise AttributeError,name
    AttributeError: n0



Thanks!

-- 
Marie E. Rognes
Ph.D Fellow,
Centre of Mathematics for Applications,
University of Oslo
http://folk.uio.no/meg


_______________________________________________
DOLFIN-dev mailing list
[email protected]
http://www.fenics.org/mailman/listinfo/dolfin-dev

Reply via email to