Example #1
0
    def _configure(self):
        """
    Setup members using inventory.
    """
        Fault._configure(self)
        ModuleFaultCohesive.useFaultMesh(self, self.inventory.useMesh)
        #ModuleFaultCohesive.faultMeshImporter(self,
        #                                      self.inventory.faultMeshImporter)

        # Hardwire collocated quadrature
        self.faultQuadrature.inventory.cell._configure()
        self.faultQuadrature._configure()
        self.faultQuadrature.cell.collocateQuad = True
        self.faultQuadrature.cell.order = self.faultQuadrature.cell.degree
        return
Example #2
0
  def _configure(self):
    """
    Setup members using inventory.
    """
    Fault._configure(self)
    ModuleFaultCohesive.useFaultMesh(self, self.inventory.useMesh)
    #ModuleFaultCohesive.faultMeshImporter(self, 
    #                                      self.inventory.faultMeshImporter)

    # Hardwire collocated quadrature
    self.faultQuadrature.inventory.cell._configure()
    self.faultQuadrature._configure()
    self.faultQuadrature.cell.collocateQuad = True
    self.faultQuadrature.cell.order = self.faultQuadrature.cell.degree
    return
Example #3
0
 def out_of_bounds(self, lat, lon, strike, length, width, minlat, maxlat,
                   minlon, maxlon):
     """Detects if a given rectangle lies outside of model bounds"""
     edge1 = Fault.step(lat, lon, strike, length / 2, self.fault.R)
     edge2 = Fault.step(lat, lon, strike - 180, length / 2, self.fault.R)
     corner1 = Fault.step(edge1[0], edge1[1], strike + 90, width / 2,
                          self.fault.R)
     corner2 = Fault.step(edge1[0], edge1[1], strike - 90, width / 2,
                          self.fault.R)
     corner3 = Fault.step(edge2[0], edge2[1], strike + 90, width / 2,
                          self.fault.R)
     corner4 = Fault.step(edge2[0], edge2[1], strike - 90, width / 2,
                          self.fault.R)
     corners = np.hstack((corner1, corner2, corner3, corner4))
     if np.any(corners[0] < minlat) or np.any(corners[0] > maxlat):
         return True
     elif np.any(corners[1] < minlon) or np.any(corners[1] > maxlon):
         return True
     else:
         return False
Example #4
0
 def __init__(self, name="faultcohesive"):
     """
 Constructor.
 """
     Fault.__init__(self, name)
     return
Example #5
0
 def __init__(self, name="faultcohesive"):
   """
   Constructor.
   """
   Fault.__init__(self, name)
   return
Example #6
0
    def split_rect(self,
                   fault,
                   lat,
                   lon,
                   length,
                   width,
                   deltadepth,
                   n=11,
                   m=3):
        R = fault.R
        # n = int(length/15000)
        # m = int(width/15000)
        n_steps = 8
        length_step = length / (n * n_steps)
        width_step = width / (m * n_steps)
        sublength = length / n
        subwidth = width / m

        lats = np.empty(n)
        lons = np.empty(n)
        lats[(n - 1) // 2] = lat
        lons[(n - 1) // 2] = lon

        # add strikeward and anti-strikeward centers
        bearing1 = fault.strike_from_lat_lon(lat, lon)
        bearing2 = (bearing1 - 180) % 360
        lat1, lon1 = lat, lon
        lat2, lon2 = lat, lon
        for i in range(1, (n - 1) // 2 + 1):
            for j in range(n_steps):
                lat1, lon1 = Fault.step(lat1, lon1, bearing1, length_step, R)
                lat2, lon2 = Fault.step(lat2, lon2, bearing2, length_step, R)
                bearing1 = fault.strike_from_lat_lon(lat1, lon1)
                bearing2 = (fault.strike_from_lat_lon(lat2, lon2) - 180) % 360
            lats[(n - 1) // 2 + i] = lat1
            lats[(n - 1) // 2 - i] = lat2
            lons[(n - 1) // 2 + i] = lon1
            lons[(n - 1) // 2 - i] = lon2

        strikes = fault.strike_map(np.vstack((lats, lons)).T)
        dips = fault.dip_map(np.vstack((lats, lons)).T)
        dipward = (strikes + 90) % 360

        Lats = np.empty((m, n))
        Lons = np.empty((m, n))
        Strikes = np.empty((m, n))
        Dips = np.empty((m, n))
        Lats[(m - 1) // 2] = lats
        Lons[(m - 1) // 2] = lons
        Strikes[(m - 1) // 2] = strikes
        Dips[(m - 1) // 2] = dips

        # add dipward and antidipward centers
        templats1, templons1 = lats.copy(), lons.copy()
        templats2, templons2 = lats.copy(), lons.copy()
        tempdips1, tempdips2 = dips.copy(), dips.copy()
        for i in range(1, (m - 1) // 2 + 1):
            for j in range(n_steps):
                templats1, templons1 = Fault.step(
                    templats1, templons1, dipward,
                    width_step * np.cos(np.deg2rad(tempdips1)), R)
                templats2, templons2 = Fault.step(
                    templats2, templons2, dipward,
                    -width_step * np.cos(np.deg2rad(tempdips2)), R)
                tempdips1 = fault.dip_map(np.vstack((templats1, templons1)).T)
                tempdips2 = fault.dip_map(np.vstack((templats2, templons2)).T)
            Lats[(m - 1) // 2 + i] = templats1
            Lats[(m - 1) // 2 - i] = templats2
            Lons[(m - 1) // 2 + i] = templons1
            Lons[(m - 1) // 2 - i] = templons2
            Strikes[(m - 1) // 2 + i] = fault.strike_map(
                np.vstack((templats1, templons1)).T)
            Strikes[(m - 1) // 2 - i] = fault.strike_map(
                np.vstack((templats2, templons2)).T)
            Dips[(m - 1) // 2 + i] = tempdips1
            Dips[(m - 1) // 2 - i] = tempdips2

        Depths = fault.depth_map(
            np.vstack((Lats.flatten(), Lons.flatten())).T) + deltadepth
        data = [Lats, Lons, Strikes, Dips, Depths]
        data = [arr.flatten() for arr in data]
        return np.array(data).T, sublength, subwidth