# Wall Boundary Condition

*The Wall boundary condition represents a solid surface where the fluid cannot penetrate, typically enforcing the no-slip condition for viscous flows.*

---

## Available Options

| *Option* | *Description* | *Applicable* |
|------------|----------------------------------|----------|
| **Use wall function** | Near-wall modeling approach | always |
| **Type** | Wall function model type (Boundary layer / Inner layer) | **Use wall function** is enabled |
| **Motion** | Type of wall movement | always |
| **Center** | Coordinates of the center of rotation | **Motion** is `Rotating wall` |
| **Axis** | Components of the axis of rotation | **Motion** is `Rotating wall` |
| **Angular velocity** | Angular velocity of the wall's rotation | **Motion** is `Rotating wall` |
| **Static pressure** | Pressure of the bleed | **Motion** is `Slater porous bleed` |
| **Porosity** | Porosity of the bleed surface | **Motion** is `Slater porous bleed` |
| **Activation step** | Pseudo step at which the bleed is activated | **Motion** is `Slater porous bleed` |
| **Velocity components** | Definition of the wall velocity | **Motion** is `User-defined` |
| **Heat flux** | Heat flux through the wall | when `Heat flux` is selected |
| **Temperature** | Temperature of the wall | when `Temperature` is selected |
| **Roughness height** | Surface roughness | always |
| **Assigned surfaces** | Geometric boundaries to apply the wall condition | always |

---

## Detailed Descriptions

### Use wall function

*Enables wall function approximation to model the near-wall region without resolving it.*

- **Options:** Enabled/Disabled
- **Default:** Disabled
- **Note:** When enabled, allows the use of coarser meshes with larger y+ values (30-300).

#### Type

*Selects the wall function model used when wall functions are enabled.*

- **Options:**
  - **Boundary layer** (default) — Uses integral flat-plate boundary-layer theory to predict wall shear stress. Performs well across all y+ ranges.
  - **Inner layer** — Uses the inner-layer behaviour of the turbulent boundary layer. Offers better accuracy for y+ values in the log layer and below (y+ ≈ 30–100).
- **Default:** Boundary layer

### Motion

*Defines how the wall moves relative to the fluid.*

- **Options:** 
  - None (Fixed wall)
  - Rotating wall
  - Slater porous bleed
  - User-defined
- **Default:** None (Fixed wall)
> **Notes:** 
> - Fixed walls have zero velocity, while other types require additional specifications.
> - When the wall is within the rotating zone:
>   - Choosing fixed wall means that the wall will have zero velocity in relation to the rotating zone.
>   - When using the `Rotating wall` or `User-defined` option, the specified velocity will be in reference to the absolute reference frame.
>   - If the wall is supposed to be stationary in the absolute reference frame, the velocity should be set to `0` using `Rotating wall` or `User-defined` option.

### Center

*Defines the coordinates of the center of rotation for a rotating wall.*

- **Required when `Rotating wall` selected.**
- **Example:** `(0, 0, 0) m`

### Axis

*Defines the rotation axis components for a rotating wall.*

- **Required when `Rotating wall` selected.**
- **Example:** `(0, 0, 1)`

### Angular velocity

*Defines the rate of rotation for a rotating wall.*

- **Required when `Rotating wall` selected.**
- **Example:** `300 RPM`

### Static pressure

*Static Pressure for Slater porous bleed model.*

- **Required when `Slater porous bleed` selected.**
- **Example:** `101325 Pa`

### Porosity

*Porosity for Slater porous bleed model.*

- **Required when `Slater porous bleed` selected.**
- **Example:** `0.3`
>**Notes:** 
>- Can be between `0` (exclusive) and `1` (inclusive).
>- Porosity of `0` is equivalent to a solid wall, and porosity of `1` is equivalent to a fluid interface.

### Activation step

*Pseudo step in the simulation at which Slater porous bleed model is activated.*

- **Default:** `0`
- **Example:** `10`

### Velocity components

*Specifies the velocity vector for moving walls.*

- **Required when `User-defined` selected.**
- **Example:** `(10, 0, 0) m/s` for a wall moving in the x-direction


### Heat flux

*Defines the thermal behavior of the wall using its heat flux.*

- **Default:** `0`
- **Example:** `-30 W/m²`
>**Notes:** Heat flux of `0` means an adiabatic wall.

### Temperature

*Defines the static temperature of the wall.*

- **Required when `Temperature` selected.**
- **Example:** `300 K`

### Roughness height

*Specifies the equivalent sand grain roughness height of the wall surface.*

- **Default:** `0` (smooth wall)
- **Example:** `0.0001 m`
>**Note:** Only available for boundaries associated with a Fluid zone.

### Assigned surfaces

*Specifies the geometric boundaries to which the wall boundary condition is applied.*

- **Accepted types:** Surface
>**Note:** Assign the boundaries 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>

