Exemplo n.º 1
0
def solveERT(mesh, concentration, verbose=0):
    """Simulate resistivity distribution for given nonsteady concentration."""
    if verbose:
        print("Solve for ERT ...")

    ertScheme = pg.physics.ert.createERTData(pg.utils.grange(-20, 20, dx=1.0),
                                             schemeName='dd')

    meshERT = mt.createParaMesh(ertScheme, quality=33, paraMaxCellSize=0.2,
                                boundaryMaxCellSize=50, smooth=[1, 2])

    scale = 0.001
    concentration *= scale  # mg/m²

    # apply saturation model to simulate unsaturated topsoil
    sat = np.zeros(mesh.cellCount())
    for c in mesh.cells():
        if c.center()[1] < -8:
            sat[c.id()] = 1.
        elif c.center()[1] < -2:
            sat[c.id()] = 1.
        else:
            sat[c.id()] = .5

    cWater = 1./100.
    conductivity = concentration * 0.1 + cWater

    rArchie = resistivityArchie(rFluid=1. / conductivity,
                                porosity=0.3, sat=sat, m=1.3,
                                mesh=mesh, meshI=meshERT, fill=1)

    # apply background resistivity model
    rho0 = np.zeros(meshERT.cellCount())
    for c in meshERT.cells():
        if c.center()[1] < -8:
            rho0[c.id()] = 150.
        elif c.center()[1] < -2:
            rho0[c.id()] = 500.
        else:
            rho0[c.id()] = 1000.

    resis = pg.Matrix(rArchie)

    for i, rbI in enumerate(rArchie):
        resis[i] = 1. / ((1./rbI) + 1./rho0)

    ert = pg.physics.ert.ERTManager(verbose=False)
    ertScheme.set('k', ert.fop.calcGeometricFactors(ertScheme))

    errPerc = 0.01
    errVolt = 1e-5

    rhoa = ert.simulate(meshERT, resis, ertScheme, verbose=0, returnArray=True)

    voltage = rhoa / ertScheme('k')
    err = np.abs(errVolt / voltage) + errPerc

    dRhoa = rhoa[1:] / rhoa[0]
    dErr = err[1:]

    return meshERT, ertScheme, resis, rhoa, dRhoa, dErr
Exemplo n.º 2
0
def solveERT(mesh, concentration, verbose=0):
    """Simulate resistivity distribution for given nonsteady concentration."""
    if verbose:
        print("Solve for ERT ...")

    ertScheme = pg.physics.ert.createERTData(pg.utils.grange(-20, 20, dx=1.0),
                                             schemeName='dd')

    meshERT = mt.createParaMesh(ertScheme,
                                quality=33,
                                paraMaxCellSize=0.2,
                                boundaryMaxCellSize=50,
                                smooth=[1, 2])

    scale = 0.001
    concentration *= scale  # mg/m²

    # apply saturation model to simulate unsaturated topsoil
    sat = np.zeros(mesh.cellCount())
    for c in mesh.cells():
        if c.center()[1] < -8:
            sat[c.id()] = 1.
        elif c.center()[1] < -2:
            sat[c.id()] = 1.
        else:
            sat[c.id()] = .5

    cWater = 1. / 100.
    conductivity = concentration * 0.1 + cWater

    rArchie = resistivityArchie(rFluid=1. / conductivity,
                                porosity=0.3,
                                sat=sat,
                                m=1.3,
                                mesh=mesh,
                                meshI=meshERT,
                                fill=1)

    # apply background resistivity model
    rho0 = np.zeros(meshERT.cellCount())
    for c in meshERT.cells():
        if c.center()[1] < -8:
            rho0[c.id()] = 150.
        elif c.center()[1] < -2:
            rho0[c.id()] = 500.
        else:
            rho0[c.id()] = 1000.

    resis = pg.Matrix(rArchie)

    for i, rbI in enumerate(rArchie):
        resis[i] = 1. / ((1. / rbI) + 1. / rho0)

    ert = pg.physics.ert.ERTManager(verbose=False)
    ertScheme.set('k', ert.fop.calcGeometricFactor(ertScheme))

    errPerc = 0.01
    errVolt = 1e-5

    rhoa = ert.simulate(meshERT, resis, ertScheme, verbose=0, returnArray=True)

    voltage = rhoa / ertScheme('k')
    err = np.abs(errVolt / voltage) + errPerc

    dRhoa = rhoa[1:] / rhoa[0]
    dErr = err[1:]

    return meshERT, ertScheme, resis, rhoa, dRhoa, dErr
