|
[Sponsors] |
UDF for specific heat as function of pressure |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 24, 2014, 14:02 |
UDF for specific heat as function of pressure
|
#1 |
New Member
Gustavo
Join Date: Jun 2013
Posts: 26
Rep Power: 13 |
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" const char* FLUID = "CarbonDioxide"; const real gauge = 101325; //operating pressure in pascal (as defined in fluent) double Props (char*, char, double, char, double, char*); /* other macros here */ DEFINE_SPECIFIC_HEAT(cell_specificHeat, temperature, Tref, enthalpy, yi) { real pressure; Domain *domain = Get_Domain(1); Thread *t; cell_t c; thread_loop_c(t, domain) { begin_c_loop(c, t) { pressure = C_P(c, t); }end_c_loop(c, t) } real specificHeat; specificHeat = Props((char*)"C",'T', temperature, 'P', pressure, (char*)FLUID)*1000; *enthalpy = specificHeat*(temperature-Tref); return specificHeat; } 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 /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 /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 /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 /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 /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 MPI Application rank 1 exited before MPI_Finalize() with status 127 999999 (../../src/mpsystem.c@1172): mpt_read: failed: errno = 104 999999: mpt_read: error: read failed trying to read 4 bytes: Connection reset by peer The fluent process could not be started. I'm running Fluent 14.5.7 on Fedora 19, in case that's relevant. |
|
March 2, 2014, 08:14 |
|
#2 |
New Member
Gustavo
Join Date: Jun 2013
Posts: 26
Rep Power: 13 |
I'm still very interested in this problem, so if someone has a suggestion, it would be more than welcome.
|
|
March 3, 2014, 10:58 |
|
#3 |
Member
Peter Aestas
Join Date: Dec 2013
Posts: 64
Rep Power: 12 |
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. |
|
March 5, 2014, 12:36 |
|
#4 |
New Member
Gustavo
Join Date: Jun 2013
Posts: 26
Rep Power: 13 |
Thanks for your reply. How should I structure the loop in a way I can grab the cell's pressure value? I still have no idea on how to deal with those loops, so if you have any source it would be welcome. The manual doesn't seem to provide a clear explanation.
|
|
March 5, 2014, 13:35 |
|
#5 | |
Senior Member
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 27 |
Quote:
Maybe your idea is good to load external library. |
||
March 5, 2014, 13:56 |
|
#6 | |
New Member
Gustavo
Join Date: Jun 2013
Posts: 26
Rep Power: 13 |
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. |
||
March 6, 2014, 08:24 |
|
#7 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
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. |
|
March 6, 2014, 08:57 |
|
#8 |
New Member
Gustavo
Join Date: Jun 2013
Posts: 26
Rep Power: 13 |
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! |
|
March 6, 2014, 09:27 |
|
#9 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
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. |
|
March 6, 2014, 10:02 |
|
#10 |
New Member
Gustavo
Join Date: Jun 2013
Posts: 26
Rep Power: 13 |
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! |
|
March 9, 2014, 19:57 |
|
#11 |
Senior Member
François Grégoire
Join Date: Jan 2010
Location: Canada
Posts: 392
Rep Power: 17 |
Hi,
Maybe you could use the DEFINE_PROPERTY macro? I guess you can retrieve cell pressure and temperature within this macro. |
|
March 9, 2014, 21:30 |
|
#12 |
New Member
Gustavo
Join Date: Jun 2013
Posts: 26
Rep Power: 13 |
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).
|
|
March 9, 2014, 21:45 |
|
#13 |
Senior Member
François Grégoire
Join Date: Jan 2010
Location: Canada
Posts: 392
Rep Power: 17 |
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.
|
|
June 13, 2017, 14:07 |
|
#14 |
New Member
Estêvão Lannes Tolentino
Join Date: Oct 2016
Posts: 9
Rep Power: 10 |
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. |
|
August 22, 2019, 01:09 |
|
#15 |
New Member
Join Date: Aug 2019
Posts: 6
Rep Power: 7 |
Hi!
I also came across the same problem, so how did you solve the 'undefined symbol' problem in parallel condition? Thanks! |
|
August 22, 2019, 01:36 |
|
#16 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
show your code
best regards |
|
August 22, 2019, 01:42 |
|
#17 |
New Member
Join Date: Aug 2019
Posts: 6
Rep Power: 7 |
The code has been deleted.
Last edited by Allen_ayt; September 2, 2019 at 07:10. |
|
August 22, 2019, 02:15 |
|
#18 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
when did you get this error? are you sure your code is compiled well without errors?
best regards |
|
August 22, 2019, 05:12 |
|
#19 |
New Member
Join Date: Aug 2019
Posts: 6
Rep Power: 7 |
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! |
|
August 22, 2019, 08:10 |
|
#20 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
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 |
|
Tags |
coolprop, fluent, pressure, specific heat, udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Question about heat transfer coefficient setting for CFX | Anna Tian | CFX | 1 | June 16, 2013 07:28 |
[blockMesh] non-orthogonal faces and incorrect orientation? | nennbs | OpenFOAM Meshing & Mesh Conversion | 7 | April 17, 2013 06:42 |
UDF parallel error: chip-exec: function not found????? | shankara.2 | Fluent UDF and Scheme Programming | 1 | January 16, 2012 23:14 |
[blockMesh] BlockMesh FOAM warning | gaottino | OpenFOAM Meshing & Mesh Conversion | 7 | July 19, 2010 15:11 |
Convective Heat Transfer - Heat Exchanger | Mark | CFX | 6 | November 15, 2004 16:55 |