# Field3D.compute\_strain\_rate

[![badge](https://img.shields.io/badge/Source%20Code-06D40C?style=plastic)](https://github.com/LorenzoPiu/aPriori/blob/main/src/aPriori/DNS.py#L1066-L1191)

### **Field3D.**<mark style="color:red;">compute\_strain\_rate</mark>(self, save\_derivatives=False, save\_tensor=True, verbose=False):

***

### Description

Computes the strain rate or the derivatives of the velocity components (U, V, W) over a 3D mesh.

### Parameters

* `save_derivatives` (bool, optional): If True, saves the derivatives of the velocity components as files in the main folder. Defaults to False.
* `save_tensor` (bool, optional): If True, saves the strain rate tensor as a file in the main folder. Defaults to True.
* `verbose` (bool, optional): If True, prints out progress information. Defaults to False.

### Returns

None

### Raises

* `TypeError`: If U, V, W are not instances of Scalar3D or if mesh is not an instance of Mesh3D.
* `ValueError`: If U, V, W and mesh do not have the same shape.

### Workflow

1. **Preprocess**:
   * Sets the closure type based on the filter size.
   * Retrieves necessary attributes and initializes variables.
2. **Compute Derivatives**:
   * Computes derivatives of the velocity components in all three directions.
   * Saves derivatives as files if `save_derivatives` is True.
3. **Compute Strain Rate Tensor**:
   * Computes the strain rate tensor components by averaging appropriate velocity component derivatives.
   * Saves the strain rate tensor as a file if `save_tensor` is True.

### Example

```python
>>> field = Field3D('your_folder_path')
>>> field.compute_strain_rate(save_derivatives=True, save_tensor=True, verbose=True)
```
