# XFEM dirichlet bc

Hi,
I’m working with XFEM and I would assume, that the boundary conditions should also hold for u_x (not only for u_std).

With [code]Vh = H1(mesh, order=1, dim=mesh.dim, dirichlet=“left”)
Vhx = XFESpace(Vh,ci)
VhG = FESpace([Vh,Vhx])

freedofs = VhG.FreeDofs()
print(freedofs)[/code]

I get
0: 0110111111111000111111111111111111111

but when clearing the dofs by hand

VhGx, VhGy = VhG.components for w in mesh.vertices: if abs(w.point[0])<0.00001: for dof in VhG.GetDofNrs(w): freedofs.Clear(dof) freedofs.Clear(VhGx.ndof+dof) print(freedofs)

also the dofs in the u_x part are also cleared:
0: 0110111111111000111111111110010011111

Does XFEM work like this or is this maybe a bug?

BR,
Nepomuk

Dear Nepomuk,

In general it is not clear if you really want to prescribe Dirichlet boundary conditions on an XFEM variable. Note that the XFEM basis is special so that interpolation of the Dirichlet value is not obvious. Perhaps you can prescribe what you want to do. Do you have an interface crossing the domain boundary?

In short: Boundary values for XFEM values is not standard in the current implementation, but - depending on what you want to do - you can do this “manually”. Please help me out with you use case and I comment on this further.

Best,
Christoph

Hi Christoph,

I use XFEM to do topology optimization on a cantilever, fixed on the left (homogene dirichlet), weighted on the right (neuman data g at gamma_N). After some iterations the interface between inner and outer material crosses the left boundary and I wondered, why there is a deformation around the interface.

The second issue is, when assembling the r.h.s. ($$\int_{\Gamma_N} g\cdot v\ ds$$) assembling v_x*ds is not possible, what would be needed if the interface crosses also the weighted boundary part.

BR, Nepomuk

Hi Nepomuk,

So, in principle we support the case that you described and if the boundary elements are intersected the corresponding XFEM-Dofs should also be marked Dirichlet automatically. Can you perhaps add a small complete example, i.e. especially including level set function and geometry?

For the second issue: As of now we are not supporting the Integation-Symbol-notation ds/dx of NGSolve yet (due to some software interfacing problems that we haven’t really addressed yet), i.e. you should work with SymbolicLFI on the boundary to obtain the Robin-type boundary integrator.

Best,
Christoph

Hi Christoph,

Here’s my jupyter-file. I already tried with SymbolicLFI, I got a similar error…
Thanks for helping!

BR,Nepomuk

Attachment: XFEMTest.ipynb

Dear Nepomuk,

The Dirichlet-thing was a bug, actually two. This is now fixed in the current master on github.

The boundary integral thing is a missing feature. First of all, you need to switch to two integrals and corresponding neg/pos-evaluations. However, to make the boundary-evaluations we need boundary evaluators which are not implemented, admittedly. I will put this on the xfem-ToDo-List.

Best,
Christoph