Skip to content

Commit dc5385f

Browse files
committed
voxel_gravity.jl
1 parent b0eed7f commit dc5385f

File tree

5 files changed

+26
-30
lines changed

5 files changed

+26
-30
lines changed

docs/src/man/gravity_code.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Gravity code
22

3-
The `voxGrav` function allows for the voxel-based computation of Bouguer anomalies and gradients from a 3D density matrix.
3+
The `voxel_grav` function allows for the voxel-based computation of Bouguer anomalies and gradients from a 3D density matrix.
44

55
```@docs
6-
GeophysicalModelGenerator.voxGrav
6+
GeophysicalModelGenerator.voxel_grav
77
```

src/GeophysicalModelGenerator.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export
1313
km, m, cm, mm, Myrs, yr, s, MPa, Pa, Pas, K, C, kg, mol,
1414
isDimensional, Value, NumValue, Unit, UnitValue
1515

16-
export ReadCSV_LatLon, meshgrid, voxGrav
16+
export ReadCSV_LatLon, meshgrid, voxel_grav
1717

1818
abstract type AbstractGeneralGrid end # general grid types
1919

src/voxel_gravity.jl

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,30 @@
77
using Printf # do we need this?
88
using Statistics # do we need that?
99

10-
export voxGrav
10+
export voxel_grav
1111

1212
"""
13-
voxGrav(X::Array{Float64, 3}, Y::Array{Float64, 3}, Z::Array{Float64, 3}, RHO::Array{Float64, 3};
13+
voxel_grav(X::Array{Float64, 3}, Y::Array{Float64, 3}, Z::Array{Float64, 3}, RHO::Array{Float64, 3};
1414
refMod="AVG", lengthUnit="m", rhoTol=1e-9, Topo=[], outName="Bouguer", printing=true)
1515
16-
Computes Bouguer anomalies and gradients
17-
18-
Required arguments:
19-
X,Y,Z: 3D matrices with the coordinates of the grid (X should vary in the first dimension, Y in the second, Z (vertical) in the third)
20-
RHO: 3D matrix with the density at each grid point [kg/m^3]
21-
22-
Optional arguments:
23-
refMod: 1D vector with the reference density for each depth
24-
Alternatively, the strings "NE", "SE", "SW", "NW", "AVG" can be used.
25-
In that case, one of the corners of `RHO` is used as reference model.
26-
In case of "AVG" the reference model is the average of each depth slice.
27-
lengthUnit: The unit of the coordinates and topography file. Either "m" or "km"
28-
rhoTol: density differences smaller than rhoTol will be ignored [kg/m^3]
29-
Topo: 2D matrix with the topography of the surface (only relevant for the paraview output)
30-
outName: name of the paraview output (do not include file type)
31-
printing: activate printing of additional information [true or false]
16+
Computes Bouguer anomalies and gradients
17+
18+
Required arguments:
19+
===
20+
- `X`,`Y`,`Z`: 3D matrices with the coordinates of the grid (X should vary in the first dimension, Y in the second, Z (vertical) in the third)
21+
- `RHO`: 3D matrix with the density at each grid point [kg/m^3]
22+
23+
24+
Optional arguments:
25+
===
26+
- `refMod`: 1D vector with the reference density for each depth. Alternatively, the strings "NE", "SE", "SW", "NW", "AVG" can be used. In that case, one of the corners of `RHO` is used as reference model.In case of "AVG" the reference model is the average of each depth slice.
27+
- `lengthUnit`: The unit of the coordinates and topography file. Either "m" or "km"
28+
- `rhoTol`: density differences smaller than `rhoTol` will be ignored [kg/m^3]
29+
- `Topo`: 2D matrix with the topography of the surface (only relevant for the paraview output)
30+
- `outName`: name of the paraview output (do not include file type)
31+
- `printing`: activate printing of additional information [`true` or `false`]
3232
"""
33-
function voxGrav(X::Array{Float64, 3}, Y::Array{Float64, 3}, Z::Array{Float64, 3}, RHO::Array{Float64, 3};
33+
function voxel_grav(X::Array{Float64, 3}, Y::Array{Float64, 3}, Z::Array{Float64, 3}, RHO::Array{Float64, 3};
3434
refMod="AVG", lengthUnit="m", rhoTol=1e-9, Topo=[], outName="Bouguer", printing=true)
3535

3636
## check input

test/gmt.history

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
# GMT 6 Session common arguments shelf
2-
BEGIN GMT 6.5.0
3-
B afWSen
4-
J X
5-
JX X15c/0
2+
BEGIN GMT 6.6.0
63
R 50/51/30/31
7-
@L 1
84
END

test/test_voxel_gravity.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ for iS = 1 : numSpheres
7070
end
7171

7272
# Voxel Code
73-
dg1, gradX1, gradY1 = voxGrav(X, Y, Z, RHO, refMod = RefMod, outName = "Benchmark1", printing = false)
73+
dg1, gradX1, gradY1 = voxel_grav(X, Y, Z, RHO, refMod = RefMod, outName = "Benchmark1", printing = false)
7474

7575
# Other options (same result)
76-
dg2, gradX2, gradY2 = voxGrav(X, Y, Z, RHO, rhoTol = 1, refMod = "SW", outName = "Benchmark2", printing = false)
76+
dg2, gradX2, gradY2 = voxel_grav(X, Y, Z, RHO, rhoTol = 1, refMod = "SW", outName = "Benchmark2", printing = false)
7777

7878
# Other options (different result)
79-
dg3, gradX3, gradY3 = voxGrav(X, Y, Z, RHO, rhoTol = 70, refMod = "NW", outName = "Benchmark3", printing = false)
79+
dg3, gradX3, gradY3 = voxel_grav(X, Y, Z, RHO, rhoTol = 70, refMod = "NW", outName = "Benchmark3", printing = false)
8080
#################################
8181

8282
############# Test ##############

0 commit comments

Comments
 (0)