CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Implementing TVD-RK3 method in rhoCentralFoam (https://www.cfd-online.com/Forums/openfoam-programming-development/191019-implementing-tvd-rk3-method-rhocentralfoam.html)

vachan July 29, 2017 05:03

Implementing TVD-RK3 method in rhoCentralFoam
 
1 Attachment(s)
Hello,

I am trying to modify rhoCentralFoam to implement TVD-RK3 time stepping by solving the governing equations thrice with appropriate variables. I have named my solver "rhoCentralFoam1".

The solver got compiled without any errors but I am getting the following error when using the solver for a shockTube case.
Code:

#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::sigFpe::sigHandler(int) at ??:?
#2  ? in "/lib/x86_64-linux-gnu/libc.so.6"
#3  Foam::tmp<Foam::GeometricField<Foam::Vector<double>, Foam::fvsPatchField, Foam::surfaceMesh> > Foam::operator/<Foam::Vector<double>, Foam::fvsPatchField, Foam::surfaceMesh>(Foam::GeometricField<Foam::Vector<double>, Foam::fvsPatchField, Foam::surfaceMesh> const&, Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> const&) at ??:?
#4  ? at ??:?
#5  __libc_start_main in "/lib/x86_64-linux-gnu/libc.so.6"
#6  ? at ??:?
Floating point exception (core dumped)

There is NO error if rhoCentralFoam is used for the same case.

I have attached the solver source file and new header files that I have used in my solver. runLog.txt is the log generated when shockTube case is run.

Can anyone please help me in this regard? I am new to this forum so sorry if my post doesn't give enough information. I am using OpenFOAM 4.1

Thanks, Vachan

vachan August 3, 2017 05:41

Figured out. (1/3) and (2/3) were taken as zeros by openfoam. Made them (1.0/3.0) and (2.0/3.0).

reza_65 December 8, 2017 11:23

Quote:

Originally Posted by vachan (Post 659340)
Figured out. (1/3) and (2/3) were taken as zeros by openfoam. Made them (1.0/3.0) and (2.0/3.0).

I am wondering are you sure about this (1/3 is zero in OpenFOAM!)? Did you check with using debug version?
Actually sometimes I face some problem regarding to precisions as well.
It would be interesting if you could share the final version of this solver.


Thanks,
Reza

vachan December 8, 2017 21:09

Hi Reza,

Thanks for the reply. Sorry, I didn't check it using the debug version but making that one change alone made the code run fine. The code I had posted earlier on this thread is an older version and I have made more modifications to it. Presently, I use 0.33333334 and 0.66666667 instead of 1.0/3.0 and 2.0/3.0 to reduce run time. The code works fine even with these.

Thanks, Vachan

spatz November 30, 2019 23:09

Shouldn't we all have TVD-RK3 for rhoCentralFoam?
 
To my knowledge TVD-RK3 (Shu, Osher, 1988 https://ntrs.nasa.gov/archive/nasa/c...9880014833.pdf) is an excellent explicit time integration choice; better than Euler explicit for aeroacoustics by a fair margin. I've implemented it a few times in simple little NS and MHD codes and never recall it being more than a dozen lines of code. I am wondering if someone more experienced in OpenFOAM and rhoCentralFoam in particular knows why higher-order RK schemes aren't offered in the main branch of OpenFOAM -- I have just download version 7 and just see the following in the ddtSchemes source folder:


backwardDdtScheme CoEulerDdtScheme ddtScheme localEulerDdtScheme steadyStateDdtScheme
boundedDdtScheme CrankNicolsonDdtScheme EulerDdtScheme SLTSDdtScheme



I am not meaning to complain. If it is for lack of man-power, I should be happy to help, and it seems like the individual who founded this thread (and perhaps many others) have already made their own explicit RK time integrators.

vachan December 23, 2019 02:35

Hi Jeff,

Quote:

I am wondering if someone more experienced in OpenFOAM and rhoCentralFoam in particular knows why higher-order RK schemes aren't offered in the main branch of OpenFOAM
For compressible flows, inviscid flux scheme is implemented in a solver. Since TVD RK3 requires calculation of residual multiple times, each time using the flux scheme, it is not possible to decouple the time integration scheme. The time stepping scheme, by itself, doesn't know how to compute the residuals in solvers like rhoCentralFoam. Had the OpenFOAM user interface for inviscid flux scheme also been managed by a dictionary entry, what you proposed would then have been possible with the time integration scheme internally using the flux scheme.


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