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

Temperature dependent properties

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 23, 2014, 06:04
Question Temperature dependent properties
  #1
New Member
 
Join Date: Jul 2014
Posts: 13
Rep Power: 12
P1361 is on a distinguished road
Hi everybody,

I am trying to solve a buoyancy-driven flow of a fluid with temperature-dependent properties. What I want to do is having properties (Rho, Cp, mu, Pr) all as functions of temperature.

I thought of modifying the solver to my need, so I have gone through several source files, but at the moment I feel kind of lost! I am quite new to OF. So any hint of where to look is appreciated.

I use buoyantPimpleFoam solver, in which rhoThermo thermophysical type is used.

Many thanks,

P
P1361 is offline   Reply With Quote

Old   July 24, 2014, 10:09
Default
  #2
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 19
chriss85 will become famous soon enough
If you can use polynomial expressions for the properties then you won't have to program anything. Polynomial properties can be specified in thermophysicalProperties by choosing the correct type. You'll have to look it up though, I don't remember it from my head.
chriss85 is offline   Reply With Quote

Old   July 24, 2014, 11:33
Default
  #3
New Member
 
Join Date: Jul 2014
Posts: 13
Rep Power: 12
P1361 is on a distinguished road
Actually, the property varies in a complicated way which cannot be well approximated by polynomial function. That's why I am looking for some 'customized' function.

I guess I have to write new sources in equationOfState, thermo and transport folders in src/thermophysicalModels/specie but I don't quite understand how they will communicate with my solver and how they relate to the thermodynamic type (in my case rhoThermi).
P1361 is offline   Reply With Quote

Old   July 28, 2014, 07:37
Default
  #4
Senior Member
 
dkxls's Avatar
 
Armin
Join Date: Feb 2011
Location: Helsinki, Finland
Posts: 156
Rep Power: 19
dkxls will become famous soon enough
Quote:
Originally Posted by P1361 View Post
Actually, the property varies in a complicated way which cannot be well approximated by polynomial function. That's why I am looking for some 'customized' function.
Which complicated way? You came up with your own model?

Quote:
Originally Posted by P1361 View Post
I guess I have to write new sources in equationOfState, thermo and transport folders in src/thermophysicalModels/specie but I don't quite understand how they will communicate with my solver and how they relate to the thermodynamic type (in my case rhoThermi).
Jep, if you really want to write your own functions for Rho, Cp, mu and Pr you have quite some coding to do.
The thermophysical classes are templated, which means that for each group of properties (e.g. transport, thermodynamic, P-V-T) you can re-implement your own template. I would recommend you to start first with only one of them (e.g. EOS), once that works (and you understand how it works) the rest should be straight forward.
I gave already in several threads some instructions on how to do that, have a look at these ones:
http://www.cfd-online.com/Forums/ope...tml#post451937
http://www.cfd-online.com/Forums/ope...tml#post451645

-Armin
dkxls is offline   Reply With Quote

Old   August 4, 2014, 06:02
Default
  #5
New Member
 
Join Date: Jul 2014
Posts: 13
Rep Power: 12
P1361 is on a distinguished road
Thanks Arimin,

That's exactly what I wanted to do. The problem is that I don't know which source files I should really compile. I started creating my own EOS; it didn't work so I decided I change the existing perfectGas source as the first step to get some idea of how it works. Here, I explain what I did:L

- coppied the whole folders "specie" and "basic" from $FOAM_DIR/src/thermophysicalModels/ to $MY_FOAM_DIR/src/thermophysicalModels/. I had to do it since I am not allowed to change the main source files in the network.

- in $MY_FOAM_DIR/src/thermophysicalModels/specie/eqiationOfState/perfectGas/perfectGasL.H I changed the rho(p,T) , Z(p,T) , psi(p,T) functions according to my will. Then I re-compiled using wmake command in the terminal from .../specie. (in the Make folder, I changed "files" so that the new .so library is coppied in my desired directory.)

- I used wmake in $MY_FOAM_DIR/src/thermophysicalModels/basic to re-create the corresponding .so library in my desired address. Before that, in the .../Make/options, I replaced -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude by -I$(USER_LIB_SRC)/... so that it uses the updated header files.

