Hi,

Is there a way to define inhomogeneous dirichlet boundary conditions per boundray node or as function depending on an arc length parameter starting at some specified boundary node? I want to use it for non trivial meshes with complex shaped boundaries.

I found examples to define constant boundary conditions or as an expression depending on x and y (gfu.Set(expr_x_y, BND)). But there seems to be no arc length parameter for expressions e.g. gfu.Set(expr_s, BND). I could just set the vector values of the corresponding grid function manually, but I did not find any accessible correspondence to know were each vector index is located in x,y space to select the correct values for each boundary node and interpolate in between.

Thanks,

Lars

In the meantime I found a partial solution: The first degrees of freedom of a gridfunction even for higher orders are sorted in a way that each node position of the mesh directly corresponds to the same index in the gridfunction vector data. So now I can use a linear interpolation of the boundary values by setting each boundary node value in the degrees of freedom manually via numpy array access. If I prepare a list of contour indices beforehand I can do:

arr = gfu.vec.FV().NumPy()

arr[:] = 0.

for index, boundarynodevalues in dirichlet:

nodeindices = contourind[index]

arr[nodeindices] = boundarynodevalues

However, this completely ignores the curvature for higher order elements. Unfortunately, even if I find out the number of the corresponding degrees of freedom for each boundary element with

gfu.space.GetDofNrs(ElementId(BND, elementnumber))

these degrees of freedom do not represent simple interpolation points, were a simple setting of function values at this position would help.

Is there some function reference documentation that I somehow missed somewhere? There are many comprehensive tutorials that really get you the first steps along the way, but if you want to modify some details, it becomes hard to understand all the parameters precisely. Also I did not find much information about the c++ code to understand what all the pybind11 functions are wrapping.

Hi Lars,

to interpolate functions with high accuracy, you should use the gf.Set(…) method.

You like to give your Dirichlet data parameterized by arc-length. The arc-legnth is special information, which is not available for arbitrary meshes, and does not make sense in 3D.

For special geometries, you can compute the arc-length by hand, or maybe you can use NGSolve to solve an ode at the boundary.

You can interpolate your boundary data either by a B-spline (1D), or by a VoxelCoefficientFunction (1D,2D,3D), and then use it like

```
mys = arctan2 (x,y)
bspline = BSpline( pntlist, datalist )
gfu.Set (bspline(mys), BND)
```

Joachim