2018 Report Anandh
2018 Report Anandh
2018 Report Anandh
Project work:
Author:
Anandh Ramesh Babu
[email protected] Peer reviewed by:
Co-supervised by : Mohammad H. Arabnejad
Hua-Dong Yao Muye Ge
[email protected]
Disclaimer: This is a student project work, done as part of a course where OpenFOAM and some
other OpenSource software are introduced to the students. Any reader should be aware that it
might not be free of errors. Still, it might be useful for someone who would like learn some details
similar to the ones presented in the report and in the accompanying files. The material has gone
through a review process. The role of the reviewer is to go through the tutorial and make sure that
it works, that it is possible to follow, and to some extent correct the writing. The reviewer has no
responsibility for the contents.
The main requirements of a tutorial are : How to use it, The theory of it, How it is implemented,
and How to modify it. Therefore the list of learning outcomes is organized with those headers.
How to use it
• The reader will learn how to use rhoPimpleAdiabaticFoam solver.
• The reader will learn how to use the implemented aeroacoustic solver for the flow past a wedge.
How it is implemented
• The reader will learn how rhoPimpleAdiabaticFoam works.
How to modify it
• The reader will learn how to implement the aeracoustic solver ’rhoPimpleAdiabaticAcoustic-
Foam’.
• The reader will learn how to modify a case and set the necessary parameters to run aeroacoustic
simulations using ’rhoPimpleAdiabaticAcousticFoam’.
1
Contents
1 Theory 3
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Governing Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2 rhoPimpleAdiabaticFoam Solver 6
2.1 rhoPimpleAdiabaticFoam.C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2 createFields.H . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.3 Make folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4 Test Case 20
4.1 system/ Folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.1.1 blockMeshDict . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.1.2 controlDict . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
4.1.3 fvSchemes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.1.4 fvSolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.2 constant/ folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.2.1 thermophysicalProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.2.2 turbulenceProperties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4.2.3 acousticSettings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4.3 0/ Folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4.3.1 ’p’ Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.3.2 ’T’ Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.3.3 ’U’ Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.3.4 ’pAcoustic’ Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
5 Results 31
6 Conclusion 33
2
Chapter 1
Theory
1.1 Introduction
Aeroacoustics is the study of flow induced sound. Some examples of aeroacoustic noises include jet
engine, wind turbines, wind musical instruments and so on. This study has been mainly practiced
to reduce the noise generated from a flow field.
This field of aeroacoustics was pioneered in the 1950’s by James Lighthill. The sound is created
by turbulent wakes, detached boundary layers, vortex structures in the flow, flow interaction with
walls and so on. There are several limitations in the computation of aeroacoustic field due to scaling
difficulties, so this field has been heavily reliant on experimental methods. Lighthill developed a
wave equation by rewriting the governing flow equations which included source terms from the flow
equations[1]. This idea has led to further extensions such as, Curle’s analogy, Ffowcs-Williams and
Hawkings equations[2]. Initially, these results were computed analytically by integrating the source
terms using Green’s integral but with Computational Fluid Dynamics (CFD), the calculation of the
source terms and the acoustic parameters was made possible.
In general, the aeroacoustic applications have two approaches namely, pressure based and density
based approaches. The pressure based approach is used ideally for low mach number simulations
where the the fluctuations of density are minimal. So, in such conditions, using the assumption that
wave propagation is isentropic, the fluctuations of pressure are used to form a wave equation that
would in turn calculate the oscillations in the acoustic regime. The density based approach is most
suited for higher mach number flow where the fluctuations in density are considerable.
1. Direct Methods : In this method, a transient solution is calculated from the source and the
propagation of the sound waves. This method uses the most exact and straightforward methodology
where the compressible Navier-Stokes equations are solved directly (DNS). There are large differ-
ences in the scales between the flow variables and acoustic variables. The meshes need to be very
fine and extremely small time steps must be employed which proves to be extremely expensive.
2. Hybrid Methods : In this method, using a source field in CFD analysis, the propagation is
3
1.2. GOVERNING EQUATIONS CHAPTER 1. THEORY
predicted using a transport method. This involves scale modeling and so the computational effort
is significantly reduced and coarser meshes can be employed.
Hybrid Methods
Hybrid methods are applicable for problem with only one-way coupling between flow and acoustics.
That is, the flow is independent of the acoustics. By doing this, the problem is divided into two sec-
tions, with one being the flow solution and other, the propagation of sound waves. The methodology
is described in Figure 1.1.
where ρ is the density, a∞ is the speed of sound and Tij is the Lighthill’s stress tensor and it is given
by,
Tij = ρui uj − τij + (p − a2∞ ρ)δij (1.2)
This equation is obtained by taking the time derivative of continuity equation and space derivative
∂2ρ
of momentum equation and subtracting them along with an additional term a2∞ ∂x 2.
i
In equation 1.1, the left hand side of the equation is an ordinary wave equation and the right hand
side is the acoustic source terms. To solve this equation, these source terms must be known and
decoupled from the acoustic field.
4
1.2. GOVERNING EQUATIONS CHAPTER 1. THEORY
are almost negligible. So a transport equation for the acoustic pressure is created and this is coupled
with the fluctuations in pressure from CFD simulations. The assumption is this method is that
only the pressure perturbations are the cause of sound production. The acoustic pressure transport
equation can be defined as,
∂ 2 pa 2
2 ∂ pa ∂ 2 p0
− c ∞ = − (1.3)
∂t2 ∂x2 ∂t2
Where, pa refers to the acoustic pressure and p’ refers to the fluctuation in pressure from CFD
simulations. This equation is obtained from Acoustic Perturbation Equations (APE)[3]. Eqn. 1.3,
is implemented in OpenFOAM to determine the acoustic pressure fluctuations in a system which is
then tested on the flow past wedge (prism).
5
Chapter 2
rhoPimpleAdiabaticFoam Solver
The acoustic solver is created as an extension of the in-built solver ’rhoPimpleAdiabaticFoam’. This
solver finds its applications in low Mach number, weakly compressible flows that is suitable for
aeroacoustic applications. The solver uses PIMPLE (PISO-SIMPLE) algorithm for time-resolved
simulations. The solver uses Rhie-Chow interpolation which will be discussed later in section 2.1.
The solver uses Reverse Cuthill McKee ordering scheme based on [4].
After initializing OFv1806, This solver is found in
cd $FOAM_APP/solvers/compressible/rhoPimpleAdiabaticFoam
The folder contains the files/folders,
• Make/ : contains ’files’ and ’options’ which are essential for compilation of the solver
• createFields.H : initializes all fields and objects used in the solver
• EEqn.H : Solves the energy equation
• pEqn.H : Solves the pressure equation
• UEqn.H : Solves the momentum equation
• resetBoundaries.H : Keeps standard formulation on domain boundaries to ensure compatibility
with existing boundary conditions.
• rhoPimpleAdiabaticFoam.C : The main solver file that contains all the steps to be performed.
2.1 rhoPimpleAdiabaticFoam.C
A basic description of the solver is described below.
The solver file, ’rhoPimpleAdiabaticFoam.C’, uses set of header files to initialize models for
simulation and control as shown in Listing 2.1.
6
2.1. RHOPIMPLEADIABATICFOAM.C
CHAPTER 2. RHOPIMPLEADIABATICFOAM SOLVER
The header ’fvCFD.H’ is used for include finite volume operations to be performed in the mesh.
The header files that are specific to a compressible flow solver are ’fluidThermo.H, turbulentFlu-
idThermoModel.H,’ which include thermodynamic properties of the fluid that are bound to change
at high speeds. With these models, the thermodynamic properties are determined. ’Bound.H’ header
is used to bound a scalar within the limits if it goes out. ’pimpleControl.H’ is used to control and
provide information on the convergence and operations of the pimple loop. ’ddtScheme.H’ includes
the time stepping schemes for transient simulations. ’fvcCorrectAlpha.H’ is used to correct the ve-
locity flux difference using an internal loop using correction factors.
From Listing 2.2, we can see that inside main(), the solver includes several classes. These classes
are to add post processing functionalities, create time and mesh control, create fields (which will be
discussed in createFields.H section), continuity errors and so on.
The runTime object is initialized in ’createTime.H’ which is a member of class, Time. This
object reads from the ’controlDict’ file from the case directory and sets a start time, end time, ∆t
value and so on. As shown in Listing 2.3, a while loop is used to control the time stepping in the
solver. Inside this loop, compressible courant number, ∆t value are determined and time control is
initialized. The current time value is set using ’runTime++’. In this step the current time value is
incremented by the time step value. Line 9 displays the current time value in the log file.
7
2.1. RHOPIMPLEADIABATICFOAM.C
CHAPTER 2. RHOPIMPLEADIABATICFOAM SOLVER
23
24 #i n c l u d e ”UEqn .H”
25
26 // −−− P r e s s u r e c o r r e c t o r l o o p
27 while ( pi mp le . c o r r e c t ( ) )
28 {
29 #i n c l u d e ”pEqn .H”
30 }
31
32 #i n c l u d e ”EEqn .H”
33
34 i f ( pi mp le . t u r b C o r r ( ) )
35 {
36 t u r b u l e n c e −>c o r r e c t ( ) ;
37 }
38 }
39
40 runTime . w r i t e ( ) ;
41
42 runTime . p r i n t E x e c u t i o n T i m e ( I n f o ) ;
43 }
44 I n f o <<”End \n”<<e n d l ;
45
46 return 0 ;
47 }
If the number of correctors, in the PIMPLE control in fvSolution file of the case directory is less
than or equal to 1, ’rhoEqn.H’ is included in the code. This code is present in ’$F OAM SRC/
finiteVolume/cfdTools/compressible/rhoEqn.H’. This file solves the continuity equation for density.
If the number of pimple correcter is not equal to 1, this line is skipped. The code in the file,
’rhoEqn.H is given in Listing 2.4.
From Listing 2.3, after this step, the pressure-velocity coupling in this solver is done using a
PIMPLE corrector loop. Using a while loop, ’pimple.loop()’ starts the pimple loop when the number
of corrector are 2 or higher. Inside the loop, velocity, density, flux and flux over density are stored
for the previous iteration step of the loop as seen in lines 19-22 in the main solver file. Then the
file ’UEqn.H’ is included which solves for velocity using momentum equation. This file ’UEqn.H’
is shown in Listing 2.5. Line 3 in the file is to set moving reference frame boundary conditions for
the velocity field. The momentum equation solver takes into account the turbulence model specified
in the ’turbulenceProperties’ dictionary in the case/constant directory. The equation is relaxed
implicitly and the appropriate constraints are set on the equation and solved for velocity. The code
in the file, ’UEqn.H’ is listed below.
8
2.1. RHOPIMPLEADIABATICFOAM.C
CHAPTER 2. RHOPIMPLEADIABATICFOAM SOLVER
10 ==
11 f v O p t i o n s ( rho , U)
12 );
13 f v V e c t o r M a t r i x& UEqn = tUEqn . r e f ( ) ;
14
15 UEqn . r e l a x ( ) ;
16
17 f v O p t i o n s . c o n s t r a i n (UEqn) ;
18
19 i f ( pi mp le . momentumPredictor ( ) )
20 {
21 s o l v e (UEqn == −f v c : : grad ( p ) ) ;
22
23 f v O p t i o n s . c o r r e c t (U) ;
24 }
After the momentum equation is solved, a pressure corrector loop is executed which solves for
the pressure field as shown in Listing 2.3. As stated before, the pressure-velocity coupling is done
using a PISO-SIMPLE algorithm. The velocity is computed by discretizing the velocity field from
the momentum equation. This is an intermediate velocity or velocity predictor step. ’pEqn.H’ is
shown in Listing2.6. Using this velocity field, fields such as ’rAU’ and ’HbyA’ are defined. Using
these, surface scalar fields ’rhorAUf’ and ’rhoHbyAf’ are interpolated based on the commented lines
mentioned between lines 7-11. It is to be noted that the current algorithm does not include transonic
options. When the working regime is non-transonic, the pressure equation is solved. Using Rhie-
Chow interpolation the velocities are interpolated and using the pressure corrector equation, the
pressure is solved. It is seen that the flux is updated for the pressure obtained from the current step.
This forms the second part of Rhie-Chow interpolation. After the pressure field is solved, Pressure
is relaxed and the velocity field is updated from the updated pressure field. Density is calculated
using thermodynamic relations and finally, ’dpdt’ is calculated.
9
2.1. RHOPIMPLEADIABATICFOAM.C
CHAPTER 2. RHOPIMPLEADIABATICFOAM SOLVER
31 i f ( pi mp le . t r a n s o n i c ( ) )
32 {
33 FatalError
34 << ” \ n T r a n s o n i c o p t i o n not a v a i l a b l e f o r ” << a r g s . e x e c u t a b l e ( )
35 << e x i t ( F a t a l E r r o r ) ;
36 }
37 else
38 {
39 // Rhie & Chow i n t e r p o l a t i o n ( p a r t 1)
40 s u r f a c e S c a l a r F i e l d phiHbyA
41 (
42 ”phiHbyA” ,
43 (
44 ( rhoHbyAf & mesh . S f ( ) )
45 + rhorAUf ∗ f v c : : i n t e r p o l a t e ( rho ) ∗ f v c : : ddtCorr (U, phiByRho )
46 + f v c : : i n t e r p o l a t e ( rho )
47 ∗ f v c : : a l p h a C o r r (U, phiByRho , p im pl e . f i n a l I n n e r I t e r ( ) )
48 )
49 );
50
51 MRF. m a k e R e l a t i v e ( f v c : : i n t e r p o l a t e ( rho ) , phiHbyA ) ;
52
53 // Non−o r t h o g o n a l p r e s s u r e c o r r e c t o r l o o p
54 while ( pi mp le . c o r r e c t N o n O r t h o g o n a l ( ) )
55 {
56 // P r e s s u r e c o r r e c t o r
57 f v S c a l a r M a t r i x pEqn
58 (
59 fvm : : ddt ( p s i , p )
60 + f v c : : d i v ( phiHbyA )
61 − fvm : : l a p l a c i a n ( rhorAUf , p )
62 ==
63 f v O p t i o n s ( p s i , p , rho . name ( ) )
64 );
65
66 pEqn . s o l v e ( mesh . s o l v e r ( p . s e l e c t ( p im pl e . f i n a l I n n e r I t e r ( ) ) ) ) ;
67
68 // Rhie & Chow i n t e r p o l a t i o n ( p a r t 2)
69 i f ( pi mp le . f i n a l N o n O r t h o g o n a l I t e r ( ) )
70 {
71 p h i = phiHbyA + pEqn . f l u x ( ) ;
72 }
73 }
74 }
75
76 phiByRho = p h i / f v c : : i n t e r p o l a t e ( rho ) ;
77
78 #i n c l u d e ” rhoEqn .H”
79 #i n c l u d e ” c o m p r e s s i b l e C o n t i n u i t y E r r s .H”
80
81 // E x p l i c i t l y r e l a x p r e s s u r e f o r momentum c o r r e c t o r
82 p . relax () ;
83
84 U = HbyA − rAU∗ f v c : : grad ( p ) ;
85 U. c o r r e c t B o u n d a r y C o n d i t i o n s ( ) ;
86 f v O p t i o n s . c o r r e c t (U) ;
87 }
88
89 rho = thermo . rho ( ) ;
90
91 i f ( thermo . dpdt ( ) )
92 {
93 dpdt = f v c : : ddt ( p ) ;
94 }
After solving the pressure field, the solver as seen in Listing 2.3, includes the file ’EEqn.H’ which
10
2.1. RHOPIMPLEADIABATICFOAM.C
CHAPTER 2. RHOPIMPLEADIABATICFOAM SOLVER
solves the temperature field in the domain. The file ’EEqn.H’ is shown in Listing 2.7. This file
primarily uses thermoDict to obtain case specific information. Initially, the values of ’cp ’ and ’cv ’
are obtained as volume scalar fields and γ is made sure to be constant throughout the domain. The
solution uses isentropic relations and for this, γ must constant. Using the dictionary in the case
directory, the stagnation values of pressure and temperature are taken into account. Using isentropic
relations, the temperature field is determined. The compressibility factors, density are obtained in
the subsequent steps.
The solver finally corrects turbulence and exits the PIMPLE loop as seen in Listing 2.3. The
entire loop is repeated based on the number of correctors described in the dictionary. At the end
of the time step, runTime.write() function prints the solver information such as residuals, num-
ber of iterations, solver, preconditioner or smoother used for solution of that variable and run-
11
2.2. CREATEFIELDS.H CHAPTER 2. RHOPIMPLEADIABATICFOAM SOLVER
Time.printExecutionTime(Info) prints the time taken for the execution of that time step.
2.2 createFields.H
The file, ’createFields.H’ initializes all the fields and scalars that are necessary for the solver to
run. For a variable to be used in the solver, it must be declared. Firstly, as seen in Listing 2.8,
thermophysical properties are defined. These properties are defined as mesh dependant properties.
Pressure and temperature are obtained from the function ’pThermo()’ which reads the initial pressure
and temperature and ’thermo.validate()’ validates the thermodynamic state variables. This function
is located in the class bassicThermo which is the parent class for fluidThermo.
12
2.2. CREATEFIELDS.H CHAPTER 2. RHOPIMPLEADIABATICFOAM SOLVER
26 );
27
28 I n f o << ” C a l c u l a t i n g f a c e f l u x f i e l d p h i \n” << e n d l ;
29
30 s u r f a c e S c a l a r F i e l d phi
31 (
32 IOobject
33 (
34 ” phi ” ,
35 runTime . timeName ( ) ,
36 mesh ,
37 I O o b j e c t : : READ IF PRESENT ,
38 I O o b j e c t : : AUTO WRITE
39 ),
40 l i n e a r I n t e r p o l a t e ( rho ) ∗ l i n e a r I n t e r p o l a t e (U) & mesh . S f ( )
41 );
42
43 I n f o << ” C a l c u l a t i n g f a c e f l u x f i e l d phiByRho\n” << e n d l ;
44
45 s u r f a c e S c a l a r F i e l d phiByRho
46 (
47 IOobject
48 (
49 ”phiByRho” ,
50 runTime . timeName ( ) ,
51 mesh ,
52 I O o b j e c t : : READ IF PRESENT ,
53 I O o b j e c t : : AUTO WRITE
54 ),
55 p h i / l i n e a r I n t e r p o l a t e ( rho )
56 );
After this point, the turbulence model is defined as seen in Listing 2.10. A new compressible
turbulence model object is created as a pointer based on the density, velocity, flux and thermody-
namic properties (pressure and temperature) according to the entries defined in turbulenceProperties
dictionary in the case directory.
The unsteady pressure term is defined and it is calculated in the file ’pEqn.H’. ’createMRF.H’ is
added if there are moving surfaces in the geometry. Finally, compressibility field ’psi’ is declared as
a volScalarField and it is calculated. This field is stored for 2 previous time steps. The final steps
are given in Listing 2.11.
13
2.3. MAKE FOLDER CHAPTER 2. RHOPIMPLEADIABATICFOAM SOLVER
3 (
4 IOobject
5 (
6 ” dpdt ” ,
7 runTime . timeName ( ) ,
8 mesh
9 ),
10 mesh ,
11 d i m e n s i o n e d S c a l a r ( p . d i m e n s i o n s ( ) /dimTime , Zero )
12 );
13
14 #include ” createMRF .H”
15
16 I n f o << ” C r e a t i n g c o m p r e s s i b i l i t y f i e l d p s i \n” << e n d l ;
17 v o l S c a l a r F i e l d p s i ( ” p s i ” , 1 . 0 / ( ( thermo . Cp ( ) − thermo . Cv ( ) ) ∗T) ) ;
18 p s i . oldTime ( ) = 1 . 0 / ( ( thermo . Cp ( ) − thermo . Cv ( ) ) ∗T . oldTime ( ) ) ;
19 p s i . oldTime ( ) . oldTime ( ) = 1 . 0 / ( ( thermo . Cp ( )−thermo . Cv ( ) ) ∗T . oldTime ( ) . oldTime ( ) ) ;
14
Chapter 3
The acoustic solver is implemented according to equation 1.3. This equation couples fluctuating
pressure from the flow field to solve for the acoustic pressure field. The operation follows the proce-
dure as stated in Figure. 1.1. The flow field is completely solved and then pressure fluctuations are
calculated followed by acoustic calculations.
In order for the solver to be implemented, it must be compiled in the user directory. The follow-
ing lines are executed in the terminal window one at a time.
OFv1806
foam
cp -r --parents applications/solvers/compressible/rhoPimpleAdiabaticFoam $WM_PROJECT_USER_DIR
15
3.1. CREATING FIELDS CHAPTER 3. IMPLEMENTATION OF ACOUSTIC SOLVER
From Listing 3.1, the pAcoustic file is a must read files that is read from the initial time directory
for initial values and boundary conditions. pFluc and pMean are read if present but they are
calculated in the solver. The fields are created like the others present in the original file, as an
’IOobject’. All the objects created are pressure fields and so the object type is ’volScalarField’ and
these fields are prescribed on the mesh.
16
3.1. CREATING FIELDS CHAPTER 3. IMPLEMENTATION OF ACOUSTIC SOLVER
From Listing 3.2, a volume scalar field, speed of sound at freestream conditions is defined as
’cInf’. It is a calculated using thermodynamic scalar properties using the relation as in eqn. 3.1.
The value of gamma is defined by eqn. 3.2 and the value of R is defined by eqn. 3.3. The values
of cp and cv are available in the object thermo and their corresponding return functions are used to
get their values. Finally, a scalar variable ’timeIndex’ is created and initialized to 1. This scalar is
used in the calculation of time averaged pressure field.
p
c∞ = γRT∞ (3.1)
cp
γ= (3.2)
cv
R = cp − cv (3.3)
In theory, the domain must be fully developed before we start time averaging the results and
when the acoustic solver is solved. So an IODictionary, ’acousticSettings’ is defined in which the
user must define at what time the solver should start time averaging pressure field. This dictionary
17
3.2. ACOUSTICSOLVER.H CHAPTER 3. IMPLEMENTATION OF ACOUSTIC SOLVER
is located in the constant folder of the case directory. ’tAc’ is the variable that defines the time as to
when the solver should start time averaging the pressure field. The variable that is defined is ’nPass’
which is to specify the solver how many passes should be completed before the wave equation is
solved. ’tAc’ has the dimensions of time while ’nPass’ is dimensionless.
3.2 acousticSolver.H
In order to simplify the implementation, a new header file containing the implementations of the
solver is created and it is included in the main solver file at the right line. The header file is named
’acousticSolver.H’ and it is created in the solver directory. The following line is added before run-
Time.write() in rhoPimpleAdiabaticAcousticFoam.C file,
#include ”acousticSolver.H”
At this point in the solver, the CFD simulation is completely finished and the solver prints the
information of the solvers and the solution details after which it starts the next time step. Now, the
following lines are added in ’acousticSolver.H’ as shown in Listing 3.3.
vi acousticSolver .H
At the beginning of the file, there is a conditional loop which allows the solver to proceed only
when the runTime object’s time value is greater that the user defined value under ’tAc’. For the
first timestep after the solver enters the loop, the value of pMean is equal to p as it is the first step
of averaging. Then the value is stored for the next time step and then timeIndex is incremented. In
the later time steps, the else section gets executed. The time averaged value of pressure is calculated
based on the formula,
(pM eant=i−1 × (t − ∆t) + pt=i × ∆t)
pM eant=i = (3.4)
t
18
3.2. ACOUSTICSOLVER.H CHAPTER 3. IMPLEMENTATION OF ACOUSTIC SOLVER
This value is stored for each time step using ’pMean.storeOldTime()’, so that it can accessed in the
next time step using ’pMean.oldTime()’. The loop continues until the calculation of pMean till the
second conditional statement is satisfied that is the time value must be greater than ’tAc*nPass’.
This allows the solver to time average the pressure field for ’tAc*(nPass-1)’ seconds. Once this
condition is satisfied, the fluctuating value is calculated by taking the difference between the actual
pressure value and mean pressure value. The wave equation is defined as an ’fvScalarMatrix’ and it
is named as ’pAcousticEqn’. This equation is defined as eqn.1.3. Here it is noted that the ’pFluc’
term is a field and so ’fvc’ namespace is used where as ’pAcoustic’ terms are solved for and so ’fvm’
namespace is used.
Finally, once the implementation of the solver is complete, the compilation1 can be done by
using,
wmake
1 In some cases, the compiler might suggest a warning stating that timeIndex is unused. But it is to be noted that
the variable is used in the calculation of pMean. It is a compiler error and can be neglected.
19
Figure 4.1: Test case domain : Prism
Chapter 4
Test Case
Once the solver is compiled, we can now use this solver on a test case to see if the implementation
yields reasonable results. To do this, we are going to test this solver on a flow past a prism (wedge)
at suitable conditions. Ideally, for aeroacoustic simulations, large domains and fine meshes are used.
But for the simplicity and quick results, we opt a smaller domain and a relatively coarse mesh. The
domain is shown in Figure. 4.1.
The prism is of height 4cm. The dimensions of the domain is 1m × 0.8m. The simulation carried
out in this case is 2D. But some information on how to implement a 3D mesh is given.
20
4.1. SYSTEM/ FOLDER CHAPTER 4. TEST CASE
The code in Listing 4.1 defines the position of the vertices. The values are scaled to 0.01. The
positioning methods in both the geometries are the same. This code simply creates a bigger domain.
The domain size is 1m × 0.8m × 0.08m
21
4.1. SYSTEM/ FOLDER CHAPTER 4. TEST CASE
The code in Listing 4.2 is to generate blocks by connecting the vertices together. Hexahedral
meshes are creates throughout the domain. ’simpleGrading’ is used to provide a gradient to the
mesh size for refinement. These two codes are copied to blockMeshDict in their respective sections.
4.1.2 controlDict
Once the the geometry is set, the solution control settings can be set in controlDict.
vi system/controlDict
In controlDict, various options such as startTime, endTime, deltaT, writeInterval and so on can be
set as seen in Listing 4.3. For this simulation, the following settings were set.
22
4.2. CONSTANT/ FOLDER CHAPTER 4. TEST CASE
The main changes from the initial file are the endTime and the deltaT values. In this simulation,
we will be looking at wake patterns and these patterns occur in a fully developed flow after 4 to 5
passes. For the flow to develop wake structures, the simulation must be run until 0.1 seconds. The
deltaT value is set from 5e-07 to 5e-06. This is because, the initial case has a velocity of 300 m/s.
But we are looking at velocities around mach 0.3 that is approximately less than 100 m/s. For this
velocity and meshing, a deltaT of 5e-06 is reasonable and it satisfies the Courant criterion. The
writeInterval can be kept the same for better visualization of the results. But, this occupies a lot of
storage space so for a rough visualization, this value can be set to 0.005.
4.1.3 fvSchemes
2 2
d d
From eqn. 1.3, we can see that two types of differential terms are used, dt2 and dx2 . The second
derivative of time and space. The discretization scheme for these terms should be specified in
fvScheme file.
This code from Listing 4.4 is copied in the file fvSchemes after ddtSchemes section. This solves
the second derivative with respect to time using Euler scheme. The second term, laplacian, is set to
’Gauss linear corrected’ by default. So the solver takes this scheme for the laplacian term.
4.1.4 fvSolution
The solvers, preconditioners or smoothers are set for the solution of each variable using fvSolution.
In this case, we need to set the solver type for the variable ’pAcoustic’. The code in Listing 4.5 is
copied to the file at the end of the solver section.
It is noted that, ’PBiCGStab’ solver and ’DILU’ preconditioner are used. These settings handle
non-symmetric matrices well and so the solution is obtained in fewer iterations. Tolerance is set at
1e-6. The solution of pAcoustic is not present in any pressure velocity correction loops.
23
4.3. 0/ FOLDER CHAPTER 4. TEST CASE
These values are calculated based on assumed boundary conditions. This definition is essential
for rhoPimpleAdiabaticFoam solver as seen in Listing 2.7, lines 28 and 29.
4.2.2 turbulenceProperties
In this file, originally, kEpsilon model is used. Since, in this simulation, near wall effects are impor-
tant, RNGkEpsilon model is used for better results.
sed -i s/'kEpsilon'/'RNGkEpsilon'/g constant/turbulenceProperties
The above line is executed in the terminal window to replace the turbulence model type.
4.2.3 acousticSettings
A dictionary must be set in the constant folder of the case directory to define additional vari-
ables which needed by the solver to run acoustic simulations. A new file is created by typing
vi constant/acousticSettings . Two variables ’tAc’ and ’nPass’ are defined in the file as shown in
Listing 4.7
4.3 0/ Folder
This folder contains all the field variables and their initial values and boundary conditions are set. As
stated above, this flow must be weakly compressible and so an arbitrary velocity value was chosen,
say 95m/s. From the equation of state, using the stagnation value of temperature and pressure
which are 297.3K and 1 atm, the temperature and pressure values were calculated using isentropic
relations. In addition, pAcoustic field is created for the newly compiled solver to work.
24
4.3. 0/ FOLDER CHAPTER 4. TEST CASE
25
4.3. 0/ FOLDER CHAPTER 4. TEST CASE
26
4.3. 0/ FOLDER CHAPTER 4. TEST CASE
9 type fixedValue ;
10 value uniform (95 0 0) ;
11 }
12
13 outlet
14 {
15 type inletOutlet ;
16 inletValue uniform (0 0 0) ;
17 value uniform (0 0 0) ;
18 }
19
20 bottomWall
21 {
22 type freestreamVelocity ;
23 pInf 96319.74;
24 TInf 293;
25 UInf (95 0 0) ;
26 gamma 1.4;
27 freestreamValue uniform (95 0 0) ;
28 }
29
30 topWall
31 {
32 type freestreamVelocity ;
33 pInf 96319.74;
34 TInf 293;
35 UInf (95 0 0) ;
36 gamma 1.4;
37 freestreamValue uniform (95 0 0) ;
38 }
39
40 prismWall
41 {
42 type noSlip ;
43 }
44
45 defaultFaces
46 {
47 type empty ;
48 }
49 }
27
4.3. 0/ FOLDER CHAPTER 4. TEST CASE
11 format ascii ;
12 class volScalarField ;
13 object pAcoustic ;
14 }
15 // ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ //
16
17 dimensions [ 1 −1 −2 0 0 0 0 ] ;
18 internalField uniform 0 ;
19
20 boundaryField
21 {
22 inlet
23 {
24 type waveTransmissive ;
25 field pAcoustic ;
26 psi thermo : p s i ;
27 gamma 1.4;
28 fieldInf 0;
29 lInf 1;
30 value uniform 0 ;
31 }
32
33 outlet
34 {
35 type waveTransmissive ;
36 field pAcoustic ;
37 psi thermo : p s i ;
38 gamma 1.4;
39 fieldInf 0;
40 lInf 1;
41 value uniform 0 ;
42 }
43
44 bottomWall
45 {
46 type waveTransmissive ;
47 field pAcoustic ;
48 psi thermo : p s i ;
49 gamma 1.4;
50 fieldInf 0;
51 lInf 1;
52 value uniform 0 ;
53 }
54
55 topWall
56 {
57 type waveTransmissive ;
58 field pAcoustic ;
59 psi thermo : p s i ;
60 gamma 1.4;
61 fieldInf 0;
62 lInf 1;
63 value uniform 0 ;
64 }
65
66 prismWall
67 {
68 type zeroGradient ;
69 }
70
71 defaultFaces
72 {
73 type empty ;
74 }
75 }
76
77 // ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ //
28
4.3. 0/ FOLDER CHAPTER 4. TEST CASE
With these variables modified, the case can be run by ’Allrun’ script and the case the can be
cleaned using ’Allclean’ script.
For the creation of ’Allrun’ script, a newfile is opened in the main case directory and the code in
Listing 4.12 is pasted.
29
4.3. 0/ FOLDER CHAPTER 4. TEST CASE
vi Allrun
chmod +x Allclean
The case can now be run by executing the Allrun script.
./Allrun
30
Figure 5.1: Acoustic pressure field at t=0.065s
Chapter 5
Results
The solution takes places in fairly small time steps and so it takes sometime for completion. On
completion, the results can be visualized using typing ’paraFoam’ in the terminal window and by
loading the case. The field is set to ’pAcoustic’ and simulation is started. Initially, the solution is
incorrect as the flow needs to get developed. By theory at least one flow pass must be completed
for the flow to be fully developed and about 4-5 flow passes for wake patterns to be generated. The
solution can be skipped to 0.065 seconds by typing 649 in the frame box and we can note that
the acoustic disturbances are captured due to these wake structures. Further forwarding to 0.15s
(1499th frame), acoustic pressure due to wake patterns are clearly visible and they can be correlated
to the instantaneous pressure values from which these acoustic pressure values are obtained from.
From Figure 5.1 and Figure 5.2, it can be seen that the magnitudes of the acoustic pressure field
develop over time.
31
CHAPTER 5. RESULTS
32
Chapter 6
Conclusion
Thus, the report covers the contents stated in the learning outcomes: A basic theoretical back-
ground behind pressure-based wave equation, how the solver ’rhoPimpleAdiabaticFoam’ has been
implemented, how an aeroacoustic solver needs to be implemented as an extension to the already
available ’rhoPimplAdiabaticFoam’ solver and how to modify a case to make use of the newly im-
plemented solver have been explained.
From the results in Figure 5.2, a maximum acoustic pressure of around 53 Pa is obtained which
corresponds to 128dB roughly. This is calculated using the equation,
pa
SP L = 20log (6.1)
pref
where SPL stands for Sound Pressure Level, pa refers to the acoustic pressure and pref = 2×10−5
which refers to reference pressure.
This SPL value of 128dB is reasonable considering the geometry of the wedge and the velocity being
high. It is to be noted that high sound levels occurs in the vortex region, downstream of the wedge.
2. An RAS k- turbulence model is implemented and these models tend to dampen fluctuations.
So it would be interesting to visualize results from LES and see the degree to which the solution
is altered. But, since the equations are hyperbolic, the mesh requirement is a problem.
3. The domain is an important feature in aeroacoustic simulations. A much larger domain would
be recommended to eliminate the effects of boundaries on the wedge for more accurate results.
4. The wave equation is only acceptable in weakly compressible and incompressible regimes. So
for mach numbers above 0.4, the solver may yield unphysical results and it can not be used in
transonic and supersonic regimes.
5. As stated above, only pressure flucatuations are considered as source terms. The effects of
vorticity interferences and velocity fluctuations can be added to the solver.
33
Study Questions
5. Explain the logic behind calculating the mean pressure field used in the implementation.
6. What is the purpose of the file resetBoundaries.H in the solver folder?
7. Where is the file rhoEqn.H located?
34
References
4. Knacke, T. (2013). Potential effects of Rhie Chow type interpolations in airframe noise sim-
ulations. In: Schram, C., Dénos, R., Lecomte E. (ed): Accurate and efficient aeroacoustic
prediction approaches for airframe noise, VKI LS 2013-03.
35