Hi. I have two questions (both for DG elements):
1) I need to create a function form to evaluate $$\frac{A}{V}$$ for each cell. I use this for an Interior-Penalty term. Below is what I've written, but I'd like to make it as general as possible. So, I think, instead of cell_idx
below, I should use the local cell index number as I do not know the cell numbering on each processors. Any thoughts what is the best approach?
def AreaOverVolume(mesh):
V0 = FunctionSpace(mesh, "DG", 0)
AoV=Function(V0)
D = mesh.topology().dim()
for cell_idx in xrange(mesh.num_cells()):
cell = Cell(mesh, cell_idx)
facet = cell.entities(D-1)
area = 0.0
for f in xrange(cell.num_entities(D-1)):
area += cell.facet_area(f) # perimeter in 2D
AoV.vector()[cell_idx] = area/cell.volume()
return AoV
2) In the DG formulation, we have a jump across facets. For interior facets, it is not really important which cell is ('+') or ('-'). For the exterior facets (ds), however, I think this distinction is important. In my little experience with FEniCS, it appears that using either one or even the average of the two returns the same identical answer. I need help understanding what is the appropriate choice; e.g., AoV('-')*ds
or AoV('+')*ds
Regards,
Alireza