I am dealing with some stabilization techniques of convection-diffusion equations and I was wondering how could I include such a term in the variational formulation of a problem:
\sum_{e = 1}^{N_{el}} \int_{\Omega_e} \alpha^e h^e (...) d\Omega
where e represents each element, \alpha^e is a cell dependent function and h^e is the cell diameter. Up to now my guess is to use a DG0 function:
h = ufl.CellDiameter(mesh)
DG0 = ufl.FiniteElement("DG", mesh.ufl_cell(), 0)
L = dolfinx.fem.functionspace(mesh, DG0)
func = dolfinx.fem.Function(L)
a += h * func * ufl.dx
and the variable func
will be updated in each iteration of a custom newton solver. Is this the proper way to do this?