CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   Quad precision? (

marupio May 17, 2011 14:17

Quad precision?
How much trouble would it be to try implementing quad precision in OpenFOAM?

- Easy!
- Tough!
- Why would you want to try? The schemes are only "second order accurate", etc..

deepsterblue May 17, 2011 14:27

Are you referring to numerical precision, or something like fourth-order accuracy?

marupio May 17, 2011 14:49

Need more digits! I mean using "long double", or __float128.

deepsterblue May 17, 2011 14:54

I've implemented an arbitrary-precision data-type as a wrap-around to the GNU MPFR library. You should be able to use this as a drop-in replacement to the scalar class:

However, this is still emulation in software, so don't expect blazing performance.

marupio May 17, 2011 15:36

Thanks a lot, Sandeep!

I've downloaded it, and am in the process of figuring out how to use it. I'm guessing to use it in finiteVolume calculations, I need to define a new fvMatrix template specialization for a multiPrecisionScalar... fvMultiPrecisionScalar (basically identical to fvScalarMatrix).

Do you have any sample code that uses your multiPrecisionScalar class?


All times are GMT -4. The time now is 16:04.