# Computable alternative to “almost everywhere”

I am working with finite elements for Maxwell's Equations (i.e. with Nedelec's edge elements) and for computation I'm using the FEniCS-project. While implementing the Augmented Lagragian Method, I need to solve a PDE with a non-linearity of the form:

\begin{align*} f(v) := \begin{cases} v, \quad &\text{on } A=\lbrace x:|v(x)| \leq g(x)\rbrace\\ \frac{v}{|v|}g, &\text{on } \Omega\backslash A \end{cases} \end{align*}

How is this non-linearity computable. More specific: How can I check that the finite element-approximation of $v$ ist smaller than $g$ almost everywhere?

• "How can I check that the finite element-approximation of vv ist smaller than gg almost everywhere" Don't FEM discretizations need some spatial interpolation for the integration? At least all of the ones I know of do that, which then gives you a continuous function to check the property on. – Chris Rackauckas Nov 13 '17 at 15:33

Regarding the question of how to check whether $|v|<g$ (which I would recommend to split into $v(x)<g(x)$ and $v(x)>-g(x)$, since $|v|$ will in general not be a piecewise polynomial), this is rather easy for piecewise constant functions and piecewise linear functions (for which the maximum and minimum are always attained in the nodes) since there it suffices to compare the coefficients of the corresponding vectors. For higher-order approximations, this is no longer true. (I'm assuming that $g$ is also a finite element function of the same order, otherwise you'll have the same problem as for higher-order approximations.)

But it's not the "almost everywhere" that's the problem (since finite element functions are always continuous on each element), but the fact that you need to separate integrals over each element $T$ into contributions from $T\cap A$ and $T\setminus A$ to assemble the term arising from the nonlinearity.

The easiest approach is to work with piecewise constant approximations to $v$, since then either $T\cap A= T$ or $T\cap A=\emptyset$.

For higher-order approximations, you can approximate the integrals by either

1. applying the nonlinearity componentwise to the vector of expansion coefficients with respect to the (nodal) basis and multiply this by the (lumped) mass or stiffness matrix (depending on where exactly this term arises, which you haven't told us) or

2. using a quadrature scheme to evaluate the nonlinearity.

How to do that in FEniCS is off-topic here (but for 2., look at the quadrature element together with UFL conditionals); the error arising from this approximation can be estimated using Strang's Lemma.

EDIT: I see you've already posted your question there, but this older question might be more what you are looking for.

Computability is not your only problem. How do you know that your finite element approximation preserves the property? Actually, it is not hard to show that there is no linear approximation scheme that does it for all $f$ and $g$, and once you make a single error somewhere, the whole PDE approximation may get totally worthless (that depends on the PDE, of course). In all honesty, your definition of $f(v)$ looks extremely fishy to me in the context of any PDE. Are you sure that what you really need is not $$f(v)=\begin{cases}v, |v|\le g\\\frac v{|v|}g, |v|>g\end{cases}$$ (i.e. the standard pointwise truncation by some fixed majorant)?

• Thanks for your answer. I quickly rechecked and I guess, you are right. I mean your suggested function and I'll edit the question. – FredTheBread Nov 13 '17 at 15:21