### How to claculate the cell length in the direction of the convection velocity in supg stablization

382

views

2

Hello, I have been working on the supg stablization used in advection-diffusion-reaction equations with python based on FEnics. I noticed the advection-diffusion demo fulfilled this supg stablization, https://github.com/FEniCS/dolfin/blob/master/demo/undocumented/advection-diffusion/python/demo_advection-diffusion.py, but the 'h' used here is "h = CellSize(mesh)", Tezduyar and Park used a different definition to define h as the diameter of cell K in the direction of the convection b, which is considered better, the folmula is as follows.

I have heard this method, it seemed like more trouble than it was worth; you have to follow the streamline from each node to find the neighboring cell.

I wonder how to code this in python? For me, I don't know how to access the basis function deravatives used in the formula, and how to code this with ufl language? Any ideas?

Community: FEniCS Project

written
12 months ago by
pf4d

### 2 Answers

1

You can calculate the steiner ellipse/ellipsoid for all elements (a kind of mesh metric), i.e.

Shouldn't this rather be

Sorry for the late comment.

```
from adaptivity import mesh_metric
M = mesh_metric(mesh)
v_times_hinv = dot(dot(v,M),v)
```

where v is the velocity and the mesh_metric is defined in https://github.com/meshadaptation/pragmatic/blob/master/python/adaptivity.py.in

Your test function then becomes

```
u_tst = TestFunction(V)
u_tst += dot(grad(u_tst),v)/v_times_hinv
```

**sqrt(v_times_hinv)**?

Sorry for the late comment.

written
5 months ago by
David Nolte

0

OK, here's a strategy :

Multiply the normalized velocity vector by CellSize(mesh) -- plus some amount to ensure that the point this vector ends on lies entirely within the cell in the upwind direction, say 1/2 Cellsize(mesh) -- then create a Point for use with the mesh BoundingBoxTree to get the cell index, which can be used to set the upwind cell size for the source Cell's SUPG formulation.

Multiply the normalized velocity vector by CellSize(mesh) -- plus some amount to ensure that the point this vector ends on lies entirely within the cell in the upwind direction, say 1/2 Cellsize(mesh) -- then create a Point for use with the mesh BoundingBoxTree to get the cell index, which can be used to set the upwind cell size for the source Cell's SUPG formulation.

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