Fast way to compute "extrapolated average" in cell #1927
-
Hello everyone, Now I write a type of limiter for DG solver. The main idea in this limiter is to select a troubled cell and their neighbours and, after that, to compare solution average values on selected cell. It is not usual averages: all average values should be computed on the troubled cell; for neighbour cells, we extrapolate solution to the troubled cell and compute an extrapolated value. To get the extrapolated averages, I rewrote the gridfunc.GetElementAverages function, but this way seems to be too slow and, maybe, difficult. Is there any other simple way to get these values? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hi @vkorchagova, It's hard to say why // To compute cell average of element i
const IntegrationRule &ir = IntRules.Get(mesh.GetElementBaseGeometry(i), order);
ElementTransformation &tr = *mesh.GetElementTransformation(i);
Vector vals;
gf.GetValues(i, ir, vals);
double cell_avg = 0.0;
for (int j=0; j<ir.Size(); ++j)
{
const IntegrationPoint &ip = ir[j];
tr.SetIntPoint(&ip);
cell_avg += vals[j]*ir[j].weight*tr.Weight();
} |
Beta Was this translation helpful? Give feedback.
Hi @vkorchagova,
It's hard to say why
GetElementAverages
is too slow for you, but you can compute the cell averages of your extrapolated values by numerically integrating over the relevant cells using anIntegrationRule
andElementTransformation
to compute the quadrature weights. You could adapt something like the following: