PETSc : integrate surface

Dear all,

I would like to calculate a surface with “int2d” but I have fews issues to find the good keyword to not take the overlap

real Surf = int2d(Th3,1)( 1.0);

give the surface on each local mesh Th3

I try

mpiAllReduce(Surf,SurfSum,mpiCommWorld, mpiSUM);

but this is sum the element overlap.

Thank you in advance

You should either use the partition of unity or generate another mesh without ghost elements.

hi, thanks you for your answer.
In fact, I had tested the solution with a global mesh and integrating only with processor 0

if (mpirank == 0)
real SurfG = int2d(Th3Global,1)( 1. );

But I wanted to try with the partition of unity, and I didn’t know how to get started.

For my solution u, I huse the operator .D but for a real it didn’t works.

My objective is to calculate flows in a heat equation.

By operating on a global mesh, I get the right surface calculations. However, my flux calculation (function of dx(u)) is processor-dependent.
(moreover even with one processor, I didn’t have exactly the same flux at the output as that imposed in my boundary conditions.)
I’ve attached the code
231026_Exemple.edp (3.4 KB)

Thank you in advance

What is the issue in this script?

I impose a flow of 500,
for post-processing calculation with 1 processor

FluxGTh1 =int2d(Th3Global,101)(eKGlobal* (dy(sum))
FluxGTh1/SurfG = -495.749 [W]

and with 4 processors

FluxGTh1 =int2d(Th3Global,101)(eKGlobal* (dy(sum))
FluxGTh1/SurfG = -481.749 [W]

I don’t understand why the two calculations give differents results.

Use -pc_type lu and you’ll get the proper answer. In the beginning, there is no point in trying fancy preconditioners if you are not sure of what you are doing.

it works better that way. Thanks you