NIntegrate over the surface of a 3D mesh

I have been trying to integrate over a surface of a 3D Mesh. The sample code looks like this

l0 = 0.1;
COD = 0.2;
X1 = 0.0;
Y1 = 0.0;
Z1 = 0.0;
X2 = 1.0;
Y2 = 8.0;
Z2 = 1.0;
Ymid = 0.5 (Y2 + Y1);
reg1=Rectangle[{X1,Y1},{X2,Y2}];
reg3=RegionDifference[reg1,reg2];
reg4=RegionProduct[reg3,Line[{{Z1},{Z2}}]];
elVol =5(l0/2)^3/(6\[Sqrt]2);
MeshIn = ToElementMesh[reg4, MaxCellMeasure -> {"Volume" -> 0.0125},
"MeshOrder" -> 1,
MeshRefinementFunction ->
Function[{vertices, Vol},
Block[{x, y, z, tol}, {x, y, z} = Mean[vertices]; tol = 0.05;
If[y < Ymid + tol && y > Ymid - tol && x > aDim - tol ,
Vol > elVol, Vol > 5]]]]


I want to integrate a function

f[x_,y_,z_] = x y^2 + z^2;


over the surface x = 1. I can directly integrate using the command

NIntegrate[f[x,y,z],{y,0,8},{z,0,1}];


Is it possible to integrate over the finite element mesh using something like this

NIntegrate[f[x,y,z], {x, y, z} \[Element] MeshIn]


and I also want to choose x = 1. I need this because i want to integrate the finite element solution which is a global interpolation function over the surface of the mesh. I would appreciate any help in this regard.

Thanks

• what is the value for COD? Apr 24, 2018 at 18:26
• @JoséAntonioDíazNavas my apologies i missed it. I have edited my question now. Apr 24, 2018 at 19:06
• I get compile messages. I'd fix those since I assume the resulting mesh is not what you want otherwise. Apr 25, 2018 at 7:06
• @user21 I am sorry for the sloppy posting. The mesh generation works now. Apr 25, 2018 at 19:29

You could use:

NIntegrate[f[1, y, z], {x, y, z} \[Element] MeshIn]
172.063

• Thank you, this works correctly. Apr 25, 2018 at 19:33