Add equidistribution marking#4187
Conversation
be3bfe6 to
ad9ef0a
Compare
ad9ef0a to
cf5dfc4
Compare
cf5dfc4 to
c4a2bdb
Compare
| /// @param[in] theta Parameter, 0 < θ < 1 | ||
| /// @param[in] comm Communicator over which the total marker is computed. | ||
| /// @return Indices (local) of marker elements, which satisfy: marker_i ≥ θ | ||
| /// (sum_i marker_i^2)^1/2 / N^1/2. |
There was a problem hiding this comment.
Please correct me if I'm wrong, but there is probably no need to do so many square root operations - assuming markers/indicators and theta are always positive, you can square both sides:
marker_i^2 ≥ θ^2 (sum_i marker_i^2) / N.
There was a problem hiding this comment.
That's true but we would sacrifice the shared code path of mark_threshold. Since it's 2x sqrt's not critical?
There was a problem hiding this comment.
Not really - in the vast majority of cases I'm familiar with, one naturally assembles the square of the entity estimator, so your approach effectively requires the user to do many square roots outside this function.
There was a problem hiding this comment.
See e.g. https://doi.org/10.1016/j.camwa.2022.11.009 eq A.1, A.4, 3.15 (which should really be squared on both sides).
| count = comm.allreduce(marker.size) | ||
| assert np.allclose( | ||
| marked_cells, | ||
| np.argwhere(marker > theta * norm / np.sqrt(count)).flatten(), |
There was a problem hiding this comment.
If my square-rootless version is correct, still keep this alternative version as-is in the test.
| spdlog::info("Marking (max) {} / {} (local) entities.", indices.size(), | ||
| /// @brief Equidistribution marking of a marker. | ||
| /// | ||
| /// @param[in] marker Input marker (local) - usually an error indicator per |
There was a problem hiding this comment.
The terminology is non-standard. Marker is normally denoted eta and called an error indicator per entity.
Furthermore, and see my comment below, it is usually most efficient to take eta_i^2 - this often saves a square root in user code.
Implements an equidistribution marking criterion for AFEM schemes, i.e. for$\theta \in (0, 1)$ and a marker $\eta \in \mathbb{R}^N$ , computes
Work towards #4141.
Fixes #3133.