# HW6: Aeroacoustics

### Description

This problem considers a 2D cylindrical obstacle (diameter $d$=0.02 m) within an incompressible flow. Inflow velocity $U_0$ = 10 m/s, kinematic viscosity $\nu$ = 0.001 m$^2$ /s, Reynolds number $Re \approx$ 200.

Air at 20$^\circ$C should be defined as material for the simulation (Material parameters are inside the air.xml file.). The computational aeroacoustic domain is depicted below.

The CFD and acoustic source interpolation computations have already been performed (see acousticSources.h5). We solve the Perturbed Convective Wave Equation (PCWE) in the frequency domain assuming low Mach number ($Ma <$ 0.3). The convective wave equation fully describes acoustic sound generated by incompressible flow structures and its wave propagation. The only unkown is the acoustic scalar potential $\psi^{\rm a}$ . In order to receive the acoustic pressure, we have to derive the scalar potential and scale it with the density.

1. Perform an openFoam Simulation of the Cylinder (monitor the transient behavior from startup until the vortex street is in a steady state), calculate the Struhaul number from the pressure data. (3 Points)
2. Write down the data from the Flow simulation into an Ensight file for further processing (look at the PCWE and neglect convective sources), write the necessary flow quantities to the storage (in the necessary time resolution - based on Struhaul number). (3 Points)
3. Calculate the aeroacoustic source and interpolate the sources conservatively. (3 Points)
4. Create input-xml files for the required openCFS simulations to perform a transient simulation of the computed source field. (3 Points)
5. Document the results you got from the openCFS simulation by answering the questions below. (3 Points)
• Plot the calculated SPL in dB vs. frequency in Hz (for mic1 and mic2). You can use the resulting .hist files.
• Add a directivity plot, radius 2 m, frequency 97Hz. You can use the resulting files in the folder mics.
• Discuss the results

### Hints

• Use the provided template simulation setup
• Use the provided ml templates interpolation.xml, propagation.xml and air.xml
• Use the provided mesh files: sourceRegion.h5, propagationRegion.cfs and PML.cfs
• The evaluation of microphone positions defined in MicPos.txt can be found in Mic_eval.py
• Use the provided file hist.py.
• State the reference pressure for any SPL in dB.

### Submission

Submit all your input files (*.jou, *.xml) as well as a concise PDF report of your results. Name the archive according to the format HWn_eNNNNNNN_Lastname.zip.

### Install openFOAM CFD software

• Extract the simulation setup in your working directory (root folder of the template directory is referred to as ~ in the following)
• Open a terminal and navigate to ~/1_cfd directory
• In order to install the CFD software openFOAM on a Debian Linux system in a virtual environment, run the installation script by typing sh InstallOpenFoamDebian.sh
• You can start the virtual environment now with the command openfoam8-linux, this will take a while for the first start, as the image is downloaded now.
• Once you are inside the virtual environment, type sh PrepareOpenFoamContainer.sh
• Your openFOAM environment is now ready, you can exit it by typing exit or pressing Ctrl+D

### Perform Transient Flow Simulation with openFOAM

• Open a terminal and navigate to ~/1_cfd directory
• Start the openFoam environment with the command openfoam8-linux and open the simulation folder: cd cfd
• Run the flow simulation with the initial setup using icoFoam. Alternatively, we can save time by running the simulation in parallel:
1. Split domain into 4 parts using decomposePar
2. Run the simulation in parallel as a background process mpirun -np 4 icoFoam -parallel > log &
3. You can check the computation status by viewing the end of the log file with tail -n 20 log
4. Combine the results using reconstructPar -newTimes
• View the flow field in ParaView using paraFoam &
• Plot flow pressure $p$ and velocity $U$ at the monitoring points: MP1 (1,0,0), MP2 (-1,0,0), MP3 (0,0.01,0), MP4 (0,2.9,0)
1. Find data (Hotkey V)
2. Search for closest point to the monitoring point
3. Plot Selection over Time
• Velocity and pressure fields should show a steady oscillation. However, the data resolution in time is not sufficient to resolve the oscillations of the vortex street.
• Export source data
• Edit ~/1_cfd/cfd/system/controlDict with a text editor eg. type gedit system/controlDict
• We want to simulate the acoustics for $0.2\,$s, so we need to change startTime to $0.5$ and endTime to $0.7$.
• To resolve the oscillations save every 20th timestep of the CFD simulation. Therefore, change writeInterval to $20$.
• Run the simulation as before
• Click Refresh Times or reopen ParaView with paraFoam command and view the flow field
• Export Pressure data in Ensight-Case fileformat using foamToEnsight -fields '( "p.*" )' -time 0.5:0.7
• You can view the exported data in ParaView by openening ~/1_cfd/cfd/EnSight/cfd.case
• Exit the openFoam environment with the command exit

### Interpolate the Flow Field and Compute Acoustic Sources

• Navigate to ~/2_sourceInterpolation and open interpolation.xml with your xml editor
• Define the cfd.case in your input filter and the target mesh ~/0_mesh/sourceRegion.h5 in the interpolation filters
• Calculate interpolated acoustic sources: cfsdat -tX interpolation using $X$ threads in parallel.
• View the acoustic sources in ParaView by opening ~/2_sourceInterpolation/results_hdf5/source_acouRhsLoad.cfs

### Acoustic Simulation Setup

• Define input files
• Include material file (air.xml)
• Assign material to regions (air 20 degrees)
• Define interfaces between the different regions/parts (Nitsche-type Mortaring)
• Define microphone points for evaluation
• Run the acoustic propagation simulation: cfs -tX propagation using $X$ threads in parallel.