# Material

*The Material section defines the physical properties of the simulated fluid inside the Fluid model. For a gas, this is air by default, and you can edit its viscosity model, thermodynamic (thermally perfect gas) species, and Prandtl numbers. For a liquid, it is water, defined by its density and dynamic viscosity.*

```{note}
The material **type** (Air or Water) follows the Gas/Liquid selection made in the **[Operating Condition](../../../01.flow-conditions/README.md)**: choosing Gas exposes the Air parameters, choosing Liquid exposes the Water parameters. The freestream state (velocity, density, temperature, etc.) is still defined in the Operating Condition; the Material section only describes the substance itself.
```

---

## Available Options

### Air (gas)

| *Option* | *Description* | *Applicable* |
|----------|---------------|--------------|
| **Dynamic viscosity** | Method used to evaluate the dynamic viscosity: `Sutherland` (temperature-dependent) or `Constant` | always |
| **Reference viscosity** | Reference dynamic viscosity $\mu_{ref}$ in Sutherland's law | **Dynamic viscosity** is `Sutherland` |
| **Reference temperature** | Reference temperature $T_{ref}$ associated with the reference viscosity | **Dynamic viscosity** is `Sutherland` |
| **Effective temperature** | Sutherland constant $S$ | **Dynamic viscosity** is `Sutherland` |
| **Value** | A single constant dynamic viscosity | **Dynamic viscosity** is `Constant` |
| **Thermally perfect gas** | List of species (with NASA 9-coefficient polynomials and mass fractions) defining the temperature-dependent thermodynamics of the gas | always |
| **Prandtl number** | Laminar Prandtl number | always |
| **Turbulent Prandtl number** | Turbulent Prandtl number | always |

### Water (liquid)

| *Option* | *Description* | *Applicable* |
|----------|---------------|--------------|
| **Density** | Density of the liquid | always |
| **Dynamic viscosity** | Dynamic viscosity of the liquid | always |

---

## Detailed Descriptions

### Dynamic viscosity (Air)

*Selects how the dynamic viscosity of the gas is evaluated.*

- **Default:** `Sutherland`
- **Options:**
  - `Sutherland`: temperature-dependent viscosity following Sutherland's law:
    $\mu(T) = \mu_{ref} \left(\dfrac{T}{T_{ref}}\right)^{1.5} \dfrac{T_{ref} + S}{T + S}$
  - `Constant`: a single, temperature-independent viscosity value.

#### Reference viscosity

*The reference dynamic viscosity $\mu_{ref}$ at the reference temperature.*

- **Required** when **Dynamic viscosity** is `Sutherland`
- **Default:** `1.716e-5 Pa·s`

#### Reference temperature

*The reference temperature $T_{ref}$ associated with the reference viscosity.*

- **Required** when **Dynamic viscosity** is `Sutherland`
- **Default:** `273.15 K`

#### Effective temperature

*The Sutherland constant $S$ used in Sutherland's formula.*

- **Required** when **Dynamic viscosity** is `Sutherland`
- **Default:** `110.4 K`

#### Value

*A single constant dynamic viscosity, used instead of the Sutherland model.*

- **Required** when **Dynamic viscosity** is `Constant`
- **Example:** `1.825e-5 Pa·s`

### Thermally perfect gas

*Defines the temperature-dependent thermodynamic properties of the gas through one or more species, each described by NASA 9-coefficient polynomials. By default the gas is a single species named `Air` whose coefficients reproduce a constant specific-heat ratio $\gamma = 1.4$ (calorically perfect gas).*

Each species is edited from its row (the cog opens the species editor) and exposes the following, all **required**:

- **Name**: the species identifier (e.g. `N2`, `O2`, `Ar`).
- **Mass fraction**: the mass fraction of this species in the mixture.
- **Temperature**: the lower and upper bounds of a temperature range over which a coefficient set applies. A species can hold several ranges (use **Add range**).
- **Coefficients**: the nine NASA 9-coefficient polynomial coefficients $c_1 \ldots c_9$ for the range. They define the non-dimensional specific heat, enthalpy, and entropy:
  - $\dfrac{c_p}{R} = c_1 T^{-2} + c_2 T^{-1} + c_3 + c_4 T + c_5 T^2 + c_6 T^3 + c_7 T^4$
  - $c_1$–$c_7$ are the $c_p$ polynomial coefficients, $c_8$ is the enthalpy integration constant, and $c_9$ is the entropy integration constant.

Use **Add species** to add another component: the `N2`, `O2`, and `Ar` presets come pre-filled with standard data, while `Custom` starts from an empty species.

>**Notes:**
>- The mass fractions of all species must sum to `1.0`. Values within a small tolerance (`1e-3`) are renormalised automatically; otherwise the input is rejected. This validation matches the Python client.
>- Species names must be unique, and all species must use the same temperature-range boundaries.

### Prandtl number

*The laminar Prandtl number of the gas.*

- **Required**
- **Default:** `0.72`

### Turbulent Prandtl number

*The turbulent Prandtl number of the gas.*

- **Required**
- **Default:** `0.9`

### Density (Water)

*The density of the liquid.*

- **Required**
- **Default:** `1000 kg/m³`

### Dynamic viscosity (Water)

*The dynamic viscosity of the liquid.*

- **Required**
- **Default:** `0.001002 Pa·s`

```{note}
A liquid is described only by its density and dynamic viscosity; it carries no thermal properties such as thermal conductivity or specific heat. Conjugate heat transfer (CHT) is therefore only available with a gas.
```

---

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

- **Why can't I run a simulation after I added a species?**
  > The mass fractions of all species must sum to `1.0`. After adding a species, adjust the mass fractions so they total `1.0` (values within a small tolerance are renormalised automatically; larger deviations are rejected and the simulation cannot start).

</details>

---

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

```{seealso}
Python API:
- {py:class}`~flow360.Air`
- {py:class}`~flow360.Water`
- {py:class}`~flow360.Sutherland`
- {py:class}`~flow360.ThermallyPerfectGas`
- {py:class}`~flow360.FrozenSpecies`
- {py:class}`~flow360.Fluid`
```

The material is configured via the `material` field on the Fluid model.

```python
import flow360 as fl
from flow360 import u

# Default air: Sutherland viscosity, single-species calorically perfect gas (gamma = 1.4)
fluid = fl.Fluid(
    material=fl.Air(),
)

# Air with a custom Sutherland model and Prandtl numbers
fluid_custom = fl.Fluid(
    material=fl.Air(
        dynamic_viscosity=fl.Sutherland(
            reference_viscosity=1.716e-5 * u.Pa * u.s,
            reference_temperature=273.15 * u.K,
            effective_temperature=110.4 * u.K,
        ),
        prandtl_number=0.72,
        turbulent_prandtl_number=0.9,
    ),
)

# Air as a constant-viscosity gas
fluid_constant = fl.Fluid(
    material=fl.Air(dynamic_viscosity=1.825e-5 * u.Pa * u.s),
)

# Liquid (water) defined by density and dynamic viscosity
fluid_liquid = fl.Fluid(
    material=fl.Water(
        name="Water",
        density=1000 * u.kg / u.m**3,
        dynamic_viscosity=0.001002 * u.Pa * u.s,
    ),
)
```

</details>
