CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

Fourth Order Runge Kutta time integration

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

Like Tree2Likes
  • 1 Post By ville
  • 1 Post By alberto

Reply
 
LinkBack Thread Tools Display Modes
Old   October 26, 2005, 09:07
Default Hello, Has someone implemen
  #1
Senior Member
 
Frank Bos
Join Date: Mar 2009
Posts: 337
Rep Power: 7
lr103476 is on a distinguished road
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
lr103476 is offline   Reply With Quote

Old   December 16, 2009, 08:19
Default
  #2
New Member
 
Join Date: Nov 2009
Posts: 17
Rep Power: 5
misakagan is on a distinguished road
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.
misakagan is offline   Reply With Quote

Old   June 14, 2010, 12:07
Default
  #3
New Member
 
Michael B Martell Jr
Join Date: Feb 2010
Location: Amherst, MA
Posts: 18
Rep Power: 5
theory37 is on a distinguished road
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?
theory37 is offline   Reply With Quote

Old   September 19, 2010, 16:56
Default Runge-Kutta 4 to top-level OpenFOAM
  #4
Member
 
ville vuorinen
Join Date: Mar 2009
Posts: 56
Rep Power: 6
ville is on a distinguished road
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
mm.abdollahzadeh likes this.
ville is offline   Reply With Quote

Old   September 20, 2010, 02:47
Default
  #5
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,877
Rep Power: 23
alberto will become famous soon enough
Quote:
Originally Posted by ville View Post
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 ?
Yes and no
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,
mm.abdollahzadeh likes this.
__________________
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.
alberto is offline   Reply With Quote

Old   September 20, 2010, 04:54
Default
  #6
Member
 
Juho Peltola
Join Date: Mar 2009
Location: Finland
Posts: 80
Rep Power: 6
juho is on a distinguished road
Quote:
Originally Posted by alberto View Post
Yes and no
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.
I've used it in 1.4.1, so I would assume it also works in all the following versions.
juho is offline   Reply With Quote

Old   September 20, 2010, 10:26
Default
  #7
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,877
Rep Power: 23
alberto will become famous soon enough
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.
alberto is offline   Reply With Quote

Old   September 20, 2010, 10:46
Default
  #8
Member
 
ville vuorinen
Join Date: Mar 2009
Posts: 56
Rep Power: 6
ville is on a distinguished road
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
ville is offline   Reply With Quote

Old   October 31, 2012, 12:00
Default Runge-Kutta 4 density based LES solver implemented
  #9
Member
 
ville vuorinen
Join Date: Mar 2009
Posts: 56
Rep Power: 6
ville is on a distinguished road
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
ville is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


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


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