# pygimli.physics.gravimetry¶

Solve gravimetric and magneto static problems in 2d and 3D analytical

## Overview¶

Functions

 BZPoly(pnts, poly, mag[, openPoly]) TODO WRITEME. BaZCylinderHoriz(pnts, R, pos, M) Magnetic anomaly for a horizontal cylinder. BaZSphere(pnts, R, pos, M) Magnetic anomaly for a sphere. gradGZCylinderHoriz(r, a, rho[, pos]) TODO WRITEME. gradGZHalfPlateHoriz(pnts, t, rho[, pos]) TODO WRITEME. gradGZSphere(r, rad, rho[, pos]) TODO WRITEME. gradUCylinderHoriz(r, a, rho[, pos]) 2D Gradient of gravimetric potential of horizontal cylinder. gradUHalfPlateHoriz(pnts, t, rho[, pos]) TODO WRITEME. gradUSphere(r, rad, rho[, pos]) Gravitational field of a sphere. solveGravimetry(mesh[, dDensity, pnts, complete]) Solve gravimetric response. uCylinderHoriz(pnts, rad, rho[, pos]) Gravitational potential of horizonzal cylinder. uSphere(r, rad, rho[, pos]) Gravitational potential of a sphere.

Classes

 GravimetryModelling([verbose]) Gravimetry modelling operator.

## Functions¶

BZPoly

pygimli.physics.gravimetry.BZPoly(pnts, poly, mag, openPoly=False)[source]

TODO WRITEME.

Parameters: pnts : list Measurement points [[p1x, p1z], [p2x, p2z],…] poly : list Polygon [[p1x, p1z], [p2x, p2z],…] mag : [M_x, M_y, M_z] Magnetization = [M_x, M_y, M_z]

BaZCylinderHoriz

pygimli.physics.gravimetry.BaZCylinderHoriz(pnts, R, pos, M)[source]

Magnetic anomaly for a horizontal cylinder.

Calculate the vertical component of the anomalous magnetic field Bz for a buried horizontal cylinder at position pos with radius R for a given magnetization M at measurement points pnts.

TODO .. only 2D atm

Parameters: pnts : [[x,z], ] measurement points – array[x,y,z] R : float radius pos : [float, float] [x,z] – sphere center M : [float, float] [Mx, Mz] – magnetization

BaZSphere

pygimli.physics.gravimetry.BaZSphere(pnts, R, pos, M)[source]

Magnetic anomaly for a sphere.

Calculate the vertical component of the anomalous magnetic field Bz for a buried sphere at position pos with radius R for a given magnetization M at measurement points pnts.

Parameters: pnts : [[x,y,z], ] measurement points – array[x,y,z] R : float radius pos : [float, float, float] [x,y,z] – sphere center M : [float, float, float] [Mx, My, Mz] – magnetization

pygimli.physics.gravimetry.gradGZCylinderHoriz(r, a, rho, pos=(0.0, 0.0))[source]

TODO WRITEME.

$g = -grad u(r), with r = [x,z], |r| = \sqrt(x^2+z^2)$
Parameters: r : list[[x, z]] Observation positions a : float Cylinder radius in [meter] rho : Density in [kg/m^3] grad gz, [gz_x, gz_z]

Examples using pygimli.physics.gravimetry.gradGZCylinderHoriz

pygimli.physics.gravimetry.gradGZHalfPlateHoriz(pnts, t, rho, pos=(0.0, 0.0))[source]

TODO WRITEME.

$g = -\nabla u$
Parameters: pnts : array ($$n\times 2$$) n 2 dimensional measurement points t : float Plate thickness in $$[\text{m}]$$ rho : float Density in $$[\text{kg}/\text{m}^3]$$ gz : array Gradient of z-component of g $$\nabla(\frac{\partial u}{\partial\vec{r}}_z)$$

Examples using pygimli.physics.gravimetry.gradGZHalfPlateHoriz

pygimli.physics.gravimetry.gradGZSphere(r, rad, rho, pos=(0.0, 0.0, 0.0))[source]

TODO WRITEME.

$g = -\nabla u$
Parameters: r : [float, float, float] position vector rad : float radius of the sphere rho : float density in [kg/m^3] [d g_z /dx, d g_z /dy, d g_z /dz]

pygimli.physics.gravimetry.gradUCylinderHoriz(r, a, rho, pos=(0.0, 0.0))[source]

2D Gradient of gravimetric potential of horizontal cylinder.

Calculate .. in mGal at position pos

