Hi FEniCS users,
I have a system of two PDEs which I want to discretize, and then port the relevant matrices to another solution platform. I have so far used assemble_system with success. These are Maxwell's equations in an electromagnetic geophysics application. In the weak form, I have an integral over the inner product of a test function belonging to the Nedelec 1st kind H(curl) space (TA), and the gradient of a trial function belonging to a single degree nodal Galerkin space. I don't quite know how to implement strong Dirichlet BC (homogeneous in this case) to the matrix that represents this particular form.
I am working on the following code; which has 4 assemble_system statements, and I don't know how to apply the boundary conditions in the 3rd usage (which is currently commented out).
parameters["linear_algebra_backend"] = "PETSc";
mesh = UnitCubeMesh(5,5,5)
mesh = refine(mesh)
VN = FunctionSpace(mesh, "Nedelec 1st kind H(curl)", 1)
VG = FunctionSpace(mesh, "Lagrange", 1)
A = TrialFunction(VN)
phi = TrialFunction(VG)
TA = TestFunction(VN)
Tphi = TestFunction(VG)
om = 1e-4
mu = 1
si = 1
ep = 1
zero = Constant((0.0,0.0,0.0))
BCN = DirichletBC(VN,zero,DirichletBoundary())
BCG = DirichletBC(VG, Constant((0.0)),DirichletBoundary()) (Nedelec)
c = inner(curl(TA), curl(A))*dx
m1 = inner(TA,A)*dx
m2 = inner(TA,grad(phi))*dx
#m3 = inner(grad(Tphi),A)*dx
m4 = inner(grad(Tphi),grad(phi))*dx
dbdt = Constant((0.0, 0.0, 1.0))
L1 = inner(TA, dbdt)*dx
L2 = inner(grad(Tphi),dbdt)*dx
C = PETScMatrix()
M1 = PETScMatrix()
M2= PETScMatrix()
M4 = PETScMatrix()
bc = PETScVector()
bm1 = PETScVector()
bm2= PETScVector()
bm4 = PETScVector()
assemble_system(c,L1,BCN, x0=None, form_compiler_parameters=None, add_values=False, finalize_tensor=True, keep_diagonal=False, A_tensor=C, b_tensor=bc, backend=PETSc)
assemble_system(m1,L1,BCN, x0=None, form_compiler_parameters=None, add_values=False, finalize_tensor=True, keep_diagonal=False, A_tensor=M1, b_tensor=bm1, backend=PETSc)
#assemble_system(m2,L1,???, x0=None, form_compiler_parameters=None, add_values=False, finalize_tensor=True, keep_diagonal=False, A_tensor=M2, b_tensor=bm2, backend=PETSc)
assemble_system(m4,L2,BCG, x0=None, form_compiler_parameters=None, add_values=False, finalize_tensor=True, keep_diagonal=False, A_tensor=M4, b_tensor=bm4, backend=PETSc)
Any help is deeply appreciated; criticism of my usage, and alternate ways of handling this kind of mixed problem are also warmly welcome with thanks.
Cheers,
Hisham