Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple Neumann boundary conditions per domain and provide a tutorial on this feature #31

Open
BenjaminRodenberg opened this issue Apr 10, 2019 · 4 comments
Milestone

Comments

@BenjaminRodenberg
Copy link
Member

Our adapter only supports a single Neumann boundary condition on the whole domain (see FEniCS tutorial book, p.85). We add g*ds in the weak form to implement Neumann boundary conditions.

To be able to support multiple Neumann boundary conditions (for example, one coupling boundary condition and one on the original boundary), we have to use markers to restrict the boundary integral to the respective subdomain. Pseudocode:

coupling_domain.mark(boundary_markers, 1)
F += g*ds(1)

For more information see FEniCS tutorial book, section 4.4

@BenjaminRodenberg
Copy link
Member Author

BenjaminRodenberg commented Oct 18, 2019

This feature is (at least partially) implemented in the current version of the adapter:

def create_coupling_neumann_boundary_condition(self, test_functions, boundary_marker=None):
"""Creates the coupling Neumann boundary conditions using
create_coupling_boundary_condition() method.
:return: expression in form of integral: g*v*ds. (see e.g. p. 83ff
Langtangen, Hans Petter, and Anders Logg. "Solving PDEs in Python The
FEniCS Tutorial Volume I." (2016).)
"""
self._function_space = test_functions.function_space()
self._create_coupling_boundary_condition()
if not boundary_marker: # there is only 1 Neumann-BC which is at the coupling boundary -> integration over whole boundary
return dot(test_functions, self._coupling_bc_expression) * dolfin.ds # this term has to be added to weak form to add a Neumann BC (see e.g. p. 83ff Langtangen, Hans Petter, and Anders Logg. "Solving PDEs in Python The FEniCS Tutorial Volume I." (2016).)
else: # For multiple Neumann BCs integration should only be performed over the respective domain.
# TODO: fix the problem here
raise Exception("Boundary markers are not implemented yet")
return dot(self._coupling_bc_expression, test_functions) * self.dss(boundary_marker)

However, I think we should also have an example, where one can see how to apply this feature. Something similar to https://fenicsproject.org/docs/dolfin/1.6.0/python/demo/documented/subdomains-poisson/python/documentation.html (link is broken, see below) would be nice.

@BenjaminRodenberg BenjaminRodenberg changed the title Support multiple Neumann boundary conditions per domain Support multiple Neumann boundary conditions per domain and provide a tutorial on this feature Nov 26, 2019
@BenjaminRodenberg
Copy link
Member Author

I just discovered that the link provided above seems to be broken. What I was referring to is the example in chapter 4.3 "Defining subdomains for different materials" in the FEniCS tutorials book.

@BenjaminRodenberg
Copy link
Member Author

The FEniCS-X version of this tutorial is provided at https://jorgensd.github.io/dolfinx-tutorial/chapter3/subdomains.html.

@arvedes
Copy link

arvedes commented Apr 6, 2022

I'm not sure if that really belongs here, but it seems somewhat related: Would it be possible to define a coupling boundary from an external mesh, as it is done here?
The main problem in more complex geometries is that I can't identify my coupling boundary using coordinates (e.g. x >= 1) but have to use tags (e.g. set it at nodes with tag=1) assigned in my meshing software (I use gmsh).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants