Implement 1D integral in 3D simulation

Sometimes in simulations, we would want to reduce the dimensionality of a domain. For example in grain boundary diffusion (see https://www.doi.org/10.1088/1361-651x/ab1624), when considering the effect of diffusion on the effectively 2D grain boundary, a weak form results in a 1D integral at the surface’s boundary. Even though the integral is 1D, it represents a 2D integral (same as int_2d f(x) dxdy = delta_y int_1d f(x)dx).

Professor François Bouchut in the thread https://community.freefem.org/t/effectively-1d-flux-boundary-condition-in-3d-simulation/3723 helped me implement such phenomena in a simplified scenario where the 1D integrals were manually calculated and added to the algebraic system. Due to the manual calculation of integrals, the solution is limited to simple cases. Utilizing the function int1D would help to implement advanced simulations involving similar phenomena, such as triple phase boundary source terms or 1D heat source and boundary in heat transfer.

This functionality is available in commercial software (I have checked COMSOL documentation), which could be an additional reason to implement it in FreeFEM.