# Calculating pressure

## Doublet gradient

The APM Solver determines the surface pressure coefficient from the gradient of the doublet strength. The gradient of the doublet strength distribution is not readily available. The solver uses several algorithms to calculate the gradient. Depending on the problem, some algorithms might perform better than others.&#x20;

* If the `doublet_gradient_scheme` option in the **.conf** file is set to 0, the doublet gradient will be calculated with a **Constrained Hermite Taylor Series Least Squares (CHTLS)** algorithm \[1]. **This is the default APM Solver doublet gradient scheme.**
* If the `doublet_gradient_scheme` option in the **.conf** file is set to 1, the doublet gradient will be calculated with a **Weighted Least Squares (WLS)** algorithm.&#x20;
* If the `doublet_gradient_scheme` option in the **.conf** file is set to 2, the doublet gradient will be calculated with a **Linear Shape Functions (LSF)** algorithm.&#x20;
* If the `doublet_gradient_scheme` option in the **.conf** file is set to 3, the doublet gradient will be calculated with a **Finite Differences (FD)** algorithm.&#x20;
* If the `doublet_gradient_scheme` option in the **.conf** file is set to 4, the doublet gradient will be calculated with the **Hess & Smith doublet - vortex ring equivalence (HS)** algorithm.

{% hint style="warning" %}
`The Finite Difference (FD) doublet gradient scheme can be used only on structured meshes!`
{% endhint %}

### Gradient smoothing

The doublet gradient estimated with either of the methods above can be further smoothed via a Gauss-Seidel smoother. The options `doublet_gradient_smoothing_iterations`  and `doublet_gradient_smoothing_factor`  control the strength of the smoothing. The default recommended settings are 3 iterations and a smoothing factor of 0.5. A smoothing factor  near 0 results in weak smoothing, and a smoothing factor close to 1 results in strong smoothing.

{% hint style="info" %}
The HS algorithm, coupled with gradient smoothing, is recommended on complex meshes. It will give superior results to the CHTLS algorithm.
{% endhint %}

The images below show a comparison of the surface pressure coefficient obtained with different doublet strength gradient algorithms.&#x20;

![CHTLS (left), WLS (middle), and LSF (right) results for a sphere geometry](/files/-Mfo2t_AO-rd2mOm6c0y)

![CHTLS (left), WLS (middle), and LSF (right) results for the AGARD-AR-303 E6](/files/-Mfo2sweLPXX5lz-gkry)

The image below compares the CHTLS (left) with HS (right). The effect of doublet gradient smoothing can be clearly seen in the pressure coefficient distribution.

<figure><img src="/files/99cVFqeZcAbhKnVdflqJ" alt=""><figcaption><p>CHTLS (left), and HS + gradient smoothing (right) results for the Cruiser UAV.</p></figcaption></figure>

## Trefftz-plane loads

An alternative to the surface pressure integration is to use the far-field of Trefftz-plane approach. In general this is a more reliable approach, especially for the induced drag component. To enable the Trefftz-plane analysis set the `trefftz_plane_analysis` option in the **.conf** file to 1.&#x20;

<figure><img src="/files/E3WnenjuA3KeJiB5mwiI" alt=""><figcaption><p>Trefftz-plane used to calculate the loads of a fixed-wing UAV</p></figcaption></figure>

{% hint style="info" %}
For best results when using the Trefftz-plane analysis perform an unsteady solution. The unsteady solution will allow the wake to roll-up. The Trefftz-plane analysis will be performed at the location of the third to last row of wake panels.
{% endhint %}

## References

\[1] Robert McDonald and Alejandro Ramos. ["Constrained Hermite TLS for Mesh-free Derivative Estimation Near and On Boundaries," ](https://arc.aiaa.org/doi/10.2514/6.2011-655)AIAA 2011-655. *49th AIAA Aerospace Sciences Meeting including the New Horizons Forum and Aerospace Exposition*. January 2011.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aviumtechnologies.com/user-guide/the-configuration-file/calculating-surface-pressure.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
