Skip to content

molivag/MeshTran

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MeshTran

Mesh transformation utilities for FEMTIC-based magnetotelluric inverse modeling.

MeshTran is a lightweight preprocessing toolkit designed to prepare spatial data and computational domains for the Finite Element Magnetotelluric Inversion Code, FEMTIC (Y. Usui, 2015). The objective of this project is not to replace FEMTIC utilities, but to provide a structured preprocessing layer that simplifies coordinate transformations, domain definition, and mesh preparation steps commonly required before running large-scale MT inversions.

The toolkit focuses on reproducible preparation of FEMTIC input files from observational data and geospatial datasets. In particular, MeshTran aims to reduce the complexity of preparing the FEMTIC preprocessing input data by allowing most mesh preparation steps to be controlled from a single configuration file.

MeshTran is also designed as a component of the broader MTIF (Magnetotelluric Inversion Framework) ecosystem, where it acts as the geometry and preprocessing layer prior to running the inversion workflow.


Features

Current utilities support the following preprocessing tasks:

  • Reading MT station information from EDI files
  • Coordinate transformation (latitude/longitude → UTM → mesh coordinates)
  • Domain centering and coordinate normalization
  • DEM and bathymetry integration
  • Automated generation of FEMTIC input files
  • Preparation of geometry and inputs for makeTetraMesh and TetGen
  • Simplified configuration of FEMTIC meshing parameters
  • Basic validation utilities for domain consistency

A key goal of MeshTran is to simplify FEMTIC mesh configuration. Instead of manually editing multiple preprocessing files, users can define the required parameters in a single configuration input, from which MeshTran generates the corresponding FEMTIC input files.


Workflow Overview

The typical preprocessing pipeline implemented in MeshTran follows these steps:

  1. Read EDI files and extract station latitude, longitude, and elevation
  2. Convert geographic coordinates to UTM coordinates
  3. Convert spatial data from meters to kilometers
  4. Compute the geometric center of the station distribution
  5. Transform coordinates into the FEMTIC mesh reference system
  6. Define the computational analysis domain in mesh coordinates
  7. Validate domain coverage with DEM and padding constraints
  8. Generate FEMTIC input files

Input files generated by MeshTran

Observe data.

  • observe.dat

Geometry.

  • control.dat         →   (mesh build)
  • topography.dat
  • bathymetry.dat
  • coastline.dat
  • observing_site.dat
  • analysis_domain.dat

Mesh refinement.

  • makeMtr.param
  • obs_site.dat

TetGen and convertion to FEMTIC

  • output.X.node
  • output.X.ele
  • output.X.face
  • output.X.neigh
  • resistivity_attr.dat

FEMTIC inputs

  • resistivity_block_iter0.dat
  • mesh.dat
  • output.*.femtic.vtk

The general workflow takes information from DEM file, converts EDI files and wrap preprocessing utilities (makeTetraMesh and TetGen) to generate the final tetrahedral mesh used by FEMTIC to run an inversion.

The control.dat file (not generated by MeshTran), which defines the inversion parameters, should be created manually according to the desired configuration.


Repository Structure

The repository is organized as follows:

MeshTran/
├─ Makefile
├── readme.md
├── computing
├── MeshTran (executable)
├── mod
├── bin
│   ├── set_meshtran.io
│ 
├── preprocessing
│   ├── buildMesh
│   ├── DEM
│   ├── edi_files
│   └── geometry
│ 
└── src
    ├── mesh_config.f90
    ├── mesh_entities.f90
    └── meshTranFemtic.f90

The structure may evolve as the project matures.


Minimal Example Workflow

A minimal preprocessing workflow using MeshTran typically follows these steps:

  1. Put the DEM.xyz and EDI files in preprocessing/ folder
  2. Provide a configuration (*.io) file describing the dataset and meshing parameters.
  3. Run the MeshTran preprocessing pipeline.
  4. Generate FEMTIC input files automatically.

Example workflow:

Run:

make

then

./meshTranPreprocessing

This command processes station data, prepares the computational domain, and generates the required FEMTIC preprocessing files.

In typical FEMTIC workflows, mesh preparation requires editing multiple configuration files and manually adjusting meshing parameters. MeshTran simplifies this process by centralizing these parameters into a single input configuration.


Example of set_meshtran.io input file.

(in preparation)


Integration with MTIF

MeshTran is designed to function as a preprocessing component within the MTIF (Magnetotelluric Inversion Framework).

Within MTIF, configuration is typically handled using structured configuration files (e.g. TOML), which are more expressive and easier to maintain than the traditional FEMTIC plaintext input files. MeshTran acts as the intermediate layer that translates these higher-level configuration parameters into the FEMTIC input format required by the meshing and inversion pipeline.


Requirements

MeshTran depends on the FEMTIC mesh generation tools and standard Fortran compilers.

Requirements:

  • makeTetraMesh
  • TetGen
  • makeMtr
  • TetGen2Femtic
  • Fortran compiler (ifort, ifx, or compatible)

Additional geospatial preprocessing tools may be required depending on the workflow.


Project Status

This project is currently under active development and is still in its early stages. However, it already covers the necessary preprocessing steps required to generate the input files needed to run land magnetotelluric inversion models with FEMTIC.

Interfaces and utilities may evolve as the preprocessing workflow matures. The code is primarily developed to support FEMTIC-based magnetotelluric inversion research.


Contributing and Feedback

Contributions, suggestions, and bug reports are welcome.

If you encounter an issue, have ideas for improvements, or would like to collaborate on the project, please open an Issue or submit a Pull Request.

Feedback from the magnetotelluric and geophysical modeling community is especially appreciated.

About

A preprocessing workflow for building and transforming finite-element meshes for FEMTIC-based magnetotelluric inversion.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors