Hi everyone! I am following the beam example using PETSc interface for solving a deflection of a beam posted here:
I am using FenicsX v0.9 and I am encountering a problem in the following lines from the example:
g = dolfinx.fem.Function(V)
g.x.array[:] = 0
dolfinx.fem.set_bc(g.x.array, bcs)
g.x.scatter_forward()
L_lifted = L - ufl.action(a, g)
I am getting the following error:
TypeError: set(): incompatible function arguments. The following argument types are supported:1. set(self, b: ndarray[dtype=float64, shape=(), order=‘C’], x0: ndarray[dtype=float64, writable=False, shape=(), order=‘C’] | None, alpha: float) → None
Invoked with types: dolfinx.cpp.fem.DirichletBC_float64, ndarray, NoneType, int
Additionally, when I started to investigate a little about this error, it seems that dolfinx.fem.set_bc() is deprecated and it is recommended to use dolfinx.fem.DirichletBC class instead. Would someone please guide me to find a work around to this issue?
Hi Stein, thanks for the quick response and apologies for gaving such a minimal description of my set-up. I’m running FenicsX v0.9.0 installed on Ubuntu 22.04 via conda. In what follows, I expand on my packages set-up:
It seems that these packages are newer comparing with those you pointed previously. Could it be a change of interphase between numpy or petsc4py versions?
Many thanks for taking the time for reviewing this and helping to understand what would be the problem.