I am trying to find error estimation based on weighted residual technique:
$$Q(e_h)=\sum_{k \in {\cal T}}\eta_k, $$ where $$\eta_k=\int_kR(z-v_h)d\Omega+\int_{\partial k}J(z-v_h)ds,$$ or in the weak form $$\eta_k=\int_k l(z-v_h)d\Omega+\int_k \nabla u_h.\nabla(z-v_h)d\Omega,$$ where $u_h$ is the solution of primal problem $a(u,v)=l(v),$ and $z$ is the solution of the dual problem $a(z,v)=Q(v),$ also $Q(v)=|\Omega|^{(-1)}(1,v),$ where $v$ is the test function. Moreover $R$ and $J$ are residual and jump respectively. Using approximation $z_h=\sum_i \phi_i*z_i$ (instead of z) at Gaussian quadrature point leads to a scalar where using $\phi$ as test function at any point gives a vector, but $(z-v_h)$ should be a scalar not a vector. How can I solve this problem?