How can I integrate along a surface/edge within the domain? Can I tag the surface/edge with an ID?

47 views
Skip to first unread message

Abbas

unread,
Nov 29, 2022, 1:08:57 AM11/29/22
to deal.II User Group
Hello, 

As per the screenshot below, I created and imported a mesh using gmsh, with two material IDs. I want to integrate on the edge that separate the two materials for my weak form. I tried tagging the internal edge with an ID in gmsh to loop on it, but of course dealii throws an error saying that I cannot tag an internal edge with an ID.     

How can I integrate on an arbitrary edge like this one? 
Screenshot from 2022-11-29 08-02-03.png

Wolfgang Bangerth

unread,
Nov 29, 2022, 11:45:33 AM11/29/22
to dea...@googlegroups.com
On 11/28/22 23:08, Abbas wrote:
>
> As per the screenshot below, I created and imported a mesh using gmsh, with
> two material IDs. I want to integrate on the edge that separate the two
> materials for my weak form. I tried tagging the internal edge with an ID in
> gmsh to loop on it, but of course dealii throws an error saying that I cannot
> tag an internal edge with an ID.

If you have marked the cells of the two sub-domains with different
material_ids, then you can mark faces as follows:

for (const auto &cell : triangulation.active_cell_iterators())
for (const unsigned int face : cell->face_indices())
if ((cell->face()->at_boundary() == false)
&&
(cell->material_id() != cell->neighbor(face)->material_id()))
cell->face(f)->set_user_flag();
else
cell->face(f)->clear_user_flag();

Then you know that if a face has its user flag set that you need to integrate
over it.

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/


Abbas Ballout

unread,
Dec 3, 2022, 9:44:06 AM12/3/22
to dea...@googlegroups.com
Thank you.This works.
 For anyone seeing this in the future, change "int face" to "int f" in the for loop.  
Reply all
Reply to author
Forward
0 new messages