Computation of flux across a surface - issue with gmsh mesh

Dear FreeFem developers and users,
I’m here to ask a question on something that in principle should be very simple, but that is creating me an issue.

Imagine you have a toroidal geometry in which you want to compute the flux of a certain quantity on an arbitrary poloidal cross section.

To do that, I imagine, a surface representative of the section across which the flux must be computed should be added to the geometry (otherwise it is impossible to provide the reference label to command int2d command, isn’t it?). By the way doing that I get an error in the case in which the mesh is imported from gmsh (Err Border element not in mesh).

I am attaching here the simplest representative case I was able to think about.

The geometry is a simple torus in which a variable will be defined/computed. Imagine to have the necessity to compute the variable flux across one arbitrary poloidal cross section. Indeed a surface representative of the reference cross section is introduced in the geometry. See the attached .geo file to see how I have did it:

SetFactory('OpenCASCADE');

Geometry.OCCTargetUnit = "M";

Torus(1) = {0.0,0.0,0.0,10.0,1.5};

Rectangle(9999) = {0.0,0.0,-5.0,15.0,10.0};
Rotate{{1,0,0},{0.0,0.0,-5.0},Pi/2}{Surface{9999};Line{3:6};Point{2:5};}

BooleanIntersection{Volume{1};}{Surface{9999};Delete;}

MeshSize{:} = 0.25;

The obtained section labelled 9999 is those across which I want to compute the variable flux.

By the way if you try to upload in FreeFem the obtained mesh (see script below) what you get is the above mentioned error: Err Boundary element not in mesh.

load "msh3"

lockOrientation = false;
mesh3 Th = readmesh3("meshname.mesh");
lockOrientation = true;

plot(Th, wait = 1, cmm = "Volume mesh mesh");

The error is clearly generated by the presence of the additional surface on which some elements are defined, since if you upload a mesh of a torus without this additional surface no issue on mesh reading are detected. By the way in this case is, despite I’m missing some tricky points, impossible to compute the variable flux.

Hope to find out someone able to help me!

Thanks a lot for your cooperation

Yours,

Marco