|
[Sponsors] | |||||
|
|
|
#1 |
|
Senior Member
Frank Bos
Join Date: Mar 2009
Posts: 337
Rep Power: 7 ![]() |
Hello,
Has someone implemented 4th order Runge Kutta time integration. I think this method will be more efficient than the 2nd order CrankNickolson. Maybe someone tried it and could give me some hints in order to develop it myself. Regards, Frank
__________________
Frank Bos |
|
|
|
|
|
|
|
|
#2 |
|
New Member
Join Date: Nov 2009
Posts: 17
Rep Power: 5 ![]() |
I'm also wondering if someone has runge-kutta implementation for incompressible turbulent flows (LES or DNS). Apparently the only application dealing such flows is Pisofoam and it uses implicit time stepping, which is very slow.
|
|
|
|
|
|
|
|
|
#3 |
|
New Member
Michael B Martell Jr
Join Date: Feb 2010
Location: Amherst, MA
Posts: 18
Rep Power: 5 ![]() |
I too am wondering about this. I am attempting to implement a 3rd order (low storage) RK scheme for an RSTM I am working on. Any ideas?
|
|
|
|
|
|
|
|
|
#4 |
|
Member
ville vuorinen
Join Date: Mar 2009
Posts: 56
Rep Power: 6 ![]() |
Hi! I am currently working on compressible flows and writing a RK4 method to OpenFOAM. I am currently learning many things about top-level programming
(mostly from the codes written by other people) but would like to share a simple example of one way to program RK4 in the top-level code. The following code (that can be put inside the main for-loop of any existing solver to test it) solves the simple advection equation for a variable rho (that can represent of course anything). Here, we btw can assume for the moment being that U is a constant field i.e. the velocity. rhoOld = rho; phiv = fvc::interpolate(U)& mesh.Sf(); k1 = -runTime.deltaT()*fvc::div(phiv, rhoOld); k2 = -runTime.deltaT()*fvc::div(phiv, rhoOld + 0.5*k1); k3 = -runTime.deltaT()*fvc::div(phiv, rhoOld + 0.5*k2); k4 = -runTime.deltaT()*fvc::div(phiv, rhoOld + k3); rho = rhoOld + a1*k1 + a2*k2 + a3*k3 + a4*k4; // ai are the RK4 coefficients Of the following I would like to hear some further comments about and hopefully the more experienced people could further comment on these issues (or point out a proper link to a discussion). When programming explicit code as above the correctBoundaryConditions() function should be used after each update because otherwise there might be inconsistencies in BC's and also in the processor BC's. I guess the reason for this is that field operations such as the ones above have no influence on what is happening on the boundary; right ? One can also explicitly update the BC's for a certain quantity (say e.g. rhoE that is often solved for in compressible computations) by typing rhoE.boundaryField() = rho.boundaryField()* ( e.boundaryField() + 0.5*magSqr(U.boundaryField()) ); Of course, it remains as user's responsibility that everything stays consistent when doing top-level OF solvers. Regarding the previous question about an incompressible RK4 solver I do not see any problem of why the above-presented approach for advection equation would not work also for the incompressible NS-equations . Best regards, Ville |
|
|
|
|
|
|
|
|
#5 | |
|
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,877
Rep Power: 23 ![]() |
Quote:
![]() Yes, you have to do something to update the boundaries, if you need that. No, what you have to do is not necessarily an explicit call to correctBoundaryConditions(). If you update the value of a field, and you also want to update the corresponding boundaryField, all you have to do is to replace = with == in the assignment. For example: k1 == ...; This should work in OF 1.6 and following. I am not sure about the previous versions, since I noticed this syntax for the first time in 1.6. Of course, if you do not have an assignment, but a sum with +=, like in the velocity corrector step, you have to call correctBoundaryConditions(). Best,
__________________
Alberto GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as live DVD/USB, hard drive image and virtual image. GeekoCFD 32bit - The 32bit edition of GeekoCFD. GeekoCFD text mode - A smaller version of GeekoCFD, text-mode only, with only OpenFOAM. Available in a variety of virtual formats. |
||
|
|
|
||
|
|
|
#6 |
|
Member
Juho Peltola
Join Date: Mar 2009
Location: Finland
Posts: 80
Rep Power: 6 ![]() |
||
|
|
|
|
|
|
|
#7 |
|
Senior Member
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,877
Rep Power: 23 ![]() |
OK. Thanks for the info
__________________
Alberto GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as live DVD/USB, hard drive image and virtual image. GeekoCFD 32bit - The 32bit edition of GeekoCFD. GeekoCFD text mode - A smaller version of GeekoCFD, text-mode only, with only OpenFOAM. Available in a variety of virtual formats. |
|
|
|
|
|
|
|
|
#8 |
|
Member
ville vuorinen
Join Date: Mar 2009
Posts: 56
Rep Power: 6 ![]() |
Hi and thanks for the comments!
As said, I am currently considering how to nicely implement the boundary conditions for a fully explicit, density based RK4 solver (say the hardest case of subsonic inflow, outflow for the time being). Currently, in the prototype version, I define the BC's for p, T and U as they are rather convenient to give. The variables that are solved for are rho, rhoU and rhoE. Now, the BC's for rho, rhoU and rhoE would be needed. In e.g. subsonic inflow the BC for rho would need to be determined by the solution. Thus, p and T may be used for determining the boundary value of rho. After this the boundary fields of rhoU and rhoE may be constructed. Any ideas of how to conveniently do this? How would the more experienced OF-people consider simply updating the boundary field in the top-level code as is done in e.g. rhoCentralFoam? Another option would be defining a new BC type for rho, rhoU and rhoE that is constructed from p, T and U. Best, Ville |
|
|
|
|
|
|
|
|
#9 |
|
Member
ville vuorinen
Join Date: Mar 2009
Posts: 56
Rep Power: 6 ![]() |
Hi,
to get a closure: I have now implemented into OpenFOAM a RK4 based fully explicit compressible solver. Works as smoothly as it only can I've also written RK4 solvers for incompressible flows based on the projection method which allows us to get rid of the PISO solvers if so desired. Work based on the incompressible solver was published recently in Computers & Fluids and can be found currently in the "Articles in Press" section of the journal. Vuorinen V., Schlatter P., Boersma B., Larmi M., and Fuchs L., A Scale-Selective, Low- Dissipative Discretization Scheme for the Navier-Stokes Equation, (to appear in Computers and Fluids) Best, Ville |
|
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Runge Kutta 4th Order Source Code | sugu | Main CFD Forum | 4 | October 26, 2012 03:15 |
| Runge-Kutta 4rd Order method help for 6DoF in CFD | siw | Main CFD Forum | 0 | August 29, 2008 06:08 |
| runge kutta | Shuo | Main CFD Forum | 0 | January 7, 2008 19:29 |
| 4th and 5th Order TVD Runge-Kutta Methods | saygin | Main CFD Forum | 2 | January 30, 2006 11:45 |
| Runge Kutta vs adams bashforth time marching | vasanth | Main CFD Forum | 5 | January 1, 2006 00:17 |