# Mshmet and mmg3d

Hello
Sorry to bother you . In freefem++, mshmet is used to generate metric matrix, and then mmg3d is used to generate three-dimensional meshes of various anisotropy. Can we use our own metric matrix and mmg3d to generate 3D anisotropic meshes without using the metric matrix generated by mshmet?
Thank you !

Yes. using Mmg3d only and put your individual metric array into the parameter `metric=...` of `mmg3d`.

Ok,thank you very much.

Hello
I would like to ask you what parameters need to be adjusted to use our own metric matrix and mmg3d to generate three-dimensional anisotropic meshes? I used my own metric matrix and found that there was no change in the grid.
Thank you!

You can adjust `hmin` and `hmax`, `hgrad` is used in controlling the ratio between two adjacent edges, and `hausd` is used in approximation of boundaries (for details, ref. https://www.mmgtools.org). Of course, before doing this, you also need to check whether the individual metric array is input correctly.

Hello
This is the metric array “metric_n11” I calculated.
metric_n11.zip (48.1 KB)

My parameter settings are as follows:
fespace Mh(Th,[P1,P1,P1,P1,P1,P1]);
Mh [n11,n21,n22,n31,n32,n33];
[n11,n21,n22,n31,n32,n33]=[0,0,0,0,0,0];
n11 =[m11,m12,m22,m13,m23,m33];
But the anisotropic mesh is not generated .Is there a problem with the metric array I calculated, or with the parameter setting?
Thank you very much.

`[n11,n21,n22,n31,n32,n33]=[0,0,0,0,0,0];`
`n11[] = [m11[], m12[], m22[], m23[], m33[]];`

Note that it’s incorrect. Correct code is as follows:

``````[n11, n21, n22, n31, n32, n33] = [m11, m12, m22, m13, m23, m33];
``````

``````n11[] = [m11[][0], m12[][0], ..., m33[][0],
m11[][1], m12[][1], ..., m33[][1],
...,
m11[][Th.nv-1], m12[][Th.nv-1], ..., m33[][Th.nv-1]];
``````

if your `m11, m12, m22, m13, m23, m33` are finite element functions.

When I use
[n11, n21, n22, n31, n32, n33] = [m11, m12, m22, m13, m23, m33];
Cutting the L-shape domain and check its interior to see if the grid changes, if the singularity of the solution is inside the domain. Otherwise, checking individual metric or adjusting `hmin` and `hmax`. In addition, your metric input should be `metric=n11[]`.