|
[Sponsors] |
how to express the exponential function in a UDF |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 31, 2015, 17:29 |
how to express the exponential function in a UDF
|
#1 |
Member
Mohamed
Join Date: Jan 2011
Location: Algeria
Posts: 46
Rep Power: 15 |
Hi all.
how to express the exponential function in a UDF on FLUENT 15.0, I used the epression exp (value) as UDF following shows: but it does not work. HTML Code:
#include "udf.h"
DEFINE_SPECIFIC_HEAT(my_user_cp, T, Tref, h, yi)
{
real cp;
real Tmelt=299.6;
real cps=1413;
real cpl=1797;
real lf=232000;
if (T <= Tmelt)
{
cp = cps+lf*exp(-0.5*(T-Tmelt)*(T-Tmelt));
}
else /*(T > Tmelt)no need if statement, "else" is enough*/
{
cp = cpl+lf*exp(-0.5*(T-Tmelt)*(T-Tmelt));
}
*h = cp*(T-Tref);
return cp;
}
THank you. |
|
June 1, 2015, 09:20 |
|
#2 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
"it does not work." is not very useful. To help you, more information would be better.
Does it compile? Do you get errors? Do you get warnings? Do you get results at all? What do you get for results, what do you expect? |
|
June 1, 2015, 12:17 |
|
#3 | |
Member
Mohamed
Join Date: Jan 2011
Location: Algeria
Posts: 46
Rep Power: 15 |
Quote:
So. I compiled the UDF. No errors? no warnings? I have not achieved the desired results by that UDF For the results, it did not work for variable specific heat. |
||
June 1, 2015, 13:20 |
|
#4 | |
Member
Join Date: Jul 2013
Posts: 80
Rep Power: 13 |
Quote:
You are not the first one to give this approach to simulate multiphase flow, check this post (also answered by me, by the way) http://www.cfd-online.com/Forums/flu...em-cp-udf.html I bet you have a similar problem as related in that post. Cp variable is quite odd in Fluent: it has its particular UDF instead a "classic" DEFINE_PROPERTY macro. That because the solver integrates Cp and get enthalpy, although it is no that trivial indeed. I think that your (only) solution is to use the multiphase models of Fluent (VOF, Euler, etc), and if you eventually need an UDF, you should use a DEFINE_SOURCE and DEFINE_MASS_TRANSFER. You will have many posts in this forum dealing with this If you want to give a last try to your approach, you could drop the energy relaxation factor. It is set as 1 as default, try 0.8 or lower. Cheers. |
||
June 1, 2015, 16:08 |
|
#5 | |
Member
Mohamed
Join Date: Jan 2011
Location: Algeria
Posts: 46
Rep Power: 15 |
Quote:
|
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF for specific heat as function of pressure | ghobold | Fluent UDF and Scheme Programming | 20 | August 22, 2019 09:19 |
using METIS functions in fortran | dokeun | Main CFD Forum | 7 | January 29, 2013 05:06 |
[blockMesh] error message with modeling a cube with a hold at the center | hsingtzu | OpenFOAM Meshing & Mesh Conversion | 2 | March 14, 2012 10:56 |
UDF: exporting a variable between two DEFINE function | Carlo | FLUENT | 3 | August 19, 2009 13:21 |
Problem with rhoSimpleFoam | matteo_gautero | OpenFOAM Running, Solving & CFD | 0 | February 28, 2008 07:51 |