98
views
0
3 months ago by
Hi everyone,

I have solved a Poisson equation in some region using an adaptive method and now I would like to compute the electric field and some charges over some surfaces.

Before using the adaptive methods I just would use:

# Compute de electric field
W = VectorFunctionSpace(mesh, 'P', 1)
e = project(-grad(u),W)​

and then go ahead and send it for plotting or computing the charges. Now, with the adaptive mesh, I get jit errors.
I have tried things like this:
W = VectorFunctionSpace(mesh, 'P', 1)
​
or

W = VectorFunctionSpace(mesh.leaf_node(), 'P', 1)
e = project(-grad(u.leaf_node()),W)​
But I must be missing something important.
Community: FEniCS Project

0
3 months ago by
Solved first part, actually the last sintax seems to be the correct one:

W = VectorFunctionSpace(mesh.leaf_node(), 'P', 1)
e = project(-grad(u.leaf_node()),W)​​
Now I only have problems with the charge integrals:

ds = Measure('ds', domain=mesh.leaf_node(), subdomain_data=boundary_markers)
n = FacetNormal(mesh.leaf_node())
Q_square = assemble(square_flux)​
The assemble instruction is giving the error.
RuntimeErrorTraceback (most recent call last)
<ipython-input-12-e7ba8b81542c> in <module>()
4 n = FacetNormal(mesh.leaf_node())
----> 6 Q_square = assemble(square_flux)
7
198 ​