The SHEMAT-Suite provides an approach for deterministic Bayesian inversion. Its specialty is that derivates are calculated by Automatic Differentiation (AD) instead of divided differences. The approach and methodology is explained in [Rath et al. (2006)](https://academic.oup.com/gji/article/167/1/453/2085661).
## Compilation
Deterministic Inversion for parameters is available in SHEMAT-Suite when
compiling with the `ad`-mode flag instead of `fw` or `sm` (note that you might have to checkout the respective code-branch that contains the AD-code-files).
`# errors` defines the uncertainty range of the 17 parameters. Each
entry stands for a property (one of 17) of a unit. Each row represents
the according unit. In the example above, log(permeability) would range
over 6 magnitudes.
```
# enable unit
0 1
```
| Property | Meaning |
| ------ | ------ |
| 0 | not activated for inversion |
| 1 | activated for inversion |
Analogue to `# enable unit` there is the command
```
# enable property
1 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0
```
| Property | Meaning |
| ------ | ------ |
| 0 | not activated for inversion|
| 1 | activated for inversion, linear |
| 2 | activated for inversion, logarithmic |
So in this example, porosity and permeability of unit 2 of 2 are enabled for
inversion, with porosity varying linearly and permeability logarithmically.
**3.2 Options for boundary condition optimization**
Another option is to invert for boundary conditions. We distinguish between stationary boundary conditions and time-dependent boundary conditions. The following keywords specify the according options:
```
# bcerrors, records=1
1 0.005 temp
!<bc-unit> <error> <pv-type>
```
| Property | Values/Meaning |
| ------ | ------ |
| bc-unit | Specifies the bcindex that is defined at the respective bc-input ([Boundary condition section](./input_file)) |
| pv-type | head / temp / conc |
a) for stationary boundary conditions
```
# optimize bc, records=1
1 1 temp
!<bc-unit> <1 (lin)/2 (log)> <pv-type>
```
b) for time-dependent boundary conditions
```
# optimize tp, records=1
!<tp entry index> <bc index number> <alphy-beta keyword>
```
Here the bc-index needs to be assoziated with a unit number and defines this the dependency to the tp period table
(where to find the tp-entry).
*Note: Information on "optimize tp" are from the read_inverse.f90 routine. Not sure about the meaning of the input options. An example on how to use this option in the input file is missing...*
4. Specify inversion control:
```
# inverse
1 !<1 (on)/0 (off)>
20 0.0001 1.0 !<max number of iterations> <break-off criterion> <time weighting>