Hello I'm not quite sure which grid functions to use to be able to stitch two grids together. What I would like to do is a hybrid of two of your grid generation examples. Basically I want to make a grid similar to the flow over a cylinder benchmark
but I want to make the grid around the circle with gridgen like the rectangle with circular hole from
I'm interested in doing this because I have multiple staggered cylinders so it would be very difficult for me to use holegrid multiple times and get them to all line up. So my thought was to have a coarse quad mesh for the inlet and outlet and a fine triangle mesh in between all of the cylinders.
All of the structured grid examples use gridmerge to merge the two grids, but the grids have to be lined up for it to work. So everything is setup carefully to match. When gridgen is used the grid is unstructured so I don't know where the vertexes on the boundary will be ahead of time. So my question is how do I get the points on the boundary of one grid so I can use gridgen to force those points to be in the next grid that I would like to merge?
I have attached a simplified version of what I am hoping to accomplish:GridExample.m
Unfortunately, FEATool does not yet support mixing mesh element types (triangles and quadrilaterals, hex and tets etc) but you can use either all quads, or the quad2tri/hex2tet functions to convert a quadrilateral grid to a simplex one. After that it should be fairly straightforward to find the grid point coordinates on edges to join, and use them with rectgrid to create matching grids. And use the findbdr function to find the boundary numbers used by gridmerge . If I have correctly understood what you want to achieve the code example below should give you an idea how one might go about it:
Thank you for the help. I'm going to try the triangle mesh using gridgen2d first instead of the quad mesh. I'll see how it goes. Oh if anyone else finds this useful there was a typo in the proposed solution.
% Create and merge right/outlet grid.
xmax = max(grid1.p(2,:));
xmax = max(grid1.p(1,:));
It worked because the example middle grid was a square.
Ok I got the mesh setup, but when I try to solve the OpenFOAM button on the GUI is grayed out. If I use the GUI to mesh it again then I can use OpenFOAM solver from the GUI again. I have a feeling there is some sort of problem related to the fact that the grid now has 3 subdomains, but the geometry doesn't. There should only be one subdomain. I tried adding two rectangles, so there were three geometry objects, and I also tried adding the two rectangles to the existing geometry, but even though the geometry shows one object and the boundary mode doesn't show internal boundaries for where the rectangles meet the grid statistics still show 3 subdomains.
So my question is how can I find out why the OpenFOAM button is grayed out, and how do I change the grid so there is only 1 subdomain?
Geometries are only used to help generate a mesh, so after you have a mesh the geometry generally does not matter any more (but may be used to visualize some geometry boundaries in some cases such as 3D).
External solvers will not be available/selectable if all valid conditions are not met. In this case, OpenFOAM only supports meshes and problems with a single subdomain. It should probably be enough by simply setting all entries in the vector of cell subdomain indices to "1", with: