# CFD Tutorial 5 – Boundary Layer Mesh

Hi, welcome to the QuickerSim CFD

Toolbox for MATLAB tutorial number five. This tutorial is devoted to boundary

layer meshing. That’s a special function that’s available in the full version of

our QuickerSim CFD Toolbox. Boundary layers are very important in

fluid dynamics as many key flow features happen over there for instance the drag

generated on surfaces that’s obtained in the fluid simulations strongly depends

on the exact resolution of the flow in the vicinity of the wall. In principle

you should be generating computational mesh that already contains boundary layers in the mesh generator that you use, but if you want just to generate a

simple mesh you can still use some built-in functions that are in our

toolbox. So, we will discuss two cases the first case is the one that you already

know, the circular cylinder let’s just have a look at that and obviously

the flow would pass around the cylinder and what we want to do we’ll want to

generate the boundary layer here at the solid walls. So, what we do is we use a

special structure that called layer and we have to define a few parameters of

this structure. That’s the height of the first element, the growth factor that is

the ratio of consecutive elements like in geometric series and the number of

layers that we want to extrude. After that we just have to define which wall

ID’s should be extruded. Extrude the layers

notice that we have to create at this moment a new version of variables p,e,t as

our mesh gets modified and you have a look at the brand new mesh. Let’s give it

a try and now you can see the difference as there is the zone of boundary layers

created. Since our tool uses only triangular

mesh the boundary layer consists of triangles so this is actually the first

layer, this is the second layer and this is the third layer anyway this is the

process of the boundary layer creation for the cylindrical case. The second case

refers to the urban mesh that will be actually used in the tutorial number

nine let’s just have a look at how it looks about the boundary laye,r so, those

are basically two square obstacles along the flow from left to the right and

since we will be simulating complex turbulent flow we will have to have

really good resolution at the solid walls on the bottom. We will also show

you some extra features as the laplace smoothing of the boundary layer mesh. Okay,

so, definitely we have to define the boundary layers from zones 18 to 23 so

that’s what’s being done in wall IDs. We prescribe new layer of height 0.02 again

the same gowth ratio and again three layers. So, just let’s have a look at the

basic mesh once again there it goes and let’s play with the boundary layer

extrusion. There it goes. Yeah, the one thing that

looks a little bit not according to the best practice is the fact that these

boundary layers gets squeezed when we get closer to the corners this can be

fixed to some extent when we use extra parameters for our function extrude layers

2D, you can always refer to the tutorial to check if any more complex

function contains some extra options. There are also two additional options

available that’s called smooth steps and smooth alpha, basically that means that

we apply extra smoothing for our mesh and smooth alpha is the factor and

smooth step is the number of smooting iterations that are being performed. By

default when the mesh is generated we use ten smoothing steps and smooth alpha

is equal to 0.9 so let’s check out how it looks after different factors are

used. So, we decrease the number of smooth steps to 0.3 and smoothing to 0.8. Let’s

redo things to make sure that member is not corrupted and that’s still what we

get in the vicinity of corners yeah, so, actually that’s even worse because we

use 10 by default and now it’s dropped down to 3, but maybe you can still fix

something. So, yeah let’s use 50 smoothing steps and

yet the same alpha let’s have a look. Okay, so, yeah now it seems to be much

better. This collapse of the boundary layer in the corner is not that strong

anymore. Yeah, here it looks really nice. Obviously

it collapses a little bit it’s pretty simplified function at this moment, but

yeah that’s the tool that you should definitely be using to improving your

boundary layers. You could also actually use that for improving your mesh in

general. Okay, so, this is the thing that we wanted to show in this tutorial. We hope

that you find it useful. Boundary layer generation is really necessary in many

kinds of flows and if you like that please subscribe drop us a comment and

check out other tutorials of QuickerSim CFD Toolbox for MATLAB.

See you next time.