# Time dependent PDE and mesh adaptation

588

views

1

I want to solve a time dependent PDE in two space dimensions and I want to adapt mesh using my own criterion. Is there any demo example that explains how to do this ? All the examples I have seen are for stationary problems.

1

Be careful because FEniCS doesn't have coarsening. If you are modeling a wave phenomena, you might be refining regions that later on will be overrefined.

written
13 months ago by
Miguel

### 2 Answers

1

If you have an instationary problem, you discretize in time and solve a series of stationary problems, so you can transfer the stationary case to this one.

You only have to make sure to adapt the problem and solver as well:

You only have to make sure to adapt the problem and solver as well:

```
adapt(problem, refined_mesh)
problem = problem.child()
solver = NonlinearVariationalSolver(problem.leaf_node())
```

Its too bad we cannot do coarsening. Is there any development on this front in fenics ? Also, I am not using *VariationalProblem or *VariationalSolver. I directly construct matrix and solve it. Is it possible to adapt in this case ? Also in your tip above, how is the solution transferred to the refined mesh ?

written
12 months ago by
Praveen C

I don't know if there is any development....

Looking at the source code if you use adapt on a problem it adapts the corresponding Forms, Variables and Bcs.

You can do this manually in your case, i.e. first adapt your Forms and so on and afterwards build your matrices.

Again looking at the source code, inside adapt(problem, refined_mesh) the solution is also adapted, i.e. adapt(u, refined_mesh) is called internally.

And if I understand it correctly inside the adapt functionality a new (child) function on the refined mesh is created and the parent function is interpolated onto the refined mesh.

to be safe you can use

Looking at the source code if you use adapt on a problem it adapts the corresponding Forms, Variables and Bcs.

You can do this manually in your case, i.e. first adapt your Forms and so on and afterwards build your matrices.

Again looking at the source code, inside adapt(problem, refined_mesh) the solution is also adapted, i.e. adapt(u, refined_mesh) is called internally.

And if I understand it correctly inside the adapt functionality a new (child) function on the refined mesh is created and the parent function is interpolated onto the refined mesh.

to be safe you can use

`adapt(u, refined_mesh)`

`u = u.child()`

written
12 months ago by
Lukas O.

1

Each timestep, you can mark the mesh for refinement. See here:

https://harishnarayanan.org/research/porous-flow/

https://harishnarayanan.org/research/porous-flow/

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