Пример #1
0
def invertGravimetry(gravPoints, dz):

    dzerr = np.random.randn(len(gravPoints)) * 0.0001
    dz = dz + dzerr

    mesh = pg.createGrid(x=np.linspace(-20, 20, 41), y=np.linspace(-20, 0, 21))

    grav = Gravimetry(verbose=True)

    model = grav.invert(gravPoints, dz, verbose=1, mesh=mesh)

    plt.plot(pg.x(gravPoints), dz)
    plt.plot(pg.x(gravPoints), grav.inv.response())

    paraDomain = grav.fop.regionManager().paraDomain()
    pg.show(paraDomain, model, colorBar=1, hold=1)

    pg.showNow()
    plt.show()
    pass
Пример #2
0
def invertGravimetry(gravPoints, dz):

    dzerr = np.random.randn(len(gravPoints)) * 0.0001
    dz = dz + dzerr

    mesh = pg.createGrid(x=np.linspace(-20, 20, 41),
                         y=np.linspace(-20, 0, 21))

    grav = Gravimetry(verbose=True)

    model = grav.invert(gravPoints, dz, verbose=1, mesh=mesh)

    plt.plot(pg.x(gravPoints), dz)
    plt.plot(pg.x(gravPoints), grav.inv.response())

    paraDomain=grav.fop.regionManager().paraDomain()
    pg.show(paraDomain, model, colorBar=1, hold=1)

    pg.showNow()
    plt.show()
    pass
Пример #3
0
k = 0.1

uFE = solver.solveFiniteElements(grid, a=a, b=k*k, f=pointSource,
                      duBoundary=neumannBC,
                      uBoundary=dirichletBC,
                      userData={'sourcePos': sourcePosA, 'k': k},
                      verbose=True)

pg.showLater(1)
ax1, cb = show(grid, uFE, 
               cMin=0, cMax=1, nLevs=10, colorBar=True)
drawMesh(ax1, grid)


f = pg.Vector(grid.cellCount(), 0)
f[grid.findCell(sourcePosA).id()]=1.0/grid.findCell(sourcePosA).size()

uFV = solveFiniteVolume(grid, a=a, b=k*k, f=f, 
                        duBoundary=neumannBC,
                        uBoundary=dirichletBC,
                        userData={'sourcePos': sourcePosA, 'k': k},
                        verbose=True)

#print('FVM:', swatch.duration(True))

ax2, cb = show(grid, uFV, interpolate=1, tri=1,
               cMin=0, cMax=1, nLevs=10, colorBar=True)
drawMesh(ax2, grid)

pg.showNow()
vB = np.array(list(map(lambda p_: [ (2.*p_[1] *(1.0 -p_[0]**2)),
                                   (-2.*p_[0] *(1.0 -p_[1]**2))],
                       mesh.boundaryCenters())))
drawStreams(ax2, mesh, vC)

f = pg.RVector(mesh.cellCount(), 0.0)
##f[mesh.findCell([-0.75, 0.75]).id()]=1000.0


uMesh = solveFiniteVolume(mesh, a=1./Peclet, f=f, vel=vB, 
                          uBoundary=dirichletBC,
                          duBoundary=neumannBC,
                          scheme=scheme)
show(mesh, data=uMesh, 
     logScale=False, interpolate=1, tri=1,
     colorBar=True, axes=ax2)

xi = np.linspace(0.2, 0.8, 81)
uG = pg.interpolate(grid, uGrid, x=x)
uM = pg.interpolate(mesh, uMesh, x=x)
plt.figure()
plt.plot(x, uG, label='outlet ' + scheme + '(grid)')
plt.plot(x, uM, label='outlet ' + scheme + '(mesh)')
#plt.plot(x, 1. + np.tanh(10 * (2 * x + 1.)) )
plt.plot(-x, 1. + np.tanh(10 * (2 * x + 1.)), label='inlet-exact')
plt.legend()
plt.xlim([0,1])


pg.showNow()
Пример #5
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
3D Visualization (Proof of concept)
-----------------------------------
"""

import pygimli as pg
from pygimli.viewer import show

mesh = pg.meshtools.createMesh3D(1,1,1)

"""
If interactive is set to True, a Mayavi window pops up which allows for
interactive introspection. If it is set to False, mayavi produces a pixel array
of the scene which is plotted in a mpl figure and therefore
automatically picked up by the plot2rst extension for the documentation.

"""

show(mesh, interactive=False)

"""
.. image:: PLOT2RST.current_figure
    :scale: 75

"""
<<<<<<< .working
=======
pg.showNow()>>>>>>> .new
Пример #6
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
3D Visualization (Proof of concept)
-----------------------------------
"""

import pygimli as pg
from pygimli.viewer import show

mesh = pg.createMesh3D(1,1,1)

"""
If interactive is set to True, a Mayavi window pops up which allows for
interactive introspection. If it is set to False, mayavi produces a pixel array
of the scene which is plotted in a mpl figure and therefore
automatically picked up by the plot2rst extension for the documentation.

"""

show(mesh, interactive=False)

"""
.. image:: PLOT2RST.current_figure
    :scale: 75

"""
<<<<<<< .working
=======
pg.showNow()>>>>>>> .new