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

rhoCentralFoam Runge Kutta

Register Blogs Community New Posts Updated Threads Search

Like Tree20Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 23, 2013, 05:04
Default rhoCentralFoam Runge Kutta
  #1
Member
 
Join Date: Nov 2012
Posts: 83
Rep Power: 14
Henning86 is on a distinguished road
Hi,


i have worked quite a lot with rhoCentralFoam and did some modification i wanted to share.



i have implemented Runge Kutta in rhoCentralFoam. It is stable for the forwardStep case until a CFL No of 1.5 and about 30% faster than the normal solver.

i also implemented local time stepping for the Runge Kutta Method (more Information about LTS can be found in the Forum) . This Solver is a lot faster than the Euler LTS. If tested with a CFL No of 1.2, which would be a speed up of more than 100% to the Euler Method. (But i havent looked at the results in detail but the first impression was good).

the Runge Kutta Method should work with different values (but not tested) (now it is Runge Kutta 4 ). Just change the values in the createFields.H.

If you find some mistakes, let me now!

it is written in vers 2.1.1

Best Regards

Henning
Attached Files
File Type: zip rhoLTSCentralFoamRK4.zip (55.7 KB, 176 views)
File Type: zip rhoCentralFoamRK4.zip (55.7 KB, 249 views)

Last edited by Henning86; October 23, 2013 at 10:55.
Henning86 is offline   Reply With Quote

Old   October 24, 2013, 04:13
Default rhoCentralFoam Runge Kutta 4
  #2
Member
 
Join Date: Nov 2012
Posts: 83
Rep Power: 14
Henning86 is on a distinguished road
the solver for the version 2.2
Attached Files
File Type: zip rhoCentralFoamRK4v222.zip (55.6 KB, 232 views)
File Type: zip rhoLTSCentralFoamRK4v222.zip (55.7 KB, 169 views)
Henning86 is offline   Reply With Quote

Old   October 29, 2013, 05:33
Default
  #3
Senior Member
 
Join Date: Dec 2010
Posts: 135
Rep Power: 16
eRzBeNgEl is on a distinguished road
I have a problem compiling the solver with v221, my relevant output is in the following: Any suggestions?

Quote:
rhoCentralFoamRK4$ ./Allwmake
+ wmake libso BCs
wmakeLnInclude: linking include files to ./lnInclude
Making dependency list for source file
...
...
...
I/opt/openfoam221/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/fixedRhoFvPatchScalarField.o
/usr/bin/ld: cannot find -lbasicThermophysicalModels
collect2: ld returned 1 exit status
make: *** [/opt/openfoam221/platforms/linux64GccDPOpt/lib/librhoCentralFoam.so] Error 1
+ wmake


Making dependency list for source file rhoCentralFoamRK4.C
could not open file basicPsiThermo.H for source file rhoCentralFoamRK4.C
SOURCE=rhoCentralFoamRK4.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -IBCs/lnInclude -I/opt/openfoam221/src/finiteVolume/lnInclude -I/opt/openfoam221/src/thermophysicalModels/basic/lnInclude -I/opt/openfoam221/src/thermophysicalModels/specie/lnInclude -I/opt/openfoam221/src/turbulenceModels/compressible/turbulenceModel -I/opt/openfoam221/src/dynamicMesh/lnInclude -I/opt/openfoam221/src/meshTools/lnInclude -IlnInclude -I. -I/opt/openfoam221/src/OpenFOAM/lnInclude -I/opt/openfoam221/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/rhoCentralFoamRK4.o


rhoCentralFoamRK4.C:34:28: fatal error: basicPsiThermo.H: No such file or directory


