Ejemplo n.º 1
0
def plate_fields(A, B, dx, dz, xc, zc, rotAng, sigplate, sighalf):
    re_run = (
        _cache["A"] != A
        or _cache["B"] != B
        or _cache["dx"] != dx
        or _cache["dz"] != dz
        or _cache["xc"] != xc
        or _cache["zc"] != zc
        or _cache["rotAng"] != rotAng
        or _cache["sigplate"] != sigplate
        or _cache["sighalf"] != sighalf
    )
    if re_run:
        # Create halfspace model
        mhalf = np.log(sighalf * np.ones([mesh.nC]))

        # Create true model with plate
        mtrue = createPlateMod(xc, zc, dx, dz, rotAng, sigplate, sighalf)
        if B == []:
            src = DC.sources.Pole([], np.r_[A, 0.0])
        else:
            src = DC.sources.Dipole([], np.r_[A, 0.0], np.r_[B, 0.0])

        survey = DC.survey.Survey([src])

        problem = DC.Simulation3DCellCentered(
            mesh, survey=survey, sigmaMap=mapping, solver=Pardiso
        )
        problem_prim = DC.Simulation3DCellCentered(
            mesh, survey=survey, sigmaMap=mapping, solver=Pardiso
        )

        primary_field = problem_prim.fields(mhalf)

        total_field = problem.fields(mtrue)

        _cache["A"] = A
        _cache["B"] = B
        _cache["dx"] = dx
        _cache["dz"] = dz
        _cache["xc"] = xc
        _cache["zc"] = zc
        _cache["rotAng"] = rotAng
        _cache["sigplate"] = sigplate
        _cache["sighalf"] = sighalf

        _cache["mtrue"] = mtrue
        _cache["mhalf"] = mhalf
        _cache["src"] = src
        _cache["primary_field"] = primary_field
        _cache["total_field"] = total_field
    else:
        mtrue = _cache["mtrue"]
        mhalf = _cache["mhalf"]
        src = _cache["src"]
        primary_field = _cache["primary_field"]
        total_field = _cache["total_field"]

    return mtrue, mhalf, src, primary_field, total_field
Ejemplo n.º 2
0
def getSensitivity(survey, A, B, M, N, model):
    src_type, rx_type = survey.split("-")
    if rx_type == "Pole":
        rx = DC.receivers.Pole(np.r_[M, 0.0])
    else:
        rx = DC.receivers.Dipole(np.r_[M, 0.0], np.r_[N, 0.0])
    if src_type == "Pole":
        src = DC.sources.Pole([rx], np.r_[A, 0.0])
    else:
        src = DC.sources.Dipole([rx], np.r_[A, 0.0], np.r_[B, 0.0])

    survey = DC.survey.Survey([src])
    problem = DC.Simulation3DCellCentered(mesh,
                                          survey=survey,
                                          sigmaMap=sigmaMap,
                                          solver=Pardiso)
    J = problem.getJ(model)

    return J[0]
Ejemplo n.º 3
0
def getSensitivity(survey, A, B, M, N, model):
    src_type, rx_type = survey.split("-")
    if rx_type == "Pole":
        rx = DC.receivers.Pole(np.r_[M, 0.0])
    else:
        rx = DC.receivers.Dipole(np.r_[M, 0.0], np.r_[N, 0.0])
    if src_type == "Pole":
        src = DC.sources.Pole([rx], np.r_[A, 0.0])
    else:
        src = DC.sources.Dipole([rx], np.r_[A, 0.0], np.r_[B, 0.0])

    # Model mappings
    expmap = maps.ExpMap(mesh)
    mapping = expmap

    survey = DC.Survey([src])
    sim = DC.Simulation3DCellCentered(
        mesh, sigmaMap=mapping, solver=Pardiso, survey=survey
    )
    J = sim.getJ(model)[0]

    return J
Ejemplo n.º 4
0
hz = [(cs, 7, -1.3), (cs, 20)]
mesh = discretize.TensorMesh([hx, hy, hz], "CCN")
sighalf = 1e-2
sigma = np.ones(mesh.nC) * sighalf
xtemp = np.linspace(-150, 150, 21)
ytemp = np.linspace(-150, 150, 21)
xyz_rxP = utils.ndgrid(xtemp - 10.0, ytemp, np.r_[0.0])
xyz_rxN = utils.ndgrid(xtemp + 10.0, ytemp, np.r_[0.0])
xyz_rxM = utils.ndgrid(xtemp, ytemp, np.r_[0.0])

