![]() showGmsh with inputs the file name the type of file we want to read (e.g. We can easily see the mesh by calling the method. Howere before reading the mesh it is always a good practice to check the generated mesh. msh file for the domain we can bringing it in the Matlab workspace using the functions read_2D_Gmsh. In our example the mesh has been generated and written in the file simple_example.msh Postprocess MeshĪfter we generated the. Note that it is still possible to create mesh even if error messages appear. In the command window we can see the process of the mesh generation, warning and errors. Info : Meshing surface 1 (Plane, Delaunay) Info : 50 points found in points clouds (1 edges) Info : 2 points found in points clouds (0 edges) Info : Running '/usr/bin/gmsh simple_example.geo -2' Simple_dom.runGmsh( 'simple_example',gmsh_path,) runGmsh and then use an empty path gmsh_path= '/usr/bin/gmsh' Optionaly we can define the path explicitly in the method. There is also a third input which is currently on experimental stage and it is used to define the number of subdomains in case we want to split the domain into subdomains. The second argument is the path where the Gmsh executable is located. The first agrument of the method is the input file that was generated from the method. Note that the threshold options are written in an parametric format at the begining of the *.geo file so that one can change the options of the input file without having to recreate the file. This created the simple_example.geo file in the workspace folder. writegeo simple_dom.writegeo( 'simple_example',meshopt) So the options for the simple case are: meshopt The remaining default options are suitable for our case. Meshopt.embed_lines = 1 % we want to embed the lines into the mesh Meshopt.embed_points = 1 % we want to embed the points into the mesh Here we need to define meshopt.lc_gen = 200 % size of maximum element The function msim_mesh_options returns a structure with all options needed to run Gmsh meshopt=msim_mesh_options plotCSGobj: axis()īefore creating the input file for Gmsh we need to define few mesh options. Simple_dom=simple_dom.readshapefile(wells) Īnytime we can plot the contained geometry of the object using the method. simple_dom=simple_dom.readshapefile(riv) Using the same method we can import the river and the well structure into the CSG object. NOTE: The domain polygon must be the first polygon to be read readshapefile method as: simple_dom=simple_dom.readshapefile(dom) in command window or locate the cursor after the dot in a script and press TAB you will see a list of all available methods. Simple_dom is now an object which has the method. Features closer to the tolerance will be joined Npoints: the approximate number of points (it is used only for space allocation).Nline: the approximate number of lines (it is used only for space allocation).Npoly: is the number of polygons that describe the outline of the simulated domain,.Dim: is the dimension of the domain (2 is the only valid option).First we will create an empty object that will hold the geometry: simple_dom = CSGobj_v2(2,1,10,10,1) %Dim,Npoly,Nline,Npoints,usertol Next we need to create a Constructive Solid Geometry object that will describe the domain. Last we will create a similar structure for the wells: wells(1,1).Geometry = 'Point' Ĭreate Constructive Solid Geometry object For elements further than DistMin the maximum element size will increase linearly between the values LcMin and LcMax up to DistMax. In short here we request that the maximum element size will be LcMin for elements closer to DistMin from the line. Here we use the threshold attractor that requires the following properties: riv.DistMin = 50 Detailed explanation on the fields can be found on the Gmsh documetation (for example see the explanation t10.geo). ![]() Next we will create a structure that will hold the river riv.Geometry = 'Line' īecause we want to refine the mesh around the river we have to provide few additional fields that control the refinment. The direction of the polygon points it is not important, however in case of domains with holes it is very important that the first polygon in the structure is the domain outline. Note that it is necessary to include the nan at the end. Other valid entries that mSim understands are 'Line' and 'Point' dom.X = To generate the mesh we need a structure variable with at least the following fields dom.Geometry = 'Polygon' The shapefiles in Matlab are structure variables with fields. In addition we assume that there are two wells located at (844,1177) and (2356,2829) coordinates and a stream which is described by the line (2500,5000) - (5000,2500). In this example we will create a rectangular domain with size L = 5 km. Create Constructive Solid Geometry object.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |