# How to implement the wall function as a source term in the momentum equa?

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

February 26, 2020, 14:48
How to implement the wall function as a source term in the momentum equa?
#1
Senior Member

kimy
Join Date: Mar 2019
Location: https://t.me/pump_upp
Posts: 164
Rep Power: 7
Hi guys,

I discovered the following information from the site:
https://www.cfd-online.com/Wiki/Two_...bulence_models

There are two[1] possible ways of implementing wall functions in a finite volume code:

Additional source term in the momentum equations.
Modification of turbulent viscosity in cells adjacent to solid walls.
The source term in the first approach is simply the difference between logarithmic and linear interpolation of velocity gradient multiplied by viscosity (the difference between shear stresses).
The second approach does not attempt to reproduce the correct velocity gradient. Instead, turbulent viscosity is modified in such a way as to guarantee the correct shear stress.

By default, the wall function is applied in the boundary condition of nut, epsilon and k at the wall. Now I am using the twophaseeulerfoam and I need to add the wall shear stress induced by the solid phase (I won't use KTGF). Thus, I am thinking the first way to implement the extra source term in the momentum equation for solid phase (as the attachments shown). However, I have not find any reference about this aspect. Who can give me some hits? Thanks.
Attached Images
 Picture1.jpg (6.2 KB, 28 views) Picture2.jpg (2.8 KB, 7 views)

 February 28, 2020, 06:29 #2 Senior Member   kimy Join Date: Mar 2019 Location: https://t.me/pump_upp Posts: 164 Rep Power: 7 I am testing the following codes however it is now not compiled successfully. I added the source term into the momentum equation and it shows that patchi, boundaryFields, internalField are not declared in this scope. Therefore, how can I get access the velocity at the wall and the first grid center in the main solver code? { E=9.8; mybeta=1.0; kappa=0.41; mu1=phase2.turbulence().mu()*(2.5/mybeta*(1/pow(1-alpha1,2.5)-1)-alpha2)/alpha1 y=phase2.turbulence().y()[patchi] Res=rho1*U1.component(2).boundaryField()[patchi].patchInternalField()*y[facei]/mu1 scalar st = 1/Res; for (int i=0; i<10; i++) { st = sqr(kappa)/Log(E*Res*sqrt(st)); } return st; //Source term Taus=alpha1*rho1*st*(U1.component(2).boundaryField ()[patchi].patchInternalField()) *(U1.boundaryField()[patchi].patchInternalField() - U1.boundaryField()[patchi]) }

 Tags twophaseeuelrfoam, wall shear stress, wallfunction