#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pylab as plt

import pygimli as pg
import pygimli.meshtools as mt
import pygimli.physics.ert as ert

###############################################################################
# Create a measurement scheme for 51 electrodes, spacing 1
scheme = ert.createERTData(elecs=np.linspace(start=0, stop=50, num=51),
                           schemeName='dd')
m = scheme['m']
n = scheme['n']
scheme['m'] = n
scheme['n'] = m

scheme.set('k', [1 for x in range(scheme.size())])

###############################################################################
# Mesh generation
world = mt.createWorld(start=[-55, 0], end=[105, -80], worldMarker=True)

conductive_anomaly = mt.createCircle(pos=[10, -7], radius=5, marker=2)

polarizable_anomaly = mt.createCircle(pos=[40, -7], radius=5, marker=3)

plc = mt.mergePLC((world, conductive_anomaly, polarizable_anomaly))

# local refinement of mesh near electrodes
                        isClosed=True,
                        addNodes=3,
                        interpolate='spline',
                        marker=5)

###############################################################################
# Merge geometry definition into a Piecewise Linear Complex (PLC)
geom = world + block + poly

###############################################################################
# Optional: show the geometry
pg.show(geom)

###############################################################################
# Create a Dipole Dipole ('dd') measuring scheme with 21 electrodes.
scheme = ert.createERTData(elecs=np.linspace(start=-15, stop=15, num=21),
                           schemeName='dd')

###############################################################################
# Put all electrode (aka sensors) positions into the PLC to enforce mesh
# refinement. Due to experience, its convenient to add further refinement
# nodes in a distance of 10% of electrode spacing to achieve sufficient
# numerical accuracy.
for p in scheme.sensors():
    geom.createNode(p)
    geom.createNode(p - [0, 0.1])

# Create a mesh for the finite element modelling with appropriate mesh quality.
mesh = mt.createMesh(geom, quality=34)

# Create a map to set resistivity values in the appropriate regions
# [[regionNumber, resistivity], [regionNumber, resistivity], [...]
Beispiel #3
0
c1 = pg.solver.solveFiniteVolume(mesh, a=dispersion, f=S, vel=vel,
                                 times=t, uB=[1, 0],
                                 scheme='PS', verbose=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:
Beispiel #4
0
R = pg.solver.parseMapToCellArray(rMap, mesh)
# Dirichlet conditions for hydraulic potential

# Create survey measurement scheme
# ertScheme = ert.createERTData(pg.utils.grange(-20, 20, dx=1.0),
#                               schemeName='dd')

if ertSchemeFull == 1:
    a = np.arange(-9.3, 10, 1)
    b = np.arange(-6.3, 0, 1)
    c = list(itertools.product(a, b))
    elecs = np.c_[np.array(c), np.zeros(len(c))]
    # orig_scheme = pg.DataContainerERT()
    # orig_scheme.setSensorPositions(elecs)
    len(elecs)
    ertScheme = ert.createERTData(elecs=elecs, schemeName='dd')
else:
    ertScheme = ert.createERTData(pg.utils.grange(-20, 20, dx=1.0),
                                  schemeName='dd')
ertScheme.save(path_Data + 'SchemeERT_dd_2d_SENS.data')

# Create suitable mesh for ert forward calculation
# meshERT = mt.createParaMesh(ertScheme, quality=33, paraMaxCellSize=0.2,
#                             boundaryMaxCellSize=50, smooth=[1, 2])

## --------- make sequence MALM --------- ##

sensors = ertScheme.sensorPositions()
EA = len(sensors) - 1
EB = len(sensors) - 2
EN = len(sensors) - 3
Compare 2D FEM modelling with 1D VES sounding with and without complex
resistivity values.
"""
import numpy as np

import pygimli as pg
import pygimli.meshtools as mt
from pygimli.physics.ert import simulate as simulateERT
from pygimli.physics.ert import VESModelling, VESCModelling
from pygimli.physics.ert import createERTData

###############################################################################
# First we create a data configuration of a 1D Schlumberger sounding with
# 20 electrodes and and increasing MN/2 electrode spacing from 1m to 24m.
scheme = createERTData(pg.utils.grange(start=1, end=24, dx=1, n=10, log=True),
                       sounding=True)

###############################################################################
# First we create a geometry that covers the sought geometry.
# We start with a 2 dimensional simulation world
# of a bounding box [-200, -100] [200, 0], the layer at -5m and some suitable
# requested cell sizes.
plc = mt.createWorld(start=[-200, -100],
                     end=[200, 0],
                     layers=[-10],
                     area=[5.0, 500])

###############################################################################
# To achieve a necessary numerical accuracy, we need some local mesh refinement
# in the vicinity of the electrodes. However, since we don't need the
# electrode (aka sensor) positions to be present as nodes in the geometry, we only add forced mesh