implementing a new wall function
I would like to implement a new wall function in OpenFOAM, however, I need to understand the existing wall function implementation first. I would like to know if I understand the current implementation.
at first we have the stresses near the wall (nu + nut) dUdy_wall = tau_w / rho where I can now rewrite to nu_t = tau_w / rho * (dUdy)^1  nu= tau_w / rho (U_P / y_P)^1  nu where U_P and y_P are the velocity in the first point from the wall from the field solution and the distance to the first point from the wall, respectively. I think tau_w can then be replaced with (Versteeg and Malalasekera) tau_w = rho (c_mu^1/4) (k_P^1/2) U_P kappa / (ln(E yPlus)) or in other version using yPlus=(c_mu^1/4) (k_P^1/2) y_P / nu this becomes nu_t = nu (yPlus kappa / ln(E yPlus)  1 ) (OF nutkWallFunction) As far as I understand I only need to replace the tau_w in the above derivation and have implemented an alternative wall function. I know that I also need to apply different terms to the epsilonwall function and the k wall function if needed. However, I had a harder time understanding the implementation of the momentum term that in Versteeg and Malalasekera is just given as tau_w * A_cell = S and should be somehow introduced in the momentum equation. The question is now, did I correctly understand the implementation and is it really just necessary to replace tau_w in the above expression in order to get a different wall function and is the replacement of dUdy = U_P/y_P correctly applied. 
Dear Roman,
Thank you for your help with my questions in another thread. Your above derivations are correct and helpful. At this stage, actually I have the same question with you: Code:
How mutw (I am looking at the compressible RAS mutUWallFunction) affects the discretization of the momentum equations? OFFO 
Dear Roman,
About your last arguments, I think it is correct: the wall shear stress is calculated in different ways in different models. For example, in the following wall function: Code:
https://github.com/OpenFOAM/OpenFOAM2.1.x/blob/master/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutUSpaldingWallFunction/mutUSpaldingWallFunctionFvPatchScalarField.C 1, in the above source files I quoted, what does the following quantity magUp stand for? Code:
scalarField magUp(mag(Uw.patchInternalField()  Uw)); Code:
const scalarField magGradU(mag(Uw.snGrad())); Any comments are welcome. OFFO 
Quote:

Quote:

Dear Romant,
Thank you for your continuous help. In my understanding, the reason why we need to model the wall stress lies in the following implementations: if we use cellcentered finite volume discretization just used in OF, we will integrate the NS equation over the all the control volumes. For the diffusion terms (molecular diffusion + turbulent diffusion) in momentum equations, the contribution of each face from diffusive fluxes to each cell (the quantities are stored at the cell cnetroids) is linked to the gradient at the intercell face (and of course also the mu and mut at the intercell faces). If this face just coincides with the wall, so this gradient is the wall shear stress (or drag). So the following problem is how to model the wall shear stress. From the above line of reasoning, the two terms (molecular diffusion + turbulent diffusion) will have the numerical flux contributions to the nearwall cell. The following issues are: how to predict the gradient corresponding to the molecular diffusion + turbulent diffusion. My ultimate question is: why in openfoam, the wall function only applies to the mut, which corresponding to the turbulent diffusion? Thank you so much. Please correct if what I am saying has some problems. OFFO Quote:

For Spalding wall function, they claimed that that equation can be used for the whole boundary layers: viscous sublayer, buffer layer and turbulence regions.
Quote:

Quote:
For RANS, there are also wall functions for alphat (temperature wall function) and also to set the turbulent production and dissipation (epsilon wall function). Quote:

Hi Romant,
Thank you for your very helpful suggestions and comments. Did you have any experience in using/implementing LES wall function in OF? How are their performances? best regards, OFFO Quote:

Unfortunately, I don't have any experience with wall functions for LES. I have only worked with wall functions for RANS models and also implemented some for RANS.

Dear Roman
I too am trying to implement a new wall function in OpenFOAM and have similar doubt as you. Were you able to find if it's necessary to introduce the new tau_w term in the momentum equation for the new wall function to take effect? Regards Nihar 
Quote:

Quote:
When I look into the code of kEpsilon.C, I find that only alphat, mut, epsilon have the code of correct the value using wall function, like this:mut_.correctBoundaries(). However, it is hard to find any clue about k, which has different types in the kWallFunction folder. Does it mean that k wall function is not used in solving kEpsilon turbulence modeling? I know that the epsilon and production term in the epsilon wall function have the influence of solving k equations, but the code in kWallFunction do not include in the program, and in the 0 folder, we have to choose a wall function for k. It looks so strange. Thanks 
Hi Jason,
the k wall function sets a value at the boundary, which means that the value in the first cell is untouched. It also does not use any values from the first cell to calculate the value k, which by the way is 0. However, nut and epsilon use values from the first cell, and or set values in the first cells, which is why the correction functions from the wallFunction class need to be called. It has to do with the order in which we calculate different values. For example, 1. Update values of epsilon and G in the first cell 2. Solve the epsilon balance equation 3. Solve the k balance equation 4. calculate nut everywhere 5. Correct nut at the wall based on velocity, k and epsilon in the first cell. Quote:

Quote:
Thanks for your reply. In the standard wall function, k is assumed to be constant across the nearwall fully turbulence region, and k_v = k_P( the first node, this formula is used in the epsilon wall function). It is sure that k=0 at the wall, however in some more advanced wall functions, k has a distribution, e.g. twolayer model, k=k_v(y/y_v)^2 when y<y_v, and k=by+a when y>y_v. If I want to add this type of wall function in the code, do I need to add k_correctBoundary in the code, or I just need to change the epsilon wall function, where epsilon and production are modified near the wall, which then have influence to the kequation? I think the second way is better, because, as you mentioned above, k=0 at the wall and the distribution of k in the first cell result in the change of epsilon and production term. Hopefully, you can understand what I said. Regards, Jason 
Hi Jason,
I understand what you mean. I haven't looked at it in a while, so I am not sure if you have to run this. I suggest you look into the velocity equations, maybe k boundaries are updated there? Otherwise, you might have to make a small diagram and see where which boundary is updated. It shouldn't take too long. If this doesn't work out, there is always the option to program it and you add an echo or similar to the location where the update should occur and see if the part of the code is reached at any point. 
Quote:
what do you mean velocity equations? Do you mean momentum equations? When I look into the code, after solving the momentum equations, there is such code: U.correctBoundaryConditions, then this refer to fixedValueFvPatchField at the wall. However, in this code, there is no clue of k. For my understanding, if it refer to a wall boundary condition, and wall function is used, the first cell of velocity should be modified. But I can not find anything in the code about this. Thanks a lot for your suggestion. Jason 
Hej Jason,
the velocity is not modified in the first cell, because this might introduce instabilities in the equations. instead we use mut or nut to introduce a shear force at the wall which is large enough to created the value of U which we want to introduce in the first cell. please take a look at http://www.cfdonline.com/Forums/ope...tml#post452744 for some information on this. The whole thread could be of interest to you. 
Quote:
Thank you for your reply. I did some numerical experiment, in which only the k BC is changed, the numerical results shows that the choice of the k wall function do influence the results. Jason 
Hi,Roman:
Could you please take a look at my wall function? I implemented a wall function to modify the velocity nearwall. However, no change is seen during the calculation, I don't know why. Could you give me some advice? Xianbei 
All times are GMT 4. The time now is 18:33. 