# Meshfree Variational-Physics-Informed Neural Networks (MF-VPINN): An Adaptive Training Strategy
## 2 Problem Formulation
### The a Posteriori Error Estimator
 \tag{19}\]where \(u^{\mathcal{NN}}\) is the output of the neural network after the enforcement of the Dirichlet boundary conditions through the operator \(B\) and \(h_{E}\) is the diameter of \(E\). Then, let us define the term \(\eta_{\text{res}}(E)\), which measures how well the equation is satisfied, as  
\[\eta_{\text{res}}(E)=h_{E}\|\operatorname{bulk}_{E}(u^{\mathcal{NN}})\,\|_{0,E}+ h_{E}^{1/2}\sum_{e\subset\partial E}\|\operatorname{jump}_{e}(u^{\mathcal{NN}})\,\|_{0,e}\,, \tag{20}\]  
where  
\[\operatorname{bulk}_{E}(u^{\mathcal{NN}})=\Pi_{E,q-1}f+\
abla\cdot\Pi_{E,q}( \mu\
abla u^{\mathcal{NN}})-\Pi_{E,q-1}(\mathbf{\beta}\cdot\
abla u^{\mathcal{NN}}+ \sigma u^{\mathcal{NN}})\]  
\[\operatorname{jump}_{e}(u^{\mathcal{NN}})=\Pi_{E_{1},q}(\mu\
abla u^{ \mathcal{NN}})\cdot\mathbf{n}-\Pi_{E,2,q}(\mu\
abla u^{\mathcal{NN}})\cdot\mathbf{n}\,.\]  
Note that \(\operatorname{jump}_{e}(u^{\mathcal{NN}})\) measures the interelectural jumps of \(\Pi_{E,q}(\mu\
abla u^{\mathcal{NN}})\) across the edge \(e\) with normal unit vector \(\mathbf{n}\) shared by the elements \(E_{1}\) and \(E_{2}\). Finally, we introduce the approximate elemental forms:  
\[a_{h}^{i,E}(w,v)=\sum_{\ell\in I^{E}}\left[\mu\
abla w\cdot\
abla v+\mathbf{\beta} \cdot\
abla w\,v+\sigma wv\right](\xi_{\ell}^{E})\,\omega_{\ell}^{E}\,, \tag{21}\]  
\[F_{h}^{i,E}(v)=\sum_{\ell\in I^{E}}\left[fv\right](\xi_{\ell}^{E})\,\omega_{ \ell}^{E}\,, \tag{22}\]  
where \(\xi_{\ell}^{E}\) and \(\omega_{\ell}^{E}\), \(\ell\in I^{E}\), are the nodes and weights used in Equation (17). With such forms, it is possible to define the residuals  
\[r_{h,i,j}(w)=\sum_{E\in\mathcal{T}_{i}}F_{h}^{i,E}(\psi_{j}^{i})-a_{h}^{i,E}(w,\psi_{j}^{i})\,,\qquad j=1,\ldots,\dim\left(V_{h}^{i}\right)\]  
and the quantity \(\eta_{\text{loss}}(E)\) as  
\[\eta_{\text{loss}}(E)=C_{h}\sqrt{\sum_{j\in I_{h}^{E}}r_{h,i,j}^{2}(u^{ \mathcal{NN}})}\,. \tag{23}\]  
Here, denoting the support of the function \(\psi_{j}^{i}\in V_{h}^{i}\) by \(\operatorname{supp}\psi_{j}^{i}\), the elemental index set  
\[I_{h}^{E}=\{j\in I_{h}:E\subset\operatorname{supp}\psi_{j}^{i}\}\]  
is the set containing the indices of the functions whose support contains \(E\). It is then possible to estimate the error between the unknown exact solution \(u\) and its MF-VPINN approximation \(u^{\mathcal{NN}}\) by means of the computable quantities in Equations (18)-(20) and (23) as  
\[|u-u^{\mathcal{NN}}|_{1,E}\lesssim\left(\eta_{\text{res}}^{2}(E)+\eta_{\text{ loss}}^{2}(E)+\sum_{i=1}^{6}\eta_{\text{coef}i}^{2}(E)+\sum_{i=1}^{2}\eta_{ \text{ths},i}^{2}(E)\right)^{1/2}. \tag{24}\]  
Once more, we refer to [46] for the proof of such a statement. We recall that our goal is to obtain a computable error estimator associated with a single patch \(P_{i}\). When evaluated on an element \(E\in P_{i}\), the quantity on the right-hand side of Equation (24) implicitly depends on several elements in \(V_{h}^{i}\) that do not belong to \(P_{i}\) because of the presence of \(\eta_{\text{res}}^{2}(E)\) and \(\eta_{\text{loss}}^{2}(E)\). Therefore, such an estimator is not computable without generating the triangulation \(\mathcal{T}_{i}\) and the corresponding space \(V_{h}^{i}\). Instead, we look for an error estimator that does not control the error on the entire patch but only in a neighborhood \(\mathcal{N}_{i}\) of its center \(c_{P_{i}}=M_{i}\big{(}c_{P}\big{)}\). This can be carried out by considering only the terms whose computation involves geometric elements containing \(c_{P_{i}}\) and the only function \(\psi_{j}^{i}\) that does not vanish on \(c_{P_{i}}\). Note that such a function is the function \(\varphi_{i}\) defined in (7).