# Aeroacoustic Output

Aeroacoustic Output in Flow360 predicts far-field noise using the Ffowcs Williams–Hawkings (FW-H) acoustic analogy, solved with Farassat's Formulation 1A. The acoustic pressure at each observer is computed from surface integrals of the unsteady CFD solution over either an impermeable (solid-wall) or a permeable (porous) surface. Typical applications include rotary-wing, jet, fan and control-surface noise, and exterior automotive aeroacoustics (for example, side-mirror noise).

> **Important**: Aeroacoustic Output and FW-H propagation are **only available for unsteady simulations** (when unsteady time stepping is selected).

---

## Available Options

| *Option* | *Description* | *Applicable* |
|----------|---------------|--------------|
| **Name** | Name of the output | always |
| **Observer time step size** | Time step at which the acoustic signal is output at the observers | always |
| **Aeroacoustic solver start time** | Time from which the sampled CFD solution is propagated to the observers | always |
| **Force clean start** | Restart the FW-H propagation in a forked case | always |
| **Write per surface output** | Output the acoustic pressure signal at the observers separately for each surface boundary | always |
| **Patch type** | Select the impermeable or permeable FW-H formulation | always |
| **Permeable surfaces** | Permeable (porous) FW-H integration surfaces enclosing the noise sources | when **Patch type** is `Permeable` |
| **Observers** | Observer positions to which the acoustic signal is propagated | always |

```{seealso}
For the underlying physics and configuration of outputs, see the {doc}`/user_guide/OutputConfiguration/OutputConfiguration` user guide.
```

---

## Forked Cases

A forked case continues its parent's acoustic signal, so it must keep the parent's **Patch type**, **Permeable surfaces**, **Observers**, **Observer time step size** and **Aeroacoustic solver start time**. If a fork changes any of them, the case is rejected at submission with a message naming the setting. An empty **Observer time step size** inherits the parent's value.

To change these settings in a fork, turn on **Force clean start**. The CFD solution still continues from the parent, but the FW-H propagation starts from this case and the parent's FW-H solution is not carried over. A fork of a case that had no aeroacoustic output starts its own FW-H propagation, so its settings can be changed freely.

For when to continue the signal and when to start it again, see {ref}`Aeroacoustic Output in Forked Cases <aeroacousticForking_userGuide>` in the user guide.

---

## Detailed Descriptions

### Observer time step size

*The time step at which the acoustic signal is output at the observers.*

- **Default:** empty, which uses the time step size of the simulation
- **Example:** `2e-4 s`
>**Note:** The value must be larger than or equal to the time step size of the simulation.

### Aeroacoustic solver start time

*The CFD solution on the FW-H surfaces is sampled and propagated to the observers from this time onward. Set it after the initial flow transient has washed out, so that the transient does not contaminate the acoustic signal at the observers.*

- **Default:** `0 s`
- **Example:** `0.05 s`

### Force clean start

*Restarts the FW-H propagation in a forked case instead of continuing the parent's FW-H solution. Required to change the aeroacoustic settings of a fork (see [Forked Cases](#forked-cases)).*

- **Default:** `false`
- **Example:** `true`
>**Note:** The switch can only be changed in the draft of a forked case.

### Patch type

*Selects the FW-H formulation. `Solid` uses the impermeable formulation, with the solid walls as the integration surfaces. `Permeable` uses the permeable formulation, with the surfaces selected in **Permeable surfaces** as the integration surfaces.*

- **Default:** `Solid`
- **Example:** `Permeable`

### Permeable surfaces

*The permeable FW-H integration surfaces, which enclose the noise sources in the flow domain. Used when **Patch type** is `Permeable`, and shown only for that patch type.*

- **Required** when **Patch type** is `Permeable`

### Observers

*Defines the observer positions to which the CFD solution is propagated. Each observer needs a position (3D coordinates) and a group name.*

- **Default:** *No default value, must be specified*
- **Example:** See Python example below
>**Note:** Observers can be placed outside the simulation domain but must not be on or inside solid surfaces.

### Write per surface output

*When enabled, the acoustic pressure signal at the observers is written separately for each surface boundary, in addition to the combined results for all surfaces.*

- **Default:** `false`
- **Example:** `true`

---

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

**Aeroacoustic History Files**

Aeroacoustic Output generates specialized history files containing acoustic data at each observer location:

