AttributeError: ‘list’ object has no attribute ‘_cpp_object’

Hello, I was trying to follow the tutorial and implemented code as my problem


I described about boundary condition on this link Boundary condition on 2D square mesh

#Generating Mesh
from mpi4py import MPI
from dolfinx import mesh
from dolfinx import *
domain = mesh.create_unit_square(MPI.COMM_WORLD, 100, 100, mesh.CellType.quadrilateral)

#RD
#Defining The Finnite Elemnet Function Space
from dolfinx.fem import FunctionSpace
U = FunctionSpace(domain, ("Lagrange", 1))

from dolfinx import fem
uD = fem.Function(U)
uD.interpolate(lambda c: (D0*eps**eta)*c[0])

#boundary condition 
def left(c):
    return np.isclose(c[0], 1)
def right(c):
    return np.isclose(c[0], 0)
def top(c):
    return np.isclose(c[1], 0)
def bottom(c):
    return np.isclose(c[1], 0)

fdim = domain.topology.dim - 1

left_facets = dolfinx.mesh.locate_entities_boundary(domain, fdim, left)
right_facets = dolfinx.mesh.locate_entities_boundary(domain, fdim, right)
top_facets = dolfinx.mesh.locate_entities_boundary(domain, fdim, top)
bottom_facets = dolfinx.mesh.locate_entities_boundary(domain, fdim, bottom)

with uD.vector.localForm() as loc:
    loc.set(0.0)

bc1 = fem.dirichletbc(uD, dolfinx.fem.locate_dofs_topological(U, fdim, left_facets))
bc2 = fem.dirichletbc(uD, dolfinx.fem.locate_dofs_topological(U, fdim, right_facets))
bc3 = fem.dirichletbc(uD, dolfinx.fem.locate_dofs_topological(U, fdim, top_facets))
bc4 = fem.dirichletbc(uD, dolfinx.fem.locate_dofs_topological(U, fdim, bottom_facets))

bc = [bc1, bc2, bc3, bc4]

#Defining the trial and test function
import ufl
u = ufl.TrialFunction(U)
uu = ufl.TestFunction(U)

#Defining the source term
from petsc4py import PETSc
default_scalar_type = PETSc.ScalarType

f = fem.Function(U)
f.interpolate(lambda c: -(k0*(1-eps)**gamma)*c[0])

#Defining the variational problem
ua = ufl.inner(ufl.grad(u), ufl.grad(uu)) * ufl.dx
uL = ufl.inner(f,uu)*ufl.dx

#Forming and solving the linear system
from dolfinx.fem.petsc import LinearProblem

problem = fem.petsc.LinearProblem(ua, uL, bcs=[bc], petsc_options={"ksp_type": "preonly", "pc_type": "lu"})
uh = problem.solve()

I want to solve concentration value (c) but it gives error at the final line of code “uh = problem.solve()”
AttributeError: ‘list’ object has no attribute ‘_cpp_object’

i’ve been stuck with this error, Could someone help me.

Change this to bcs=bc

it worked :laughing:, thank you for your helping