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
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.core.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. resis = pg.Matrix(resBulk) for i, rbI in enumerate(resBulk): resis[i] = 1. / ((1. / rbI) + 1. / rho0) # Initialize ert method manager ERT = ERTManager(verbose=False) # Run simulation for the apparent resistivities
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
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. resis = pg.RMatrix(resBulk) for i, rbI in enumerate(resBulk): resis[i] = 1. / ((1./rbI) + 1./rho0) # Initialize ert method manager ERT = ERTManager(verbose=False) # Run simulation for the apparent resistivities rhoa = ERT.simulate(meshERT, resis, ertScheme, verbose=0, returnArray=True)