Skip to main content

mesh2flac3d

CI License: MIT

Convert meshes (Gmsh .msh, VTK, and anything meshio reads) to Itasca FLAC3D .f3grid grids — preserving physical groups:

  • Volume physical groups → ZGROUP (zone groups)
  • Surface physical groups → FGROUP (face groups, for boundary conditions)
  • Correct zone winding: every zone is reordered to FLAC3D's convention, so you never get negative-volume zone errors on import.

It reads meshes through meshio (MIT) and does not import gmsh, so it carries no GPL obligation — you can use it freely, including in commercial workflows.

Why not just use meshio?

meshio has a FLAC3D writer, but for a typical geomechanics mesh (volume and surface physical groups) it currently:

  • crashes (TypeError in split_f_z) when both zone and face groups are present, and
  • drops all 2D groups ("FLAC3D format only supports 3D cells. Skipping triangle…"), so you lose the face groups you need for boundary conditions, and
  • does not guarantee zone orientation.

mesh2flac3d is a focused, correct writer built for that exact case.

Install

pip install mesh2flac3d          # once published
# or, from source:
pip install -e .

Command line

mesh2flac3d model.msh model.f3grid
mesh2flac3d model.msh                 # -> model.f3grid
mesh2flac3d model.msh out.f3grid --dat out.dat   # also write a FLAC3D command skeleton
mesh2flac3d model.msh --no-faces      # zones only

Example output:

[mesh2flac3d] model.msh -> model.f3grid
  points: 350  zones: 1218  faces: 522
  zone groups: Underburden(401), Salt(414), Overburden(403)
  face groups: Top(90), Bottom(90), Sides(342)

Python API

import mesh2flac3d as m2f

grid = m2f.convert("model.msh", "model.f3grid")
print(grid.zone_groups.keys())   # dict_keys(['Underburden', 'Salt', 'Overburden'])
print(grid.face_groups.keys())   # dict_keys(['Top', 'Bottom', 'Sides'])

Supported elements

Family Gmsh / meshio FLAC3D
Zones tetra T4
pyramid P5
wedge / prism W6
hexahedron B8
Faces triangle T3
quad Q4

High-order variants (tetra10, hexahedron20, …) are exported using their linear corner nodes.

In Gmsh, name your groups

Give your regions and boundaries Physical Groups with names — those names become the FLAC3D group names:

Physical Volume("Salt")  = {2};
Physical Surface("Top")  = {4};

Development

pip install -e ".[test]"
pytest -q

The test fixture is generated with Gmsh (tests/fixtures/make_testmesh.py); Gmsh is a test-only dependency, never used by the package at runtime.

License

MIT © AI SIM Engenharia Geotécnica. FLAC3D and Itasca are trademarks of Itasca Consulting Group; this project is independent and not affiliated with Itasca.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mesh2flac3d-0.1.0.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mesh2flac3d-0.1.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file mesh2flac3d-0.1.0.tar.gz.

File metadata

  • Download URL: mesh2flac3d-0.1.0.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.13

File hashes

Hashes for mesh2flac3d-0.1.0.tar.gz
Algorithm Hash digest
SHA256 de03f41ba4e770748ccdaf2c2d76e264fef4a88158223fc1184eecb355d8d886
MD5 ccc45f0f6b5f8f43eded081ae81a1c1c
BLAKE2b-256 82e899e63da00442ae38a46eb86238b50845c921c2d74e4f8cb6fab9c6dce5c7

See more details on using hashes here.

File details

Details for the file mesh2flac3d-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mesh2flac3d-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.13

File hashes

Hashes for mesh2flac3d-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 413889f28733adbcc172e89beeb80478f39fc6b30edf0888d50a8f5b36bd75f0
MD5 8ecf48c07a75efec9a4f1aa2076dc581
BLAKE2b-256 0bd8a0aa4e488ee582ad1dd041a1c2b581b92533bfd113d181a550344c6642f2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page