# Usage¶

As for any simulation software, three steps are needed to come from a question to an answer:

pre-processing

running the simulation

post-processing

Since DAMASK can be used together with different solvers, one more step is required before setting up the simulation:

solver selection

## 0. Solver Selection¶

The materialpoint model of DAMASK can be used in conjunction with different software packages for the solution of boundary and initial value problems. The most suitable solver for the problem at hand should be selected considering the following comparison:

### Grid Solver¶

included in DAMASK

open source

spectral method (based on Fast Fourier Transforms, FFT) or Finite Element Method (FEM)

geometry is defined on a regular grid

periodic volume element with periodic boundary conditions

### Mesh Solver¶

Warning

The mesh solver is under development and not yet feature complete.

included in DAMASK

open source

Finite Element Method (FEM)

geometry is defined on an unstructured mesh

### MSC.Marc/Mentat¶

requires MSC.Marc/Mentat license

closed source

Finite Element Method (FEM)

geometry is defined on an unstructured mesh

complex boundary conditions including contact

## 1. Pre-Processing¶

### DAMASK Materialpoint Model¶

The materialpoint model of DAMASK is configured through a `material.yaml`

file.
Its format is documented in Material Configuration.
Additional information is given in the Configure a DAMASK Simulation video tutorial and the Create Texure for a Dual-Phase Microstructure Jupyter notebook.

A set of curated configuration files is available as config.tar.xz.

### Geometry and Load¶

The procedure for generating the geometry and setting boundary and initial conditions depends on the selected solver.

#### Grid Solver¶

A grid solver simulation is set up with a Geometry and a Load Case file. The video tutorials Define a Grain Structure on a Regular Grid and Boundary Conditions on an Infinite Body explain the underlying ideas of these file formats. Examples are given in the Jupyter notebooks Generate a Three-Step Load Case for the Grid Solver, Create a Polycrystal with Voronoi Tessellation for the Grid Solver, and Rescale a Grid Solver Geometry File.

A complete simulation setup is available as grid.tar.xz.

#### Mesh Solver¶

A grid solver simulation is set up with a Geometry and a Load Case file.

A complete simulation setup is available as mesh.tar.xz.

#### MSC.Marc/Mentat¶

An MSC.Marc simulation is set up manually or through a `*.proc`

file with MSC.Mentat.

A complete simulation setup is available as Marc.tar.xz.

## 2. Run¶

How to start a simulation depends on the selected solver:

### Grid Solver¶

The grid solver is invoked on the shell with

```
DAMASK_grid --load {load}.yaml --geom {grid}.vti
```

Parallelization with MPI and/or openMP is enabled with

```
OMP_NUM_THREADS={n_threads} mpiexec -n {n_proc} \
DAMASK_grid --load {load}.yaml --geom {grid}.vti
```

### Mesh Solver¶

The mesh solver is invoked on the shell with

```
DAMASK_mesh --load {load}.load --geom {grid}.msh
```

Parallelization with MPI and/or openMP is enabled with

```
OMP_NUM_THREADS={n_threads} mpiexec -n {n_proc} \
DAMASK_grid --load {load}.yaml --geom {grid}.vti
```

### MSC.Marc/Mentat¶

DAMASK is included as subroutine to MSC.Marc via `DAMASK_Marc.f90`

.
To simplify the use of this combination, the DAMASK Python library contains a small wrapper that assembles the command call:

```
import damask
s = damask.solver.Marc()
s.submit_job(model=modelname, job=jobname)
```

## 3. Post-Processing¶

DAMASK results are stored in a HDF5-based file format. Usage examples are given as video tutorials Get a Custom View and Add Derived Quantities, Spatially-Resolved Visualization in Paraview, Data Analysis: Using Matplotlib and Pandas and Jupyter notebooks Add Derived Field Data, Density Plot with Pandas, Plot Data per Grain with Scatter, Calculate r-Value, respectively.