Hello,
I want to use a different wall function model, other than the ones that are implemented in Code_saturne, for the velocity field for the k-epsilon turbulence model.
Where I can find a template or a guide how to implement user defined wall functions in Code_saturne?
Thank you,
Ionut
wall function implementation, k-epsilon
-
- Posts: 9
- Joined: Fri Apr 27, 2018 2:33 pm
Re: wall function implementation, k-epsilon
Dear Ionut
There are currently no dedicated user files that enables the user to prescribe user defined wall functions.
It is however possible to modify a wall function or even to add one through sources.
Wall boundary conditions are set in the clptur.f90 file that you 'll find in the src/base directory.
Boundary conditions for the turbulent quantities ( / ) are defined in this routine for each turbulence model.
Turbulence model in the sources are set through the keyword iturb and itytur = iturb / 10.
In your case, the - corresponds to iturb = 20 or 21 (depending if you selected Linear Production or not) and itytur = 2. Looking for tests on those criteria will guide you straight to those BCs.
In this file you'll also find a call to the wall function subroutine
This routine, described in the cs_wallfunctions.c and cs_wallfunctions.h files of the src/base directory, set the boundary conditions for the velocity with or without wall functions. The keyword iwallf passed as an argument contains the information on which wall function should be used :
= 0: no wall functions
= 1: one scale friction velocities (power law)
= 2: one scale friction velocities (log law)
= 3: two scales friction velocities (log law)
= 4: two scales friction velocities (scalable wall functions)
= 5: two scales friction velocities (based on V. Driest analysis)
= 6: two scales rough/smooth wall functions
At this stage, you can either add your own wall function by adding an other routine/iwallf or directly modify the routine you are using (for example if you're using two scales friction velocities - default ones for k-eps models, iwallf = 3 - directly modify the corresponding routine in the cs_wallfunctions.h file).
Jean-Francois
There are currently no dedicated user files that enables the user to prescribe user defined wall functions.
It is however possible to modify a wall function or even to add one through sources.
Wall boundary conditions are set in the clptur.f90 file that you 'll find in the src/base directory.
Boundary conditions for the turbulent quantities ( / ) are defined in this routine for each turbulence model.
Turbulence model in the sources are set through the keyword iturb and itytur = iturb / 10.
In your case, the - corresponds to iturb = 20 or 21 (depending if you selected Linear Production or not) and itytur = 2. Looking for tests on those criteria will guide you straight to those BCs.
In this file you'll also find a call to the wall function subroutine
Code: Select all
call wallfunctions &
( iwallf, ifac , &
xnuii , xnuit , utau , distbf, roughness, rnnb, ek, &
iuntur, nsubla, nlogla, &
uet , uk , yplus , ypup , cofimp, dplus )
= 0: no wall functions
= 1: one scale friction velocities (power law)
= 2: one scale friction velocities (log law)
= 3: two scales friction velocities (log law)
= 4: two scales friction velocities (scalable wall functions)
= 5: two scales friction velocities (based on V. Driest analysis)
= 6: two scales rough/smooth wall functions
At this stage, you can either add your own wall function by adding an other routine/iwallf or directly modify the routine you are using (for example if you're using two scales friction velocities - default ones for k-eps models, iwallf = 3 - directly modify the corresponding routine in the cs_wallfunctions.h file).
Jean-Francois
Re: wall function implementation, k-epsilon
Thank you very much for the explanation.
I tried to search for the clptur.f90 or the src/base directory, but I could not find them. I need to install some source codes?
I use Code_saturne 5.0.7 on Windows 10 64bit.
If I will write the code in the case directory/SRC folder, will it be taken into account rather than the code that is already implemented in Code_saturne?
Thank you,
Ionut
I tried to search for the clptur.f90 or the src/base directory, but I could not find them. I need to install some source codes?
I use Code_saturne 5.0.7 on Windows 10 64bit.
If I will write the code in the case directory/SRC folder, will it be taken into account rather than the code that is already implemented in Code_saturne?
Thank you,
Ionut
-
- Posts: 9
- Joined: Fri Apr 27, 2018 2:33 pm
Re: wall function implementation, k-epsilon
Dear Ionut,
I'm not familiar with the Windows versions of Code_Saturne.
When dealing with code modification going beyond modification of user subroutine, installing the code through sources (under Linux) and then re-compile/re-build the sources with those advanced modifications is usually preferred.
However, as you mentioned, any Fortran or C file present in the case directory/SRC are compiled. This is also true if you place here source files that are already present in the original sources. So putting here your modified clptur.f90 should do the trick.
Sources are not present in the Program Files/Code_Saturne directory when you install it on Windows but you can get the sources you need via the Code_Saturne github repository.
Jean-François
I'm not familiar with the Windows versions of Code_Saturne.
When dealing with code modification going beyond modification of user subroutine, installing the code through sources (under Linux) and then re-compile/re-build the sources with those advanced modifications is usually preferred.
However, as you mentioned, any Fortran or C file present in the case directory/SRC are compiled. This is also true if you place here source files that are already present in the original sources. So putting here your modified clptur.f90 should do the trick.
Sources are not present in the Program Files/Code_Saturne directory when you install it on Windows but you can get the sources you need via the Code_Saturne github repository.
Jean-François
Re: wall function implementation, k-epsilon
Thank you very much, Jean-François for the support.
Is there a way to access the pressure gradient from inside the "cs_wall_functions.h"?
I need it to calculate the streamwise pressure gradient (in the flow direction), and some other variables like wall shear stress, dynamic viscosity, density etc, I guess I have to add some headers.
Thank you,
Ionut
Is there a way to access the pressure gradient from inside the "cs_wall_functions.h"?
I need it to calculate the streamwise pressure gradient (in the flow direction), and some other variables like wall shear stress, dynamic viscosity, density etc, I guess I have to add some headers.
Thank you,
Ionut
-
- Posts: 9
- Joined: Fri Apr 27, 2018 2:33 pm
Re: wall function implementation, k-epsilon
Fluid properties such as dynamic viscosity are already passed as argument to the wallfunctions subroutine and are thus accessible in the "cs_wall_functions.h".
I assume you're trying to implement wall functions similar to the UMIST analytical wall functions from Craft et al. (2002) which requires additional terms like convection or pressure gradient at wall cells ?
The easiest way to do that is to compute all the needed variables in the clptur routine and add them as arguments in the wallfunctions routine. Be careful to also change the arguments of the wallfunctions routine in the cs_wall_functions.c/.h which contains the Fortran/C wrapper. Once you've done that, all your desired variables will be accessible in the cs_wall_functions.h file.
Jean-François
I assume you're trying to implement wall functions similar to the UMIST analytical wall functions from Craft et al. (2002) which requires additional terms like convection or pressure gradient at wall cells ?
The easiest way to do that is to compute all the needed variables in the clptur routine and add them as arguments in the wallfunctions routine. Be careful to also change the arguments of the wallfunctions routine in the cs_wall_functions.c/.h which contains the Fortran/C wrapper. Once you've done that, all your desired variables will be accessible in the cs_wall_functions.h file.
Jean-François
Re: wall function implementation, k-epsilon
Thank you for your help.Jean-Francois Wald wrote: ↑Thu May 03, 2018 8:15 am Fluid properties such as dynamic viscosity are already passed as argument to the wallfunctions subroutine and are thus accessible in the "cs_wall_functions.h".
I assume you're trying to implement wall functions similar to the UMIST analytical wall functions from Craft et al. (2002) which requires additional terms like convection or pressure gradient at wall cells ?
The easiest way to do that is to compute all the needed variables in the clptur routine and add them as arguments in the wallfunctions routine. Be careful to also change the arguments of the wallfunctions routine in the cs_wall_functions.c/.h which contains the Fortran/C wrapper. Once you've done that, all your desired variables will be accessible in the cs_wall_functions.h file.
Jean-François
I am trying to implement a wall function developed by Manhart et al. (2008), which requires the pressure gradient in the streamwise direction of the flow.
In the clptur.f90 routine, the pressure gradient is already defined and can be accessed trough a function or it needs to be calculated?
Thank you,
Ionut