# Meshfree Variational-Physics-Informed Neural Networks (MF-VPINN): An Adaptive Training Strategy
## 2 Problem Formulation
### The a Posteriori Error Estimator  
The goal of this section is to derive an error estimator associated with an arbitrary patch \(P_{i}\), with \(i\in\{1,\ldots,n_{\text{patches}}\}\). To do so, we rely on the a posteriori error estimator proposed in [46]. It has been proven to be efficient and reliable; therefore, such an estimator allows us to know where the error is larger without knowing the exact solution of the PDE. Let us consider the patch \(P_{i}\), formed by the triangles \(T_{i,1},\ldots,T_{i,N_{p}}\) and a triangulation \(\mathcal{T}_{i}\) of \(\Omega\) such that \(T_{i,j}\in\mathcal{T}_{i}\), for every \(j=1,\ldots,N_{p}\). We remark that the triangulation \(\mathcal{T}_{i}\) does not have to be explicitly generated; it is only used to properly define all the quantities introduced in [46] required to derive the proposed error estimator. Let \(V_{h}^{i}=\text{span}\{\psi_{j}^{i}:1\leq j\leq\text{dim}\big{(}V_{h}^{i}\big{)}\}\) be the space of piecewise linear functions defined on \(\mathcal{T}_{i}\). Where \(\{\psi_{j}^{i}:1\leq j\leq\text{dim}\big{(}V_{h}^{i}\big{)}\}\) is a Lagrange basis of \(V_{h}^{i}\). It is then possible to define two constants \(c_{h}^{i}\) and \(C_{h}^{i}\), with \(0<c_{h}^{i}<C_{h}^{i}\), such that  
\[c_{h}^{i}|v|_{1,\Omega}\leq\|v\|_{2}\leq C_{h}^{i}|v|_{1,\Omega}\qquad\forall v \in V_{h}^{i}\,, \tag{15}\]  
where \(v=\sum_{j=1}^{\text{dim}\big{(}V_{h}^{i}\big{)}}v_{j}\psi_{j}^{i}\) is an arbitrary element of \(V_{h}^{i}\) associated with the expansion coefficients \(\mathbf{v}=\Big{\{}v_{1},\ldots,v_{\text{dim}}(v_{h}^{i})\Big{\}}\) and \(\|\mathbf{v}\|_{2}=\left(\sum_{j=1}^{\text{dim}\big{(}V_{h}^{i}\big{)}}v_{j}^{2} \right)^{1/2}\). Then, given an integer \(k\geq 0\), for any element \(E\in\mathcal{T}_{i}\), we define the projection operator \(\Pi_{E,k}:L^{2}(E)\to\mathbb{P}_{k}(E)\) such that  
\[\int_{E}\Pi_{E,k}\phi=\int_{E}\phi\qquad\forall\phi\in L^{2}(E)\,. \tag{16}\]  
We also denote by \(\{(\xi_{\ell}^{E},\omega_{\ell}^{E}):\ell\in I^{E}\}\) a quadrature formula of order \(q\) on \(E\) and define the quadrature-based discrete seminorm:  
\[\|v\|_{0,E,\omega}=\left(\sum_{\ell\in I^{E}}v^{2}(\xi_{\ell}^{E})\,\omega_{ \ell}^{E}\right)^{1/2}. \tag{17}\]  
We require the weights and nodes of this quadrature rule to coincide with the ones introduced in (9) when \(E\) is a triangle included in \(P_{i}\) (i.e., when \(E\in\{T_{i,1},\ldots,T_{i,N_{p}}\}\)). We can now introduce all the terms involved in the a posteriori error estimator. Let \(\eta_{\text{rhs},1}(E)\) and \(\eta_{\text{rhs},2}(E)\) be the quantities:  
\[ \begin{split}\eta_{\text{rhs},1}(E)&=h_{E}\|f-\Pi_ {E,q-1}f\|_{0,E}\,,\\ \eta_{\text{rhs},2}(E)&=h_{E}\|f-\Pi_{E,q-1}f\|_{0,E,\omega}+\|f-\Pi_{E,q}f\|_{0,E,\omega}\,.\end{split}  \tag{18}\]  
They measure the oscillations of the forcing term with respect to its polynomial projections in various norms. Similar oscillations are also measured for the diffusion, convection and reaction terms by the terms \(\eta_{\text{coef},i}(E)\) for \(i=1,\ldots,6\):  
\[ \begin{split}\eta_{\text{coef},1}(E)&=\|\mu\
abla u ^{\mathcal{N}}-\Pi_{E,q}(\mu\
abla u^{\mathcal{N}})\|_{0,E}\,,\\ \eta_{\text{coef},2}(E)&=h_{E}\|f\cdot\
abla u^{ \mathcal{N}}-\Pi_{E,q-1}(\mathbf{\beta}\cdot\
abla u^{\mathcal{N}})\|_{0,E}\,,\\ \eta_{\text{coef},3}(E)&=h_{E}\|\sigma u^{\mathcal{ N}}-\[PERSON]_{E,q-1}(\sigma u^{\mathcal{N}})\|_{0,E}\,,\\ \eta_{\text{coef},4}(E)&=\|\mu\
abla u^{\mathcal{ N}}-\[PERSON]_{E,q}(\mu\
abla u^{\mathcal{N}})\|_{0,E,\omega}\,,\\ \eta_{\text{coef},5}(E)&=h_{E}\|\mathbf{\beta}\cdot \
abla u^{\mathcal{N}}-\[PERSON]_{E,q-1}(\mathbf{\beta}\cdot\
abla u^{\mathcal{N}})\|_{0, E,\omega}\,,\\ &\qquad\qquad\qquad+\|\mathbf{\beta}\cdot\
abla u^{\mathcal{N}}-\Pi_{ E,q}(\mathbf{\beta}\cdot\
abla u^{\mathcal{N}})\|_{0,E,\omega}\\ \eta_{\text{coef},6}(E)&=h_{E}\|\sigma u^{\mathcal{ N}}-\Pi_{E,q-1}(\sigma u^{\mathcal{N}})\|_{0,E,\omega}\\ &\qquad\qquad\qquad+\|\sigma u^{\mathcal{N}}-\Pi_{E,q}(\sigma u^{ \mathcal{N}})\|_{0,E,\omega}\,,\end{split}