# How to use the Constitutive Law class

The constitutive law behaviour is dealt with in kratos by the use of the class "ConstitutiveLaw", with a public interface defined in the file

```  kratos/kratos/includes/constitutive_law.h
```

which also provides some rather extensive inline documentation (in the form of comments in the code).

By design such file aims to provide a very flexible interface to constitutive law modelling, with the specific goal of maximizing the flexibility in the implementation of complex constitutive behaviours. While such approach provide obvious advantages, it also implies that the API is more complex than what would be strictly needed for very simple constitutive laws.

The objective of current HowTo is to provide a brief introduction to the interface

### Conventions

Through the whole section, the following convenctions will be employed:

voigt notation: - 3D case:

``` STRAIN Voigt Notation:  e00 e11 e22 2*e01 2*e12 2*e02
STRESS Voigt Notation:  s00 s11 s22   s01   s12   s02

```

- 2D plane strain/axisymmetric case (4 stress components)

``` STRAIN Voigt Notation:  e00 e11 e22 2*e01
STRESS Voigt Notation:  s00 s11 s22   s01
```

- 2D plane stress

``` STRAIN Voigt Notation:  e00 e11 2*e01
STRESS Voigt Notation:  s00 s11   s01
```

The constitutive law API is also designed to ease the implementation not only of Total Lagrangian but also of Updated Lagrandian and "Spatial Lagrangian" approaches. In order to understant the interface we shall consider 3 possible references:

1 - The "Initial Reference", representing the position in space occupied by the nodes at the very beginning of the simulation, before any deformation is applied. We recall that in Kratos such position can be recovered by

```   const array_1d<double,3>& X0 = node->InitialCoordinates()
```

2 - The "last known position", identifying the position in space occupied in the last moment at which everything is considered known. We could name such position as "Xlast" 3 - The "final" configuration of the mesh, identified as the position at which the nodes are located at the very latest iteration. This position can be obtained as

```       const array_1d<double,3>& X = node->Coordinates()
//must coincide with          node->InitialCoordinates() + node.FastGetSolutionStepValue(DISPLACEMENT);
```

taking into account this definitions, the Constitutive Law defines

- F0 := D(Xref) / D(X0)

- F  := D(X) / D(Xref)

The total deformation gradient can hence be always obtained as

```  Ftot = prod(F,F0)
```

taking into account such definitions the CL API allows the user to define on which domain configuration to compute the given stress/strain measure There are thus 3 different possibilities

1 - INITIAL CONFIGURATION - in this case everything should be computed on the reference configuration, so that

```   F0 := I
F  := D(X) / D(X0)
In this case the user shall instruct the constitutive law to obtain this behaviour by setting

```

2 - LAST KNOWN CONFIGURATION - in this case everything should be computed on the reference configuration, so that

```   F0 := D(Xref) / D(X0)  ---> RICCARDOS PROPOSAL: should change this to Fref
F  := D(X) / D(Xref) ---> RICCARDOS PROPOSAL: should change the name to DF
```

3 - INITIAL CONFIGURATION - in this case everything should be computed on the reference configuration, so that

```   F0 := D(X) / D(X0)
F  := I
```