CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   How can I add a new wall function (http://www.cfd-online.com/Forums/openfoam-solving/59282-how-can-i-add-new-wall-function.html)

imano May 3, 2005 03:37

Hello, I want to simulate a
 
Hello,

I want to simulate a flow around a square prism exposed with a rough-wall turbulent boundary layer. For saving a calculation time, I want to use the log-law wall function with a roughness length instead of putting appropriate rougness blocks on the ground exactly.

Log-law wall function with a roughness length:

Uw/U*=ln(hw/z0)/kappa + A

where,

z0: roughness length
Uw: velocity near the ground
U*: friction velocity
hw: height from the ground
kappa, A: parameters

This is a my question.
[Q] How can I add a new wall function like this?

Thanks,
Masashi IMANO

eugene May 3, 2005 06:14

At the moment, wall functions
 
At the moment, wall functions are hardwired into the RANS turbulence models. To add a new wall function, you would have to copy an existing turbulence model and insert your new wall function where appropriate.

Example: kEpsilon model src/turbulenceModels/incompressible/kEpsilon/kEpsilin.C
line 88 = # include "wallViscosityI.H"

The "wallViscosityI.H" can be found here:
src/turbulenceModels/incompressible/wallFunc

So copy "wallViscosityI.H" to "roughWallViscosityI.H", modify it as required and include it in a copy of the turbulence model you wish to use. If you are feeling a bit adventurous, making the wall function selectable via a dictionary entry in the turbulenceProperties file would be more elegant.

henry May 3, 2005 06:15

Are you running LES or RANS?
 
Are you running LES or RANS?

Currently LES wall-functions are run-time selectable and it is easy to add new types but RANS wall-functions are not. I have thought about trying to make RANS wall-functions run-time selectable but have not yet come up with an elegant solution. If you would like to change the current RANS implementation you will find them in
OpenFOAM-1.1.1/src/turbulenceModels/compressible/wallFunc
for incompressible flow and in
OpenFOAM-1.1/src/turbulenceModels/compressible/wallFunc
for compressible flow.

imano May 4, 2005 03:18

Sorry, I forgot to mention abo
 
Sorry, I forgot to mention about my calculation setup's detail.

1. I'm running high-Re RANS.
2. I need to apply the rough wall function only to a ground and other walls
should be calculated with normal slip wall function. So I would like
to change wall functions whether a wall is a ground or not.

Since I'm beginner about both OpenFOAM and C++ language;;,
I would like to copy and modify the wall function sources directly,
but I still need to switch wall functions with using information of
the wall.

[Q] How can I switch wall functions according to wall's
information(name?) in RANS wall function sources?

Thanks for your advice,
Masashi IMANO

henry May 4, 2005 03:36

You could add a test for the p
 
You could add a test for the patch name to the code in

OpenFOAM-1.1.1/src/turbulenceModels/compressible/wallFunc
for incompressible flow and in
OpenFOAM-1.1/src/turbulenceModels/compressible/wallFunc
for compressible flow

and use your rough wall function on some wall patches and the original form on the rest.

imano May 4, 2005 03:46

Thanks. I will add a switch to
 
Thanks. I will add a switch to the code you advised.

BTW how can I obtain OpenFOAM-1.1.1?
I could not find out the new release.

Thanks in advance,
Masashi IMANO.

henry May 4, 2005 04:06

OpenFOAM-1.1.1 is not quite re
 
OpenFOAM-1.1.1 is not quite ready for release yet, in fact it will go out as OpenFOAM-1.2 as it includes a substantial number of developments. OpenCFD will release it as soon as possible.

segersson January 22, 2006 12:39

Hi, Im also trying to implem
 
Hi,
Im also trying to implement rough wall functions (with non-uniform roughness...). Is it necessary to make changes anywhere else in the code, besides in the turbulence model, to include roughness effects (e.g. in the velocity b.c.)?

Masashi, have you made any progress in your implementation? In that case, it would probably help me a lot if you could post your code here or in the Wiki.

Regards
David

imano January 23, 2006 00:18

Hi, David! I actually imple
 
Hi, David!

I actually implemented rough wall functions, but my implementation couldn't handle non-uniform roughness and
was very ad-hoc like this:

src/turbulenceModels/incompressible/wallFunc/wallViscosityI.H:

if (yPlus > yPlusLam_)
{
if ((curPatch.name().count('~'))==2) {
nutw[facei] =
nuw[facei]
*(yPlus*kappa_.value()/(log(y_[patchi][facei]/z0_.value())) - 1.0);
} else if ((curPatch.name().count('^'))==2) {
nutw[facei] =
nuw[facei]
*(1.0/alpha_.value() - 1.0);
} else {
nutw[facei] =
nuw[facei]
*(yPlus*kappa_.value()/log(E_.value()*yPlus) - 1);
}
}

So I'm afraid my code would not help you...

Masashi,

segersson February 27, 2006 16:52

Thanks Masashi, I'm not famil
 
Thanks Masashi,
I'm not familiar with the "wall viscosity" concept. Could you explain how you go from your wall-function for velocity to your implementation in wallViscosityI.H?

Also, since your formulation of a rough wallfunction differ from the one used in other codes e.g. Fluent, which uses Ks "sand grain roughness" to describe the roughness length, it would be interesting to know if you have evaluated the results from your wall-function somehow.

Regards
David

imano February 27, 2006 23:29

Dear David, Actually I impl
 
Dear David,

Actually I implemented the log-law wall function with roughness length,
but there was little difference between a calculation result with the
implemented roughness wall and that with the original smooth wall.
As I had no time for finding out the reason at that time, I switched
the wall function from the roughness type to the original one.
So there is no evaluation about my implementation to show here...

Since my mother tongue is not English , it's difficult to explain the
"wall viscosity" concept here. So please consult guide books about
the numerical calculation of turbulent flow.

Regards,
Masashi

eugene February 28, 2006 07:57

Wall viscosity is a pretty str
 
Wall viscosity is a pretty straightforward concept. Really it is just a "trick" to specify the wall shear stress via turbulent viscosity and the no-slip velocity boundary conditions.

So tau_w = nut_w * dU/dy

where tau_w can be found from some wall function and dU/dy is the wall normal derivative of velocity. See wallFunctions/wallViscosityI.H for details.

asteria December 13, 2007 11:00

Hi all. I'm solving two phase
 
Hi all.
I'm solving two phase flow with twoPhaseEulerFoam and I want to implement new drag model. So according to your suggestions, I think it will be better to change the code which exists already(acutally it is schillerNeumann.C) rather than make new code for the drag model. I'm solving new fields, say moments and with those moments, got average diameter fields, let say, volScalarField D10. I want to use this D10 instead phasea_.d() in below code. How can I implement this diameter? I'm not used to C++, so any suggestion and help will be appreciated. Thanks in advance. have fun!!



// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //

Foam::tmp<foam::volscalarfield> Foam::SchillerNaumann::K
(
const volScalarField& Ur
) const
{
volScalarField Re = max(Ur*phasea_.d()/phaseb_.nu(), scalar(1.0e-3));
volScalarField Cds = 24.0*(scalar(1) + 0.15*pow(Re, 0.687))/Re;

forAll(Re, celli)
{
if(Re[celli] > 1000.0)
{
Cds[celli] = 0.44;
}
}

return 0.75*Cds*phaseb_.rho()*Ur/phasea_.d();
}

desert_1250 January 17, 2011 06:19

roughness
 
Hi all of foamers, i hope that you are well
i compiled the new solver with roughness( i modified simpleFoam & i used OF 1.5dev), but my question is how to change the related case to read this coeffs (Ks , Cs)? how to define the BC for this Coeffs?


best regards


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