Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

Integral on cut boundary

More
4 years 11 months ago - 4 years 11 months ago #1524 by noname
Hello everyone,

I have a cut boundary that I have created using level set function (I am using xfem extension of NGsolve). My domain is square and it has a circular cut boundary in it defined by x^2+y^2=0.5^2. After doing my calculations, I want to calculate flux over this circular cut boundary which means calculating a boundary integral. After my previous question I know how to calculate integrals on mesh boundaries but I do not know how to calculate on this cut boundary, I keep getting wrong results or zeros. Analogous to my previous question I tried,
Code:
n_ls = grad(level_set_p1)* (-1/grad(level_set_p1).Norm()) VH1= H1(mesh, order=2, dirichlet="wall|inlet|outlet") gradu00 = GridFunction(VH1) gradu01 = GridFunction(VH1) gradu10 = GridFunction(VH1) gradu11 = GridFunction(VH1) gradu00.Set(grad(u_h.components[0])[0]) gradu01.Set(grad(u_h.components[0])[1]) gradu10.Set(grad(u_h.components[1])[0]) gradu11.Set(grad(u_h.components[1])[1]) et = GridFunction(VH1) et.Set(CoefficientFunction(1.0), definedon=level_set_cut) flux_x = Integrate(levelset_domain = { "levelset" : level_set_p1, "domain_type" : IF}, cf=et*(gradu00*n_ls[0] + gradu01*n_ls[1]), mesh=mesh, order = order) flux_y = Integrate(levelset_domain = { "levelset" : level_set_p1, "domain_type" : IF}, cf=et*(gradu10*n_ls[0] + gradu11*n_ls[1]), mesh=mesh, order = order) print ("flux_x:", flux_x)
Last edit: 4 years 11 months ago by noname.
More
4 years 11 months ago #1525 by schruste
Replied by schruste on topic Integral on cut boundary
Hi noname!

Your snippet is not helping me to reproduce your problem. Could you please post a full example that is not working as planned?!

Best,
Christoph
Time to create page: 0.150 seconds