Assigning Boundary Marker when merging meshes

More
2 years 3 weeks ago #4525 by tommaso
Starting from the tutorial exemple  Working with meshes  for creating a volume mesh from two surface meshes (a cube and a sphere), I would like to mark a specific sub-surface of one of the surfaces, let's say one face of the cube, in order to have a Boundary Marker to be used in a FEM equation.

How should the tutorial exemple be modified to do so?

Thanks for your help
More
2 years 2 weeks ago - 2 years 2 weeks ago #4528 by tommaso
Always keeping in mind the tutorial exemple Working with meshes , but beeing a bit more specific, let's say I want to assign a custom boundary condition name to one of the square faces of the first mesh. What I would do is :
Code:
geo1 = CSGeometry() geo1.Add (OrthoBrick( Pnt(0,0,0), Pnt(1,1,1) )) m1 = geo1.GenerateMesh (maxh=0.1) m1.SetBCName(0, 'face1')


So that, its FaceDescriptors will look like:
Code:
[surfnr = 0, domin = 1, domout = 0, tlosurf = 0, bcprop = 1, bcname = face1, domin_sing = 0, domout_sing = 0, colour = (0, 1, 0, 1),  surfnr = 4, domin = 1, domout = 0, tlosurf = 0, bcprop = 2, bcname = default, domin_sing = 0, domout_sing = 0, colour = (0, 1, 0, 1),  surfnr = 3, domin = 1, domout = 0, tlosurf = 0, bcprop = 3, bcname = default, domin_sing = 0, domout_sing = 0, colour = (0, 1, 0, 1),  surfnr = 5, domin = 1, domout = 0, tlosurf = 0, bcprop = 4, bcname = default, domin_sing = 0, domout_sing = 0, colour = (0, 1, 0, 1),  surfnr = 1, domin = 1, domout = 0, tlosurf = 0, bcprop = 5, bcname = default, domin_sing = 0, domout_sing = 0, colour = (0, 1, 0, 1),  surfnr = 2, domin = 1, domout = 0, tlosurf = 0, bcprop = 6, bcname = default, domin_sing = 0, domout_sing = 0, colour = (0, 1, 0, 1)]


Now I want to merge the mesh of this object with the mesh m2 of a sphere to a new mesh, and keep the reference to this surface "face1" to the bounday condition names of the new mesh.

So I would create, in addiction to the FaceDescriptors associated with the two domanies, a FaceDescriptor for this surface like so:
Code:
fd_outside = mesh.Add (FaceDescriptor(bc=1,domin=1,surfnr=1)) fd_inside = mesh.Add (FaceDescriptor(bc=2,domin=2,domout=1,surfnr=2)) fd_face1 = mesh.Add (FaceDescriptor(bc=2,domin=2,domout=1,surfnr=3))


My question is: when coping all boundary points from first mesh to new mesh, how can I set the FaceDescriptor fd_face1 to only the surface elements which have the bcname=='face1' in the old mesh?
Thanks for your help.
Last edit: 2 years 2 weeks ago by tommaso.
Time to create page: 0.097 seconds