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^\circC should be defined as material for the simulation (Material parameters are inside the air.xml
file.). The computational aeroacoustic domain is depicted below.
Inside the source region, a transient incompressible CFD Simulation is performed. Thereafter, aeroacoustic sourceterms can be computed from the obtained flow field. We then solve the Perturbed Convective Wave Equation (PCWE) 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.
Hints¶
- Use the provided template simulation setup
- Use the provided ml templates
interpolation.xml
,propagation.xml
andair.xml
- Use the provided mesh files:
sourceRegion.h5
,propagationRegion.cfs
andPML.cfs
- The evaluation of microphone positions defined in
MicPos.txt
can be found inevaluate_mics.py
- Use the provided file
evaluate_hist.py
. - State the reference pressure for any SPL in dB.
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
- Now you need to Log Out from your user and Log In again!
- 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:- Split domain into 4 parts using
$ decomposePar
- Run the simulation in parallel as a background process
$ mpirun -np 4 icoFoam -parallel > log &
- You can check the computation status by viewing the end of the log file with
tail -n 20 log
- Combine the results using
$ reconstructPar -newTimes
- Split domain into 4 parts using
- 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)
- Find data (Hotkey
V
) - Search for closest point to the monitoring point
- Plot Selection over Time
- Find data (Hotkey
- 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.
- 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)
- 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
- Edit
- Exit the openFoam environment with the command
$ exit
Interpolate the Flow Field and Compute Acoustic Sources¶
- Navigate to
~/2_sourceInterpolation
and openinterpolation.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.
Post Processing¶
- Use the provided python script
evaluate_hist.py
to read the.hist
files and calculate the amplitude spectrum - Calculate the SPL from the amplitude spectrum and plot it over the frequency
- Use the provided python script
evaluate_mics.py
to read the microphone results and calculate the fourier transform - Generate the directivity plots
You can download the templates linked on this page individually by right click --> save target as. Alternativey, head over to the git repository and use the download button on the top right: Here is a direct link to the zip archive.