def createMesh(self, depth=None, quality=34.3, paraDX=0.5, boundary=0, paraBoundary=5, apply=True, **kwargs): """Create (inversion) mesh using createParaDomain2D Parameters ---------- apply : bool set Mesh property of the underlying forward operator """ if self.dataContainer is None: raise('Cannot create mesh without dataContainer.') if depth is None: depth = self.getDepth() self.poly = createParaMeshPLC(self.dataContainer.sensorPositions(), paraDepth=depth, paraDX=paraDX, paraBoundary=paraBoundary, boundary=boundary) mesh = createMesh(self.poly, quality=quality, smooth=(1, 10)) if apply: self.setMesh(mesh) return mesh
def createMesh(self, depth=None, quality=34.3, paraDX=0.5, boundary=0, paraBoundary=5, apply=True, **kwargs): """Create (inversion) mesh using createParaDomain2D Parameters ---------- apply : bool set Mesh property of the underlying forward operator """ if self.dataContainer is None: raise BaseException('Cannot create mesh without dataContainer.') if depth is None: depth = self.getDepth() self.poly = createParaMeshPLC(self.dataContainer.sensorPositions(), paraDepth=depth, paraDX=paraDX, paraBoundary=paraBoundary, boundary=boundary) mesh = createMesh(self.poly, quality=quality, smooth=(1, 10)) if apply: self.setMesh(mesh) return mesh
def createMesh(self, depth=None, quality=34.3, paraDX=1, boundary=0, paraBoundary=0, secNodes=3, apply=True, **kwargs): """Create (inversion) mesh using createParaDomain2D Parameters ---------- depth : float, optional maximum depth, 0 (default) means maximum offset / 3. paraDX : float relative distance for refinement nodes between two sensors e.g., 0 or 1 means no refinement e.g., 0.5 means 1 additional node between two neighboring sensors e.g., 0.33 means 2 additional equidistant nodes between two sensors boundary : float, optional boundary width to be appended for domain prolongation in absolute para domain width. values < 0 force the boundary to be 4 times para domain width. paraBoundary : float, optional margin for parameter domain in sensor distances (default 2) quality : float, optional mesh quality (smallest angle allowed) apply : bool, optional set mesh property of the underlying forward operator secNodes : int (1) Amount of secondary nodes to improve accuracy of the forward solution. **kwargs: Additional keyword arguments passed to pygimli.meshtools.createParaMeshPLC See also -------- pygimli.meshtools.createParaMeshPLC """ if self.dataContainer is None: raise BaseException('Cannot create mesh without dataContainer.') if depth is None: depth = self.getDepth() self.poly = mt.createParaMeshPLC(self.dataContainer.sensorPositions(), paraDepth=depth, paraDX=paraDX, paraBoundary=paraBoundary, boundary=boundary, **kwargs) mesh = mt.createMesh(self.poly, quality=quality, smooth=(1, 10)) if apply: self.setMesh(mesh, secNodes=secNodes) return mesh
def createMesh(self, depth=None, quality=34.3, paraDX=0.5, boundary=0, paraBoundary=5): """Create (inversion) mesh using createParaDomain2D""" if depth is None: depth = max(self.getOffset()) / 3. self.poly = createParaMeshPLC(self.dataContainer.sensorPositions(), paraDepth=depth, paraDX=paraDX, paraBoundary=paraBoundary, boundary=boundary) mesh = createMesh(self.poly, quality=quality, smooth=(1, 10)) self.setMesh(mesh)
def parseSurface(self, surf): """Parses the surface and creates the parametric domain. The parameter domain will have marker '2' and the outer region will have marker '1'. TODO: Add override capability via **kwargs """ self.sensorsPos = self.extractPoints( surf.findall("point[@type='node']")) paradx = float(surf.get('paradx', 0.5)) paradepth = float(surf.get('paradepth', 0.0)) paraboundary = float(surf.get('paraboundary', 2.0)) boundary = float(surf.get('boundary', -1.0)) self.paramaxcellsize = float(surf.get('maxcellsize', 0.0)) self.poly = createParaMeshPLC(self.sensorsPos, paradx, paradepth, paraboundary, self.paramaxcellsize, boundary) marker_pos, marker_id = self.extractMarker(surf) self.poly.addRegionMarker(marker_pos, marker_id)
print(combinedSensors) # %% for case in 1, 2: if case == 2: p1 = [8., 0, -0.03] p2 = [12., 0, -0.23] p3 = [24., 0, -0.37] p4 = [28., 0, -0.69] for p in p1, p2, p3, p4: combinedSensors.createSensor(p) combinedSensors.sortSensorsX() plc = mt.createParaMeshPLC(combinedSensors, paraDX=0.15, boundary=4, paraDepth=12, paraBoundary=3, paraMaxCellSize=0.3) if case == 2: box = pg.Mesh(2) radius = 2. points = [(p1, p2), (p3, p4)] for x, depth, pts in zip([10., 26.], [depth_5198, depth_5000], points): start = plc.createNode(x - radius, -depth, 0.0) ul = plc.createNode(pts[0][0], pts[0][2], 0.0) b = plc.createEdge(start, ul, marker=20) box.copyBoundary(b) end = plc.createNode(x + radius, -depth, 0.0) ur = plc.createNode(pts[1][0], pts[1][2], 0.0)
############ # Settings maxIter = 15 zWeight = 0.25 ############ case = int(sys.argv[1]) ertData = pb.load("erttrue.dat") print(ertData) mesh = pg.load("mesh.bms") depth = mesh.ymax() - mesh.ymin() # %% Build inversion meshes plc = mt.createParaMeshPLC(ertData, paraDepth=depth, paraDX=0.3, boundary=0, paraBoundary=2) if case == 1: for depth in (5, 15): start = plc.createNode(mesh.xmin(), -depth, 0.0) end = plc.createNode(mesh.xmax(), -depth, 0.0) plc.createEdge(start, end, marker=1) for sensor in ertData.sensorPositions(): plc.createNode([sensor.x(), sensor.y() - 0.1]) rect = mt.createRectangle([mesh.xmin(), mesh.ymin()], [mesh.xmax(), mesh.ymax()], boundaryMarker=0)