Does boundary integral accumulate periodic boundary?

Hello, I am solving a periodic homogenization problem, where the domain looks like (a simplified version)

The dashed blue lines are my periodic boundaries, and red solid lines are Neumann boundary.
My question is after I solved my problem and get the solution, I want to compute some boundary integral with the solution:

int_s = assemble_scalar(some_function(mysolution) * ufl.ds)

So, does this integral accumulate values on periodic boundary?
This is not I want, since the periodic boundary are meant to connect each other, making them somehow the interior of the domain

Note that the solution is not automatically periodic. Values left/right, up/down will vary within the tolerance of the algorithm unless you explicitly impose periodicity. You can impose periodicity for instance with dolfinx_mpc, search this forum for examples.

In regards to your direct question, yes, ds will integrate over the entire boundary, including your periodic “internal” sections. To integrate only over the red boundary, you need to explicitly identify the two boundary domains (subdomains), red and blue (index 0 and 1, say), and then integrate (assemble) over ds(0) instead of ds.

cf. Setting multiple Dirichlet, Neumann, and Robin conditions — FEniCSx tutorial

I see, many thanks for your help!