kinnala / scikit-fem

Simple finite element assemblers
https://scikit-fem.readthedocs.io
BSD 3-Clause "New" or "Revised" License
512 stars 81 forks source link

Is the problem statement incorrect for example 13? #671

Closed cottrell closed 3 years ago

cottrell commented 3 years ago

The problem is stating that the the normal derivative of u on the curved boundaries is zero but I don't see that boundary condition being used anywhere explicitly in the code. Possible it is not needed or I am not understanding something.

https://github.com/kinnala/scikit-fem/blob/master/docs/examples/ex13.py#L64

kinnala commented 3 years ago

The boundary condition du/dn = 0, aka the Neumann condition, is implicit and automatic for this variational formulation.

cottrell commented 3 years ago

The boundary condition du/dn = 0, aka the Neumann condition, is implicit and automatic for this variational formulation.

Yes, but is there an example of how to set non-zero Neumann conditions elsewhere? I have not found it yet.

Maybe the assumption is you always transform to zero Neumann so you never need to implement the boundary derivative conditions?

If you have arbitrary derivative conditions on the boundary, I can't remember if that is always a trivial task to simply have some polynomial term in the solution and then let the mesh handle the rest.

cottrell commented 3 years ago

Ok, I think I remember that you can typically add some term that might or might not be in the null space of your differential operator. If not you carry some complexity into the forms.

gdmcbain commented 3 years ago

is there an example of how to set non-zero Neumann conditions elsewhere?

https://github.com/kinnala/scikit-fem/blob/d08af2a3f4607e28023656b1b6ad025b1a530aa1/docs/examples/ex28.py#L40

Maybe the assumption is you always transform to zero Neumann so you never need to implement the boundary derivative conditions?

Not exactly. In the finite element method (in general, thie isn't specific to scikit-fem) one integrates the laplacian conduction term by parts (a.k.a. applies Green's second theorem). This results in a domain term and a boundary term. The domain term is something skfem.models.poisson.laplace.

https://github.com/kinnala/scikit-fem/blob/d08af2a3f4607e28023656b1b6ad025b1a530aa1/docs/examples/ex28.py#L188

The boundary term involves the flux; if the boundary condition involves this flux, we call the boundary condition 'natural' or 'Neumann' and use it to eliminate the flux by expressing it in terms of the given Neumann data.

https://github.com/kinnala/scikit-fem/blob/d08af2a3f4607e28023656b1b6ad025b1a530aa1/docs/examples/ex28.py#L190

gdmcbain commented 3 years ago

For the integration by parts, see, e. g. https://en.wikipedia.org/wiki/Finite_element_method#The_weak_form_of_P1.

gdmcbain commented 3 years ago

a.k.a. applies Green's second theorem

A.k.a. https://en.wikipedia.org/wiki/Green%27s_identities#Green's_second_identity