Permalink
Browse files

Merge branch 'docu_dirichlet_update' into 'master'

update dirichlet how to docu to use bc names instead of indices

See merge request jschoeberl/ngsolve!304
  • Loading branch information...
JSchoeberl committed Feb 13, 2018
2 parents 2335f05 + 929ce94 commit 75958e73d61c592a6ae254afe18533f1d0220428
Showing with 4 additions and 11 deletions.
  1. +4 −11 docs/how_to/howto_dirichlet.rst
@@ -1,22 +1,15 @@
Setting inhomogeneous Dirichlet boundary conditions
=========================================================
A mesh stores boundary elements, which know the *bc* index given in the geometry.
The Dirichlet boundaries are given as a list of boundary condition indices to the finite element space:
A mesh stores boundary elements, which know the *bc* name given in the geometry.
The Dirichlet boundaries are given as a regular expression of these names to the finite element space:
.. code-block:: python
V = FESpace(mesh,order=3,dirichlet=[2,5])
V = FESpace(mesh,order=3,dirichlet="top|back")
u = GridFunction(V)
If bc-labels are used instead of numbers, the list of Dirichlet bc numbers can be generated as follows. Note that bc-nums are 1-based:
.. code-block:: python
bcnums = [ i+1 for i,bcname in enumerate(mesh.GetBoundaries()) if bcname in ["dir1", "dir2"] ]
The BitArray of free (i.e. unconstrained) dof numbers can be obtained via
.. code-block:: python
@@ -29,7 +22,7 @@ Inhomogeneous Dirichlet values are set via
.. code-block:: python
u.Set(x*y, BND)
u.Set(x*y, definedon=mesh.Boundaries("top|back"))
This function performs an element-wise L2 projection combined with arithmetic averaging of coupling dofs.

0 comments on commit 75958e7

Please sign in to comment.