Integrating part of a cylindrical domain

I have my code ready and running. The domain was also fixed in here by Dokken actually. Here is the mesh that I am using to solve my current problem:

Now I am trying to integrate right-half of the domain. I think I’ve done that but the numerical and the plot results does not make sense to me when I run my code.

I would like to ask if this is the right way to integrate that right-half of the domain:

region = AutoSubDomain(lambda x: pow(x[0],2)+pow(x[1],2)>=pow(r_in,2)+.01 and pow(x[0],2)+pow(x[1],2)<=pow(r_out,2)-.01 and x[0]>=0)
region.mark(mf, 1)
dx_sub = Measure('dx', subdomain_data=mf)
        
u_tot = assemble(u*dx_sub(1))

I would strongly suggest that you write your subdomain to file, i.e. write mf to file and visualize it in Paraview. Then you can see what part of the domain you have marked.

1 Like