CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM

Wall functions - questions about implementation

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree4Likes

Reply
 
LinkBack Thread Tools Display Modes
Old   September 20, 2013, 08:22
Default
  #21
Senior Member
 
romant's Avatar
 
Roman Thiele
Join Date: Aug 2009
Location: Stockholm, Sweden
Posts: 359
Rep Power: 11
romant is on a distinguished road
Quote:
Originally Posted by RodriguezFatz View Post
So what you are saying is that omega and epsilon wall functions have to change the cell value itself, so thay need to be explitcitly called and "overwrite" the calculated cell value. Whereas the k boundary condition defines the value at the cell's boundary and thus just changes theboundary condition of the wall cell but not the value in the first cell. Thus, k boundary condition changes something that is more hidden in the solving routine.
Is that correct?
Yes, most of the wall functions in OpenFOAM, with the exception of the kqRWallFunction, manipulate either the first cell value, or the wall value (in the case of the mut or nut wall functions) and this needs to be explicitly calculated and performed for every cell or cell face.

For more information on wall functions and how they are used you can also take a look at Pope, Turbulent Flows, 2000, pp 442-443 and Versteeg and Malalasekera, An introduction to computational fluid dynamics: The finite volume method, pp. 276-277
__________________
~roman

Last edited by romant; September 20, 2013 at 08:24. Reason: books added
romant is offline   Reply With Quote

Old   April 5, 2014, 04:40
Default su and sp treatment when epsilon gets redined in the first cell
  #22
Member
 
Manan
Join Date: Oct 2013
Location: Göteborg
Posts: 37
Rep Power: 3
MaLa is on a distinguished road
Hello

I have a question related to what is being discussed in this thread.
Say for example, I wish to set epsilon in the first cell as a function of k in the first cell. Is simply calling the appropriate wall function sufficient to implement that?

From what I understand,

Quote:

epsilon_.boundaryField().updateCoeffs()
^calls the relevant epsilon wall function.

Subsequent to this, the solving happens. But what I wonder is, shouldn't the sp and the su terms for the first cell also be modified so that the solver does not overwrite the newly calculated first cell values for epsilon?

For example, if we consider a 1D discretised equation:

ap*eps_p=ae*eps_e+aw*eps_w+su (1)
ap=ae+aw-sp

Now if I set sp and su such as:

su (@first_cell_next_to_wall)=1e10*epsilon_new
sp (@first_cell_next_to_wall)=-1e10

(where epsilon_new is the new value calculated as a function of k)

then,
sp>>aw, sp>>ae. su>>ae, su>>aw. Hence eq. 1 gives

-sp*eps_p=su => eps_p=su/-sp=1e10*epsilon_new/1e10=epsilon_new
Shouldn't such a treatment as above also be there?

Please let me know if I haven't made myself clear. Thanks.
MaLa is offline   Reply With Quote

Old   April 5, 2014, 10:08
Default
  #23
Senior Member
 
Join Date: Jan 2013
Posts: 196
Rep Power: 4
openfoammaofnepo is on a distinguished road
Hi All,

I have a question about the wall functions implemented in Openfoam. Theoretically, when wall function is used, the velocity at the wall is not zero and instead the velocity there is the friction velocity which is solved from the log-law or linear law. (If the zero velocity is emposed there, then it is equivalent to the non-slip boundary condition.) Then the wall shear stress is obtained tau_w=rho*u_tau**2. Then this wall shear stress can be used for the discretization of the momentum equations in the finite volume appraoch. However, in openfoam's specifications, when wall function is applied, the velocity at the wall is still (0 0 0).

Why can we still use (0 0 0) for the wall velocity here?

Thank you in advance.

OFFO
openfoammaofnepo is offline   Reply With Quote

Old   April 5, 2014, 17:28
Default
  #24
Senior Member
 
romant's Avatar
 
Roman Thiele
Join Date: Aug 2009
Location: Stockholm, Sweden
Posts: 359
Rep Power: 11
romant is on a distinguished road
Quote:
Originally Posted by openfoammaofnepo View Post
Hi All,

