Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

grdgravmag3D_grav_sph.sh 1.8 KB

You have to be logged in to leave a comment. Sign In
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
  1. #!/usr/bin/env bash
  2. #
  3. # Computes the gravity anomaly over a sphere with radius r = 15 m and center at -15 m.
  4. # The sphere is approximated by two hemispheres
  5. # Compare with analytical expressions
  6. ps=grdgravmag3D_grav_sph.ps
  7. r=10
  8. z0=-15
  9. rho=1000
  10. # Compute two half spheres with radius = 10 and center at -15
  11. gmt grdmath -R-10/10/-10/10 -I0.5 X Y HYPOT $r DIV ACOS SIN $r MUL $z0 ADD = top_half.grd
  12. gmt grdmath -R-10/10/-10/10 -I0.5 X Y HYPOT $r DIV ACOS SIN $r MUL NEG $z0 ADD = bot_half.grd
  13. echo -50 0 > li
  14. echo 50 0 >> li
  15. gmt sample1d li -Fl -I2 > li1.dat
  16. # Compute the effect of the two hemi-spheres and add them
  17. gmt grdgravmag3d top_half.grd -C$rho -Zb -Gtop_g.grd
  18. gmt grdgravmag3d bot_half.grd -C$rho -Zt -Gbot_g.grd
  19. gmt grdmath bot_g.grd top_g.grd ADD = sphere_g.grd
  20. # Compute the effect of the two hemi-spheres along XX axis and add them
  21. gmt grdgravmag3d top_half.grd -C$rho -Zb -Fli1.dat > tt.dat
  22. gmt grdgravmag3d bot_half.grd -C$rho -Zt -Fli1.dat > tb.dat
  23. gmt math tt.dat tb.dat ADD = t.dat
  24. # Profile of analytic anomaly
  25. gmt math -T-50/50/1 T $z0 HYPOT 3 POW INV 6.674e-6 MUL 4 MUL 3 DIV PI MUL $r 3 POW MUL $rho MUL $z0 ABS MUL = ztmp.dat
  26. gmt psxy ztmp.dat -R-50/50/0/0.125 -JX14c/8c -Bx10f5 -By.01 -BWSne+t"Anomaly (mGal)" -W1p,200/0/0 -P -K > $ps
  27. gmt psxy t.dat -i0,2 -R -JX -Sc.15c -Gblue -O -K >> $ps
  28. echo -49 0 > li
  29. echo 49 0 >> li
  30. gmt sample1d li -Fl -I2 -S-49/49 > li1.dat
  31. # Compute the anomaly using the two hemi-sphere grids at once
  32. gmt grdgravmag3d top_half.grd bot_half.grd -C1000 -Fli1.dat > t2.dat
  33. gmt psxy t2.dat -i0,2 -R -JX -Sc.15c -Ggreen -O -K >> $ps
  34. gmt makecpt -T0.047/0.125/0.001 > t.cpt
  35. gmt grdimage sphere_g.grd -Ct.cpt -JX12c -B2f1 -BWSen+t"Gravity anomaly of a sphere" -Y10.5c -O >> $ps
  36. rm -f t*.dat t.cpt li*.dat top_*.grd bot_*.grd ztmp.dat
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...