4.2 constant/ folder
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.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 which is 297.3K, the temperature and pressure values were calculated using isentropic relations. In addition, pAcoustic and pMean fields are created for the newly compiled solver to work.
4.3.1 ’p’ Field
The boundary conditions of this field remains the same as in the original tutorial file. But the value is modified to the value obtained from the compressible flow relations. The final file looks as given below. The inlet boundary condition is a ’fixedValue’ boundary condition which is maintained constant throughout the simulation. ’waveTransmissive’ boundary condition best suited for pressure waves which acts as a non-reflective boundary. ’zeroGradient’ is a nuemann boundary condition.
vi 0/p
4.3. 0/ FOLDER CHAPTER 4. TEST CASE
Like the pressure field, the magnitude of the temperature at the initial and boundary values are modified. The code presented below is pasted in the this file. ’inletOutlet’ boundary condition is a generic outflow condition which assumes the inflow value if return flow occurs. vi 0/T
d i m e n s i o n s [ 0 0 0 1 0 0 0 ] ;
4.3. 0/ FOLDER CHAPTER 4. TEST CASE
The velocity is set at 95m/s. The boundary conditions remain the same while the values of velocity, temperature, gamma and pressure are modified. ’freeStreamVelocity’ boundary condition is used to set a free stream velocity on the boundary.
vi 0/U
4.3. 0/ FOLDER CHAPTER 4. TEST CASE
The mean field of pressure at the inital time step is the same as the pressure field itself. So the field
’pMean’ is created by just copying the pressure field into a new file.
cp 0/p 0/pMean
4.3.5 ’pAcoustic’ Field
This field is the result of the solution of the wave equation. The acoustic pressure field is a pressure wave and it is essential that the boundaries do not reflect them back in the domain. So all bound-aries except the prism take ’waveTransmissive’ boundary condition whereas prim boundary takes
’zeroGradient’ boundary condition. The entire code is pasted in a new file named ’pAcoustic’.
vi 0/pAcoustic
4.3. 0/ FOLDER CHAPTER 4. TEST CASE
4.3. 0/ FOLDER CHAPTER 4. TEST CASE
}
d e f a u l t F a c e s {
t y p e empty ;
} }
// ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ //
With these variables modified, the case can be run creating ’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 following piece of code is pasted. vi Allrun
#!/ b i n / sh
cd ${0%/∗} | | e x i t 1 # Run from t h i s d i r e c t o r y
. $WM PROJECT DIR/ bin / t o o l s /RunFunctions # T u t o r i a l run f u n c t i o n s r u n A p p l i c a t i o n blockMesh
r u n A p p l i c a t i o n $ ( g e t A p p l i c a t i o n )
#−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
After pasting the code, the file is made executable by executing, chmod +x Allrun
Similarily, ’Allclean’ script is created.
vi Allclean
#!/ b i n / sh
cd ${0%/∗} | | e x i t 1 # Run from t h i s d i r e c t o r y
. $WM PROJECT DIR/ bin / t o o l s / CleanFunctions # T u t o r i a l c lean f u n c t i o n s c l e a n C a s e
#−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
chmod +x Allclean
The case can now be run by executing the Allrun script.
./Allrun
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 atleast 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.
CHAPTER 5. RESULTS
Figure 5.2: Acoustic pressure field at t=0.15s
Chapter 6
Conclusion
Thus, an acoustic solver was implemented as an extension to the already available ’rhoPimplAdi-abaticFoam’ solver. Though the results seem physically acceptable, they are not validated. 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. For future work, the effects of vorticity interferences and velocity fluctuations can be added to the solver.
Chapter 7
Study Questions
1. What are the two methods used in CAA?
2. Explain how the hybrid method in CAA works.
3. State Lighthill’s equation.
4. Explain the logic behind calculating the mean pressure field used in the implementation.
5. What is the purpose of the file resetBoundaries.H in the solver folder?
6. Where is the file rhoEqn.H located?
Chapter 8
References
1. Hirschberg, Avraham, and Sjoerd W. Rienstra. ”An introduction to aeroacoustics.” Eindhoven university of technology (2004).
2. Uosukainen, Seppo. Foundations of acoustic analogies. VTT, 2011.
3. Siemens, P. L. M. ”STAR-CCM+ Userˆas Manual.”
Chapter 9
Appendix
The appendix contains codes of the modified solver,’rhoPimpleAdiabaticAcousticFoam’ and the test case,’prism’.
Solver Files
rhoPimpleAdiabaticAcousticFoam.C
#i n c l u d e ”fvCFD .H”
#i n c l u d e ” f l u i d T h e r m o .H”
#i n c l u d e ” t u r b u l e n t F l u i d T h e r m o M o d e l .H”
#i n c l u d e ” bound .H”
#i n c l u d e ” p i m p l e C o n t r o l .H”
#i n c l u d e ” f v O p t i o n s .H”
#i n c l u d e ” f v c A v e r a g e .H”
#i n c l u d e ” ddtScheme .H”
#i n c l u d e ” f v c C o r r e c t A l p h a .H”
// ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ //
i n t main ( i n t a r g c , c h a r ∗ argv [ ] ) {
#i n c l u d e ” p o s t P r o c e s s .H”
#i n c l u d e ” addCheckCaseOptions .H”
#i n c l u d e ” s e t R o o t C a s e .H”
#i n c l u d e ” c r e a t e T i m e .H”
#i n c l u d e ” c r e a t e M e s h .H”
#i n c l u d e ” c r e a t e C o n t r o l .H”
#i n c l u d e ” c r e a t e T i m e C o n t r o l s .H”
#i n c l u d e ” c r e a t e F i e l d s .H”
#i n c l u d e ” c r e a t e F v O p t i o n s .H”
#i n c l u d e ” i n i t C o n t i n u i t y E r r s .H”
// ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ //
I n f o << ”\ n S t a r t i n g t i m e l o o p \n” << e n d l ;
CHAPTER 9. APPENDIX
w h i l e ( runTime . run ( ) ) {
#i n c l u d e ” r e a d T i m e C o n t r o l s .H”
#i n c l u d e ” c o m p r e s s i b l e C o u r a n t N o .H”
#i n c l u d e ” s e t D e l t a T .H”
runTime++;
I n f o << ”Time = ” << runTime . timeName ( ) << n l << e n d l ; i f ( p i m p l e . nCorrPIMPLE ( ) <= 1 )
{
#i n c l u d e ” rhoEqn .H”
}
// −−− P r e s s u r e −v e l o c i t y PIMPLE c o r r e c t o r l o o p w h i l e ( p i m p l e . l o o p ( ) )
{
U. s t o r e P r e v I t e r ( ) ; rho . s t o r e P r e v I t e r ( ) ; p h i . s t o r e P r e v I t e r ( ) ; phiByRho . s t o r e P r e v I t e r ( ) ;
#i n c l u d e ”UEqn .H”
// −−− P r e s s u r e c o r r e c t o r l o o p w h i l e ( p i m p l e . c o r r e c t ( ) )
{
#i n c l u d e ”pEqn .H”
}
#i n c l u d e ”EEqn .H”
i f ( p i m p l e . t u r b C o r r ( ) ) {
t u r b u l e n c e −>c o r r e c t ( ) ; }
}
#i n c l u d e ” a c o u s t i c S o l v e r .H”
runTime . w r i t e ( ) ;
runTime . p r i n t E x e c u t i o n T i m e ( I n f o ) ; }
I n f o << ”End\n” << e n d l ; r e t u r n 0 ;
}
CHAPTER 9. APPENDIX
CHAPTER 9. APPENDIX
CHAPTER 9. APPENDIX
#i n c l u d e ” rhoEqn .H”
#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”
// 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 p . r e l a x ( ) ;
U = HbyA − rAU∗ f v c : : grad (p ) ; 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 ( ) ;
f v O p t i o n s . c o r r e c t (U ) ; }
rho = thermo . rh o ( ) ; i f ( thermo . dpdt ( ) ) {
dpdt = f v c : : ddt ( p ) ; }
EEqn.H
{
v o l S c a l a r F i e l d& he = thermo . he ( ) ;
c o n s t tmp<v o l S c a l a r F i e l d >& tCp = thermo . Cp ( ) ; c o n s t tmp<v o l S c a l a r F i e l d >& tCv = thermo . Cv ( ) ; c o n s t v o l S c a l a r F i e l d& Cp = tCp ( ) ;
c o n s t v o l S c a l a r F i e l d& Cv = tCv ( ) ;
c o n s t s c a l a r gamma = max (Cp/Cv ) . v a l u e ( ) ; i f ( mag (gamma − min (Cp/Cv ) . v a l u e ( ) ) > VSMALL) {
notImplemented ( ”gamma no t c o n s t a n t i n s p a c e ” ) ; }
c o n s t d i c t i o n a r y& t h e r m o D i c t = thermo . s u b D i c t ( ” m i x t u r e ” ) ;
c o n s t d i c t i o n a r y& e o s D i c t = t h e r m o D i c t . s u b D i c t ( ” e q u a t i o n O f S t a t e ” ) ; b o o l l o c a l = e o s D i c t . l o o k u p O r D e f a u l t ( ” l o c a l ” , f a l s e ) ;
// E v o l v e T a s : //
// T 1 = T 0 \ f r a c {p }{ p 0 }ˆ{\ f r a c {\gamma − 1}{\gamma}}
i f ( ! l o c a l ) {
c o n s t s c a l a r T0 = r e a d S c a l a r ( e o s D i c t . l o o k u p ( ” T0 ” ) ) ; c o n s t s c a l a r p0 = r e a d S c a l a r ( e o s D i c t . l o o k u p ( ” p0 ” ) ) ;
he = thermo . he ( p , pow ( p/p0 , (gamma − s c a l a r ( 1 ) ) / gamma)∗T0 ) ;
CHAPTER 9. APPENDIX
CHAPTER 9. APPENDIX
pMean = ( pMean . oldTime ( )∗ ( timeIndex −1)+p)/ timeIndex ; pMean . s t o r e O l d T i m e ( ) ;
pFluc = p − pMean ;
I n f o << ” S o l v i n g t h e wave e q u a t i o n f o r p A c o u s t i c \n” << e n d l ; f v S c a l a r M a t r i x pAcousticEqn
(
fvm : : d2dt2 ( p A c o u s t i c ) − s q r ( c I n f )∗ fvm : : l a p l a c i a n ( pAcoustic ) + f v c : : d2dt2 ( pFluc ) ) ;
s o l v e ( pAcousticEqn ) ;
Make/files
r h o P i m p l e A d i a b a t i c A c o u s t i c F o a m . C
EXE = $ (FOAM USER APPBIN)/ rhoPimpleAdiabaticAcousticFoam
Make/options
EXE INC = \
−I$ (LIB SRC)/ transportModels / co mp re ssi b le / l n I n c l u d e \
−I$ (LIB SRC)/ thermophysicalModels / b a s i c / l n I n c l u d e \
−I$ (LIB SRC)/ TurbulenceModels / turbulenceModels / l n I n c l u d e \
−I$ (LIB SRC)/ TurbulenceModels / c omp r ess ible / l n I n c l u d e \
−I$ (LIB SRC)/ finiteVolume / cfdTools \
−I$ (LIB SRC)/ finiteVolume / l n I n c l u d e \
−I$ (LIB SRC)/ meshTools/ l n I n c l u d e \
−I$ (LIB SRC)/ sampling / l n I n c l u d e \ EXE LIBS = \
−l c o m p r e s s i b l e T r a n s p o r t M o d e l s \
−l f l u i d T h e r m o p h y s i c a l M o d e l s \
− l s p e c i e \
−l t u r b u l e n c e M o d e l s \
−l c o m p r e s s i b l e T u r b u l e n c e M o d e l s \
−l f i n i t e V o l u m e \
−l m e s h T o o l s \
−l s a m p l i n g \
−l f v O p t i o n s
Test Case files
system/blockMeshDict
s c a l e 0 . 0 1 ; v e r t i c e s (
( 0 0 0 )
CHAPTER 9. APPENDIX
CHAPTER 9. APPENDIX
CHAPTER 9. APPENDIX
(
( 1 8 40 41 1 9 ) ( 1 9 41 42 2 0 ) ( 2 0 42 43 2 1 ) ) ;
}
prismWall {
t y p e w a l l ; f a c e s (
( 1 2 10 32 3 4 ) ( 1 2 34 31 9 ) ( 9 31 32 1 0 ) ) ;
} ) ;
m e r g e P a t c h P a i r s (
) ;
system/controlDict
a p p l i c a t i o n r h o P i m p l e A d i a b a t i c A c o u s t i c F o a m ; s t a r t F r o m l a t e s t T i m e ;
s t a r t T i m e 0 ;
s t o p At endTime ;
endTime 0 . 1 5 ;
d e l t a T 5 e −06;
w r i t e C o n t r o l runTime ; w r i t e I n t e r v a l 0 . 0 0 0 1 ; p u r g e W r i t e 0 ; w r i t e F o r m a t a s c i i ; w r i t e P r e c i s i o n 6 ; w r i t e C o m p r e s s i o n o f f ; timeFormat g e n e r a l ; t i m e P r e c i s i o n 6 ;
CHAPTER 9. APPENDIX
CHAPTER 9. APPENDIX
CHAPTER 9. APPENDIX
CHAPTER 9. APPENDIX
CHAPTER 9. APPENDIX
CHAPTER 9. APPENDIX
CHAPTER 9. APPENDIX
CHAPTER 9. APPENDIX
CHAPTER 9. APPENDIX
t y p e kqRWallFunction ;
v a l u e u n i f o r m 1 0 0 0 ;
CHAPTER 9. APPENDIX
CHAPTER 9. APPENDIX