# examples/diffusion/poisson.py null von Neumann conditions

129 views

### David Libault

Aug 29, 2012, 4:04:03 AM8/29/12
Hi !

I could install sfepy and run the examples wihout any issue so far. Congratulations !

In the "examples/diffusion/poisson.py" example, the Dirichlet conditions are explicitly specified on the "Gamma_Left" and "Gamma_Right" regions, but the Von Neumann boundary conditions (grad(T).n = 0) on "all other" surfaces are not specified although the solution does complies with them...

How is this working ? Are the "0 Von Neumann conditions" implicit in that case ? What am I missing ?

David.

Aug 29, 2012, 5:27:20 AM8/29/12
Hi David!
The Dirichlet boundary conditions are associated with the nodal values,
but the Von Neumann conditions are specified by boundary integrals (in
the week form), so the "zero integrals" corresponding to the "0 Von
Neumann" conditions vanish.

Regards

>
> David.
>
> --
> You received this message because you are subscribed to the Google
> Groups "sfepy-devel" group.
> To view this discussion on the web visit
> To post to this group, send email to sfepy...@googlegroups.com.
> To unsubscribe from this group, send email to
> For more options, visit this group at

### Alec Kalinin

Aug 29, 2012, 5:35:45 AM8/29/12
Hello,

My understanding is following. The general Poission problem is (I will use LaTeX notations for the math):
$$\Delta t = f(x), x \in \Omega.$$
$$t(x) = u(x), x \in \Gamma_D,$$
$$\frac{\parial t(x)}{\partial n} = g(x), x \in Gamma_N,$$
where $t$ is the unknown function to be found, $f(x)$, $u(x)$, $g(x) is the known functions,$\Gamma_D$is the part of the surface with Dirichlet boundary conditions,$Gamma_N$is the part of the surface with the Neumann boundary conditions. The weak form of this problem is: $$\iint_limits{\Omega} \nabla t \nabla v \, dV - \iint_limits{\Gamma_n} g v \, dS + \iint_limits{\Omega} f v \, dV = 0, v \in V_0,$$ where$v$is the test function that is equal to zero on the domain boundary. There are two key moments in this formulation: 1. There are no integral on the Dirichlet part of the surface, because the test function in equals to zero on this part. To apply the Dirichlet conditions there are two known methods: penalty and substitution (the direct row/column modification with known data). I think SfePy uses the substitution method. 2. To apply the Neumann boundary conditions we need to add new integral term on Neumann part of the surface. And now go back to the "examples/diffusion/poisson.py". In this problem the$\Gamma_Left$and$\Gama_Right" is the Dirichlet part of the boundary, other part is the Neumann part of the boundary.

In the equation there are only one term:
$$\iint_limits{\Omega} \nabla t \nabla v \, dV$$

It means that the $f(x) = 0$ and the $g(x) = 0$ -- Neumann boundary conditions also equals to zero.

If we need to apply non zero Neumann boundary condition we need to add new term -- the integral on the Neumann part of the surface.

Alexander.

### Robert Cimrman

Aug 29, 2012, 5:43:21 AM8/29/12
Thank you, Alec, for the nice explanation (we could add this to the docs?). I
will just add, that the term needed for non-zero Neumann conditions (or fluxes)
is dw_surface_ndot - see the example posted in the discussion .

>
> On Wednesday, August 29, 2012 12:04:03 PM UTC+4, David Libault wrote:
>>
>> Hi !
>>
>> I could install sfepy and run the examples wihout any issue so far.
>> Congratulations !

Thanks, I am glad to hear that!

>> In the "examples/diffusion/poisson.py" example, the Dirichlet conditions
>> are explicitly specified on the "Gamma_Left" and "Gamma_Right" regions, but
>> the Von Neumann boundary conditions (grad(T).n = 0) on "all other" surfaces
>> are not specified although the solution does complies with them...
>>
>> How is this working ? Are the "0 Von Neumann conditions" implicit in that
>> case ? What am I missing ?
>>
>> David.
>>
>

Cheers,
r.

### David Libault

Aug 29, 2012, 6:13:34 AM8/29/12
Alexander,

I think I understand how we get from the Laplace equation to its "weak form" as explained in the wikipedia article (http://en.wikipedia.org/wiki/Finite_element_method - integration by parts), but what I don't get is how the Von Neumann condition appears as a new term in the "weak form" as it is not in the Laplace equation...

Regards,

David.

### Robert Cimrman

Aug 29, 2012, 7:30:26 AM8/29/12
Hi David,

a modified version of the Poisson example that shows what you want is attached
to the thread I linked in my previous e-mail. To sum it up: modify the
equations as follows:

equations = {
'Temperature' : """dw_laplace.i1.Omega( coef.val, s, t )
= dw_surface_ndot.2.Gamma(coef.c, s)"""
}

and add the "c" coefficient to the materials:

material_2 = {
'name' : 'coef',
'values' : {'val' : 1.0,
'c' : nm.array([[0.0], [0.0], [40.0]])},
}

Does it help?

r.

### David Libault

Aug 29, 2012, 7:51:07 AM8/29/12
Hi Robert,

Yes it does. Thank you. Although as a user with little FEA background, as the poisson.py example is now, I would tend to use it with c=0 for the "null Von Neumann boundary conditions" which (if it works at all) is probably overkill...
IMHO, it would help to explain in the tutorial that the second term can (or should) be omited for surfaces where "null Von Neumann boundary conditions" are set.

David.

### Robert Cimrman

Aug 29, 2012, 8:02:08 AM8/29/12
Hi David,

Yes, it's a good idea to have an example with the general situation, together
with description of this in the tutorial. I have added a new issue , so that
it is not forgotten, as I will be spending the first two weeks of September by
traveling to various conferences. I labeled it as "EasyToFix", hinting that
contributions by anyone are welcome. :)

Best regards,
r.

 https://github.com/sfepy/sfepy/issues/195