I have a question about the wall functions implemented in Openfoam. Theoretically, when wall function is used, the velocity at the wall is not zero and instead the velocity there is the friction velocity which is solved from the log-law or linear law. (If the zero velocity is emposed there, then it is equivalent to the non-slip boundary condition.) Then the wall shear stress is obtained tau_w=rho*u_tau**2. Then this wall shear stress can be used for the discretization of the momentum equations in the finite volume appraoch. However, in openfoam's specifications, when wall function is applied, the velocity at the wall is still (0 0 0).

Why can we still use (0 0 0) for the wall velocity here?

Thank you in advance.

OFFO
You can use 0 for the velocity, because the shear velocity is not a velocity in this sense. It is calculated as
u_{\tau}=\sqrt{\frac{\tau_w}{\rho}}
where \tau_w is the the wall shear stress calculated from
\tau_w = \mu\partial u / \partial y |_{y=0}
As you can see from that it is not the velocity at the wall, but the velocity gradient at the wall that plays a role.
kiddmax likes this.
__________________
~roman
romant is offline   Reply With Quote

Old   April 5, 2014, 17:48
Default
  #25
Senior Member
 
romant's Avatar
 
Roman Thiele
Join Date: Aug 2009
Location: Stockholm, Sweden
Posts: 359
Rep Power: 11
romant is on a distinguished road
Quote:
Originally Posted by MaLa View Post
Hello

I have a question related to what is being discussed in this thread.
Say for example, I wish to set epsilon in the first cell as a function of k in the first cell. Is simply calling the appropriate wall function sufficient to implement that?

From what I understand,

^calls the relevant epsilon wall function.

Subsequent to this, the solving happens. But what I wonder is, shouldn't the sp and the su terms for the first cell also be modified so that the solver does not overwrite the newly calculated first cell values for epsilon?

For example, if we consider a 1D discretised equation:

ap*eps_p=ae*eps_e+aw*eps_w+su (1)
ap=ae+aw-sp

Now if I set sp and su such as:

su (@first_cell_next_to_wall)=1e10*epsilon_new
sp (@first_cell_next_to_wall)=-1e10

(where epsilon_new is the new value calculated as a function of k)

then,
sp>>aw, sp>>ae. su>>ae, su>>aw. Hence eq. 1 gives

-sp*eps_p=su => eps_p=su/-sp=1e10*epsilon_new/1e10=epsilon_new
Shouldn't such a treatment as above also be there?

Please let me know if I haven't made myself clear. Thanks.

I think when you look into the code you can see that you don't need the newly calculated epsilon in the first cell anymore, after you have solved the system. http://foam.sourceforge.net/docs/cpp/a10359_source.html

The only part where you need to use epsilon again is in line 329 and following to calculate mut, however, in the case of wall functions, mut will be set in the first cell anyway and therefore it doesn't matter if your epsilon is wrong or not. So epsilon in the first cell only needs to be correct before we solve epsilon, not after.
__________________
~roman
romant is offline   Reply With Quote

Old   April 5, 2014, 18:27
Default
  #26
Senior Member
 
Join Date: Jan 2013
Posts: 196
Rep Power: 4
openfoammaofnepo is on a distinguished road
Dear Roman,

Thank you for your reply. In the practical CFD implementations, if we use cell centered finite volume method as is done in the OF, the velocity gradient is needed to calculate the numerical flux for the diffusion term in the momentum equations. Is this understanding correct?

Is the following line of reasoning correct:
1, use the log law or linear linear law to get the friction velocity
2, use the equation you mentioned to predict the wall shear stress, which can be used for the momentum equation discretizations.

Is the above understanding correct? Thank you. I am working on the wall function implementations and thus would like to have these knowledge for my work. Thanks.

OFFO
openfoammaofnepo is offline   Reply With Quote

Old   April 7, 2014, 03:06
Default
  #27
Senior Member
 
romant's Avatar
 
Roman Thiele
Join Date: Aug 2009
Location: Stockholm, Sweden
Posts: 359
Rep Power: 11
romant is on a distinguished road
Quote:
Originally Posted by openfoammaofnepo View Post
Dear Roman,

