Hi People!
Im a working student and have to port python code, which uses the Fenics 2019 module to fenicsx-dolfinx 0.4.1. i have trouble understanding the code since im relativly new to the FEM-method, but for most of the code i have found the corresponding fenicsx methods. But there is one part of the code, where i cant find corresponding fenicsx functions.
(old fenics code)
BC_Diriclet = PETScMatrix()
assemble(lhs(B_real_vf),tensor=BC_Diriclet)
BC_Diriclet.zero()
for bc in bcs:
bc.apply(BC_Diriclet)
If I understand the old-code correct, there is a petsc-matrix created, which just holds the Boundary conditions
First i have done something like this:
from dolfinx.fem import petsc
BC_Diriclet = petsc.assemble_matrix(fem.form(ufl.lhs(B_real_vf)), bcs=BClist)
But then the matrix still holds the values of the assembly of B_real_vf.
My second idea looks like this:
from dolfinx.fem import petsc
BC_Diriclet = petsc.assemble_matrix(fem.form(ufl.lhs(B_real_vf)))
BC_Diriclet.assemble()
AI, AJ, AV = BC_Diriclet.getValuesCSR()
newValues = np.zeros(AV.shape[0])
BC_Diriclet.setValuesCSR(AI, AJ, newValues)
BC_Diriclet.assemble()
but how can i set the boundary conditions now?
Thank you in advance,
Tobias