# Uniform Refinement

*Uniform refinement creates regions of consistent mesh resolution, particularly useful for capturing off-body flow features such as wakes, shocks, and vortices, while maintaining computational efficiency in regions of uniform flow.*

---

## Available Options

| *Option* | *Description*                  |
|------------|----------------------------------|
| **Spacing** | Target mesh spacing in the region |
| **Assigned boxes and cylinders** | Target volumes for refinement application |

---

## Detailed Descriptions

### Spacing

*Defines the uniform mesh spacing within the refinement region.*

- **Required**
- **Example:** `0.1 m`
>**Note:** Should be chosen based on flow feature size and resolution requirements.

### Assigned boxes and cylinders

*Specifies the volumes where uniform refinement will be applied.*

- **Required**
>**Notes:** 
>  - Must reference valid box or cylinder entities in the geometry. 
>  - Assign the entity by selecting from the list using the + button or select graphically in the viewer region.

---

<details>
<summary><h3 style="display:inline-block"> 💡 Tips</h3></summary>

- Size refinement region 10% larger than expected flow feature
- Extend wake regions 2-3 characteristic lengths downstream
- Align refinement with expected shock angles
- Use $\sqrt{3}$ times surface spacing for near-body regions
- Consider flow direction when positioning refinement regions

</details>

---

<details>
<summary><h3 style="display:inline-block"> ❓ Frequently Asked Questions</h3></summary>

- **How do I size uniform refinement regions?**  
  > Consider the expected size of flow features and extend 10% beyond to ensure complete capture.

- **What happens if uniform refinements overlap?**  
  > The finest (smallest) spacing will be applied in overlapping regions.

</details>

---

<details>
<summary><h3 style="display:inline-block"> 🐍 Python Example Usage</h3></summary>

```python
from flow360 import UniformRefinement, u

# Wake region refinement
wake_ref = UniformRefinement(
    name="wake_region",
    entities=[wake_box],
    spacing=0.1 * u.m
)

# Shock region refinement
shock_ref = UniformRefinement(
    name="shock_region",
    entities=[shock_box],
    spacing=0.05 * u.m  # Finer spacing for shock resolution
)

# Near-body refinement
near_body_ref = UniformRefinement(
    name="near_body",
    entities=[near_body_box],
    spacing=0.02 * u.m  # √3 times surface spacing
)
```
</details> 