# Custom zones

*Custom zones allow you to create user-defined volume mesh zones from custom volumes. The names of the generated volume zones will match the names of the custom volumes. Each assigned custom volume, and every surface the fluid zone encloses, must also be listed in the farfield's [**Enclosed entities**](./01.farfield.md#enclosed-entities).*

## Available Options

| *Option* | *Description* | *Applicable* |
|----------|---------------|--------------|
| [**Name**](#name) | Name of the custom zone setting | always |
| [**Element type**](#element-type) | Type of mesh elements to use in the zone | always |
| [**Assigned custom volume**](#assigned-custom-volume) | Custom volume entities to generate zones from | always |

```{seealso}
For a deeper discussion of the meshing workflow and parameters, see {doc}`/user_guide/Meshing/Meshing`.
```


## Detailed Descriptions

### Name

*Display name for this custom zone configuration.*

- **Default:** `Custom zone`

### Element type

*Specifies the type of mesh elements to be used for the generated volume zones.*

**Possible selections:**
- `Mixed` - Tetrahedral and tet elements in the mesh volume
- `Tetrahedra` - Only tetrahedral elements will be used for the generated volume zones

- **Default:** `Mixed`
>**Notes:**
>  - `Mixed` typically produces fewer elements and better quality for most geometries
>  - `Tetrahedra` may be preferred for CHT solid zones

### Assigned custom volume

*The custom volume entities from which volume zones will be generated.*

- **Required**
>**Notes:**
>  - Select volumes from the 3D scene or from the entity list using the `+` button
>  - Each custom volume will generate a separate volume zone with the same name
>  - Volume zone names must be unique across the simulation

---

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

- **When should I use Mixed vs Tetrahedra element type?**
  > Use `Mixed` (default) for most cases as it produces better quality meshes with fewer elements. Use `Tetrahedra` when you need an all-tet mesh, for example for CHT solid zones.

- **Can I have multiple custom zones?**
  > Yes, you can define multiple custom zone configurations, each with different custom volumes and element types.

</details>

---

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

```{seealso}
Python API:
- {py:class}`~flow360.CustomVolume`
- {py:class}`~flow360.CustomZones`

Example Library notebooks:
- {doc}`/python_api/example_library/notebooks/conjugate_heat_transfer`
```

```python
import flow360 as fl

project = fl.Project.from_cloud(project_id="prj-XXXXX")  # Should be a valid project id
geometry = project.geometry

# Define a custom volume from the surfaces that bound it.
# The bounding entities are the surfaces enclosing the region (e.g. interfaces
# selected from the geometry). The generated volume zone takes the
# custom volume's name.
wake_region = fl.CustomVolume(
    name="WakeRegion",
    bounding_entities=[
        geometry["wake_interface_inlet"],
        geometry["wake_interface_outlet"],
    ],
)

# Create the custom zone(s) from one or more custom volumes.
custom_zones = fl.CustomZones(
    name="Custom zones",
    entities=[wake_region],
    element_type="mixed",  # or "tetrahedra" for an all-tet zone
)
```

</details>
