### processing adaptive solutions

98

views

0

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:

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:

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)
e = project(-grad(u.leaf_node()),W)
```

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

### 1 Answer

0

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())
square_flux = -dot(grad(u.leaf_node()),n)*ds(1)
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())
5 square_flux = -dot(grad(u.leaf_node()),n)*ds(1)
----> 6 Q_square = assemble(square_flux)
7
8 cyl_flux = -dot(grad(u.leaf_node()),n)*ds(2)
/usr/lib/python2.7/dist-packages/dolfin/fem/assembling.py in assemble(form, tensor, form_compiler_parameters, add_values, finalize_tensor, keep_diagonal, backend)
194
195 # Create tensor
--> 196 comm = dolfin_form.mesh().mpi_comm()
197 tensor = _create_tensor(comm, form, dolfin_form.rank(), backend, tensor)
198
```

Please login to add an answer/comment or follow this question.