
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.
