Dear Lorenzo, This is the correct way of calculating such integrals both regarding the current and the integral of the multiplier (i.e. reaction force). Not sure why you get a NaN.
Look for example at line 220 of this indentation simulation: https://git.savannah.nongnu.org/cgit/getfem.git/tree/contrib/continuum_mechanics/plasticity_finite_strain_linear_hardening_tension_3D.py We do exactly the same for calculating the applied force. Just FYI, you can just provide the relevant model to gf.asm_generic() instead of 'V', 1, mf, dataV. Remark, for debugging purposes you can use the Print function in GWFL, try e.g. '-sigma*Print(Grad_V).Normal or '-sigma*Print(Grad_V.Normal)' to see the values of the respective quantities at each integration point. Best regards Kostas On Thu, Oct 28, 2021 at 6:38 PM Lorenzo Ferro <lorenzo.i...@gmail.com> wrote: > Dear All, > > I tried to calculate the electrical flow through a mesh region, > like \int_{\Gamma} F(x)\cdot n\ d\sigma. > After some trials I found a working way by means of "gf.asm_generic", see > the code here below: > > Electrical _current = gf.asm_generic(mim, 0, '-sigma*Grad_V.Normal', > MeshRegion, 'V', 1, mf, dataV) > > Question_1: is this method correct or is there any other way to perform > this kind of calculation? > > Then, since it is a calculation performed on a Dirichlet region, I > wanted to do the same calculation integrating the Lagrange multiplier. I > tried the same technique but the result of the integration is NaN, probably > because the multiplier variable has less DOF than MeshFem. > > Question_2: How can I perform this integration? > > Thank you in advance. > Lorenzo >