I am planning a visualization of flows though Concave Bisymmetric hexagons with two mouths.
Example where the length of the side d1 equals the other length of the side d2:
which naming I discussed initially here about Irregular hexagons.
There is the standard Mesh tool where you can draw your own meshes but I would like have some standard library such that I can cooperate better with others with the flow simulations later. I did not find any Mesh library for Hexagons in MathCentral File Exchange here.
Is there any standard Mesh library for irregular hexagon shapes? I am open to any other languages too because I could read the code and convert it those standards to Matlab library.
I discussed this issue with my colleque. He motivates to create a triangle network but also points out general algorithms for nonconvex polygons.
assemmbly
and construct trimesh structures by inittri
f
is built by bilin_assembly
(because this worked before but not necessarily the optimal choice)Division of hexagon with two mouths into two trapezoids
The following syntaxes are based on my editions of codes in 2013 but mostly on descriptions of the book Numerical solutions of partial differential equations by the finite element method by Claes Johnson.
Syntax of assembly where considered now for simplicity a Poisson problem (must be later refined here)
% [S,f]=assemblyGlobal(loadfunction,mesh)
%
% loadfunction = function on the right-hand side of the Poisson equation
% mesh = mesh structure on which the assembly is done
%
% S = stiffness matrix of the Poisson problem
% f = load vector corresponding to loadfunction
where we need bilinear assembly which syntax
% function B=bilin_assembly(bilin,mesh)
%
% bilin = function handle to integrand of the bilinear form
% given as bilin(u,v,ux,uy,vx,vy,x,y), where
% u - values of function u
% v - values of function v
% ux - x-derivative of function u
% uy - y-derivative of function u
% vx - x-derivative of function v
% vy - y-derivative of function v
% x - global x-coordinate
% y - global y-coordinate
% mesh = mesh structure on which the matrix will be assembled
%
% B = matrix related to bilinear form bilin
Syntax to init triangular mesh
% function mesh = inittri(p,t)
%
% p = nodes
% t = triangles
%
% mesh = trimesh structure corresponding to (p,t)
%
% TRIMESH STRUCTURE :
%
% p = nodes in a 2xN-matrix
%
% t = triangles in a 3xN- matrix (nodes of the triangles as indeces to the p- matrix).
%
% edges = a matrix of all edges in the mesh. Each column is an edge :
% [n1 ; n2] where n1 < n2;
%
% t2e = a matrix connecting triangle's and edges's.
% Each column corresponds to a triangle and has
% triangle's edges in the order n1->n2, n2->n3,
% n1->n3.
%
% e2t = inverse of t2e.
I did no post the complete source codes here because of copyright issues and they would make the answer rather long. However, all algorithms are based on the first source so can be created by any researcher here. I think this kind of FEM method is the only way to find the optimum mesh here.
There are also algorithms which can create meshes for general nonconvex polygons. It is possible that the mesh provided by Margus' answer is produced by such an algorithm.
I was experiencing different products about visualizing holes, different geometries and different materials. Ansys is promising solution here.