CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   the DEFINE_MASS_TRANSFER is only a interpreting udf IN ANSYS 14.0 (http://www.cfd-online.com/Forums/fluent-udf/105917-define_mass_transfer-only-interpreting-udf-ansys-14-0-a.html)

fangdian August 13, 2012 05:07

the DEFINE_MASS_TRANSFER is only a interpreting udf IN ANSYS 14.0
 
HI
when i use the DEFINE_MASS_TRANSFER udf in ansys 14.0 . I compile the .c source file success ,then load it sucess as follows:
.....
(chdir "libudf")()
(chdir "ntx86\2ddp")()
# Generating ud_io1.h
test.c
# Generating udf_names.c because of makefile test.obj
udf_names.c
# Linking libudf.dll because of makefile user_nt.udf udf_names.obj test.obj
Microsoft (R) Incremental Linker Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
正在创建库 libudf.lib 和对象 libudf.exp
Done.
Opening library "F:\rongdi\seconddimension\libudf"...
Library "F:\rongdi\seconddimension\libudf\ntx86\2ddp\libud f.dll" opened
cell_vis
liq_gas_source
Done.
.....
But when i use the liq_gas_source in Multiphase Model dialog box , a error found in the messgage box:
Error: NO user-defined function have been loaded
Error object: #f

when i use it with Interpreting UDFs, it is OK!
on the other time, I use it with compile udf in the ansys 12.1. it is also ok!
why?
thanks!
fangdian


PS: my .c source file>
#include "udf.h"

DEFINE_PROPERTY(cell_vis,cell,thread) /*viscosity*/
{real ga_visy;
real temp=C_T(cell,thread);
if(temp<=1773)
ga_visy=2;
else if(temp<=1853)
ga_visy=1e-3*(119.003-0.061*temp);
else if(temp<=1873)
ga_visy=1e-3*(10.603-0.0025*temp);
else if(temp<=1973)
ga_visy=1e-3*(36.263-0.0162*temp);
else
ga_visy=3e-3;
return ga_visy;
}

DEFINE_MASS_TRANSFER(liq_gas_source,cell,thread,fr om_index,from_species_index,to_index,to_species_in dex)
{
real m_lg;
real T_frost=1773;
Thread *liq = THREAD_SUB_THREAD(thread, from_index);
Thread *soild = THREAD_SUB_THREAD(thread, to_index);
m_lg = 0.;
if (C_T(cell, soild) >= T_frost)
{
m_lg = -0.1*C_VOF(cell,soild)*C_R(cell,soild)*fabs(C_T(cel l,soild)-T_frost)/T_frost;
}
if ((m_lg == 0. ) && (C_T(cell, liq) <= T_frost))
{
m_lg = 0.1*C_VOF(cell,liq)*C_R(cell,liq)*fabs(T_frost-C_T(cell,liq))/T_frost;
}
return (m_lg);
}

msaeedsadeghi February 14, 2013 09:37

I have asked Ansys Fluent support team. The problem is with the cracked version of fluent. In licensed version the compiled UDF can be easily selected in interaction menu.

murdock88 February 15, 2013 03:57

i have same problem in mass transfer udf i solved using these formulas:

1)Do not make copy pastes because of character set of program it gives direct errors

2)Do not use thread pointer like this

Thread *liq = THREAD_SUB_THREAD(thread, from_index);
Thread *soild = THREAD_SUB_THREAD(thread, to_index);

instead use thread pointer like this

Thread *liq;
liq = THREAD_SUB_THREAD(thread, from_index);
Thread *soild;
solid = THREAD_SUB_THREAD(thread, to_index);

i have solved my problem using these tips.

Have a good day.

msaeedsadeghi February 15, 2013 04:10

Are you running in licensed version of Fluent?
Our problem is that the compiled UDF can not be hooked in interaction menu. It says "No user-defined functions have been loaded", but I have really compiled and loaded it.
I am highly professional in UDF writing but couldn't solve this problem yet.

godspeedsam September 12, 2014 02:08

Quote:

Originally Posted by msaeedsadeghi (Post 407955)
Are you running in licensed version of Fluent?
Our problem is that the compiled UDF can not be hooked in interaction menu. It says "No user-defined functions have been loaded", but I have really compiled and loaded it.
I am highly professional in UDF writing but couldn't solve this problem yet.


Does anyone solve the problem?
I have the same problem running in licensed version of Fluent.

coglione September 12, 2014 04:28

UDF-Manual 2.4.6. DEFINE_MASS_TRANSFER:

By default, FLUENT will attempt to hook mass transfer UDFs defined using DEFINE_LINEARIZED_MASS_TRANSFER. In order to hook a DEFINE_MASS_TRANSFER UDF to FLUENT, you must first issue the TUI command solve/set/expert and enter no at the Linearized Mass Transfer UDF? prompt.

cheers

godspeedsam September 12, 2014 04:33

Quote:

Originally Posted by coglione (Post 510070)
UDF-Manual 2.4.6. DEFINE_MASS_TRANSFER:

By default, FLUENT will attempt to hook mass transfer UDFs defined using DEFINE_LINEARIZED_MASS_TRANSFER. In order to hook a DEFINE_MASS_TRANSFER UDF to FLUENT, you must first issue the TUI command solve/set/expert and enter no at the Linearized Mass Transfer UDF? prompt.

cheers

Thank you. It works.

cheersend April 19, 2016 03:53

my once success
 
I created a new .cs file in the VS, and saved it as x.c (C program file). Then I copied the udf code into the programming text frame and deleted some of the spaces in the udf (maybe actually they are not all real space). Amazingly, the x.c works.

I don't know which step is the key, but it can be a bit of help.


All times are GMT -4. The time now is 00:43.