Overview
Description
fragma is a 2D finite element solver for simulating crack propagation using the phase-field approach to fracture.
It is built on top of fenicsx.
It has several non-classic features :
- crack propagation in anistropic media,
- indirect load control using path-following methods.
Installation
To run fragma, install the required Python modules in a dedicated environment:
-
Create and activate a dedicated environment:
conda create -n fragma conda activate fragma -
Install FEniCSx (with GMSH):
conda install -c conda-forge fenics-dolfinx=0.10 pyvista mpich gmsh # Linux and macOS conda install -c conda-forge fenics-dolfinx=0.10 pyvista pyamg gmsh # Windows -
Install
fragma:pip install . # If you cloned the repo pip install fragma # If you want to install from pypi
Hands-On: Test with Examples
The examples directory contains ready-to-run scripts and parameter files.
Just follow these steps:
- Navigate to the
examplesdirectory. -
Run the provided
run.shscript:cd examples ./run.sh -
Visualize the results in Paraview.
Usage
Requirements
To run a simulation, the following files are required in the simulation directory:
- A GMSH mesh file :
mesh.geo - A
parameters.tomlconfiguration file (see theexamplesdirectory for reference)
Running the Solver
- Navigate to the simulation directory containing (the mesh and the
parameters.tomlfile). -
Activate the
fragmaenvironment:conda activate fragma -
Run the solver:
python path/to/repo/fragma/main.py
Notes
- The
examplesinclude arun.shscript to automate mesh generation and execution. -
On some Linux distributions, set
OMP_NUM_THREADS=1to prevent FEniCSx from using all available threads:OMP_NUM_THREADS=1 python path/to/repo/fragma/main.py
Outputs
Results are saved in the results subdirectory.
Two types of file are exported:
- The solution fields (displacement, phase-field, etc.) are saved in
VTKfiles (e.g.,Displacement.pvd). - The scalar outputs (energies, displacement/force measures, etc.) are saved in the
probes.csvCSV file.