rx = DC.Rx.Dipole(xyz_rxP, xyz_rxN)
src = DC.Src.Dipole([rx], np.r_[-200, 0, -12.5], np.r_[+200, 0, -12.5])
survey = DC.Survey([src])
sim = DC.Simulation3DCellCentered(mesh,
                                  survey=survey,
                                  solver=Solver,
                                  sigma=sigma,
                                  bc_type="Neumann")

data = sim.dpred()


def DChalf(srclocP, srclocN, rxloc, sigma, I=1.0):
    rp = (srclocP.reshape([1, -1])).repeat(rxloc.shape[0], axis=0)
    rn = (srclocN.reshape([1, -1])).repeat(rxloc.shape[0], axis=0)
    rP = np.sqrt(((rxloc - rp)**2).sum(axis=1))
    rN = np.sqrt(((rxloc - rn)**2).sum(axis=1))
    return I / (sigma * 2.0 * np.pi) * (1 / rP - 1 / rN)


data_anaP = DChalf(np.r_[-200, 0, 0.0], np.r_[+200, 0, 0.0], xyz_rxP, sighalf)
Ejemplo n.º 5
0
                                 b=3,
                                 n=8)

# Concatenate lines
survey = DC.Survey(survey1.source_list + survey2.source_list +
                   survey3.source_list)

# Setup Problem with exponential mapping and Active cells only in the core mesh
expmap = maps.ExpMap(mesh)
mapactive = maps.InjectActiveCells(mesh=mesh,
                                   indActive=actind,
                                   valInactive=-5.0)
mapping = expmap * mapactive
problem = DC.Simulation3DCellCentered(mesh,
                                      survey=survey,
                                      sigmaMap=mapping,
                                      solver=Solver,
                                      bc_type="Neumann")

data = problem.make_synthetic_data(mtrue[actind],
                                   relative_error=0.05,
                                   add_noise=True)

# Tikhonov Inversion
####################

# Initial Model
m0 = np.median(ln_sigback) * np.ones(mapping.nP)
# Data Misfit
dmis = data_misfit.L2DataMisfit(simulation=problem, data=data)
# Regularization
Ejemplo n.º 6
0
def model_fields(A, B, zcLayer, dzLayer, xc, zc, r, sigLayer, sigTarget,
                 sigHalf):
    re_run = (_cache["A"] != A or _cache["B"] != B
              or _cache["zcLayer"] != zcLayer or _cache["dzLayer"] != dzLayer
              or _cache["xc"] != xc or _cache["zc"] != zc or _cache["r"] != r
              or _cache["sigLayer"] != sigLayer
              or _cache["sigTarget"] != sigTarget
              or _cache["sigHalf"] != sigHalf)
    if re_run:
        # Create halfspace model
        mhalf = sigHalf * np.ones([mesh.nC])
        # Add layer to model
        mLayer = addLayer2Mod(zcLayer, dzLayer, mhalf, sigLayer)
        # Add plate or cylinder
        mtrue = addCylinder2Mod(xc, zc, r, mLayer, sigTarget)

        Mx = np.empty(shape=(0, 2))
        Nx = np.empty(shape=(0, 2))
        rx = DC.receivers.Dipole(Mx, Nx)
        if B == []:
            src = DC.sources.Pole([rx], np.r_[A, 0.0])
        else:
            src = DC.sources.Dipole([rx], np.r_[A, 0.0], np.r_[B, 0.0])

        survey = DC.Survey([src])

        problem = DC.Simulation3DCellCentered(mesh,
                                              sigmaMap=sigmaMap,
                                              solver=Pardiso,
                                              survey=survey)
        problem_prim = DC.Simulation3DCellCentered(mesh,
                                                   sigmaMap=sigmaMap,
                                                   solver=Pardiso,
                                                   survey=survey)

        primary_field = problem_prim.fields(mhalf)

        total_field = problem.fields(mtrue)

        _cache["A"] = A
        _cache["B"] = B
        _cache["zcLayer"] = zcLayer
        _cache["dzLayer"] = dzLayer
        _cache["xc"] = xc
        _cache["zc"] = zc
        _cache["r"] = r
        _cache["sigLayer"] = sigLayer
        _cache["sigTarget"] = sigTarget
        _cache["sigHalf"] = sigHalf

        _cache["mtrue"] = mtrue
        _cache["mhalf"] = mhalf
        _cache["src"] = src
        _cache["total_field"] = total_field
        _cache["primary_field"] = primary_field
    else:
        mtrue = _cache["mtrue"]
        mhalf = _cache["mhalf"]
        src = _cache["src"]
        total_field = _cache["total_field"]
        primary_field = _cache["primary_field"]

    return mtrue, mhalf, src, primary_field, total_field