When FiniteElement
method is used, the differential equations will first be transformed to certain standard form (named as formal PDE in recent FEM document), and it turns out to be critical to check what the standard form is when analyzing various issues related to FEM. Here are some examples:
Position of discontinuous coefficient influences the solution of PDE
How to input Robin boundary conditions for nonstandard Laplace equation?
Sign of conservative convection coefficient in a formal (Inactive) PDE
Stress analysis in axisymmetric bodies
The coefficient of formal PDE is available from PDECoefficientData
, but its output is just hard to read. For example, with
{state} = NDSolve`ProcessEquations[
With[{u = u[x, y]}, {-2 D[u, y, y] - 3 D[u, x, x] == 1,
DirichletCondition[u == 0, True]}],
u, {x, 0, 1}, {y, 0, 1}];
data = state["FiniteElementData"]["PDECoefficientData"];
data["All"]
(* {{{{1}}, {{{{0}, {0}}}}}, {{{{{3, 0}, {0, 2}}}}, {{{{0}, {0}}}}, {{{{0,
0}}}}, {{0}}}, {{{0}}}, {{{0}}}} *)
at hand, can you tell what's what? Can you label $d$, $c$, $\alpha$, etc. in the formal PDE
$$d\frac{\partial }{\partial t}u+\nabla \cdot (-c \nabla u-\alpha u+\gamma ) +\beta \cdot \nabla u+ a u -f=0$$
with corresponding values, without doubt?
Can we have a function that shows the formal PDE of FiniteElement
in a easy-to-read way? A possible (but not necessary of course) input-output in my mind:
showFormalPDE@With[{u = u[x, y]}, -2 D[u, y, y] - 3 D[u, x, x] == 1]
(* -1 + Inactive[Div][(-{{3, 0}, {0, 2}}.Inactive[Grad][u[x, y], {x, y}]), {x, y}] == 0 *)