### Mesh Resolution Requirements

- **Without Wall Functions:**
  - Target y+ < 1 for accurate boundary layer resolution
  - Use prism layers with growth rate < 1.2
  - At least 20-30 points within the boundary layer

- **With Wall Functions:**
  - Target y+ between 30-300
  - At least 10 points within the boundary layer
  - More efficient for high Reynolds number flows

### Common Applications

- **Moving Walls:**
  - Ground simulations with moving belt in wind tunnels
  - Rotating wheels in automotive simulations
  - Moving components in machinery

- **Thermal Conditions:**
  - Adiabatic for external aerodynamics where heat transfer is negligible
  - Isothermal for heat transfer studies with known wall temperatures
  - Heat Flux for heat transfer studies with known energy inputs

### Convergence Considerations

  - Start with simpler boundary conditions before introducing complexity
  - For moving or rotating walls, consider ramping up the motion gradually
  - For thermal simulations, first converge the flow field, then enable heat transfer

</details>

---

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

- **When should I use wall functions?**  
  > Wall functions are appropriate for high Reynolds number flows where resolving the entire boundary layer would be prohibitively expensive. They're a good choice when you're more interested in overall flow patterns and forces than detailed boundary layer behavior.

- **What y+ value should I target for my simulation?**  
  > For simulations without wall functions, target y+ < 1 to properly resolve the viscous sublayer. For simulations with wall functions, target y+ between 30-300, with optimal results typically around 30-100.

- **How do I handle complex geometries with varying y+ values?**  
  > Focus on achieving proper y+ values in regions of interest. For complex geometries, consider using wall functions in some regions and resolving the boundary layer in critical areas.

- **Can I model surface roughness effects?**  
  > Yes, use the Roughness Height parameter to specify an equivalent sand grain roughness height. This is particularly important for aerodynamic simulations where surface quality affects performance.

- **How does the Slater Porous Bleed model work?**  
  > The model controls mass flow through a boundary based on the difference between local static pressure and specified target pressure, modulated by the porosity value. It's commonly used to simulate bleed systems in inlets or other flow control devices.

- **Can I model heat transfer between the wall and fluid?**  
  > Yes, by selecting either Isothermal (fixed temperature) or Heat Flux in the Thermal Condition setting. For coupled heat transfer with solids, additional setup may be required.

</details>

---

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

```python
# Example of configuring a stationary adiabatic wall
stationary_wall = fl.Wall(
    name="wing_surface",
    entities=volume_mesh["wing"],
    heat_spec=fl.HeatFlux(0 * fl.u.W / fl.u.m**2)  # Adiabatic wall (zero heat flux)
)

# Example of a moving wall with specified velocity
moving_wall = fl.Wall(
    name="moving_ground",
    entities=volume_mesh["ground"],
    velocity=["30", "0", "0"]  # Velocity vector as strings
)

# Example of a moving wall with velocity expressions (default Boundary layer wall function)
moving_wall_expressions = fl.Wall(
    entities=volume_mesh["wall_function"],
    velocity=["min(0.2, 0.2 + 0.2*y/0.5)", "0", "0.1*y/0.5"],
    use_wall_function=fl.WallFunction()
)

# Example of a moving wall with Inner layer wall function
moving_wall_inner_layer = fl.Wall(
    entities=volume_mesh["wall_function"],
    velocity=["min(0.2, 0.2 + 0.2*y/0.5)", "0", "0.1*y/0.5"],
    use_wall_function=fl.WallFunction(type_name="InnerLayer")
)

# Example of a rotating wall
rotating_wall = fl.Wall(
    name="propeller",
    entities=volume_mesh["propeller"],
    velocity=fl.WallRotation(
        axis=(0, 0, 1),
        center=(0 * fl.u.m, 0 * fl.u.m, 0 * fl.u.m),
        angular_velocity=1000 * fl.u.rpm
    )
)

# Example with wall functions and roughness
rough_wall = fl.Wall(
    name="rough_surface",
    entities=volume_mesh["rough_wall"],
    use_wall_function=fl.WallFunction(),
    roughness_height=0.0002 * fl.u.m
)

# Example with isothermal wall
isothermal_wall = fl.Wall(
    entities=volume_mesh["fluid/isothermal-*"],
    heat_spec=fl.Temperature(350 * fl.u.K)
)

# Example with heat flux
heat_flux_wall = fl.Wall(
    entities=volume_mesh["solid/isoflux-*"],
    heat_spec=fl.HeatFlux(1.0 * fl.u.W / fl.u.m**2)
)

# Example with Slater porous bleed model
porous_wall = fl.Wall(
    entities=volume_mesh["fluid/SlaterBoundary-*"],
    velocity=fl.SlaterPorousBleed(
        static_pressure=1.01e6 * fl.u.Pa, 
        porosity=0.4, 
        activation_step=200
    )
)
```

</details> 