|
[Sponsors] |
July 23, 2014, 06:04 |
Temperature dependent properties
|
#1 |
New Member
Join Date: Jul 2014
Posts: 13
Rep Power: 12 |
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 |
|
July 24, 2014, 10:09 |
|
#2 |
Senior Member
Join Date: Oct 2013
Posts: 397
Rep Power: 19 |
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.
|
|
July 24, 2014, 11:33 |
|
#3 |
New Member
Join Date: Jul 2014
Posts: 13
Rep Power: 12 |
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). |
|
July 28, 2014, 07:37 |
|
#4 | ||
Senior Member
Armin
Join Date: Feb 2011
Location: Helsinki, Finland
Posts: 156
Rep Power: 19 |
Quote:
Quote:
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 |
|||
August 4, 2014, 06:02 |
|
#5 |
New Member
Join Date: Jul 2014
Posts: 13
Rep Power: 12 |
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? |
|
August 5, 2014, 04:08 |
|
#6 |
Senior Member
Join Date: Oct 2013
Posts: 397
Rep Power: 19 |
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. |
|
August 7, 2014, 06:40 |
|
#7 |
New Member
Join Date: Jul 2014
Posts: 13
Rep Power: 12 |
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). |
|
August 7, 2014, 12:49 |
|
#8 |
Senior Member
Join Date: Oct 2013
Posts: 397
Rep Power: 19 |
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 |
|
December 27, 2018, 07:38 |
|
#9 | |
Senior Member
Jianrui Zeng
Join Date: May 2018
Location: China
Posts: 157
Rep Power: 8 |
Quote:
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. |
||
|
|
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 |