Thank you for your reply. In the practical CFD implementations, if we use cell centered finite volume method as is done in the OF, the velocity gradient is needed to calculate the numerical flux for the diffusion term in the momentum equations. Is this understanding correct?

Is the following line of reasoning correct:
1, use the log law or linear linear law to get the friction velocity
2, use the equation you mentioned to predict the wall shear stress, which can be used for the momentum equation discretizations.

Is the above understanding correct? Thank you. I am working on the wall function implementations and thus would like to have these knowledge for my work. Thanks.

OFFO
I think your first assumption is correct.

For the other parts:
1. you use the log law or the linear law to find the velocity in the first point away from the wall away from the grid, not he friction velocity. This velocity can then be used to calculate the wall shear stress as you know the velocity at the wall (either no slip, partial slip or whatever you define).

I describe here implementing a new wall function how the nut wall function works, which is the wall function for the velocity. Since setting the velocity in the first point is a bad choice (it will be overwritten), setting a source on the wall strong enough to make the velocity in the first grid point exactly what you need it much better.

Take a look at the references given in the mentioned post and also in this thread. These are:
  • Pope, Turbulent Flows, 2000, pp 442-443
  • Versteeg and Malalasekera, An introduction to computational fluid dynamics: The finite volume method, pp. 276-277
They are very helpful when it comes to understanding wall function implementations and how wall functions work.
Bernhard likes this.
__________________
~roman
romant is offline   Reply With Quote

Old   April 7, 2014, 03:19
Default
  #28
Senior Member
 
RodriguezFatz's Avatar
 
Philipp
Join Date: Jun 2011
Location: Germany
Posts: 1,097
Rep Power: 16
RodriguezFatz will become famous soon enough
Manan, I thought about the same thing. As far as I understand it, this is done with the "boundaryManipulate" function, called before solving.
I found it in "src/finiteVolume/lnInclude/fvMatrix.C". It calls a "manipulateMatrix"-function for all the boundary patches. This function can be found in the wall function file. Here I am lost, because I don't know which of the functions (from which .C file) "setValues(...)" and "manipulateMatrix" is called. But this pretty much looks like the right spot!
Cheers,
Philipp.
__________________
The skeleton ran out of shampoo in the shower.
RodriguezFatz is offline   Reply With Quote

Old   April 7, 2014, 07:15
Default
  #29
Senior Member
 
Join Date: Jan 2013
Posts: 196
Rep Power: 4
openfoammaofnepo is on a distinguished road
Dear Roman,

Thank you so much for your reply about the wall function implementations. Very helpful for me.

About the following:

Code:
1. you use the log law or the linear law to find the velocity in the first point away from the wall away from the grid, not he friction velocity.
My opinion is: the velocity at the first interior grid nodes (cell centroids if cell centered FVM is applied) is from the outer flow calculations like LES and RANS. The height of that nodes is always known. Having these two quantities and the law of wall (like log-law), we can get the friction velocity from iterative solutions of the law of wall.

Please directly point out if what I am saying is not correct.
Thank you.
OFFO
openfoammaofnepo is offline   Reply With Quote

Old   April 7, 2014, 08:01
Default
  #30
Senior Member
 
romant's Avatar
 
Roman Thiele
Join Date: Aug 2009
Location: Stockholm, Sweden
Posts: 359
Rep Power: 11
romant is on a distinguished road
Quote:
Originally Posted by openfoammaofnepo View Post
Dear Roman,

Thank you so much for your reply about the wall function implementations. Very helpful for me.

About the following:

Code:
1. you use the log law or the linear law to find the velocity in the first point away from the wall away from the grid, not he friction velocity.
My opinion is: the velocity at the first interior grid nodes (cell centroids if cell centered FVM is applied) is from the outer flow calculations like LES and RANS. The height of that nodes is always known. Having these two quantities and the law of wall (like log-law), we can get the friction velocity from iterative solutions of the law of wall.

