Is matrix assembly really that slow?
Hello,
I am pretty much impressed with FeniCS, but now I'm facing something I'm not sure is my fault or something FeniCS might improve upon. My setup is as follows:
element_type = "Nedelec 1st kind H(curl)"
element_order = 2
V_c = FunctionSpace(mesh, element_type, element_order) #mesh is in 3D, is read from a XML file
V = MixedFunctionSp
Er, Ei = TrialFunctions(V)
vr, vi = TestFunctions(V)
fr = Function(
fi = Function(
#Filled fr, fi somehow....
wf = -fr*(dot(Er, vr)+dot(Ei, vi))*dx + fi*(dot(Ei, vr) - dot(Er, vi))*dx \
+ dot(curl(Er), curl(vr))*dx + dot(curl(Ei), curl(vi))*dx
n = FacetNormal(mesh)
# Add surface term at excitation boundary
d_exc = some_integer_index
r_v = Expression(
k_dir_c = Constant( k_dir.tolist() ) # k_dir is a 3-element numpy array ...
E0_c = Constant( E0.tolist() ) # ... and so is E0
# ... real part
#wf += dot(-k*cross(n, cross(Ei, n)) - k*sin(dot(k_dir_c, r_v))*cross(n, cross(E0_c, n-k_dir_c)), vr)*ds(d_exc)
## ... imaginary part
#wf += dot(k*cross(n, cross(Er, n)) - k*cos(dot(k_dir_c, r_v))*cross(n, cross(E0_c, n-k_dir_c)), vi)*ds(d_exc)
T = Function(V)
a, L = lhs(wf), rhs(wf)
problem = LinearVariation
With a test mesh, I get a system of 460k DOFs, that takes around 6 mins to assemble when running on 8 cores. When running single-threaded, It takes a lot more. Is this expected or can I do anything to improve this situation?
Thanks,
Luis.
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Garth Wells
- Solved:
- Last query:
- Last reply: