UDF for specific heat as function of pressure
Hello,
I am trying to make an UDF to obtain specific heat as a function of temperature and other state variable (either pressure or density, hopefully). The problem is that the default macro for specific heat DEFINE_SPECIFIC_HEAT passes only temperature as a state variable and does not inform on the cell or thread. This is what I have tried to do in order to obtain the pressure in the cell: Code:
#include "udf.h" Code:
/home/ansys_inc/v145/fluent/fluent14.5.7/lnamd64/2ddp_node/fluent_mpi.14.5.7: symbol lookup error: libudf/lnamd64/2ddp_node/libudf.so: undefined symbol: _Z10Get_Domaini I'm running Fluent 14.5.7 on Fedora 19, in case that's relevant. |
I'm still very interested in this problem, so if someone has a suggestion, it would be more than welcome.
|
i never have this problem,but it's clear the loop is wrong:
thread_loop_c(t, domain) { begin_c_loop(c, t) { pressure = C_P(c, t); }end_c_loop(c, t) } this will only make pressure equal the last cell value it loops. |
Quote:
|
Quote:
Maybe your idea is good to load external library. |
Quote:
As mentioned in the UDF I posted, Props() is a C function that will get the value of specific heat as a function of two state properties (such as temperature and pressure, or temperature and density). The problem is that the DEFINE_SPECIFIC_HEAT does not pass the cell value of pressure or density, so I am not able to consult the external library. So that's why I am trying to find a way to get the value of pressure in the cell. Is there any other macro that would help me in defining specific heat as a function of temperature and other thermodynamic property? I have also noticed that the bult-in NIST REFPROP library in Fluent does not compute specific heat as a function of pressure, only temperature. |
When the udf DEFINE_SPECIFIC_HEAT is called by Fluent, Fluent does not give information about density or pressure. You already saw that.
However, Fluent also does not give information about which cell it currently is. Within the udf DEFINE_SPECIFIC_HEAT, there is no way to find the density of the cell of interest, because the udf can not know what the cell of interest is. It is possible to do a loop over all domains and find out what the average density is (I think a small modification of your code would do about that) but that is not what you want. What you want is not possible with this udf. I would consider this to be a design flaw of Fluent, but maybe they have a reason for this. |
Thanks, so it is not possible. Are you aware if OpenFOAM (or any other open source CFD code) is able to compute thermophysical (mainly density, conductivity, viscosity and specific heat) properties from the cell's pressure and temperature (or any two other state properties, really)?
What about enthalpy in the DEFINE_SPECIFIC_HEAT, does it pass any kind of information on the cell's enthalpy? Because I could use that to calculate specific heat. But anyways, I am guessing Fluent does not calculate enthalpy as a function of pressure either. Thanks for your support! |
I don't know about what OpenFoam or other codes can do in this aspect...
Fluent makes the assumption that specific heat is completely determined by temperature (and the mass fractions if you have a mixture). As far as I see, there is no possibility to remove that assumption. Usually, this works fine, although there might be situations (I guess at extremely high pressures?) where the pressure is also relevant. By the way, you can not use the enthalpy in that UDF to get any information about the cell, because the enthalpy is output of the function, not input. Your udf should also calculate the enthalpy based on the specific heat that it provides. |
That is what I thought.
In my case, the specific heat dependance on pressure is extremely relevant, as I am going to work very close to the critical point, where there's a sudden jump in specific heat with respect to pressure (or density, or any other state property, for that matter). I will consider coding a CFD code myself for now, at least for some simple geometries. Thanks for your support! |
Hi,
Maybe you could use the DEFINE_PROPERTY macro? I guess you can retrieve cell pressure and temperature within this macro. |
Altough the DEFINE_PROPERTY does retrieve cell information, it is not possible to define specific heat with this macro (when choosing user-defined specific heat in the Materials tab, it is not possible to choose from DEFINE_PROPERTY UDFs).
|
That's a shame. Once again, that kind of problem reflects how it can be complicated to do simple things in Fluent. That's the kind of stuff that takes 5 minutes to figure out in Comsol for example.
|
Hi,
I'm having a similar problem and I would like to know if this issue has been solved. If so, how was it solved? Thank you. |
Hi!
I also came across the same problem, so how did you solve the 'undefined symbol' problem in parallel condition? Thanks! |
show your code
best regards |
The code has been deleted.
|
when did you get this error? are you sure your code is compiled well without errors?
best regards |
The code could be compiled and implemented well on my workstation. However, on the super computer Linux platform, there's an error like this when the EXECUTE_AT_END macro is implemented after the first step calculation.
Thanks! |
I have no experience on simulations in Linux. You do better to ask technical support from Ansys
From my point of view, it seems, there are some problems with mpi libraries on linux machine. Try to remove EXCHANGE_SVAR_MESSAGE_EXT macro and check, how it works. Frankly speaking, I'm not sure, that you really need it here best regards |
All times are GMT -4. The time now is 15:43. |