# complex-valued problem in XFEM

Dear developer,

I would like to solve some Helmholtz equations (complex-valued) with ngsxfem package (X-FEM) method.

As I know, the level set function is interpolated in real valued H1 FE space, but the solution of the Helmholtz problem is approximated in the complex H1 space such Vh = H1(mesh, order, complex=True). Thus, there will be some conflicts?
I was coding such a problem (for example modified the unf_interf_prob.py by Helmholtz equation in the demos) and I did not get the expected solution, so I am in doubt if ngsxfem is able to treat such a problem.

Another problem is in the ngsxfem, to integrate the Neumann BC on a specific boundary, we can not use the common symbol such f = g *v * ds(“left|right”) with the label of the boundary, we have to use dCut (Cut differential symbol ? If it is necessary, how can we define a specific boundary by dCut ?

Looking forward to your reply and thanks very much
Shaoqi

Hi Shaoqi,

dCut is a differential symbol to integrate over domains defined by a level set function. Depending on which domain_type (NEG,IF,POS) you give dCut, you will integrate over the region where the level set function is negative , zero or positive respectively. My guess is that with your ds(“left|right”) you are trying to integrate on a mesh boundary rather than a level set interface, right? This then does not need any ngsxfem functionality.

Best wishes,
Henry

PS: Try to provide a minimal working example of any problems you have, since it it otherwise very difficult to answer questions.

Thanks for your reply, I fixed the problem !
It is due to the fact that my BCs was not well imposed.

Shaoqi

Hello,

Sorry to bother you, I have another question concerning the boundaries on the levelset domain.
I want to impose the BCs on each outer boundary separated by the level set function like BC1 and BC2 respectively in attached figure (a figure attached)
[attachment=undefined]bconlevelset.jpg[/attachment]

This kind of BCs can not be imposed directly by the label of the boundary since for example the top and bottom bc will be assigned with two different condition.
It seems that the dCut symbol have to be used to assign these two boundaries with NEG and POS label. I knew how to define the subdomain with dCut, but confused with this kind of “sub boundaries” .

Could you give me some hint, thanks !

Best
Shaoqi

Attachment: bconlevelset_2021-05-07.pdf

Hi Shaoqi,

as far as I am aware, integrating over the part of the mesh boundary where a given level set function is POS or NEG is currently not implemented.

Best wishes,
Henry

PS: There appears to have been a problem with your attachments.

Thanks for your reply !

I saw in some tutorial, we can use GetFacetsWithNeighborTypes(mesh,a=ci.GetElementsOfType(HASNEG),
b=ci.GetElementsOfType(IF))
to define some boundary, but I am not sure it works in my case.

I update the attachment.

Attachment: bconlevelset.pdf

Hi Shaoqi,

code like GetFacetsWithNeighborTypes(mesh, a=ci.GetElementsOfType(HASNEG), b=ci.GetElementsOfType(IF))
is used to mark element boundaries (facets) based on elements cut by the level set in the entire mesh for ghost-penalty stabilisation, which is then done over the entire marked facet.

Best wishes,
Henry

As a side note: If all you need is to define integrators on fixed parts of the boundary, another solution would be to define the split in the geometry, so that this is discretised by the mesh.
https://ngsolve.org/media/kunena/attachments/830/split_boundary.py

Attachment: split_boundary.py

Many thanks! Yes, that could be a solution, but kind of manually.
Cause we have a geometry cut by the interface defined with the level set, it is better we can get the boundaries’ info of the “new” geometry directly.
In other words, the geometry could be split automatically once we create the levelset domain.