$g = -G[m^3/(kg s^2)] * dM[kg/m] * 1/r[1/m] * grad(r)[1/1] = [m^3/(kg s^2)] * [kg/m] * 1/m * [1/1] == m/s^2$
Parameters: r : list[[x, z]] Observation positions a : float Cylinder radius in [meter] pos : [x,z] Center position of cylinder. rho : float Delta density in [kg/m^3] g : [dudx, dudz] Gradient of gravimetry potential.

Examples using pygimli.physics.gravimetry.gradUCylinderHoriz

pygimli.physics.gravimetry.gradUHalfPlateHoriz(pnts, t, rho, pos=(0.0, 0.0))[source]

TODO WRITEME.

Analytical solution

Parameters: pnts : t : rho : Density in [kg/m^3] gz: z-component of g .. math:: nabla(partial u/partialvec{r})_z

Examples using pygimli.physics.gravimetry.gradUHalfPlateHoriz

pygimli.physics.gravimetry.gradUSphere(r, rad, rho, pos=(0.0, 0.0, 0.0))[source]

Gravitational field of a sphere.

$g = -G[m^3/(kg s^2)] * dM[kg] * 1/r^2 1/m^2] * \grad(r)[1/1] = [m^3/(kg s^2)] * [kg] * 1/m^2 * [1/1] == m/s^2$
Parameters: r : [float, float, float] position vector rad : float radius of the sphere rho : float density in [kg/m^3] [gx, gy, gz] : [float*3] gravitational acceleration (note that gz points negative)

solveGravimetry

pygimli.physics.gravimetry.solveGravimetry(mesh, dDensity=None, pnts=None, complete=False)[source]

Solve gravimetric response.

2D with pygimli.physics.gravimetry.lineIntegralZ_WonBevis

3D with pygimli.physics.gravimetry.gravMagBoundarySinghGup

TOWRITE

Parameters: mesh : GIMLI::Mesh 2d or 3d mesh with or without cells. dDensity : float | array Density difference. float – solve for positive boundary marker only. Assuming one inhomogeneity. [[int, float]] – solve for multiple positive boundaries TOIMPL array – solve for one delta density value per cell None – return per cell kernel matrix G TOIMPL pnts : [[x_i, y_i]] List of measurement positions. complete : bool [False] If True return whole solution or matrix for [dgx, dgy, dgz] and … TODO

Examples using pygimli.physics.gravimetry.solveGravimetry

uCylinderHoriz

pygimli.physics.gravimetry.uCylinderHoriz(pnts, rad, rho, pos=(0.0, 0.0))[source]

Gravitational potential of horizonzal cylinder.

TODO

uSphere

pygimli.physics.gravimetry.uSphere(r, rad, rho, pos=None)[source]

Gravitational potential of a sphere.

Gravitational potential of a sphere with radius and density at a given position.

$u = -G * dM * \frac{1}{r}$
Parameters: r : [float, float, float] position vector rad : float radius of the sphere rho : float density pos : [float, float, float] position of sphere (0.0, 0.0, 0.0)

## Classes¶

GravimetryModelling

class pygimli.physics.gravimetry.GravimetryModelling(verbose=True)[source]

Gravimetry modelling operator.

