Hi, if I have the following bilinear form:
a = (\nabla u,\nabla v)+\int_c \nabla u\cdot\pmb{n}v\ {\rm d}S
where c is part of the boundary, but not the whole boundary, is it possible?
In the following case, c is the boundary of the internal hole in the center.
Does any one have any idea regarding me problem?
Thanks in advance.
dokken
February 18, 2025, 9:59am
2
When you say edge, do you mean a set of triangular facets or actual edges (i.e. 1D lines)?
If you mean facets, this is covered in some tutorials (search for subdomain_id)
(Test problem 2: Flow past a cylinder (DFG 2D-3 benchmark) — FEniCSx tutorial ,
Coupling PDEs of multiple dimensions — FEniCS Workshop )
I think the facet is enough, now I use ds, but it seems that it is compuing the intergral on the whole bounday, including the outer eadg
dokken
February 18, 2025, 10:08am
4
You need to restrict it via a meshtag object, where you mark the entities you want to integrate over with a given value, that you then pass to the integral measure ds
through subdomain_id
.
Should I do something like:
inner_facets = mesh.locate_entities_boundary(msh, 1, boundary_marker)
facet_tags = mesh.meshtags(msh, 1, inner_facets, np.full(len(inner_facets), 1))
ds = ufl.Measure("ds", domain=msh, subdomain_data=inner_facets, subdomain_id=facet_tags)
dokken
February 18, 2025, 12:47pm
6
WjjSteve:
inner_facets = mesh.locate_entities_boundary(msh, 1, boundary_marker)
facet_tags = mesh.meshtags(msh, 1, inner_facets, np.full(len(inner_facets), 1))
ds = ufl.Measure("ds", domain=msh, subdomain_data=inner_facets, subdomain_id=facet_tags)
It should be like
marker_value = 33
inner_facets = mesh.locate_entities_boundary(msh, 1, boundary_marker)
facet_tags = mesh.meshtags(msh, 1, inner_facets, np.full(len(inner_facets), marker_value, dtype=np.int32))
ds = ufl.Measure("ds", domain=msh, subdomain_data=facet_tags, subdomain_id=marker_value)
OK now I solve it, thanks!