def primaryMapping(self): # Setup Pimary Maps: # we want to simulate on a physical property model that # consists of casing in a layered background. Air cells are included. # Our "model", that we are considering when computing the sensitivity, # consists of the layered background and block, so the casing and air # cells are inactive parts of the model and need to be appropriately # injected during the construction of the primary model if getattr(self, '_primaryMapping', None) is None: print('Building primary mapping') # inject parameters we want to invert for into the full casing # model valInactive = np.r_[ np.log(self.sigmacasing), # log conductivity of the casing np.log(self.sigmainside), # log conductivity fluid inside # casing self.casing_r, # radius of the casing (to its center) self.casing_t, # casing thickness self.casing_z[0], # bottom of casing (at depth) self.casing_z[1] # top of casing (at surface) ] # inject casing parameters so they are included in the construction # of the layered background + casing injectCasingParams = Maps.InjectActiveCells( None, indActive=np.r_[0, 1, 4, 5], valInactive=valInactive, nC=10 ) # maps a list of casing parameters to the cyl mesh (below the # subsurface) paramMapPrimary = Maps.ParametricCasingAndLayer( self.meshp, indActive=self.indActivePrimary, slopeFact=1e4 ) # inject air cells injActMapPrimary = Maps.InjectActiveCells( self.meshp, self.indActivePrimary, np.log(self.sigmaair) ) # map from log conductivity to conductivity expMapPrimary = Maps.ExpMap(self.meshp) # assemble the primary mapping primaryMapping = ( expMapPrimary * # log(sigma) --> sigma injActMapPrimary * # log(sigma) below surface --> include air paramMapPrimary * # parametric --> casing + layered earth injectCasingParams * # parametric layered earth --> parametric # layered earth + casing self.projectionMapPrimary # grab relevant parameters from full # model (eg. ignore block) ) self._paramMapPrimary = paramMapPrimary self._primaryMapping = primaryMapping print('... done building primary mapping') return self._primaryMapping
def test_ParametricCasingAndLayer(self): mapping = Maps.ParametricCasingAndLayer(self.meshCyl) m = np.r_[-2., 1., 6., 2., -0.1, 0.2, 0.5, 0.2, -0.2, 0.2] self.assertTrue(mapping.test(m))