forked from simpeg/simpeg
/
plot_block_in_layer.py
55 lines (43 loc) · 1.29 KB
/
plot_block_in_layer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
"""
Maps: Parametric Block in a Layer
===================================
Parametric description of a block confined to a layer in a
wholespace. The mapping can be applied in 2D or 3D. Here we show a 2D
example.
The model is given by
.. code::
m = np.r_[
'value of the background',
'value in the layer',
'value in the block',
'center of the layer (depth)',
'thickness of the layer',
'x-center of block',
'width of the block'
]
"""
from SimPEG import Mesh, Maps
import numpy as np
import matplotlib.pyplot as plt
def run(plotIt=True):
mesh = Mesh.TensorMesh([50, 50], x0='CC') # 2D Tensor Mesh
mapping = Maps.ParametricBlockInLayer(mesh) # mapping
m = np.hstack(
np.r_[
1., # value of the background
2., # value in the layer
3., # value in the block
-0.1, # center of the layer (depth)
0.2, # thickness of the layer
0.3, # x-center of block
0.2 # width of the block
]
)
# apply the mapping to define the physical property on the mesh
rho = mapping * m
if plotIt is True:
fig, ax = plt.subplots(1, 1, figsize=(4, 6))
mesh.plotImage(rho, ax=ax)
if __name__ == '__main__':
run()
plt.show()