compilation terminated.
make: *** [Make/linux64GccDPOpt/rhoCentralFoamRK4.o] Error 1
+ wmake rhoCentralDyMFoam
Making dependency list for source file rhoCentralDyMFoam.C
could not open file basicPsiThermo.H for source file rhoCentralDyMFoam.C
SOURCE=rhoCentralDyMFoam.C ; g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3 -DNoRepository -ftemplate-depth-100 -I.. -I../BCs/lnInclude -I/opt/openfoam221/src/finiteVolume/lnInclude -I/opt/openfoam221/src/thermophysicalModels/basic/lnInclude -I/opt/openfoam221/src/thermophysicalModels/specie/lnInclude -I/opt/openfoam221/src/turbulenceModels/compressible/turbulenceModel -I/opt/openfoam221/src/dynamicMesh/lnInclude -I/opt/openfoam221/src/meshTools/lnInclude -IlnInclude -I. -I/opt/openfoam221/src/OpenFOAM/lnInclude -I/opt/openfoam221/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/rhoCentralDyMFoam.o


rhoCentralDyMFoam.C:34:28: fatal error: basicPsiThermo.H: No such file or directory


eRzBeNgEl is offline   Reply With Quote

Old   October 29, 2013, 06:52
Default
  #4
Member
 
Join Date: Nov 2012
Posts: 83
Rep Power: 14
Henning86 is on a distinguished road
you probably download the solver for the version 2.1.1.

the class basicPsithermo doesn't exist anymore. in 2.2.x there was a huge change in the thermodynamic libary.


try the solver for version 2.2.2

Last edited by Henning86; October 29, 2013 at 20:25.
Henning86 is offline   Reply With Quote

Old   October 30, 2013, 13:01
Default
  #5
New Member
 
Konrad Makowka
Join Date: Apr 2012
Location: München, Germany
Posts: 6
Rep Power: 14
konneym is on a distinguished road
Hi,

first of all, thanks for you code contribution.

I have implemented something equivalent a while ago, whereas there is the following issue (which is still on my todo list):

