grav2d-cube : Forward modeling of gravitational field of cubes under the Cartesian coordinates.
Compile
For Mac OS users, install gcc using Homebrew by
brew install gcc
For Linux users, install gcc by
apt-get install gcc
then go the directory of the program and make the program. Then export the directory to your $PATH.
Usage
grav2d-cube -r<x-start>/<x-step>/<x-end>/<y-start>/<y-step>/<y-end>/<elevation>|<filename> -c<x-cen>/<y-cen>/<z-cen>/<dx>/<dy>/<dz>/<density>|<filename> -tgravity|gx|gy|gz -h > out-file
Options
- -r: Initializing the observation points from parameters or a file. If the parameters are used, you need to specify starting and ending positions of x and y coordinates of the observation points, along with their intervals dx and dy. The interval could be a positive or negative number depending on whether the starting coordinate is bigger than the ending coordinate or not. The program could also read observation’s positions from a file, in which each line of the file contains the x, y and z coordinates of a observation point. Any line that starts with ‘#’ will be ignored so that you can annotate the file as you want. Note that the program uses the right-hand system for the observation points, which means the x and y directions correspond to the easting and northing directions, respectively.
- -c: Initializing geometric and physical properties of a cube from parameters or cubes from a file. The geometric properties of a cube is represented by its center location <x-cen>/<y-cen>/<z-cen> and spatial extensions <dx>/<dy>/<dz>. the cube’s density is appended last to the parameter string. A file that contains parameter strings is needed if you want to add multiple cubes. Each line of the file describes one cube. Also, any line that starts with ‘#’ will be ignored. Note that the program uses the reversed right-hand system for locating the cubes, in which case the z direction is pointing downward, and the x and y directions correspond to the northing and easting directions, respectively.
- -t: Choose the component of the forward calculation, which is gravity for gravity and gx, gy and gz gravity gradient in x, y and z directions, respectively.
- out-file: Output file of the forward calculated gravitational data. The program will use the standard output by default. However, you can redirect the output to a file by using the ‘>’ symbol. Each line of output file consists of x y z positions of the observation point and the forward calculation gravitational data appended at the last.
- -h: Show help information.
Examples
- Forward calculating a cube’s gravity data. The center of the cube is located at (500 m,500 m,200 m) and the size of the cube are 200 m, 100 m and 100 m in x, y and z directions. The density of the cube is 1.0 \(g/cm^3\). Observation points are from 0 ~ 1000 m with 10 m spacing in both x and y directions. Moreover, the elevation of observations equals 10 m.
grav2d-cube -r 0/10/1000/0/10/1000/10 -c 500/500/200/200/100/100/1.0 -t gravity > one-cube-grav.txt
- Read the cube’s parameters and observation’s positions from files. And forward calculating the gravity gradient data.
grav2d-cube -r obs-position.txt -c cube-para.txt > cubes-gravity.txt