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

Performance hint for material libraries

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By chriss85
  • 1 Post By olivierG

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 18, 2014, 04:33
Default Performance hint for material libraries
  #1
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 18
chriss85 will become famous soon enough
Just as a hint for others:

I had to implement a material library based on tabular data for the various thermophysical properties. Most notably here is the enthalpy. OpenFOAM uses a root-finding algorithm for inverting the h(p, T) function to T(p, h). If the h(p, T) function is numerically expensive (such as in the case of interpolation tables), there can be a massive performance drop.

Instead it is better to implement a new class that replaces hePsiThermo (or a similar one that you use) that uses a table with pre-calculated T(p, h) values. It is very important that the inverted table class returns exactly the same results, as even a small deviation will result in largely different end-results. In my case, I first interpolate the pressure value for each point in the relevant range and then interpolate temperature or enthalpy. With such a bilinear interpolation the mapping between both tables is exact. Took me a few days to find a working method

All in all, I notice a performance improvement of 450-500% in a flow solver based on sonicFoam, not solving any other equations other than flow. In more complex solvers this performance margin will not be as large as time is spent on solving other equations, but I think this figure is still very significant.
ngj likes this.
chriss85 is offline   Reply With Quote

Old   August 22, 2014, 05:15
Default
  #2
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21
jherb is on a distinguished road
Do you plan to release the framework/class structure for such a library? Even without the material data this would be very interesting.
jherb is offline   Reply With Quote

Old   August 22, 2014, 05:46
Default
  #3
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 18
chriss85 will become famous soon enough
I'll have to check if I can since I'm developing for a commercial application.
In the end it's an extension to the interpolation2DTable class for extrapolation and some classes for the thermophysical models that return data based on these tables instead of analytical formulas like most of the current implementations do.

Getting good tabulated data proves to be the most difficult task. Anyone knows of any reliable programs which are able to calculate properties of plasmas for air and polymers?

For absorption coefficients I have been using SPARTAN, which seems to produce good results for lower temperatures, unfortunately its integrated databases don't include multiple ionized species yet.
chriss85 is offline   Reply With Quote

Old   August 22, 2014, 06:01
Default
  #4
Senior Member
 
Olivier
Join Date: Jun 2009
Location: France, grenoble
Posts: 272
Rep Power: 17
olivierG is on a distinguished road
Hello,

Like Joachim, i would be really happy if you could release your interpolation table and Thermos model.
About plasma properties, this is always a difficult task to get good data, but you can take a look at: http://fr.lxcat.net/home/

regards,
Olivier
mm.abdollahzadeh likes this.
olivierG is offline   Reply With Quote

Old   August 22, 2014, 07:01
Default
  #5
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 18
chriss85 will become famous soon enough
Thanks for the link! Unfortunately my knowledge in the field of plasma chemistry is very shallow, but from what I've understood these programs and databases should allow the calculation of rho(p,T) (density) and mu(p,T) (viscosity) tables?
That would be one step in the total task. One also needs h(p,T) (enthalpy), lambda(p,T) (heat conductivity), sigma(p,T) (electrical conductivity) and kappa(nu, p,T) (spectral absorption coefficient). Is it possible to calculate the thermodynamic quantities from these databases?. I have some of this data from this paper: http://epjd.epj.org/articles/epjd/ab...305/d9305.html

However I'm also looking for data in higher pressure ranges (< 500 bar), spectral absorption coefficients for these ranges and also data sets for polymers. Some polymer data is shown in http://iopscience.iop.org/0022-3727/29/7/033, but again, the range is too limited for my applications
chriss85 is offline   Reply With Quote

Old   August 22, 2014, 08:19
Default
  #6
Senior Member
 
Olivier
Join Date: Jun 2009
Location: France, grenoble
Posts: 272
Rep Power: 17
olivierG is on a distinguished road
hello,

ok, sorry, but this link will not give you thermos properties, since usually we deals with gas so we use perfect gas Thermos model.
But you can get the most important part, which is plasma mobility, diffusivity and kinetics and energy exchange.
Electric conductivity is linked to electronic density and frequency (! usually complex number).
So other properties come from kinetic theory /perfect gaz.

regards,
olivier
olivierG is offline   Reply With Quote

Old   August 26, 2014, 09:40
Default
  #7
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 18
chriss85 will become famous soon enough
I fear I won't get any trustworthy results soon, calculating plasma composition feels quite difficult already.

I will package my tabulated material models code soon and release it, so feel free to use it then. Just keep in mind that it's work in progress and future changes are possible.
chriss85 is offline   Reply With Quote

Old   September 17, 2014, 04:41
Default
  #8
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 18
chriss85 will become famous soon enough
I've finally released the library!

http://www.cfd-online.com/Forums/ope...s-library.html
chriss85 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
[swak4Foam] difficulties installing swak4foam newbie29 OpenFOAM Community Contributions 120 October 21, 2022 04:01
compiling libraries - LIBBIN and USER_LIBBIN grjmell OpenFOAM Programming & Development 4 June 17, 2022 22:06
parallel performance on BX900 uzawa OpenFOAM Installation 3 September 5, 2011 15:52
Linux kernel performance enhancement ConnClark OpenFOAM 0 January 17, 2011 18:18
Fortran90 (creating executable by using libraries) Ravi Main CFD Forum 0 September 27, 2004 22:34


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