Mesh
GoalsIn this tutorial, we show how to use the different meshers of ISSM:
Go to Squaremesh
Usage>> md=model;
>> md=squaremesh(md,100,200,15,25);
ExampleThe previous command creates the mesh shown below: >> plotmodel(md,'data','mesh');
Roundmesh
Usage>> md=roundmesh(model,100,10);
ExampleThe previous command creates the mesh shown below: >> plotmodel(md,'data','mesh');
Triangle
Usage>> md=triangle(model,'Square.exp',.2);
The previous command creates the following mesh: >> plotmodel(md,'data','mesh');
You can change the resolution from BamgBAMG stands for Bidimensional Anisotropic Mesh Generator. It has been developed by Frederic Hecht, and was released in 2006 after more than 10 years of development. It is now part of FreeFEM++. The algorithm that is available on ISSM is inspired from this original software but has been entirely rewritten. Usage>> md=bamg(model,...);
Uniform meshTo create a non-uniform mesh, use the following options:
>> md=bamg(model,'domain','Square.exp','hmax',.05);
The previous command will create the following mesh (use Note that the nodes are not as randomly distributed as Non-Uniform meshTo create a non-uniform mesh, use the following options:
In our example, >> md=model;
>> hvertices=[0.2;0.2;0.005;0.2];
>> md=bamg(md,'domain','Square.exp','hvertices',hvertices);
Use the Mesh adaptationWe can use observations to generate a mesh that is adapted to the solution we are trying to model. Given a solution field, For a first example, we are going to use the observations given by the function First, we generate a simple uniform mesh. We interpolate the observations on the vertices of this mesh: >> md=bamg(model,'domain','Square.exp','hmax',.05);
>> vel=shock(md.mesh.x,md.mesh.y);
>> plotmodel(md,'data',vel,'edgecolor','w');
With a simple uniform mesh, the discontinuity is not captured. It is best to start with a finer mesh, which captures the discontinuity rather well, and interpolate the observations on this finer mesh to adapt the mesh anisotropically. >> md=bamg(model,'domain','Square.exp','hmax',.005);
>> vel=shock(md.mesh.x,md.mesh.y);
Now, we call
>> md=bamg(md,'field',vel,'err',0.05,'hmin',0.005,'hmax',0.3);
>> vel=shock(md.mesh.x,md.mesh.y);
>> plotmodel(md,'data',vel,'edgecolor','w');
You can change the option >> md=bamg(model,'domain','Square.exp','hmax',.005);
>> vel=shock(md.mesh.x,md.mesh.y);
>> md=bamg(md,'field',vel,'err',0.03,'hmin',0.005,'hmax',0.3,'gradation',3);
>> vel=shock(md.mesh.x,md.mesh.y);
>> plotmodel(md,'data',vel,'edgecolor','w');
We can also force the triangles to be equilateral by using the >> md=bamg(model,'domain','Square.exp','hmax',.005);
>> vel=shock(md.mesh.x,md.mesh.y);
>> md=bamg(md,'field',vel,'err',0.03,'hmin',0.005,'hmax',0.3,'gradation',1.3,'anisomax',1);
>> vel=shock(md.mesh.x,md.mesh.y);
>> plotmodel(md,'data',vel,'edgecolor','w');
You can also try to refine a mesh using the function Mesh refinement in a specific regionIt is sometimes necessary to specify a mesh resolution for an area of interest. We will use the same example as before. The first step consists of creating an ARGUS file that defines the region where we want to refine the mesh. We first plot >> plotmodel(md,'data',vel,'edgecolor','w');
>> exptool('refinement.exp')
Now, we are going to create a vector that specifies, for each vertex of the existing mesh, the resolution of the adapted mesh. We use >> h=NaN*ones(md.mesh.numberofvertices,1);
>> in=ContourToNodes(md.mesh.x,md.mesh.y,'refinement.exp',1);
>> h(find(in))=0.02;
>> plotmodel(md,'data',in,'edgecolor','w');
You will see that all the vertices that are in Now, we call >> vel=shock(md.mesh.x,md.mesh.y);
>> md=bamg(md,'field',vel,'err',0.03,'hmin',0.005,'hmax',0.3,'hVertices',h);
>> vel=shock(md.mesh.x,md.mesh.y);
>> plotmodel(md,'data',vel,'edgecolor','w');
Another exampleIf you would like to try another example, you can use the function |