def setup(self): self.setup_geometry() self.set_syntetic_conductivity() self.setup_measurement() # Setup Problem with exponential mapping and Active cells only in the core mesh expmap = Maps.ExpMap(self.mesh) extrude = Maps.Surject2Dto3D(self.mesh_core, normal='Y') mapactive = Maps.InjectActiveCells(mesh=self.mesh, indActive=self.actind, valInactive=-5.) self.mapping = expmap * mapactive * extrude assert self.mapping.nP == self.mesh_core.nCx * self.mesh_core.nCz problem = DC.Problem3D_CC(self.mesh, sigmaMap=self.mapping) problem.pair(self.survey.simpeg_survey) problem.Solver = SolverLU #problem.Solver = SolverBiCG # Compute prediction using the forward model and true conductivity data. # survey.dpred(mtrue[actind]) # Make synthetic data adding a noise to the prediction. # In fact prediction is computed again. self.survey.simpeg_survey.makeSyntheticData(self.mtrue, std=0.05, force=True)
def test_map2Dto3D_y(self): M2 = Mesh.TensorMesh([3, 4]) M3 = Mesh.TensorMesh([3, 2, 4]) m = np.random.rand(M2.nC) for m2to3 in [Maps.Surject2Dto3D(M3, normal='Y'), Maps.Map2Dto3D(M3, normal='Y')]: # m2to3 = Maps.Surject2Dto3D(M3, normal='Y') m = np.arange(m2to3.nP) self.assertTrue(m2to3.test()) self.assertTrue(m2to3.testVec()) self.assertTrue(np.all(Utils.mkvc((m2to3 * m).reshape(M3.vnC, order='F')[:, 0, :]) == m))
import numpy as np from pymatsolver import PardisoSolver from SimPEG import Maps import os cur_dir = "D:/Seogi/Dropbox/Researches/AEM_workshow_2018_simpeg/2d_inv_warm_start" os.chdir(cur_dir) cs, ncx, ncy, ncz, = 50., 20, 1, 20 npad_x, npad_y, npad_z = 10, 10, 10 pad_rate = 1.3 hx = [(cs, npad_x, -pad_rate), (cs, ncx), (cs, npad_x, pad_rate)] hy = [(cs, npad_y, -pad_rate), (cs, ncy), (cs, npad_y, pad_rate)] hz = [(cs, npad_z, -pad_rate), (cs, ncz), (cs, npad_z, pad_rate)] mesh_3d = Mesh.TensorMesh([hx, hy, hz], 'CCC') mesh_2d = Mesh.TensorMesh([hx, hz], 'CC') actind = mesh_2d.gridCC[:, 1] < 0. map_2Dto3D = Maps.Surject2Dto3D(mesh_3d) expmap = Maps.ExpMap(mesh_2d) actmap = Maps.InjectActiveCells(mesh_2d, indActive=actind, valInactive=np.log(1e-8)) mapping = map_2Dto3D * expmap * actmap x = mesh_3d.vectorCCx[np.logical_and(mesh_3d.vectorCCx > -450, mesh_3d.vectorCCx < 450)] time = np.logspace(np.log10(5e-5), np.log10(2.5e-3), 21) ind_start = 19 dobs = np.load('../dobs.npy') DOBS = dobs.reshape((x.size, 2, time.size))[:, :, ind_start:] dobs_dbdtz = DOBS[:, 0, :].flatten() dobs_dbdtx = DOBS[:, 1, :].flatten() #%%
inversion_mesh.plotGrid() ############################################################################### # Mappings # --------- # # Mappings are used to take the inversion model and represent it as electrical # conductivity on the inversion mesh. We will invert for log-conductivity below # the surface, fixing the conductivity of the air cells to 1e-8 S/m # create a 2D mesh that includes air cells mesh2D = Mesh.TensorMesh([mesh.hx, mesh.hz], x0=mesh.x0[[0, 2]]) active_inds = mesh2D.gridCC[:, 1] < 0 # active indices are below the surface mapping = ( Maps.Surject2Dto3D(mesh) * # populates 3D space from a 2D model Maps.InjectActiveCells(mesh2D, active_inds, sigma_air) * # adds air cells Maps.ExpMap( nP=inversion_mesh.nC) # takes the exponential (log(sigma) --> sigma) ) ############################################################################### # True Model # ---------- # # Create our true model which we will use to generate synthetic data for m_true = np.log(sigma_deep) * np.ones(inversion_mesh.nC) interface_depth = interface(inversion_mesh.gridCC[:, 0]) m_true[inversion_mesh.gridCC[:, 1] > interface_depth] = np.log(sigma_surface)