1. **Time Domain Data**
   - Acoustic pressure time histories for each observer position
   - Individual contributions from each surface (if "Write Per Surface Output" is enabled)
   - Combined acoustic signals from all surfaces

2. **Frequency Domain Data**
   - Frequency spectra generated from the time domain signals
   - Sound Pressure Level (SPL) data at various frequencies
   - Overall Sound Pressure Level (OASPL) values

3. **File Format and Organization**
   - CSV files for easy import into analysis software
   - Time domain data is updated continuously during the simulation
   - Frequency analysis is performed at the end of the simulation
   - Files are organized by observer and surface groups

4. **Post-Processing** - The acoustic history files can be used for:
   - Noise source identification
   - Directivity analysis
   - Spectral analysis
   - A-weighted sound level calculations
   - Comparison with experimental measurements
   - Certification requirement evaluations

**Important Considerations**

1. **Observer Placement**: Observers can be placed outside the simulation domain but must not be on or inside solid surfaces.
2. **Temporal Resolution**: Aeroacoustic analysis requires sufficient temporal resolution to capture the relevant frequency content. Make sure your time step is small enough for the frequency range of interest.
3. **Spatial Resolution**: The mesh should be fine enough to resolve acoustic waves of the frequencies of interest. As a rule of thumb, aim for at least 20 grid points per wavelength of the highest frequency of interest.
4. **Simulation Duration**: The simulation must run long enough to capture the acoustic phenomena of interest, including startup transients.
5. **Permeable Surfaces**: When using the permeable approach, the permeable surfaces should enclose all significant acoustic sources and be placed in regions with good mesh resolution.

</details>

---

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

- **Can I place observers outside the computational domain?**  
  > Yes, observers can be placed outside the computational domain. In fact, this is often preferred for far-field noise predictions. However, observers should not be placed on or inside solid surfaces.

- **What is the difference between solid and permeable patch types?**  
  > The solid patch type uses solid wall boundaries to compute the aeroacoustic solution, which is simpler but may miss some acoustic sources. The permeable patch type uses surfaces embedded within the flow domain, which can capture additional acoustic sources and is generally more accurate for certain applications.

- **How do I determine the appropriate time step for aeroacoustic analysis?**  
  > The time step should be small enough to resolve the highest frequency of interest. As a rule of thumb, you need at least 20 time steps per period of the highest frequency you want to capture.

- **How long should I run my simulation to get good aeroacoustic results?**  
  > The simulation should run long enough to capture several periods of the lowest frequency of interest, plus additional time to overcome initial transients. For most applications, this means running for at least several flow-through times.

</details>

---

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

```{seealso}
Python API reference: {py:class}`~flow360.AeroAcousticOutput`, {py:class}`~flow360.Observer`. See also the {doc}`/python_api/example_library/notebooks/aeroacoustics` example.
```

Below is a Python code example showing how to configure aeroacoustic output:

```python
# Basic aeroacoustic output with solid patch type
aeroacoustic_output = fl.AeroAcousticOutput(
    observers=[
        fl.Observer(position=[1.0, 0.0, 1.75] * fl.u.m, group_name="1"),
        fl.Observer(position=[0.2, 0.3, 1.725] * fl.u.m, group_name="1"),
    ],
)

# Aeroacoustic output with permeable patch type
aeroacoustic_output = fl.AeroAcousticOutput(
    observers=[
        fl.Observer(position=[1.0, 0.0, 1.75] * fl.u.m, group_name="1"),
        fl.Observer(position=[0.2, 0.3, 1.725] * fl.u.m, group_name="1"),
    ],
    patch_type="permeable",
    permeable_surfaces=[volume_mesh["inner/interface*"]]
)

# In a forked case: restart the aeroacoustic solver to move the observers
aeroacoustic_output = fl.AeroAcousticOutput(
    observers=[
        fl.Observer(position=[2.0, 0.0, 1.75] * fl.u.m, group_name="1"),
    ],
    force_clean_start=True,
)

# Aeroacoustic output with write_per_surface_output enabled
aeroacoustic_output = fl.AeroAcousticOutput(
    observers=[
        fl.Observer(position=[1.0, 0.0, 1.75] * fl.u.m, group_name="1"),
        fl.Observer(position=[0.2, 0.3, 1.725] * fl.u.m, group_name="1"),
    ],
    write_per_surface_output=True
)
```

</details> 