Trying to connect 2 plates with a rod failing in tetgen

I can post the code but maybe someone can suggest a sample that
does what I need. I have a 3d cube that contains two plates
( a parallel plate capacitor ). I want to connect the plates with a rod
running between them and thought if the surfaces touched the meshes
would merge but it seems to create a segfault as shown below. How should I connect
3D cubes together? Ultimately the 3 pieces will probably all be the same
lossy material and i will want a mesh inside them although right now just a
surface mesh and BC’s would be ok.

Thanks.

3D RemplissageSurf3D:: Vertex  triangle2  border 1830 3664 424
 tetgenio: vertex 
 tetgenio: facet 
tetgen: before tetrahedralize( , &in, &out);
numberof regions 4
numberof hole 0

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff128c970 in tetgenmesh::facet_ridge_vertex_adjacent(tetgenmesh::face*, double*) () from /home/ubuntu/dev/freefem/install2/lib/ff++/4.12/lib/mpi/tetgen.so
(gdb) bt
#0  0x00007ffff128c970 in tetgenmesh::facet_ridge_vertex_adjacent(tetgenmesh::face*, double*) () from /home/ubuntu/dev/freefem/install2/lib/ff++/4.12/lib/mpi/tetgen.so
#1  0x00007ffff128cd6b in tetgenmesh::create_a_shorter_edge(double*, double*) ()
   from /home/ubuntu/dev/freefem/install2/lib/ff++/4.12/lib/mpi/tetgen.so
#2  0x00007ffff129d78f in tetgenmesh::insertpoint(double*, tetgenmesh::triface*, tetgenmesh::face*, tetgenmesh::face*, tetgenmesh::insertvertexflags*) ()
   from /home/ubuntu/dev/freefem/install2/lib/ff++/4.12/lib/mpi/tetgen.so
#3  0x00007ffff12bf8db in tetgenmesh::recoversubfaces(tetgenmesh::arraypool*, int) ()
   from /home/ubuntu/dev/freefem/install2/lib/ff++/4.12/lib/mpi/tetgen.so
#4  0x00007ffff12c169a in tetgenmesh::recoverboundary(long&) ()
   from /home/ubuntu/dev/freefem/install2/lib/ff++/4.12/lib/mpi/tetgen.so
#5  0x00007ffff12d3d35 in tetrahedralize(tetgenbehavior*, tetgenio*, tetgenio*, tetgenio*, tetgenio*) ()
   from /home/ubuntu/dev/freefem/install2/lib/ff++/4.12/lib/mpi/tetgen.so
#6  0x00007ffff12d46a5 in tetrahedralize(char*, tetgenio*, tetgenio*, tetgenio*, tetgenio*) () from /home/ubuntu/dev/freefem/install2/lib/ff++/4.12/lib/mpi/tetgen.so
#7  0x00007ffff123a7de in RemplissageSurf3D_tetgen_new (
    switch_tetgen=switch_tetgen@entry=0x15c5800 "pqaAATTQ", ThS=..., 
    label_tet=@0x7fffffffb000: 0, nbhole=@0x7fffffffb004: 0, tabhole=0x15c3350, 
    nbregion=@0x7fffffffb008: 4, tabregion=0x1654680, nbfacecl=@0x7fffffffb00c: 0, 
    tabfacecl=0x151c5b0) at tetgen.cpp:1121
#8  0x00007ffff124e2f4 in Remplissage_Op::operator() (this=0x15c4800, 
    stack=0x1538320) at tetgen.cpp:1909
#9  0x0000000000aea3f1 in E_F_F0F0_<Fem2D::Mesh3 const**, Fem2D::Mesh3 const**, Fem2D::Mesh3 const*, E_F0>::operator() (this=0x15c4970, s=0x1538320) at AFunction.hpp:1122
#10 0x000000000095b284 in ListOfInst::operator() (this=0x153a900, s=0x1538320)
    at AFunction2.cpp:794
#11 0x00000000008d2f81 in CListOfInst::eval (this=0x7fffffffbba8, s=0x1538320)
    at ./../fflib/AFunction.hpp:1486
#12 lgparse () at lg.ypp:360
#13 0x00000000008d7bda in Compile () at lg.ypp:853
#14 0x00000000008d8604 in mainff (argc=2, argv=0x7fffffffd078) at lg.ypp:1027
#15 0x00007ffff5599840 in __libc_start_main (main=0x8c1480 <main(int, char**)>, 
    argc=2, argv=0x7fffffffd078, init=<optimized out>, fini=<optimized out>, 
    rtld_fini=<optimized out>, stack_end=0x7fffffffd068) at ../csu/libc-start.c:291
#16 0x00000000008c5209 in _start ()

You might consider using an alternative meshing software such as GMSH if you want to construct 3D meshes in nontrivial geometries. It is easy to import .mesh files to FreeFEM using load "gmsh" and then mesh3 Th3 = gmshload3(MESHFILENAME);

Thanks, I got tetgen with cgal now ( although I needed an older version
due to compiler and boost age ). The immediate concern was naming boundaries.
Will it be obvious how to name surfaces or regions that I can use in FreeFem solve?

I don’t expect geometries to get too complicated but if there is a way for touching
surfaces to “mesh” together then building up should be easy. In the meantime
I can look at drift and diffusion with reactions at a surface ( maybe an electrode or
blood coagulation around a nucleus). In these cases I would expect just a planar
interface between two regions although 3D may still be important as I expect
to model formation of porous solids of unknown shape. In these cases, I guess time
stepping is an option although doing FEM along the T direction may be interesting to
consider :slight_smile:

Thanks.

In 3D, the surfaces all retain their numbering in GMSH. So you can identify composite surfaces using int[int] surfacelabels = [1, 2, 5, ...]; I am not sure about how this works in TetGen.

So I downloaded an older GMSH bin and clicked on it and up came a GUI window lol.
I guess I could read the docs but I take it this is like a CAD or visual editor?
I was happy to see that CGAL made a big deal of “exact” math as earlier I was curious
about mesh generation on rational number coords while visual design
seems to go the other way :slight_smile:
Thanks. I’ll see how it goes while i was hoping to get a tractable text description of
the geometry ( rods and plates etc) this may be easier for now.

I guess I could read the docs but I take it this is like a CAD or visual editor?

I think reading the docs would be a good idea. :slight_smile:

GMSH has a GUI, but its utility comes from its scripting language. The GUI is useful for visualizing your mesh, but I don’t use it to actually create the mesh. You should create a .geo file for your geometry and go from there.