Please directly point out if what I am saying is not correct.
Thank you.
OFFO
Of course the velocity in the first interior grid point is calculated through the solution of the velocity field. In the law of the wall / or any other wall function, you would like to set the velocity in the first grid point, because you know the velocity in that point based on theory. This is where the extra source term for the calculations comes in, in the case of openfoam, this source term is inserted into the momentum equation through nut/mut at the wall, as mut/nut at the wall are generally zero, due to the fact that k is zero.

I am not sure what you mean with calculating the friction velocity, because it results directly from the solution without having to know the law of the wall. As the friction velocity is
u_{\tau}=\sqrt{\tau_w/\rho}
and
\tau_w=\mu \left( \frac{\partial u}{\partial y}\right)_{y=0}
where the last part can just be calculated from
\tau_w = \mu \left( \frac{u_P - u_w}{y_p} \right)

As you can see there is not need to calculate the shear velocity using the law of the wall and iterations
__________________
~roman
romant is offline   Reply With Quote

Old   April 7, 2014, 08:05
Default
  #31
Senior Member
 
Join Date: Jan 2013
Posts: 196
Rep Power: 4
openfoammaofnepo is on a distinguished road
Ok, thanks. But in your line of reasoning, what did you mean by setting the velocity in the first grid point? Besides, how was the u_w obtained? I think if we calculate the tau_w directly from the third equations you provided, there will be some inaccuracies. Please comment if any. Thanks.
openfoammaofnepo is offline   Reply With Quote

Old   April 7, 2014, 08:11
Default
  #32
Senior Member
 
romant's Avatar
 
Roman Thiele
Join Date: Aug 2009
Location: Stockholm, Sweden
Posts: 359
Rep Power: 11
romant is on a distinguished road
Quote:
Originally Posted by openfoammaofnepo View Post
Ok, thanks. But in your line of reasoning, what did you mean by setting the velocity in the first grid point? Thank you.
Wall functions predict the velocity in the first grid point based on theory. However, it is very hard to just prescribe the velocity in the first grid point and keep it fixed. In order to achieve the predicted velocity in the first grid point and not "fix" and thereby destabilize the differential equation (look at Pope, 2000 for this one), we generally introduce a source term, which in openfoam is introduced through the nut/mut wall function.
Bernhard likes this.
__________________
~roman
romant is offline   Reply With Quote

Old   April 7, 2014, 18:50
Default
  #33
Senior Member
 
Join Date: Jan 2013
Posts: 196
Rep Power: 4
openfoammaofnepo is on a distinguished road
Thank you for your explanation, Roman.

In Openfoam, when we use wall function for both RANS and LES, the velocity at the walls are zero. So here the non-slip velocity is still applied. Can the slip velocity boundary conditions be used in Openfoam?

best regards,
OFFO
openfoammaofnepo is offline   Reply With Quote

Old   April 8, 2014, 02:42
Default
  #34
Senior Member
 
romant's Avatar
 
Roman Thiele
Join Date: Aug 2009
Location: Stockholm, Sweden
Posts: 359
Rep Power: 11
romant is on a distinguished road
Hej,

when you take a look here http://www.openfoam.org/docs/cpp/ all the way at the bottom, there is a link to boundary conditions. It will take you to the boundary conditions that can be found in OpenFOAM togther (not the wall function, these are separate because they are part of the specific turbulence models). Take a look there. You can find wall boundary conditions and all the explanations how to use them, i.e. how to set them up in the variable files. Under wall boundaries there is something called a partial slip, and there should of course also be a complete slip (otherwise partial can be used as complete slip and no slip based on how large the partial slip is).
__________________
~roman
romant is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF Wall functions in Fluent syler3321 Fluent UDF and Scheme Programming 2 September 20, 2014 12:37
Water subcooled boiling Attesz CFX 7 January 5, 2013 04:32
wall functions and boundary conditions in OF 1.7.1 cristobal OpenFOAM 2 May 6, 2011 04:10
UDF for wall slipping HFLUENT Fluent UDF and Scheme Programming 0 April 27, 2011 12:03
k-omega simulation without wall functions vkrastev OpenFOAM 2 January 24, 2010 18:45


All times are GMT -4. The time now is 16:48.