I am solving the PNP equations, using fluxless boundaries, in mixed form, but I am getting an error, what is the problem ?
Thanks!
BDM = FiniteElement('BDM', mesh.ufl_cell(), 1)
DG = FiniteElement('DG', mesh.ufl_cell(), 0)
element = MixedElement([BDM, BDM, BDM, DG, DG, DG])
V = FunctionSpace(mesh, element)
(J1, J2, sigma, c1, c2, phi) = TrialFunctions(V)
(tau_J1, tau_J2, tau_sigma, v_c1, v_c2, v_phi) = TestFunctions(V)
bcs = DirichletBC(V.sub(0), J, boundary_markers, 0)
n = FacetNormal(mesh)
f1_c1 = 0
a1 = (div(J1) * v_c1 + dot(J1, tau_J1) - D_cation * c1 * div(tau_J1) + (
z_caion * e_const * D_cation / kB / T) * c1 * dot(sigma, tau_J1)) * dx
L1 = f1_c1 * v_c1 * dx - D_cation * c0 * dot(tau_J1, n) * ds(1) - D_cation * c0 * dot(tau_J1, n) * ds(3)
f1_c2 = 0
a2 = (div(J2) * v_c2 + dot(J2, tau_J2) - D_anion * c2 * div(tau_J2) + (z_anion * e_const * D_anion / kB / T) * c2 * dot(
sigma, tau_J2)) * dx
L2 = f1_c2 * v_c2 * dx - D_anion * c0 * dot(tau_J2, n) * ds(1) - D_anion * c0 * dot(tau_J2, n) * ds(3)
f2 = -(F_const / epsilon0) * (c1 * z_caion + z_anion * c2)
a3 = (div(sigma) * v_phi + dot(sigma, tau_sigma) + phi * div(tau_sigma)) * dx
L3 = f2 * v_phi * dx - phi1 * dot(tau_sigma, n) * ds(1) - phi2 * dot(tau_sigma, n) * ds(3)
a = a1 + a2 + a3
L = L1 + L2 + L3
u = Function(V)
(J1, J2, sigma, c1, c2, phi) = split(u)
solve(a == L, u, bcs)
Traceback (most recent call last):
File "/home/dd/桌面/dad/2D.py", line 206, in <module>
solve(a == L, u, bcs)
File "/home/dd/anaconda3/envs/FEniCS/lib/python3.8/site-packages/dolfin/fem/solving.py", line 220, in solve
_solve_varproblem(*args, **kwargs)
File "/home/dd/anaconda3/envs/FEniCS/lib/python3.8/site-packages/dolfin/fem/solving.py", line 241, in _solve_varproblem
problem = LinearVariationalProblem(eq.lhs, eq.rhs, u, bcs,
File "/home/dd/anaconda3/envs/FEniCS/lib/python3.8/site-packages/dolfin/fem/problem.py", line 55, in __init__
L = Form(L, form_compiler_parameters=form_compiler_parameters)
File "/home/dd/anaconda3/envs/FEniCS/lib/python3.8/site-packages/dolfin/fem/form.py", line 43, in __init__
ufc_form = ffc_jit(form, form_compiler_parameters=form_compiler_parameters,
File "/home/dd/anaconda3/envs/FEniCS/lib/python3.8/site-packages/dolfin/jit/jit.py", line 47, in mpi_jit
return local_jit(*args, **kwargs)
File "/home/dd/anaconda3/envs/FEniCS/lib/python3.8/site-packages/dolfin/jit/jit.py", line 97, in ffc_jit
return ffc.jit(ufl_form, parameters=p)
File "/home/dd/anaconda3/envs/FEniCS/lib/python3.8/site-packages/ffc/jitcompiler.py", line 217, in jit
module = jit_build(ufl_object, module_name, parameters)
File "/home/dd/anaconda3/envs/FEniCS/lib/python3.8/site-packages/ffc/jitcompiler.py", line 130, in jit_build
module, signature = dijitso.jit(jitable=ufl_object,
File "/home/dd/anaconda3/envs/FEniCS/lib/python3.8/site-packages/dijitso/jit.py", line 165, in jit
header, source, dependencies = generate(jitable, name, signature, params["generator"])
File "/home/dd/anaconda3/envs/FEniCS/lib/python3.8/site-packages/ffc/jitcompiler.py", line 65, in jit_generate
code_h, code_c, dependent_ufl_objects = compile_object(ufl_object,
File "/home/dd/anaconda3/envs/FEniCS/lib/python3.8/site-packages/ffc/compiler.py", line 142, in compile_form
return compile_ufl_objects(forms, "form", object_names,
File "/home/dd/anaconda3/envs/FEniCS/lib/python3.8/site-packages/ffc/compiler.py", line 185, in compile_ufl_objects
analysis = analyze_ufl_objects(ufl_objects, kind, parameters)
File "/home/dd/anaconda3/envs/FEniCS/lib/python3.8/site-packages/ffc/analysis.py", line 89, in analyze_ufl_objects
form_datas = tuple(_analyze_form(form, parameters)
File "/home/dd/anaconda3/envs/FEniCS/lib/python3.8/site-packages/ffc/analysis.py", line 89, in <genexpr>
form_datas = tuple(_analyze_form(form, parameters)
File "/home/dd/anaconda3/envs/FEniCS/lib/python3.8/site-packages/ffc/analysis.py", line 169, in _analyze_form
form_data = compute_form_data(form,
File "/home/dd/anaconda3/envs/FEniCS/lib/python3.8/site-packages/ufl/algorithms/compute_form_data.py", line 418, in compute_form_data
check_form_arity(preprocessed_form, self.original_form.arguments(), complex_mode) # Currently testing how fast this is
File "/home/dd/anaconda3/envs/FEniCS/lib/python3.8/site-packages/ufl/algorithms/check_arities.py", line 177, in check_form_arity
check_integrand_arity(itg.integrand(), arguments, complex_mode)
File "/home/dd/anaconda3/envs/FEniCS/lib/python3.8/site-packages/ufl/algorithms/check_arities.py", line 162, in check_integrand_arity
raise ArityMismatch("Integrand arguments {0} differ from form arguments {1}.".format(args, arguments))
ufl.algorithms.check_arities.ArityMismatch: Integrand arguments (Argument(FunctionSpace(Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 11), MixedElement(FiniteElement('Brezzi-Douglas-Marini', triangle, 1), FiniteElement('Brezzi-Douglas-Marini', triangle, 1), FiniteElement('Brezzi-Douglas-Marini', triangle, 1), FiniteElement('Discontinuous Lagrange', triangle, 0), FiniteElement('Discontinuous Lagrange', triangle, 0), FiniteElement('Discontinuous Lagrange', triangle, 0))), 0, None),) differ from form arguments (Argument(FunctionSpace(Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 11), MixedElement(FiniteElement('Brezzi-Douglas-Marini', triangle, 1), FiniteElement('Brezzi-Douglas-Marini', triangle, 1), FiniteElement('Brezzi-Douglas-Marini', triangle, 1), FiniteElement('Discontinuous Lagrange', triangle, 0), FiniteElement('Discontinuous Lagrange', triangle, 0), FiniteElement('Discontinuous Lagrange', triangle, 0))), 0, None), Argument(FunctionSpace(Mesh(VectorElement(FiniteElement('Lagrange', triangle, 1), dim=2), 11), MixedElement(FiniteElement('Brezzi-Douglas-Marini', triangle, 1), FiniteElement('Brezzi-Douglas-Marini', triangle, 1), FiniteElement('Brezzi-Douglas-Marini', triangle, 1), FiniteElement('Discontinuous Lagrange', triangle, 0), FiniteElement('Discontinuous Lagrange', triangle, 0), FiniteElement('Discontinuous Lagrange', triangle, 0))), 1, None)).