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

12 months ago by
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,, 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 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
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.
written 12 months ago by pf4d  

2 Answers

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

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

Your test function then becomes

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

Shouldn't this rather be sqrt(v_times_hinv) ?
Sorry for the late comment.
written 5 months ago by David Nolte  
12 months ago by
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.
Please login to add an answer/comment or follow this question.

Similar posts:
Search »