Exemplo n.º 3
0
                                 verbose=0)
# Stack results together
c = np.vstack((c1, c2))

#ax, _ = pg.show(mesh, data=c[400]*0.001, label='Concentration $c$ in g$/$l',
#cMin=0, cMax=2.5)

print('Solve ERT modelling ...')

# Create survey measurement scheme
ertScheme = pg.physics.ert.createERTData(pg.utils.grange(-20, 20, dx=1.0),
                                         schemeName='dd')
# Create suitable mesh for ert forward calculation
meshERT = mt.createParaMesh(ertScheme,
                            quality=33,
                            paraMaxCellSize=0.2,
                            boundaryMaxCellSize=50,
                            smooth=[1, 2])
# Select 10 time frame to simulate ERT data
timesERT = pg.IndexArray(np.floor(np.linspace(0, len(c) - 1, 10)))
# Create conductivity of fluid for salt concentration $c$
sigmaFluid = c[timesERT] * 0.1 + 0.01
# Calculate bulk resistivity based on Archie's Law
resBulk = pg.physics.petro.resistivityArchie(rFluid=1. / sigmaFluid,
                                             porosity=0.3,
                                             m=1.3,
                                             mesh=mesh,
                                             meshI=meshERT,
                                             fill=1)
# apply background resistivity model
rho0 = np.zeros(meshERT.cellCount()) + 1000.
# Create more realistic data set
ertScheme = pb.createData(sensors, "dd", spacings=[1, 2, 4])
k = pb.geometricFactors(ertScheme)
ertScheme.markInvalid(pg.abs(k) > 5000)
ertScheme.removeInvalid()

ert = ERTManager()

# Create suitable mesh for ert forward calculation
# NOTE: In the published results paraMaxCellSize=1.0 was used, which is
# increased here to allow testing on Continuous Integration services.
meshERTFWD = mt.createParaMesh(ertScheme,
                               quality=33.5,
                               paraMaxCellSize=2.0,
                               paraDX=0.2,
                               boundaryMaxCellSize=50,
                               smooth=[1, 10],
                               paraBoundary=30)
pg.show(meshERTFWD)

res = pg.RVector()
pg.interpolate(mesh, rhotrue, meshERTFWD.cellCenters(), res)
res = mt.fillEmptyToCellArray(meshERTFWD, res, slope=True)
ert.setMesh(meshERTFWD)
ert.fop.createRefinedForwardMesh()
ertData = ert.simulate(meshERTFWD,
                       res,
                       ertScheme,
                       noiseLevel=0.05,
                       noiseAbs=0.0)
Exemplo n.º 5
0
# Solve without injection starting with last result
c2 = pg.solver.solveFiniteVolume(mesh, a=dispersion, f=0, vel=vel,
                                 u0=c1[-1], times=t, uB=[1, 0],
                                 scheme='PS', verbose=0)
# Stack results together
c = np.vstack((c1, c2))

ax, _ = pg.show(mesh, data=c[400]*0.001, cMin=0, cMax=2.5,
                label='Concentration $c$ in g$/$l')
print('Solve ERT modelling ...')

# Create survey measurement scheme
ertScheme = ert.createERTData(pg.utils.grange(-20, 20, dx=1.0),
                              schemeName='dd')
# Create suitable mesh for ert forward calculation
meshERT = mt.createParaMesh(ertScheme, quality=33, paraMaxCellSize=0.2,
                            boundaryMaxCellSize=50, smooth=[1, 2])
# Select 10 time frame to simulate ERT data
timesERT = pg.IndexArray(np.floor(np.linspace(0, len(c)-1, 10)))
# Create conductivity of fluid for salt concentration $c$
sigmaFluid = c[timesERT] * 0.1 + 0.01
# Calculate bulk resistivity based on Archie's Law
resBulk = petro.resistivityArchie(rFluid=1. / sigmaFluid,
                                  porosity=0.3, m=1.3,
                                  mesh=mesh, meshI=meshERT, fill=1)
# apply background resistivity model
rho0 = np.zeros(meshERT.cellCount()) + 1000.
for c in meshERT.cells():
    if c.center()[1] < -8:
        rho0[c.id()] = 150.
    elif c.center()[1] < -2:
        rho0[c.id()] = 500.