[CFD] What are Wall Functions and How do they work?
Estimated read time: 1:20
Learn to use AI like a Pro
Get the latest AI workflows to boost your productivity and business performance, delivered weekly by expert consultants. Enjoy step-by-step guides, weekly Q&A sessions, and full access to our AI workflow archive.
Summary
In a comprehensive video, Aiden from Fluid Mechanics 101 breaks down the concept of wall functions in Computational Fluid Dynamics (CFD) codes. The video begins with an introduction to wall functions, which are statistical models used to simulate the behavior of fluids close to walls without the need for an excessive number of finite volume cells. Aiden explains the challenges CFD codes face, such as poor cell quality and increased solution time due to the necessity of resolving steep gradients near walls. He explores empirical wall functions, their use in different flow regions, and the issues in modeling behavior in the buffer region between areas of linear and logarithmic flow profiles. Lastly, Aiden provides practical advice on selecting appropriate y+ values in simulations and emphasizes verifying models with experimental or numerical data to ensure accuracy.
Highlights
Wall functions allow larger cells by replacing thin cells, reducing cell count and improving simulation stability. 💡
Three regions of y+ in flows are the viscous sublayer, buffer layer, and log-law region, each with specific modeling needs. 🌪️
Empirical coefficients and equations (like the Spalding function) help fit wall functions to observed data. 📏
Adjustment of the wall viscosity in models helps maintain accuracy across different flow regions. ⚙️
Using y+ values less than 5 is preferred in viscous sublayer for better simulation accuracy. 🎯
Key Takeaways
Wall functions simplify CFD simulations by reducing the need for complex meshing close to walls. 🚀
Using wall functions helps decrease computational time and enhance simulation stability. ⏳
The challenge lies in accurately modeling flow behavior in the buffer region (y+ between 5 and 30). 🌊
CFD solvers often use 'automatic' wall treatments to adaptively apply wall functions based on local y+ values. 🔧
It's crucial to verify CFD results against experimental data, especially in complex flow scenarios. 🔍
Overview
Wall functions in CFD are crucial for effectively simulating flow near solid boundaries without excessive computational demands. These functions replace the need for numerous thin cells near walls, leveraging empirical data to model expected behavior. By using these statistical models, simulations can maintain accuracy while greatly reducing the computational load.
An interesting aspect of wall functions is their division into three flow regions: the viscous sublayer, the log-law region, and the buffer region which is tricky to model accurately. This categorization helps in applying the right equations and coefficients to predict flow behavior correctly, ensuring that simulations are both efficient and reliable.
One of the main benefits of using wall functions is the reduction in computational complexity and time. However, Aiden stresses the importance of validating CFD results with experimental or numerical data, particularly when dealing with complex flows involving separation and curvature. This ensures the models are providing accurate representations of the studied phenomena.
Chapters
00:00 - 00:30: Introduction to Wall Functions The chapter introduces wall functions, explaining their importance in computational fluid dynamics (CFD) codes. Aiden outlines the topics to be covered, including the background of wall functions, the need for them in CFD, and an introduction to automatic wall functions and wall treatment. The chapter promises to delve deeper into the mechanics of how CFD codes utilize these functions.
00:30 - 01:00: Background on Velocity Profiles The chapter discusses the optimal values of 'y plus' that should be used in CFD (Computational Fluid Dynamics) simulations to achieve accurate results. It begins with a background on velocity, temperature, and turbulent scalar profiles within a fluid domain—highlighting how these profiles approach zero at the wall and feature steep gradients as they near the wall.
01:00 - 01:30: Capturing Steep Gradients in CFD In this chapter titled 'Capturing Steep Gradients in CFD', the focus is on understanding and capturing steep velocity gradients in Computational Fluid Dynamics (CFD). It begins with an explanation of a typical velocity profile that is zero at the wall (due to the no-slip condition) and freestream far away from it. As one approaches the wall, the gradients become steeper. The chapter emphasizes the challenges posed by these steep gradients in CFD, especially when using a second-order finite volume CFD code where variations across cells are assumed to be linear. The discussion highlights the necessity of accurately capturing these gradients for effective CFD simulations.
01:30 - 02:00: Motivation for Using Wall Functions The chapter discusses the motivation for using wall functions in computational fluid dynamics (CFD). It highlights the need for a large number of cells that get progressively thinner as they approach the wall, in order to accurately resolve gradients. An example is given with a 2D aerofoil plot, showing how the cell size decreases in the direction perpendicular to the wall.
03:00 - 04:00: Empirical Wall Functions The chapter 'Empirical Wall Functions' discusses the importance of resolution in the wall normal direction, which is significantly greater than in the chordwise and spanwise directions. It highlights that cells in the wall normal direction are very thin and have a high aspect ratio. The chapter explains the potential issues with skewed cells, such as poor cell quality, which can negatively impact CFD solvers by causing instabilities or even divergence. Additionally, it points out the large number of cells required in this context.
04:00 - 05:00: Mathematical Form of Wall Functions In this chapter, the concept of resolving gradients near walls in CFD using a second-order finite volume approach is discussed. The chapter explores the traditional method of using many thin cells close to the wall to capture gradients. It then proposes an alternative approach where these multiple thin cells are replaced with a single large cell to simplify the process.
05:00 - 06:00: Understanding Y+ and U+ The chapter titled 'Understanding Y+ and U+' discusses an alternative approach to modeling the variation between a cell centroid and the wall in Computational Fluid Dynamics (CFD). Instead of using a linear variation, the chapter explores the use of a nonlinear function, which can lead to the utilization of larger cells, a reduction in the total cell count, and an improvement in the stability of the CFD solution. The motivation for using a nonlinear function is highlighted, and a plot is shown to represent the desired nonlinear function for modeling.
06:00 - 07:00: Modeling the Buffer Region This chapter discusses modeling the buffer region in computational fluid dynamics (CFD) simulations, focusing on a velocity profile that plots tangential velocity against the distance normal to the wall. The plot is derived from both experimental measurements and direct numerical simulations of flow in a plane parallel channel, which is depicted in an accompanying sketch. It highlights the importance of accurately modeling this profile in CFD simulations.
07:00 - 08:00: Spalding Wall Function Wall functions are empirical models used in simulations to approximate the behavior close to walls. They are critical in modeling the tangential velocity as a function of normal distance from the wall. The use of wall functions allows for the implementation of larger cell sizes in simulations without losing accuracy close to the wall. This is illustrated in the plot where the tangential velocity is plotted against the normal distance, showing the observed behavior closely matched by the wall function.
08:00 - 09:00: Automatic Wall Treatment in CFD Codes The chapter discusses the use of wall treatment in CFD (Computational Fluid Dynamics) codes. It focuses on the challenges in capturing the velocity profile near walls and highlights the use of empirical functions to model this behavior. The velocity profile is divided into three distinct regions, which is a standard method for modeling observed behaviors. Specifically, it addresses the region close to the wall for very low y-plus values (less than five).
09:00 - 10:00: Calculating Wall Shear Stress The chapter titled "Calculating Wall Shear Stress" discusses profiles fitting observed data, highlighting that the blue profile aligns well in certain regions. It also notes the green line's good agreement in areas with y plus values greater than 30. The chapter emphasizes the linearity of the green line and reminds the reader that in the typical plots shown, the x-axis is on a logarithmic scale while the y-axis is on a standard scale.
10:00 - 12:00: Recommendations for Y+ Values The chapter discusses recommendations for Y+ values in fluid dynamics and heat transfer simulations. It highlights that within the log law region, empirical functions fitting the data exhibit a logarithmic profile, whereas variations close to the wall in the viscous sublayer appear linear. However, in the buffer layer situated between these two regions, there is poor agreement between theoretical models (represented by the blue and green curves) and observed data, suggesting that current wall function models may not accurately capture the behavior in this zone.
12:00 - 13:00: Validation with 2D Simulations The chapter titled 'Validation with 2D Simulations' discusses the behavior of certain functions and their mathematical forms, particularly focusing on how they might be integrated into CFD (Computational Fluid Dynamics) code. The discussion involves understanding the blue line observed in the viscous sublayer, described by the equation y plus equals u plus. It explains that the velocity variation between the wall and the centroid is linear, although the plots use a logarithmic scale.
13:00 - 14:00: Conclusion and References In the 'Conclusion and References' chapter, the discussion centers around a logarithmic variation involving a set of empirical coefficients, specifically Kappa, E, and others, which are used to fit a logarithmic profile to observed data. The values of these coefficients are 0.4, 87, and 9.793. The findings include data fits for specific ranges of 'y plus', notably less than five and above, though only two-fifths of the data is mentioned in the current context.
[CFD] What are Wall Functions and How do they work? Transcription
00:00 - 00:30 hi everyone this is Aiden for fluid mechanics 101 and today I'm going to be talking about wolf functions and how do they work it's just to give an overview of what I'm going to talk about I'm going to talk about the background for what wolf functions are why they're needed in CFD codes and then going to touch briefly on what our automatic wolf functions and what is automatic wall treatment and then we're going to dive in behind the scenes a little bit to look at what CFD codes actually do and
00:30 - 01:00 then to wrap up and finish up which is going to look at what values of why plush should you be using in your CFD simulations to get the best results so just to start with some background if we look at profiles of velocity temperature or turbulent scalars in a fluid domain we see a profile that approaches zero of the wall and has some quite steep gradients as we approach the wall so if
01:00 - 01:30 we look at the plus on the Left that's just a typical velocity profile that you might see and the velocity is freestream far away from the wall zero at the wall from the no slip condition and as we approach the wall we see that the gradients gets steeper and steeper as we approach the wall and in a CFD code a second-order finite volume CFD code the variation across the cells is linear and as a result if we want to capture those steep gradients close to
01:30 - 02:00 the wall then we have to use a large number of cells and the cells get thinner and thinner as we approach the wall if we want to accurately resolve those gradients so a typical match that you might see for a CFD solution shown in the picture this is just a 2d aerofoil plot and we can see that in the direction normal to the wall the cells get very very thin as we approach the
02:00 - 02:30 wall and that resolution in the wall normal Direction is much greater than the chord wise and span wise direction and what we see is that those cells in the wall normal Direction are very thin have a high aspect ratio and if there's any skewness in those cells then this can lead to poor cell quality and this is bad for our CFD solver because poor cell quality can lead to instabilities and perhaps even divergence and the large number of cells that are needed to
02:30 - 03:00 resolve those gradients increase the solution time so currently with the second-order finite volume CFD the way we resolve those gradients close to the wall is a piecewise linear approach and we have to have lots and lots of thin thin cells to capture those gradients in order to the wall but what if we could replace all of those thin cells with a single large cell instead and the way we
03:00 - 03:30 would do that is by instead of having a linear variation between that cell centroid the red dot and the wall we have a nonlinear function instead that would allow us to use much larger cells reduce the total cell count and also improve the stability of our CFD solution so that's really the motivation but what is this nonlinear function and what would it look like so the plot I've shown you there is actually the nonlinear function that we want to model
03:30 - 04:00 and this function is a plot of velocity tangential velocity and distance normal to the wall Y and this plot was generated from experimental measurements and direct numerical simulations of flow in a plane parallel channel as you can see from the little sketch and so in our CFD simulations we really want to try and model that profile between the cell
04:00 - 04:30 centroid and the wall so then we can have our large cells which is this a total cell Cal so how do we do it now wall functions are the empirical functions that we fit to that observed behavior close to the wall and in the plot again we've got tangential velocity plotted against all normal distance and the black solid line again shows that but that observed behavior close to the wall and this is
04:30 - 05:00 what we want the velocity profile to look like and what we've got there are blue and green lines which show the empirical functions that we can fit to this observed behavior and these are the wall functions now we can see that actually we've the profile is split into three regions and this is the standard approach for modeling that observed behavior close to the wall and for y plus values of left at less than five the left hand region of the graph we can
05:00 - 05:30 see that that blue profile gives a very good fit to the observed data and in the region on the right for y plus values aggress than 30 we can see that that green line gives a very good agreement and that green line is linear and it should always be remembered with these plots as they're typically shown the x-axis is on a log scale whereas the vertical axis the y-axis is shown on a
05:30 - 06:00 linear scale so actually that data fit that empirical function in the log law region is actually a logarithmic profile whereas in the viscous sub layer in that section on the left the variation close to the wall is actually linear now in the buffer layer in between these two regions we can see that the blue curve the blue wall function and the green curve neither of them actually give a good agreement with the observed
06:00 - 06:30 behavior and we're going to talk a little bit about those later and what we might do so what is the mathematical form of these functions and how light might we include them in the CFD code so that blue line that we saw in the viscous sub layer is given by the function equation 1 y plus is equal to u plus so the variation of velocity between the wall and the centroid is actually linear remembering that the scale on those plots is logarithmic on
06:30 - 07:00 the x-axis and then that green line so for y plus greater than 30 we a logarithmic variation of U Plus with y plus and those coefficients Kappa and E are empirical coefficients that we use to fit the logarithmic profile to the observed data and they're 0.4 and 87 and nine point seven 93 respectively so we've got two fifths of the data we've got a fit for y plus less than five and we've also got fit for y plus
07:00 - 07:30 greater than thirty and at this point it's worth stopping and actually just taking a minute to think about what y plus and u plus actually are than what they represent so y plus a nu plus our dimensionless units off sometimes called wall units in the literature you may see them called wall units and y plus is the distance normal to the wall and u plus
07:30 - 08:00 is still the tangential velocity but these are dimensionless quantities and the reason we want to plot with dimensionless quality quantities is so that that behavior observed the normal to the wall is universal and it's valid for a range of flows with a range of geometries and flow speeds and the quantity that we use to dimensionalize those those properties is a velocity called the friction velocity or u sub
08:00 - 08:30 tau and this is a reference velocity based on the wall shear stress or the square root of the wall shear stress and the reason we choose the square root of the wall shear stress to represent our reference velocity is because at the wall the velocity of the wall is zero so actually we need to choose a better reference velocity because the free stream velocity far away is not really
08:30 - 09:00 going to be effective here so we use the square root of the wall shear stress to dimensionalize our coefficients and it's important at this point to also point out that you could use another reference velocity and some CFD codes use the square root of the turbulent kinetic energy and we're not going to go into this in too much detail now but it's something we could bring up later so what about that buffer region in the middle between Y plus a 5 and y plus of
09:00 - 09:30 30 now at the moment we saw that those blue and green curves don't actually give a good fit to that observed behavior in that region so how are we going to model the buffer region the most obvious approach we could use is notice that the blue curve and the green curve intersect at a y plus of 11.25 and so then the most straightforward approach would be to use a conditional wave statement and say that u plus is
09:30 - 10:00 equal to y plus C if it's if y plus is less than 0.25 or it's equal to the logarithmic variation if it's greater than the urban point two-five now this is the most straightforward approach to the buffer region but it will give large errors because we've seen that both the blue curve and the green curve don't closely match that observed behavior in the buffer region and it's this reason that CFD codes and CFD manuals often recommend not placing
10:00 - 10:30 cells in the buffer region between a Y plus of 5 and y plus of 30 and this often leads to war resolved meshes with y plus a less than 5 and wolf's function meshes with y plus greater than 30 because that behavior in the buffer region is really uncertain and hence can be quite inaccurate so what's an alternative approach we can take well an alternative would be to fit a single smooth continuous function through that
10:30 - 11:00 entire range of data and one example of a function we could use to use that is the Spalding wall function which is given in equation 6 this function is smooth continuous and valid for the entire range of Y plus so what does the Spalding wolf function look like here you can see we've got the same plot as before with the observed data and the linear and log law wolf functions but now we've got the Spaulding wolf function in purple as
11:00 - 11:30 well and we can see that the Spaulding wolf function actually is a very good fit in the viscous sub layer and does a pretty good job in the buffer layer of capturing the observed behavior and then over predicts slightly in the log law region so the Spaulding wolf function is one approach we could take however most CFD codes actually tend to use a proprietary blending between the linear law global functions in that buffer layer so it's still quite uncertain
11:30 - 12:00 what's actually going on there and how accurate that treatment is in the buffer layer so one thing we often find in CFD manuals is that the wall treatment is often called automatic and what this means is that the CFD code will switch between that linear variation and that logarithmic variation depending on the local value of y plus and this is without the user having to explicitly
12:00 - 12:30 specify what region y plus is going to be in ahead of time remembering of course that when you create the mesh initially you don't know what the value of y plus is and actually y plus varies and changes as the simulation converges so the CFD code on the fly will switch between the appropriate wall treatments without any user input and this is often why wall treatment is called water Matic or blended we don't have to specify ahead of time what we're going to do and
12:30 - 13:00 the user can simply specify a boundary as a wall and the CFD code will do than it would do the rest so now we've had a bit of background now we're actually going to dive into what the CFD codes actually do behind the scenes and this does take a little bit of thinking about in the diagram on the left you can see we've got a typical cell with the height of the centroid is YP normal to the wall now what we need to think about is that the
13:00 - 13:30 at the wall is zero the no slip condition and we actually know the velocity at the cell centroid as well which we're going to call u P here so we know the velocity at the wall and we know the velocity in the cell centroid so actually what we need to know is we need to know the gradient and the wall shear stress normal to the wall and if the cell is very close to the wall in the viscous sub layer we know that that variation is linear and so actually it's
13:30 - 14:00 very straightforward to calculate the wall shear stress and we can do that using equation seven now what if the variation between the cell centroid and the one is nonlinear so what if our cell is actually in the lord'll or region again we can evaluate the expression for the wall shear stress by substituting in that logarithmic profile and we get an equation for the wall shear stress we can work out the gradient normal to the wall from this so this is where we
14:00 - 14:30 actually have to do a bit of thinking and if we remember that we know the velocity at the wall we also know the velocity at the cell centroid from the cfd solver and we're trying to work out the gradient now in a second-order finite volume approach we want to use the same method to calculate the gradient across the entire mesh and using second-order so the variation is linear across the cells now if we assume
14:30 - 15:00 the variation between centroid on the wall is linear and we're in the Loblaw region the wall shear stress will be predicted incorrectly so what we want to do is correct to make sure that the wall shear stress is computed correctly and the way we do that is we equate those expressions for the linear profile and the logarithmic profile for the wall shear stress as we can see in equation nine and rearrange and we get an expression for the wall viscosity now
15:00 - 15:30 what this is is the viscosity that if we used even though the gradient is actually nonlinear and if we use that and a linear expression we would get the same wall stress so I think we need to take a step back again and think about what we're doing here is that if our cell is in the Loblaw region we can use this wall viscosity we can modify the wall viscosity and then the wall shear stress we predict assume that the gradient is
15:30 - 16:00 linear will be the same as if it wasn't and then we can use the same method of calculating the gradient across the entire mesh and get the correct solution so this is often wine some CFD codes you may see the wall viscosity it's a way of correcting to ensure that we get the same wall shear stress and the same gradients now for convenience if you actually dig into the CFD code what we
16:00 - 16:30 find is that CFD codes often express the wall viscosity as a as the summation of a laminar and a turbulent component and of course if your wall adjacent cell is in the viscous sub layer the wall viscosity will be entirely laminar and that turbulent component is zero but then if we're in the log law region the more viscosity will be increased and hence we can just use a simple conditional if statement to calculate our wall viscosity so this allows our
16:30 - 17:00 CFD code to use the same calculation of the gradient across the domain we know what the velocity is that wall adjacent self centroid and all we have to do is a conditional if statement to switch between the calculation of the wall viscosity to ensure that we get the correct wall shear stress so now just wrapping up with some recommendations for what value of y plus should I actually be aiming for in my CFD simulations and the first point is
17:00 - 17:30 trying to always avoid placing cells in that buffer region because we don't really know the accuracy of the wall treatment when the cells in the buffer region and so actually if we have ourselves there the solution is quite likely to be inaccurate now one thing we should also remember and think about here is that that universal profile the experimental measurements and the DNS data were extracted from a plain
17:30 - 18:00 parallel flow where there were no was no separation no curvature and no strong pressure gradients so if we're in a flow scenario where separation curvature and strong pressure gradients are present say unsteady flow behind a cylinder for example then that universal profile is no longer likely to be accurate and valid and so if we use this wall treatment approach then the flow
18:00 - 18:30 solution that we predict is highly likely to be incorrect and wrong so really what we have to do is have a think about the flow physics that we're actually trying to represent when we're choosing ry+ values and ideally if we can we always want to try and get our y plus less than 5 so that we're in the viscous sub layer now at this point it's worth noting that for some external aerodynamic simulations where separation
18:30 - 19:00 and curvature effects are very strong the conventional wisdom is to have a y plus approximately equal to 1 now this may appear a bit counterintuitive at first because we saw that actually the viscous sub layer extends from a Y plus of 0 to y plus of 5 but we should remember that actually the shape of that universal profile and the onset of the buffer region don't necessarily occur at y plus equal to 5 when we have strong curvature of separation and pressure
19:00 - 19:30 gradient effects and so actually conventional wisdom through the industry has shown that actually producing the y+ down to one is sufficient to achieve an accurate solution because when the y+ is one then the flow variation between the wall and the wall adjacent centroid is linear even under separation culture and pressure gradient effects but that may not be very useful one piece of advice
19:30 - 20:00 which is always very good is if possible to run a 2d check or to compare your results again experimental measurements to actually see how well is my wall modeling approach actually capturing the flow physics and just give you a quick example of that what we've got here is an example of a 2d aerofoil so this can represent a slice through your 3d wing or 3d wind turbine or compressor blade and you can use the 2d simulation to
20:00 - 20:30 actually investigate the accuracy of the wolf' function and the wall resolved approaches because we can use a much finer mesh and what we see for this to the aerofoil is actually four angles of attack less than eight degrees the solid line which is the more resolved approach and the dashed line which is the Wolfe functional approach actually give you a very good agreement so for this aerofoil as long as the flow is attached and at low angles of attack actually the wall function would be very reasonable for our wind turbine blade or our wing but
20:30 - 21:00 as soon as the flow starts to separate an angle of attack of 10 or 12 then actually we have to go with the wall resolved approach and try and drive that white glass down to one so just to wrap up with some useful references always worth looking at the answers fluent user manual as much excellent help and advice view if you're actually running your CFD simulation and I've also included the reference here for the original direct numerical simulation data that we use to
21:00 - 21:30 derive and fit these wall functions to and also a technical report from Charles University which really goes into a lot more depth that I have here about the wall functions for velocity and also for temperature and other turbulence quantities which I haven't covered of course I'll include all references in the description down below and if you have any comments suggestions or even noticed any errors feel free to drop a message or leave a comment