Consider the PDE
$$\nabla \cdot ( - \color{blue}{\texttt{c}} \;\nabla u - \color{blue}{\texttt{alpha}} \; u) = 0 \tag{std}\label{std} $$
where
c = {{1, 0}, {0, 1}};
alpha = {1, 0};
We use the helper function from FEM Usage Tips for extracting parsed coefficients:
<< NDSolve`FEM`
getcoeffs[eqn_] :=
First[
NDSolve`ProcessEquations[
List[
eqn,
DirichletCondition[u[x, y] == 0, True]
], u, Element[{x, y}, Disk[]]
]
]["FiniteElementData"]["PDECoefficientData"];
PDE specified with minus sign outside Inactive[Times][
...]
:
out =
Inactive[Div][
-c . Inactive[Grad][u[x, y], {x, y}]
- Inactive[Times][alpha, u[x, y]]
(* ^ here *)
, {x, y}] == 0;
PDE specified with minus sign inside Inactive[Times][
...]
:
in =
Inactive[Div][
-c . Inactive[Grad][u[x, y], {x, y}]
+ Inactive[Times][-alpha, u[x, y]]
(* ^ here *)
, {x, y}] == 0;
Intuitively one would expect these to represent the same PDE, but it turns out that they are parsed differently:
getcoeffs[out]["ConservativeConvectionCoefficients"] (* {{{{1}, {0}}}} *)
getcoeffs[in]["ConservativeConvectionCoefficients"] (* {{{{-1}, {0}}}} *)
Given this, I would say that the minus sign should be placed outside to be consistent with the standard form $\eqref{std}$.
However, I am confused by the example in FEM Usage Tips from In[93]
onwards (Version 11.0). The intended PDE is
$$\nabla \cdot ( - \color{blue}{c} \;\nabla u + \color{blue}{\alpha} \; u) = 0 $$
where $\color{blue}{\alpha} = \{ -x, -y \}$ (see In[85]
). But that example effectively places the minus sign inside Inactive[Times][
...]
:
α = {-x, -y};
ipde =
Inactive[Div][
-c . Inactive[Grad][u[x, y], {x, y}]
+ Inactive[Times][α, u[x, y]]
, {x, y}] == 0;
We get
getcoeffs[ipde]["ConservativeConvectionCoefficients"] (* {{{{-x}, {-y}}}} *)
meaning the actual (i.e. parsed) PDE is
\begin{align*} \nabla \cdot (-\color{blue}{c} \;\nabla u - \{ -x, -y \} \; u) &= 0 \\ \nabla \cdot (-\color{blue}{c} \;\nabla u - \color{blue}{\alpha} \; u) &= 0 \end{align*}
in light of the standard form $\eqref{std}$.
TLDR; I think I should put the minus sign outside
Inactive[Times][
...]
. Is this correct?