In order to be consistent, you would also need to perform the RK integration on the turbulence equations. You need to be able *write* the (let's say) k and omega of your turbulence model, because:
You also need to perform the weighted RK summation of your turbulence fields that you solve for.

This is basically only a programming issue, however, I am experiencing a strange bug related to that, see http://www.cfd-online.com/Forums/ope...sgs-model.html.

Cheers,

Konrad

Last edited by konneym; October 31, 2013 at 04:28.
konneym is offline   Reply With Quote

Old   October 31, 2013, 16:30
Default
  #6
Member
 
Join Date: Jun 2012
Posts: 76
Rep Power: 14
maHein is on a distinguished road
Hello Henning86,

I implemented a low-storage Runge-Kutta scheme in rhoCentralFoam as well some time ago.

I rewrote a ddt-class to account for the coefficients. So, the code in the main file was much more compact. Maybe you could try something yourself.

As a guideline, you could check out Oliver Borms density based solver, which also utilizes a low-storage Runge-Kutta scheme.

Regards,

maHein
fumiya and openfoammaofnepo like this.
maHein is offline   Reply With Quote

Old   November 16, 2013, 16:53
Default
  #7
Member
 
Fluid Dynamics
Join Date: Mar 2013
Posts: 41
Rep Power: 13
cfd.with.openfoam is on a distinguished road
Hey Henning86,

Sounds really good and I will test both of them and will try to post some results as well; at some point.

A quick comment though - I am not sure if it can be done but if possible please change the name of the thread in order to incorporate words like LTS and or faster rhoCentralFoam. I think it will bring in more people here.

Thanks very much.
cfd.with.openfoam is offline   Reply With Quote

Old   November 17, 2013, 02:10
Default
  #8
Member
 
Fluid Dynamics
Join Date: Mar 2013
Posts: 41
Rep Power: 13
cfd.with.openfoam is on a distinguished road
Hey Henning86,

Quickly wanted to mention that the 2.2.2 versions that you uploaded are not working with 2.2.2 - I got this error while compiling -

/opt/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/Field.C: In member function ‘void Foam::Field<Type>:perator=(const Foam::VectorSpace<Form, Cmpt, nCmpt>&)’:
/opt/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/Field.C:680:42: warning: typedef ‘VSType’ locally defined but not used [-Wunused-local-typedefs]
typedef VectorSpace<Form,Cmpt,nCmpt> VSType;
^
/usr/bin/ld: cannot find -lbasicThermophysicalModels
collect2: error: ld returned 1 exit status
make: *** [/opt/OpenFOAM-2.2.0/platforms/linux64GccDPOpt/lib/librhoCentralFoam.so] Error 1


We can see the basicThermoPhysicalModels issue here. Did you check your 2.2.2 versions - looks like it needs a couple of more changes to get going on 2.2.2

It's quite late here and I'll try to see if can get around this issue tomorrow or next week but any comments will be helpful.

Thanks very much
cfd.with.openfoam is offline   Reply With Quote

Old   November 17, 2013, 07:15
Default
  #9
Member
 
Join Date: Nov 2012
Posts: 83
Rep Power: 14
Henning86 is on a distinguished road
I'm pretty sure you compiled the solver with Allwmake.


i havent changed the rhoCentralDymFoam so you get this error.
Henning86 is offline   Reply With Quote

Old   November 17, 2013, 13:32
Default
  #10
Member
 
Fluid Dynamics
Join Date: Mar 2013
Posts: 41
Rep Power: 13
cfd.with.openfoam is on a distinguished road
Hey Henning86,

Thanks for your quick response.

Yes I saw rhoCentralDyMFoam in the Allwmake file but what I didn't pay attention to was the BCs which are also from OpenFOAM 2.1.0, I think.

So, I simply copied both BCs and the rhoCentralDyMFoam folders from the OF-2.2.0 sources and used Allwmake. It seems to have worked.

On the other hand - Did you ever use Michael Borm's densityBasedTurbo solver? If yes, then, any comments on how it performs when compared to rhoCentralFoam

Thanks
cfd.with.openfoam is offline   Reply With Quote

Old   November 17, 2013, 15:01
Default
  #11
Member
 
Fluid Dynamics
Join Date: Mar 2013
Posts: 41
Rep Power: 13
cfd.with.openfoam is on a distinguished road
Hey Henning86,

I just attempted to start a run with the rhoLTS... solver and I got this error -

Unknown ddt Scheme - Valid ddtschemes are -

9 (CoEuler, CrankNicolson, Euler, SLTS, backward, bounded, boundedBackward, localEuler, steadyState)

I was thinking that I could just use [rk4 (or maybe RK4) rDeltaT] option for the ddtSchemes in the fvSchemes file and it will run with rk4 local time stepping.

Am I missing something here? Please let me know.

Thanks very much
cfd.with.openfoam is offline   Reply With Quote

Old   November 17, 2013, 18:09
Default
  #12
Member
 
Fluid Dynamics
Join Date: Mar 2013
Posts: 41
Rep Power: 13
cfd.with.openfoam is on a distinguished road
Hey Henning86,

Even if I use Euler it somehow works as RK4 but it diverges/stops/crashes pretty quickly in my case even with a MaxCo of 0.2. Maybe I am doing something wrong.

As a side note - I was trying to get densityBasedTurbo going with OpenFOAM 2.2.0 but it gives me an error related to the thermophysical models, which is not at all surprising since it has been developed based on OF-1.6-ext (link below)

http://www.extend-project.de/user-fo...dturbo-solvers

The error looks like this -

/opt/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/Field.C: In member function ‘void Foam::Field<Type>:perator=(const Foam::VectorSpace<Form, Cmpt, nCmpt>&)’:
/opt/OpenFOAM-2.2.0/src/OpenFOAM/lnInclude/Field.C:680:42: warning: typedef ‘VSType’ locally defined but not used [-Wunused-local-typedefs]
typedef VectorSpace<Form,Cmpt,nCmpt> VSType;
^
localTimeStep/localTimeStep.C: In member function ‘void Foam::localTimeStep::update(Foam::scalar, Foam::Switch)’:
localTimeStep/localTimeStep.C:153:57: error: ‘const class Foam::basicThermo’ has no member named ‘psi’
(thermophysicalModel_.Cv()*thermophysicalModel_.ps i());
^
make: *** [Make/linux64GccDPOpt/localTimeStep.o] Error 1


Since you seem to be be quite comfortable with OpenFOAM, can you give me a couple of pointers in order to handle this problem.

I think you might also find the densityBasedTurbo as a useful alternative to rhoCentralFoam for steady state cases.


Also another thing that I don't understand is that even if we use Local Time Stepping with OpenFOAM it is still not like e.g FLUENT which can give us a 2D steady state solution within minutes. What is the difference between the LTS in OpenFOAM and that in e.g FLUENT. Is it something entirely else.

To me it seems that densityBasedTurbo will be something like FLUENT and will give real quick steady state 2D solutions.

Thanks very much
cfd.with.openfoam is offline   Reply With Quote

Old   November 19, 2013, 05:13
Default
  #13
Member
 
Join Date: Nov 2012
Posts: 83
Rep Power: 14
Henning86 is on a distinguished road
hi

the Runge kutta 4 loop is in the solver. You need to use Euler or localEuler rDeltaT (for local timestepping)


i dont think it is possible to adapt turbfoam to v 2.2.x without great affort.

most crashes of solvers in cfd are caused by the initialisation or the boundary conditions

best regards

henning
Henning86 is offline   Reply With Quote

Old   April 5, 2015, 19:23
Default
  #14
Senior Member
 
Phoevos
Join Date: Mar 2009
Posts: 104
Rep Power: 17
fivos is on a distinguished road
Hi all,

I would like to know if anyone has tried to port the rhoCentralFoamRK4/LTS to 2.3.x.

I have done some things; there are some changes to be made (e.g. at the Make file with fluidThermophysycalModels and basicThermophysicalModels) and the code compiles with OF2.3.x and runs for the tutorial case of shocktube. However, at other cases (mainly involving total pressure/temperature) the solver crashes with the following output:


Code:
--> FOAM FATAL ERROR: 

    request for volScalarField psi from objectRegistry region0 failed
    available objects of type volScalarField are

27
(
(1|thermo:psi)
rhok0
rhok1
thermo:mu
thermo:psi
rhoOld
rhoEk1
rhok3
rho
rhoOld_0
k
rhok2
sqrt(((Cp|Cv)*(1|thermo:psi)))
rhoEk3
thermo:psi_0
e_0
rho_0
p
T
rhoE
e
rhoEk2
muEff
rhoEk0
rhoEOld
thermo:alpha
(rhok0*0.5)
)


    From function objectRegistry::lookupObject<Type>(const word&) const
    in file /home/fivos/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude/objectRegistryTemplates.C at line 198.

FOAM aborting

#0  Foam::error::printStack(Foam::Ostream&) in "/home/fivos/OpenFOAM/OpenFOAM-2.3.x/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#1  Foam::error::abort() in "/home/fivos/OpenFOAM/OpenFOAM-2.3.x/platforms/linux64GccDPOpt/lib/libOpenFOAM.so"
#2  Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const& Foam::objectRegistry::lookupObject<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >(Foam::word const&) const in "/home/fivos/OpenFOAM/OpenFOAM-2.3.x/platforms/linux64GccDPOpt/lib/libfiniteVolume.so"
#3  Foam::fixedRhoFvPatchScalarField::updateCoeffs() in "/home/fivos/OpenFOAM/OpenFOAM-2.3.x/platforms/linux64GccDPOpt/lib/librhoCentralFoamRK4.so"
#4   at EulerDdtSchemes.C:0
#5  Foam::fv::EulerDdtScheme<double>::fvmDdt(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) in "/home/fivos/OpenFOAM/OpenFOAM-2.3.x/platforms/linux64GccDPOpt/lib/libfiniteVolume.so"
#6  
 at rhoCentralFoamRK4.C:0
#7  
 in "/home/fivos/OpenFOAM/fivos-2.3.x/platforms/linux64GccDPOpt/bin/rhoCentralFoamRK4"
#8  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#9  
 in "/home/fivos/OpenFOAM/fivos-2.3.x/platforms/linux64GccDPOpt/bin/rhoCentralFoamRK4"
Aborted (core dumped)
I am trying to find the reason behind that.. it seems it is related to the
Foam::fixedRhoFvPatchScalarField::updateCoeffs() in fixedRhoFvPatchScalarField, but I have not been able to poinpoint the exact reason..

Any ideas are welcome.
Thanks in advance.
Fivos
fivos is offline   Reply With Quote

Old   April 7, 2015, 04:42
Default
  #15
Member
 
Join Date: Jun 2012
Posts: 76
Rep Power: 14
maHein is on a distinguished road
Simply use "thermosi" in your boundary conditions instead of just "psi". This solves this problem.

Regards,

Martin
maHein is offline   Reply With Quote

Old   April 7, 2015, 20:01
Default
  #16
Senior Member
 
Phoevos
Join Date: Mar 2009
Posts: 104
Rep Power: 17
fivos is on a distinguished road
Hi maHein,

Thanks for your answer

Have you done the rhoCentralFoamRK4 for OF2.3.x and it worked? Could you share it, because I may have done something wrong with mine..?

I am asking because it seems that it is not related just with replacing psi with thermosi in the total boundary conditions... Actually, I have the same issue with the forwardStep case (OpenFOam tutorial) where, if I remember correctly, static values are prescribed.

Thanks again.
fivos is offline   Reply With Quote

Old   April 8, 2015, 09:49
Default
  #17
Member
 
Join Date: Nov 2012
Posts: 83
Rep Power: 14
Henning86 is on a distinguished road
your are right the solver don't work with 2.3.x will upload an updated version.
Henning86 is offline   Reply With Quote

Old   April 8, 2015, 09:50
Default
  #18
Senior Member
 
Phoevos
Join Date: Mar 2009
Posts: 104
Rep Power: 17
fivos is on a distinguished road
Dear Henning,

Thanks a lot in advance. If you don't mind, could you also briefly describe what changes you made?

Thanks again.
fivos is offline   Reply With Quote

Old   April 8, 2015, 10:04
Default
  #19
Member
 
Join Date: Nov 2012
Posts: 83
Rep Power: 14
Henning86 is on a distinguished road
Dear fivos,


In the folder BCs all the files where from the version 2.1, as it used the old thermodynamic library, it didn't work.

Only update it.

Hope the solver works,

Best Regards

Henning
Attached Files
File Type: gz rhoCentralFoamRK4vers23x.tar.gz (15.8 KB, 228 views)
File Type: gz rhoLTSCentralFoamRK4vers23x.tar.gz (17.1 KB, 144 views)
fumiya, saatt and Makot like this.
Henning86 is offline   Reply With Quote

Old   April 9, 2015, 15:41
Default
  #20
Senior Member
 
Phoevos
Join Date: Mar 2009
Posts: 104
Rep Power: 17
fivos is on a distinguished road
Hi Henning,

Thank you for your help, I can confirm that replacing the BCs of the old version with the new made it work.

Thanks again
fivos is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Main advantage of using Runge Kutta of higher order? jakubstary Main CFD Forum 14 August 20, 2019 17:15
1D Burgers euqation with 4th Runge Kutta dokeun Main CFD Forum 3 August 8, 2011 07:34
Runge Kutta Discontinuous Galerkin procedure? Ameya J Main CFD Forum 6 July 29, 2011 06:56
Runge Kutta Optimization vasanth Main CFD Forum 6 December 2, 2005 14:07
Diagonally Dominate Runge Kutta Method Anthony Iannetti Main CFD Forum 0 January 23, 2001 22:27


All times are GMT -4. The time now is 07:01.