
[Sponsors] 
January 2, 2022, 09:01 
Implementation of a RANS k epsilon solver

#1 
New Member
David
Join Date: Oct 2020
Posts: 21
Rep Power: 6 
Hello everyone
I want to implement my own code in fortran to solve a RANS standart kepsilon problem using the Boussinesq approximation. The idea is to get some coding practice as well as to better understand the generall workings of a solver. I then planing to validate my solver using the pitzDaisy case from the tutorial from openFOAM. I understand the generall approach of the turbulent modelling approach but right now I am struggling at the implementation of the different steps to solve this problem. Can somebody recommend a step by step guide/manual on how to implement such a solver? I am especially struggling on how I can solve for the corresponding k and epsilon using transportation equations. Also how can I use the derived Reynoldstress to derive the velocity field? I would love something like: k_new = k_old + dt * parameters. Does something like this exist? And where could I find something like this? Many thanks already in advance for your help. Best regards fidu 

January 3, 2022, 03:13 

#2  
Senior Member

Quote:
Also, kepsilon models require wall functions or some specific variant to work at walls. I would suggest SpalartAllmaras or komega for a novice as first implementation. In general, turbulence model equations are not much different from general scalar equations (something you should be really able to solve by yourself before attempting any turbulence model implementation). Some specificities are:  Most models have similar equations, differing the most trough their source terms. Source terms can indeed be relevant, so an explicit approach might simply not work. You should be ready to implement them implicitly. Most models have suggestions on the implicit source term treatment in their original papers  You need first to compute the turbulent viscosity from the turbulence variables before solving the momentum equations, then use the effective viscosity (laminar + turbulent) as constant in the momentum equations. With momentum equations solved, you have the massflux to use in the turbulence equations. Then repeat. 

January 3, 2022, 05:30 

#3  
New Member
David
Join Date: Oct 2020
Posts: 21
Rep Power: 6 
Quote:
I have currently a working code a convection programm for low Prandl number which works pretty well and was thinking to exent/change it for my porpose. However this was a 2D modell where my velocity was calculated using streamfunctions. I then updated my vorticity and temperatur fields using the procedure shown in the images. Thanks again for all your help and time. Best fidu 

January 3, 2022, 06:09 

#4 
Senior Member
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,740
Rep Power: 66 
Have you somehow overlooked that OpenFOAM is open source? You can just open up the source code and look at what is there. I realize it is c++ and not Fortran but you can just skip over all the cspecific stuff. There is also a programmer's guide to help you with the gnitty gritty details. If you want you can even compare your streamfunction code with potentialFoam.
Btw k_new = k_old + dt * parameters implies an explicit approach... are you sure you want to do it this way? 

January 3, 2022, 07:41 

#5  
Senior Member

Quote:
An additional aspect I never looked into is that I expect the turbulence formalism to be maybe different in the psiomega framework, unless you maybe derive the psi and omega equations from the RANS equations first 

January 4, 2022, 03:21 

#6  
New Member
David
Join Date: Oct 2020
Posts: 21
Rep Power: 6 
Quote:
And thanks to pointing it out with the implized approach. I just wanted to make an example on what kind of manueal/floating charte I am looking for. 

January 4, 2022, 03:23 

#7  
New Member
David
Join Date: Oct 2020
Posts: 21
Rep Power: 6 
Quote:


Tags 
coding skills.., kepsilon model, numerical methods, rans modelling, reynolds shear stress 
Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
foamextend4.1 release  hjasak  OpenFOAM Announcements from Other Sources  19  July 16, 2021 05:02 
Fail to converge when solving with a fabricated solution  zizhou  FLUENT  0  March 22, 2021 06:33 
Divergence detected in AMG solver: k, epsilon, pressure coupled  Tanjina  FLUENT  5  January 13, 2014 10:46 
Puzzled by multiblock solver implementation......  Chen Zhi  Main CFD Forum  3  February 14, 2010 20:10 
SimpleFoam k and epsilon bounded  nedved  OpenFOAM Running, Solving & CFD  1  November 25, 2008 20:21 