> For the complete documentation index, see [llms.txt](https://particle-analytics-1.gitbook.io/iotasuite-user-manual/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://particle-analytics-1.gitbook.io/iotasuite-user-manual/coarse_graining_intro/cg_setting_cg/cg_averaging/cg_averaging_spatial_averaging.md).

# Spatial Averaging

This section allows users to define the options for the the spatial averaging process, including the calculation of spatial gradients and spatial integrals.

![](https://3637271227-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Ll27EH-tZ9C1wVq7SVN%2F-Ll27FcXY9XiJV180mCy%2F-Ll27K1XUv4RXFGq4HbO%2Fiota-cg-Averaging_spatial_avg_cropped_new.PNG?generation=1564494354276699\&alt=media)

*Figure 67 - "Spatial Averaging" section of* [*coarse-graining*](/iotasuite-user-manual/coarse_graining_intro/cg_setting_cg.md) *module.*

## [Function](/iotasuite-user-manual/coarse_graining_intro/cg_setting_cg/cg_averaging/cg_averaging_spatial_averaging.md#function) <a href="#function" id="function"></a>

Users can select between different weight functions for the spatial averaging:

* `Gaussian`: particles' contibution varies according to the [Gaussian function](https://en.wikipedia.org/wiki/Normal_distribution) of the given `width`.
* `Heaviside`: particles' contibution will be equally-weighted while they lay in the averaging region being averaged over.

## [Width and Cutoff Factor](/iotasuite-user-manual/coarse_graining_intro/cg_setting_cg/cg_averaging/cg_averaging_spatial_averaging.md#width-and-cutoff-factor) <a href="#width-and-cutoff-factor" id="width-and-cutoff-factor"></a>

The value of the `width` determines the length scale for the spatial averaging function. For `Gaussian` function, this corresponds to the standard deviation of the funciton. For `Heaviside`, this determines the size of the representative volume.

The `Cutoff Factor` is used in combination with the `Width` to ignore particles whose contribution will be very small. Since the `Gaussian` function only becomes zero at infinity, all particles would contribute to the spatial average, most giving the tiniest of contributions.

> The values of `Width` and `Cutoff Factor` are problem dependent, but for quasi-static problems or low speed flows a `Width` of 2.5 to 3.0 times the average particle radius can be considered a safe value. For high speed flows and high sampling frequencies, this value can be as low as half the average radius. A `Cutoff Factor` of 3.0 can be considered safe. In the case of high speed flows or sampling frequencies, this value can decrease to obtain a better resolution close to the boundaries.

## [Gradients](/iotasuite-user-manual/coarse_graining_intro/cg_setting_cg/cg_averaging/cg_averaging_spatial_averaging.md#gradients) <a href="#gradients" id="gradients"></a>

This features allows the user to activate the calculation of spatial gradients during the spatial averaging process. This creates the extra results in the Coarse-graining dataset that correspond to spatial gradients of the results: Density, Solid fraction, Momentum, and Velocity.

## [Spatial Integral](/iotasuite-user-manual/coarse_graining_intro/cg_setting_cg/cg_averaging/cg_averaging_spatial_averaging.md#spatial-integral) <a href="#spatial-integral" id="spatial-integral"></a>

This feature allows the users to select if spatial intergral will be performed during the calculation of the coarse-graining results:

* `None`: spatial intergral will not be calculated.
* `1D`: the coarse-grianing results are integrated along one of the main axis-directions: \[`X` / `Y` / `Z`].
* `2D`:  the coarse-grianing results are integrated over a plane. Users can select among the following planes for the integration: \[`XY` / `YZ` / `XZ`].
* `1D cylindrical`: the coarse-grianing results are integrated along the tangential of cylindrical coordinate system defined by the user:
  * `1D Cylindrical Direction`: defines the axial direction of the cylindrical coordinate system.
  * `1D Cylindrical Origin`: defines the position of the origin of the cylindrical coordinate system.