Methods

 __call__((object)arg1, (object)model) C++ signature : GIMLI::Vector __call__(GIMLI::ModellingBase {lvalue},GIMLI::Vector) clearConstraints((object)arg1) C++ signature : void* clearConstraints(GIMLI::ModellingBase {lvalue}) clearJacobian((object)arg1) C++ signature : void* clearJacobian(GIMLI::ModellingBase {lvalue}) constraints((object)arg1) C++ signature : GIMLI::MatrixBase* constraints(GIMLI::ModellingBase {lvalue}) constraintsRef((object)arg1) C++ signature : GIMLI::SparseMapMatrix {lvalue} constraintsRef(GIMLI::ModellingBase {lvalue}) createConstraints((object)arg1) C++ signature : void* createConstraints(GIMLI::ModellingBase {lvalue}) createDefaultStartModel((object)arg1) C++ signature : GIMLI::Vector createDefaultStartModel(GIMLI::ModellingBase {lvalue}) createJacobian(model) Create Jacobian matrix for a density model. createMappedModel((object)arg1, …) Read only extrapolation of model values given per cell marker to values given per cell. createRefinedForwardMesh((object)arg1 [, …) C++ signature : void* createRefinedForwardMesh(GIMLI::ModellingBase {lvalue} [,bool=True [,bool=False]]) createStartModel((object)arg1) C++ signature : GIMLI::Vector createStartModel(GIMLI::ModellingBase {lvalue}) createStartVector((object)arg1) DEPRECATED use createStartModel createStartmodel() Create the default starting model. data((object)arg1) Return the associated data container. deleteMesh((object)arg1) Delete the actual mesh. initConstraints((object)arg1) C++ signature : void* initConstraints(GIMLI::ModellingBase {lvalue}) initJacobian((object)arg1) C++ signature : void* initJacobian(GIMLI::ModellingBase {lvalue}) initRegionManager((object)arg1) C++ signature : void* initRegionManager(GIMLI::ModellingBase {lvalue}) jacobian((object)arg1) Return the pointer to the Jacobian matrix associated with this forward operator. jacobianRef((object)arg1) C++ signature : GIMLI::Matrix {lvalue} jacobianRef(GIMLI::ModellingBase {lvalue}) mapModel((object)arg1, (object)model [, …) C++ signature : void* mapModel(GIMLI::ModellingBase {lvalue},GIMLI::Vector [,double=0]) mesh((object)arg1) C++ signature : GIMLI::Mesh* mesh(GIMLI::ModellingBase {lvalue}) multiThreadJacobian((object)arg1) Return number of threads used for Jacobian generation. region((object)arg1, (object)marker) Syntactic sugar for this->regionManager().region(marker). regionManager((object)arg1) C++ signature : GIMLI::RegionManager regionManager(GIMLI::ModellingBase {lvalue}) regionManagerRef((object)arg1) C++ signature : GIMLI::RegionManager {lvalue} regionManagerRef(GIMLI::ModellingBase {lvalue}) response(dDensity) Calculate response for a given density distribution. response_mt((object)arg1, (object)model [, …) C++ signature : GIMLI::Vector response_mt(GIMLI::ModellingBase {lvalue},GIMLI::Vector [,unsigned long=0]) setConstraints((object)arg1, (object)C) C++ signature : void* setConstraints(GIMLI::ModellingBase {lvalue},GIMLI::MatrixBase*) setData((object)arg1, (object)data) Change the associated data container setJacobian((object)arg1, (object)J) C++ signature : void* setJacobian(GIMLI::ModellingBase {lvalue},GIMLI::MatrixBase*) setMesh((object)arg1, (object)mesh [, …) Set new mesh to the forward operator, optionally hold region parameter for the new mesh (i.e. setMultiThreadJacobian((object)arg1, …) Set number of threads used for brute force Jacobian generation. setRegionManager((object)arg1, (object)reg) C++ signature : void* setRegionManager(GIMLI::ModellingBase {lvalue},GIMLI::RegionManager*) setSensorPositions(pnts) Set measurement locations. setStartModel((object)arg1, (object)startModel) C++ signature : void* setStartModel(GIMLI::ModellingBase {lvalue},GIMLI::Vector) setThreadCount((object)arg1, (object)nThreads) Set the maximum number of allowed threads for MT calculation. setVerbose((object)arg1, (object)verbose) Set verbose state. solution((object)arg1) C++ signature : GIMLI::Matrix solution(GIMLI::ModellingBase {lvalue}) startModel((object)arg1) C++ signature : GIMLI::Vector startModel(GIMLI::ModellingBase {lvalue}) threadCount((object)arg1) Return the maximum number of allowed threads for MT calculation verbose((object)arg1) Get verbose state.
 createJacobian_mt responses
__init__(verbose=True)[source]

Constructor.

clearConstraints((object)arg1) → object :
C++ signature :
void* clearConstraints(GIMLI::ModellingBase {lvalue})

clearConstraints( (object)arg1) -> object :

C++ signature :
void* clearConstraints(ModellingBase_wrapper {lvalue})
clearJacobian((object)arg1) → object :
C++ signature :
void* clearJacobian(GIMLI::ModellingBase {lvalue})

clearJacobian( (object)arg1) -> object :

C++ signature :
void* clearJacobian(ModellingBase_wrapper {lvalue})
constraints((object)arg1) → object :
C++ signature :
GIMLI::MatrixBase* constraints(GIMLI::ModellingBase {lvalue})

constraints( (object)arg1) -> object :

C++ signature :
GIMLI::MatrixBase* constraints(ModellingBase_wrapper {lvalue})

constraints( (object)arg1) -> object :

C++ signature :
GIMLI::MatrixBase* constraints(GIMLI::ModellingBase {lvalue})

constraints( (object)arg1) -> object :

C++ signature :
GIMLI::MatrixBase* constraints(ModellingBase_wrapper {lvalue})
constraintsRef((object)arg1) → object :
C++ signature :
GIMLI::SparseMapMatrix<double, unsigned long> {lvalue} constraintsRef(GIMLI::ModellingBase {lvalue})

constraintsRef( (object)arg1) -> object :

C++ signature :
GIMLI::SparseMapMatrix<double, unsigned long> {lvalue} constraintsRef(GIMLI::ModellingBase {lvalue})
createConstraints((object)arg1) → object :
C++ signature :
void* createConstraints(GIMLI::ModellingBase {lvalue})

createConstraints( (object)arg1) -> object :

C++ signature :
void* createConstraints(ModellingBase_wrapper {lvalue})
createDefaultStartModel((object)arg1) → object :
C++ signature :
GIMLI::Vector<double> createDefaultStartModel(GIMLI::ModellingBase {lvalue})

createDefaultStartModel( (object)arg1) -> object :

C++ signature :
GIMLI::Vector<double> createDefaultStartModel(ModellingBase_wrapper {lvalue})
createJacobian(model)[source]

Create Jacobian matrix for a density model.

Create Jacobian matrix for a density distribution (model) and store it internal.

createJacobian_mt(model, resp)
createMappedModel((object)arg1, (object)model[, (object)background=-1]) → object :

Read only extrapolation of model values given per cell marker to values given per cell. Exterior values will be set to background or prolongated for background = -1.

C++ signature :
GIMLI::Vector<double> createMappedModel(GIMLI::ModellingBase {lvalue},GIMLI::Vector<double> [,double=-1])
createRefinedForwardMesh((object)arg1[, (object)refine=True[, (object)pRefine=False]]) → object :
C++ signature :
void* createRefinedForwardMesh(GIMLI::ModellingBase {lvalue} [,bool=True [,bool=False]])
createStartModel((object)arg1) → object :
C++ signature :
GIMLI::Vector<double> createStartModel(GIMLI::ModellingBase {lvalue})
createStartVector((object)arg1) → object :

DEPRECATED use createStartModel

C++ signature :
GIMLI::Vector<double> createStartVector(GIMLI::ModellingBase {lvalue})
createStartmodel()[source]

Create the default starting model.

data((object)arg1) → object :

Return the associated data container.

C++ signature :
GIMLI::DataContainer {lvalue} data(GIMLI::ModellingBase {lvalue})
deleteMesh((object)arg1) → object :

Delete the actual mesh.

C++ signature :
void* deleteMesh(GIMLI::ModellingBase {lvalue})
initConstraints((object)arg1) → object :
C++ signature :
void* initConstraints(GIMLI::ModellingBase {lvalue})

initConstraints( (object)arg1) -> object :

C++ signature :
void* initConstraints(ModellingBase_wrapper {lvalue})
initJacobian((object)arg1) → object :
C++ signature :
void* initJacobian(GIMLI::ModellingBase {lvalue})

initJacobian( (object)arg1) -> object :

C++ signature :
void* initJacobian(ModellingBase_wrapper {lvalue})
initRegionManager((object)arg1) → object :
C++ signature :
void* initRegionManager(GIMLI::ModellingBase {lvalue})
jacobian((object)arg1) → object :

Return the pointer to the Jacobian matrix associated with this forward operator.

C++ signature :
GIMLI::MatrixBase* jacobian(GIMLI::ModellingBase {lvalue})
jacobian( (object)arg1) -> object :

Return the pointer to the Jacobian matrix associated with this forward operator.

C++ signature :
GIMLI::MatrixBase* jacobian(GIMLI::ModellingBase {lvalue})
jacobianRef((object)arg1) → object :
C++ signature :
GIMLI::Matrix<double> {lvalue} jacobianRef(GIMLI::ModellingBase {lvalue})

jacobianRef( (object)arg1) -> object :

C++ signature :
GIMLI::Matrix<double> {lvalue} jacobianRef(GIMLI::ModellingBase {lvalue})
mapModel((object)arg1, (object)model[, (object)background=0]) → object :
C++ signature :
void* mapModel(GIMLI::ModellingBase {lvalue},GIMLI::Vector<double> [,double=0])
mesh((object)arg1) → object :
C++ signature :
GIMLI::Mesh* mesh(GIMLI::ModellingBase {lvalue})
multiThreadJacobian((object)arg1) → object :

Return number of threads used for Jacobian generation.

C++ signature :
region((object)arg1, (object)marker) → object :

Syntactic sugar for this->regionManager().region(marker).

C++ signature :
GIMLI::Region* region(GIMLI::ModellingBase {lvalue},int)
regionManager((object)arg1) → object :
C++ signature :
GIMLI::RegionManager regionManager(GIMLI::ModellingBase {lvalue})

regionManager( (object)arg1) -> object :

C++ signature :
GIMLI::RegionManager {lvalue} regionManager(GIMLI::ModellingBase {lvalue})
regionManagerRef((object)arg1) → object :
C++ signature :
GIMLI::RegionManager {lvalue} regionManagerRef(GIMLI::ModellingBase {lvalue})
response(dDensity)[source]

Calculate response for a given density distribution.

response_mt((object)arg1, (object)model[, (object)i=0]) → object :
C++ signature :
GIMLI::Vector<double> response_mt(GIMLI::ModellingBase {lvalue},GIMLI::Vector<double> [,unsigned long=0])

response_mt( (object)arg1, (object)model [, (object)i=0]) -> object :

C++ signature :
GIMLI::Vector<double> response_mt(ModellingBase_wrapper {lvalue},GIMLI::Vector<double> [,unsigned long=0])
responses(models, respos)
setConstraints((object)arg1, (object)C) → object :
C++ signature :
void* setConstraints(GIMLI::ModellingBase {lvalue},GIMLI::MatrixBase*)

setConstraints( (object)arg1, (object)C) -> object :

C++ signature :
void* setConstraints(ModellingBase_wrapper {lvalue},GIMLI::MatrixBase*)
setData((object)arg1, (object)data) → object :

Change the associated data container

C++ signature :
void* setData(GIMLI::ModellingBase {lvalue},GIMLI::DataContainer {lvalue})
setJacobian((object)arg1, (object)J) → object :
C++ signature :
void* setJacobian(GIMLI::ModellingBase {lvalue},GIMLI::MatrixBase*)

setJacobian( (object)arg1, (object)J) -> object :

C++ signature :
void* setJacobian(ModellingBase_wrapper {lvalue},GIMLI::MatrixBase*)
setMesh((object)arg1, (object)mesh [, (object)ignoreRegionManager=False]) -> object : Set new mesh to the forward operator, optionally hold region parameter for the new mesh (i.e. for roll a long)

Set new mesh to the forward operator, optionally hold region parameter for the new mesh (i.e. for roll a long)

C++ signature :
void* setMesh(GIMLI::ModellingBase {lvalue},GIMLI::Mesh [,bool=False])
setMultiThreadJacobian((object)arg1, (object)nThreads) → object :

Set number of threads used for brute force Jacobian generation. 1 is default. If nThreads is greater than 1 you need to implement response_mt with a read only response function. Maybe its worth set the single setThreadCount to 1 than, that you dont find yourself in a threading overkill.

C++ signature :
setRegionManager((object)arg1, (object)reg) → object :
C++ signature :
void* setRegionManager(GIMLI::ModellingBase {lvalue},GIMLI::RegionManager*)
setSensorPositions(pnts)[source]

Set measurement locations. [[x,y,z],…].

setStartModel((object)arg1, (object)startModel) → object :
C++ signature :
void* setStartModel(GIMLI::ModellingBase {lvalue},GIMLI::Vector<double>)

setStartModel( (object)arg1, (object)startModel) -> object :

C++ signature :
void* setStartModel(ModellingBase_wrapper {lvalue},GIMLI::Vector<double>)
setThreadCount((object)arg1, (object)nThreads) → object :

Set the maximum number of allowed threads for MT calculation. Have to be greater than 0. Will also set ENV(OPENBLAS_NUM_THREADS) .. if used.

C++ signature :
setVerbose((object)arg1, (object)verbose) → object :

Set verbose state.

C++ signature :
void* setVerbose(GIMLI::ModellingBase {lvalue},bool)
solution((object)arg1) → object :
C++ signature :
GIMLI::Matrix<double> solution(GIMLI::ModellingBase {lvalue})
startModel((object)arg1) → object :
C++ signature :
GIMLI::Vector<double> startModel(GIMLI::ModellingBase {lvalue})

startModel( (object)arg1) -> object :

C++ signature :
GIMLI::Vector<double> startModel(ModellingBase_wrapper {lvalue})
threadCount((object)arg1) → object :

Return the maximum number of allowed threads for MT calculation

C++ signature :
verbose((object)arg1) → object :

Get verbose state.

C++ signature :
bool verbose(GIMLI::ModellingBase {lvalue})

verbose( (object)arg1) -> object :

C++ signature :
bool verbose(GIMLI::ModellingBase {lvalue})

Created using Bootstrap, Sphinx and pyGIMLi 1.0.10+38.gde1bd3dd) on Mar 13, 2019.