Usage

Note

EMFEM does not have a graphic user interface. The user should be familiar with the basic Unix commands to compile and run applications.

Note

EMFEM was only tested on Linux and macOS systems. For Windows users, we suggest to use WSL1/WSL2 or a virtual machine.

Prerequisites

EMFEM uses several open source libraries, including:

  • MPI implementation, such as mpich or openmpi, EMFEM uses MPI to parallize the forward modeling procedure.

  • PETSc is a library that supports parallel linear algebra, krylov solvers, preconditioners and many other things. Note that PETSc must be compiled with MUMPS and HYPRE.

  • Metis is a library for partitioning graphs and finite element meshes.

  • TetGen is a program to generate tetrahedral meshes of any 3D polyhedral domains. EMFEM uses it to tetrahedralize the computational domain and refine mesh adaptively.

  • Eigen is a C++ template library for linear algebra.

  • nanoflann is a C++11 header-only library for building KD-Trees of datasets with different topologies. EMFEM uses it to find the vertex or cell closest to a receiver point efficiently.

The easiest way to install the dependencies of EMFEM is using spack. All the dependencies can be installed with

$ spack install metis tetgen eigen petsc+mumps+hypre+superlu-dist nanoflann

Building

Once installed all the dependencies and unpacked the source code of EMFEM into a directory /path/to/emfem/sources. Then configure, compile EMFEM with

$ cd /path/to/emfem/sources
$ mkdir build
$ cd build
$ spack load mpi
$ cmake -DCMAKE_BUILD_TYPE=Release \
        -DPETSC_DIR=$(spack location -i petsc) \
        -DTETGEN_DIR=$(spack location -i tetgen) \
        -DNANOFLANN_DIR=$(spack location -i nanoflann) \
        -DEIGEN_DIR=$(spack location -i eigen) \
        -DMETIS_DIR=$(spack location -i metis) ..
$ make

Quick start

Normally EMFEM is executed just with the prefix of the input files and the prefix of output files

$ mpirun -np <np> ./emfem -iprefix <prefix of input files> -oprefix <prefix of output file>

The input files consists of Model File and Data File. The model file describes the model geometry, resistivity. The data file contains the data, i.e., frequencies, transmitters, receivers… By convention, The model file must have the extension .mdl. For example: <prefix of input files>.mdl. The data file should have the extension .emd. For example: <prefix of input files>.emd. The corresponding model responses are written to <prefix of output file>.rsp.

EMFEM also accepts other parameters, please see Command Line Arguments for more details.