# Simple tesseroid modelΒΆ

The `simple_tess.sh` script calculates
the gravitational potential, gravitational attraction,
and gravity gradient tensor due to a simple tesseroid model:

```
#!/bin/bash
# Generate a regular grid, pipe it to all the computation programs,
# and write the result to output.txt
tessgrd -r-30/30/-30/30 -b50/50 -z250e03 | \
tesspot model.txt | \
tessgx model.txt | tessgy model.txt | tessgz model.txt | \
tessgxx model.txt | tessgxy model.txt | \
tessgxz model.txt | tessgyy model.txt | \
tessgyz model.txt | tessgzz model.txt -v -llog.txt > output.txt
```

Option `-v` tells tessgzz
to print information messages (to stderr).
Option `-llog.txt` tells tessgzz
to log the information plus debug messages
to a file called `log.txt`.

The model file looks like this:

```
# Test tesseroid model file
-5 5 -10 10 0 -50000 200
-12 -16 -12 -16 0 -30000 -500
```

You will notice that this takes
considerably more time to compute
than a *simple 2 prism model*.
This is because *Tesseroids* has to
recursively divide each tesseroid
into smaller tesseroids
in order to maintain the accuracy
of the *numerical integration*.
If you have a look at `log.txt`,
you’ll notice that the 2 tesseroids
were divided approximately 360,000 times
in total.
Don’t worry,
this only happened because the tesseroids
are extremely large.

The result should look like the *following*
(“column” means the column of the output file).