computer exercise 2 - strömningsteknik · lund university / division of fluid mechanics /...
TRANSCRIPT
Computer Exercise 2
MVK150: Applied CFD
Holger Grosshans
Lund University / Division of Fluid Mechanics / 25.3.2011
To do
• Answer the questions marked with (*)
• Max 1-2 pages
• Each answer should be one or two sentences only.
• 1 report per student
• Send your report to
Lund University / Division of Fluid Mechanics / 25.3.2011
Case structure
Lund University / Division of Fluid Mechanics / 25.3.2011
Grid independency study
• Create 4 cases from the case ”pipe” and change the number of cells: 10, 20, 40 and 100. (for each block and direction)
• Run these cases (blockMesh + icoFoam)
• (*) Compare the velocity components and pressure at the sample line going trough the bend of the pipe
• (*) Deduce the coarsest independent grid.
• (*) Plot for this case the convergence history.
– IcoFoam > terminal
– Pick ca. 15 values for Ux Initial residual
– Plot (eg. Excel) log(residual) vs. log(timestep)
Lund University / Division of Fluid Mechanics / 25.3.2011
icoFoam
• Solver application
• Solves the incompressible Navier-Stokes equations
Lund University / Division of Fluid Mechanics / 25.3.2011
icoFoam
• Uses PISO (pressure-implicit splitting operator) algorithm to solve these equations iteratively :
1. Guess p, flux (from previous time step)
2. Velocity predictor : solve momentum equations to get Ux, Uy, Uz
3. Solve pressure equation
4. Correct flux to satisfy continuity
5. go back to 2. until convergence is reached
Lund University / Division of Fluid Mechanics / 25.3.2011
icoFoam
• How is it done in OpenFOAM?
• Let's have a look at the source code (only Linux version) :
icoFoam.C
Lund University / Division of Fluid Mechanics / 25.3.2011
icoFoam
• The time loop starts
• The fvSolution PISO dictionary is read
• The CFL number is evaluated and printed to the screen
• The momentum equations are defined
• The velocity predictor is solved for the PISO loop
Lund University / Division of Fluid Mechanics / 25.3.2011
icoFoam
• Piso loop:
- The pressure equation is defined
- and solved
- Correct the flux
• Print out the continuity error on the screen
• Evaluate the velocity field
Lund University / Division of Fluid Mechanics / 25.3.2011
icoFoam
• Print out the execution time on the screen
Lund University / Division of Fluid Mechanics / 25.3.2011
system/fvScheme
Lund University / Division of Fluid Mechanics / 25.3.2011
system/fvScheme
• Create a new case from the ”pipe” case.
• Change the schemes to higher order
time terms: second order bounded implicit
gradient terms: fourth order
divergence terms: fourth orderrest: as in original pipe case
• Reference : Numerical schemes in Chapter 4.4 in the User Guide. (...typo...)
Lund University / Division of Fluid Mechanics / 25.3.2011
system/fvScheme
• Create a new case from the ”pipe” case.
• Change the schemes to lower order
divergence terms: first order
laplacian terms: first orderrest: as in original pipe case
• (*) Compare the execution time for each case. ( icoFoam > terminal )
• (*) Compare the results.
Lund University / Division of Fluid Mechanics / 25.3.2011
system/fvSolution
• Linear-solver to solve the system of discretized equations
• Solver stops at current residual
• Solver stops at ratio of current to initial residual
• Controlling PISO algorithm
Lund University / Division of Fluid Mechanics / 25.3.2011
system/fvSolution
• Create 2 new cases from the ”pipe” case :
– Put tolerance values to 1e-3
– Put tolerance values to 1e-9
• (*) Discuss the sensitivity of the results:
- probe point (4.5 3 0.05), how can the difference be explained ?
- number of iterations per time step
Lund University / Division of Fluid Mechanics / 25.3.2011
system/controlDict
• Create one new case from the ”pipe” case
• Change the inlet velocity to 20 m/s
and the viscosity to 0.001 m^2/s
• (*) If your case diverges... which parameter would you change to obtain convergence?
• Simulate 1 s and look how the velocity field evolves.
Lund University / Division of Fluid Mechanics / 25.3.2011
system/controlDict
• Initial time
• Final time
• Time step
CFL = u dt / dx
• How often the results are printed into the time directory.