## Simple surface integration

General discussions about how to formulate a script for FlexPDE.

### Simple surface integration

Dear colleagues,

I have a question concerning surface integration.
It is a simple model: 3 cubes one over another. The middle cube is polled (a polarisation vector(0,0,1) is assigned) and should produce charges on surfaces which are equal to a normal component of the polarisation.

To calculate a total charge on each surface I want to integrate through the surfaces the normal component of the polarisation.
I expect to get values 1 and -1 for these integrals on the top and bottom surfaces of the cube.

In the manual book I found three different ways to integrate. I used all of them and have following questions:
1) SURF_INTEGRAL ( integrand, surface, region ) - gives a value for a down surface but not for the upper surface as well as SURF_INTEGRAL ( integrand, surface, region, layer ) does. Why is it so?
2) SURF_INTEGRAL ( integrand, surface) - gives values both for down and upper surfaces but reduced by factor 2. What is the reason?

I am sorry for such a question, but what is the difference between all this three ways of integration and how finally calculate integrals both on down and upper surfaces?

Thank you for your support, it is always useful,
Ruben

Please find my script attached below.
Attachments
cube.pde
Ruben

Posts: 11
Joined: Fri Feb 12, 2016 3:38 am

### Re: Simple surface integration

I'm not sure the way you have done it can't be made to work somehow, but it does violate the rules of domain definition by which FlexPDE operates.
All three of your Regions in fact describe the same region, so the later definitions over-ride and hide the earlier ones. This will affect the way integrals are computed on the interface surfaces, and without digging into the code, I don't know how this construction will be treated.

A better approach is to follow the 3D construction rules and see if that doesn't cure your problems.
See Technical Notes->Extrusions in 3D for a discussion of how FlexPDE will interpret your definitions.
In the attached script, I have modified your script to standard form. The results are:
cube.png (3.47 KB) Viewed 1021 times
.
Attachments
cube_1.pde
moderator

Posts: 722
Joined: Tue Jan 11, 2011 1:45 pm

### Re: Simple surface integration

Thanks,

it was very useful. I will change the code and continue further investigation.

Best,
Ruben
Ruben

Posts: 11
Joined: Fri Feb 12, 2016 3:38 am