Usage

Installation

To use the MTE code, follow these steps:
  1. Clone from github.

  2. Ensure that you have the following dependencies installed and up to date: python3, paraview, matplotlib and/or gnuplot.

General outline (hierarchy) of code

The main body of the code is in MTE.py, where you can configure the model setup for various benchmarks and modify meshing, among other tasks. It relies on three modules that consist of various functions:
  1. magnetostatics: This module mainly involves the translation of the original Fortran77 code from [Blakely, 1995].

  2. tools: This module contains functions to generate vtu files for visualization.

  3. support: This module houses several functions related to specific model setups.

The script run.sh performs a straightforward task: it executes the MTE.py code, generating output both in the terminal and writing it in a file named log.txt.
Additionally, several specific model setups have exclusive modules and (run) scripts, please see respective sections for specific usage of the code: Benchmarks, Synthetic topopography: flank simulations, Parameters, Artificial DEM and Case study: Mount Etna.

Reproducing results

Throughout this documentation, we provide a stepwise approach to reproduce the results. These steps can be found in collapsible subsections at the end of each respective section. Each step will contain one or more code blocks detailing the required commands or changes.
Code blocks are preceded by captions that specify the location or context of the provided code. This caption might refer to a particular file in the MTE library, such as:
Code 1 /main/MTE.py
1

In such cases, the line numbers in the code block correspond directly to the line numbers in the specified file. Changes or additions to the base version are highlighted for ease of reference. Some comments in code blocks may not exactly match the comments in the code.

Note

Highlighted lines are changes from the last setup outlined in previous steps or sections, if any preceding steps or section were not performed, make sure to check all lines for changes to the base code 1.

Alternatively, the caption might indicate a terminal (or Spyder console 2) command executed within a certain directory:
Code 2 /main/ (runtime: ~10 s)

In steps were computation time is expected to be significant, an estimate of the computation time is stated in the caption 3.
If testing required several changes to the same file, more concise code blocks side by side are used. So, when encountering two code blocks placed side by side in the model setup steps, this denotes multiple runs with different setups, each subsequent code block listed only once within that step should be performed repeatedly for all setups.
Any changes from the previous step are again highlighted for ease of reference.
Code 3 /main/benchmarks/

Code 4 /main/benchmarks/

Regarding data visualization, for the benchmarks we supply scripts for two different plotting tools: gnuplot and matplotlib. While both scripts are designed to generate similar outputs, it is worth noting that gnuplot was our primary tool for this project. As such, the plots it produces are considered the most accurate visual representation of our data. When encountering two code blocks placed side by side in the plotting steps, this denotes a choice to use your preferred plotting tool.
In instances where specific commands are executed multiple times consecutively, a single caption will precede all such repetitive steps:
Code 5 /main/



Note

Any modifications to the code and accompanying data not mentioned within these steps might produce unverified results. Should you make such alterations, please meticulously reviews all comments in the code and consult the Functions documentation.

Footnotes

1

The base code is the version of MTE.py on github.

2

If you are using Spyder, make sure to add the Spyder-terminal plugin.

3

Time estimate done with OS: ubuntu 22.04.3, with processor: Intel® Core™ i5-8250U CPU @ 1.60GHz × 8, and with RAM: 8,0 GiB.