- I re-compiled my solver source, again in the option file, I replaced $(LIB_SRC) with $(MY_LIB_SRC), whenever it comes to thermophysical models.

- in my case controlDict I added
libs
(
"$FOAM_USER_LIBBIN/libfluidThermophysicalModels_PF.so"
"$FOAM_USER_LIBBIN/libspecie_PF.so"
);
"libfluidThermophysicalModels_PF.so" and "libspecie_PF.so" are my newly changed libraries.

Now I expect by running my case (specifying perfectGas as the EOS) my rho field is calculated according to the function I put in the perfectGasL.H file. But it does not show any change!

I guess there are other things I have to re-compile, but I cannot really find what!

Any idea?
P1361 is offline   Reply With Quote

Old   August 5, 2014, 04:08
Default
  #6
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 19
chriss85 will become famous soon enough
Are you trying to simulate a plasma?
I'm doing similar stuff, but I can't give out my code unfortunately.
However, I can give you some hints:

Copying some of the existing models is fine, but you should rename the classes and typenames. This requires quite some search/replace and can be tedious. You need to watch out that everything stays consistent.

There is a file, I believe it is called makeThermos.C, that includes macro calls to create combinations of the various sub-classes for EOS, transport, enthalpy and so on. You will have to add a call with your new typenames there. If you build your own library, you should remove the other classes from it so there are no duplicates.
Finally, you will have to use a class such as interpolating2DTable as an input for tabular data if you need it. Alternatively, if you can provide analytical functions you can implement them directly in the specific functions of the classes.
I also had to extend the interpolating2dTable to use extrapolation, but this might not be neccessary for you.

Let me know if you need further hints.

Edit:
Oh and one more thing, if you are implementing a tabular enthalpy, you might need to modify the used algorithm for calculating temperature from enthalpy. I had to resort to a bisection method as fallback if the implemented Newton method doesn't converge. An alternative, probably also a better approach might be to completely exchange the algorithm and just supply a T(h,p) table.

Last edited by chriss85; August 5, 2014 at 07:52.
chriss85 is offline   Reply With Quote

Old   August 7, 2014, 06:40
Default
  #7
New Member
 
Join Date: Jul 2014
Posts: 13
Rep Power: 12
P1361 is on a distinguished road
Heaps of thanks! It works now! I guess the problem was duplication of classes (not 100% sure but it works anyway.) Just for the record, the file that contains the thermo types is rhoThermos.C.

And no! I am trying to simulate a fluid near its critical point (where we have some crazy variation of properties).
P1361 is offline   Reply With Quote

Old   August 7, 2014, 12:49
Default
  #8
Senior Member
 
Join Date: Oct 2013
Posts: 397
Rep Power: 19
chriss85 will become famous soon enough
Ah, so you are using a material model that is not based on compressibility. In my case it was psiThermos.C, because I was using the psiThermo class.

Glad to know I could help a bit
chriss85 is offline   Reply With Quote

Old   December 27, 2018, 07:38
Default
  #9
Senior Member
 
Jianrui Zeng
Join Date: May 2018
Location: China
Posts: 157
Rep Power: 8
calf.Z is on a distinguished road
Quote:
Originally Posted by P1361 View Post
Heaps of thanks! It works now! I guess the problem was duplication of classes (not 100% sure but it works anyway.) Just for the record, the file that contains the thermo types is rhoThermos.C.

And no! I am trying to simulate a fluid near its critical point (where we have some crazy variation of properties).
I am simulating supercritical CO2, which also has crazy variation of propertities.
And now I want to use tabulated method in buoyantPimpleFoam, which is based on rhoThermo. But rho cannot be read from constant/rho file. So I am confused about how I can use tabular method in rhothermo-based solver.
calf.Z 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
melting problem: looking for appropriate solvers som OpenFOAM Running, Solving & CFD 329 September 6, 2024 13:43
whats the cause of error? immortality OpenFOAM Running, Solving & CFD 13 March 24, 2021 08:15
problem in defining the temperature dependent viscosity!!! adambarfi OpenFOAM Programming & Development 0 March 5, 2013 07:25
Poor convergence with temperature dependent density on modified pisoFOAM ovie OpenFOAM 1 March 20, 2011 04:19
Two-Phase Buoyant Flow Issue Miguel Baritto CFX 4 August 31, 2006 13:02


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