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/)
-   -   Define- mass (http://www.cfd-online.com/Forums/fluent-udf/126309-define-mass.html)

mehdimoradi. November 13, 2013 23:38

Define- mass
 
Hello;
Recently I have been used below UDF(that exist in UDF manual) for definition of mass transfer in eulerian fram. udf interpreted and hooked successfully but when initializing appear followed error: Why???
/* UDF to define a simple mass transfer based on Saturation
Temperature. The "from" phase is the gas and the "to" phase is the
liquid phase */
#include "udf.h"
DEFINE_MASS_TRANSFER(liq_gas_source,cell,thread,fr om_index,from_species_index, to_index, to_species_index)
{
real m_lg;
real T_SAT = 373.15;
Thread *gas = THREAD_SUB_THREAD(thread, from_index);
Thread *liq = THREAD_SUB_THREAD(thread, to_index);
m_lg = 0.;
if (C_T(cell, liq) >= T_SAT)
{
m_lg = -0.1*C_VOF(cell,liq)*C_R(cell,liq)*
fabs(C_T(cell,liq)-T_SAT)/T_SAT;
}
if ((m_lg == 0. ) && (C_T(cell, gas) <= T_SAT))
{
m_lg = 0.1*C_VOF(cell,gas)*C_R(cell,gas)*
fabs(T_SAT-C_T(cell,gas))/T_SAT;
}
return (m_lg);
}

Error:Error:
FLUENT received fatal signal (ACCESS_VIOLATION)
1. Note exact events leading to error.
2. Save case/data under new name.
3. Exit program and restart to continue.
4. Report error to your distributor.

smhosseini November 18, 2013 05:21

Hi mehdi,
Compile your UDF after some iterate and then use it.

mehdimoradi. November 18, 2013 05:45

Quote:

Originally Posted by smhosseini (Post 462358)
Hi mehdi,
Compile your UDF after some iterate and then use it.

Hi SmHossieni
Thanks for your reply. But Fram donot run anyway to iterate it.

smhosseini November 18, 2013 07:11

When you don't have any udf, you can run your case without mass source, then you should compile your UDF after some iteration or one time step and solve your problem with mass source. If the fluent don't start the iteration, you have another problem, for example in your boundary condition or initial condition.

mehdimoradi. November 18, 2013 12:27

Hi;
Thanks for your complete answer. It may be through interpreting of UDF. because i cannot compile it. Please help me about compilation precedure of a udf. in udf manual sayed about MS visual studio software for compiling of udfs. nonetheless it donot work.
what sugestions do you have?
thanks

smhosseini November 18, 2013 13:43

If you use the Fluent on Windows, at first you should install visual studio for compiling a UDF because it needs the c++ compiler. You'll need another small software that I cannot remember its name, but don't worry, you can find a lot of information about it on this forum and web. You cannot interpret this UDF and you have to compile it.

mehdimoradi. November 18, 2013 14:34

Thanks alot ag.Mohsen.

mehdimoradi. November 19, 2013 13:05

Quote:

Originally Posted by smhosseini (Post 462426)
If you use the Fluent on Windows, at first you should install visual studio for compiling a UDF because it needs the c++ compiler. You'll need another small software that I cannot remember its name, but don't worry, you can find a lot of information about it on this forum and web. You cannot interpret this UDF and you have to compile it.

Hi Mohsen;
After reading forum and web, i can not compile udf.
it results "error: the udf library you are trying to load(libudf) is not compiled for 2ddp on current platform(ntx86). the system cannot find the file specified."
Can you help me to solve this troublous problem?
OS is win7 (32bit).
thanks

smhosseini November 19, 2013 13:38

Did you install every requirements? Please read this link:
http://www.cfd-online.com/Forums/flu...mpiled-2d.html

mehdimoradi. November 20, 2013 12:17

Hello;
Thanks for your reply.
I read all the forums about my problem. But none of them did not help me.
I did below stages:
1- Install MS visual studio 2012, SDK , framework.
2- Set environment variables as existed in fluent forums.
3- Open fluent from SDK prompt and or Visual studio prompt.
4- In fluent: file/read/case… and then define/user defined/functions/compiled/add source files/build. It is copied successfully.
5- In building appear the below error:
The UDF library you are trying to load (libudf) is not compiled for 2ddp on the curent platform (ntx86).
The system cannot find the file specified.
C:\program files\ANSYS Inc\v140\fluent
tbin
tx86\libudf\ntx86\2ddp\libudf.dll
this is exactly that error is appeared.
Although in my system tbin file is not existed rather ntbin is in sub root. I don’t know why fluent has applied tbin instead of ntib. It is also about tx86(rather ntx86) .
Is someone who can help me??

smhosseini November 20, 2013 14:28

Is your UDF in the same place with your case file?

mehdimoradi. November 20, 2013 14:54

Quote:

Originally Posted by smhosseini (Post 462769)
Is your UDF in the same place with your case file?
Do you have Nmake? I think Nmake is necessary for compiling UDF on Windows OS.

How can check it?

smhosseini November 20, 2013 16:38

Your UDF must be in the same folder with your case.
I'm sorry, what I said you about Nmake was not correct.

mehdimoradi. November 21, 2013 02:07

Thak you Mohsen;
these two files are in the same folder.

smhosseini November 21, 2013 02:26

Did you start fluent from visual studio command prompt?

mehdimoradi. November 21, 2013 03:51

yes
i started fluent from VS command prompt 2012.

pakk November 21, 2013 11:30

I see that Fluent looks for
Quote:

C:\program files\ANSYS Inc\v140\fluent
tbin

tx86\libudf\ntx86\2ddp\libudf.dll

But it should look for
Quote:

C:\program files\ANSYS Inc\v140\fluent\ntbin\ntx86\libudf\ntx86\2ddp\libudf.dll
It looks like "\n" is replaced by a newline. Which is a common substitution, but it should not happen here.

This has nothing to do with your udf... My best guess is that it has something to do with the installation of fluent. You use a system with dos-based directories (using "\" to separate directory levels), while Fluent thinks you are using a unix-based system (using "/" to separate directory levels). The best thing you can do is contact whoever installed Fluent on your computer.
I have no experience in installing Fluent, so my guess may be wrong.

mehdimoradi. November 21, 2013 15:12

Quote:

Originally Posted by pakk (Post 462948)
I see that Fluent looks for
[FONT=Calibri][SIZE=3]
But it should look for
[FONT=Calibri][SIZE=3]
It looks like "\n" is replaced by a newline. Which is a common substitution, but it should not happen here.

This has nothing to do with your udf... My best guess is that it has something to do with the installation of fluent. You use a system with dos-based directories (using "\" to separate directory levels), while Fluent thinks you are using a unix-based system (using "/" to separate directory levels). The best thing you can do is contact whoever installed Fluent on your computer.
I have no experience in installing Fluent, so my guess may be wrong.

Thanks. I solved this problem by excecutting the setenv.exe file(in fluent subroot) and setting environment variables automatically. after completing the compilation, i decide to hook this UDF. therefore go to the interaction box (in defining phases). when i want to select compiled udf below error was appeared:
no user defined function have been loaded
whereas udf loaded completely in compiling step!!!!!!!!
Can you solve this problem?

mehdimoradi. November 21, 2013 15:28

Excues me another question; Cannot interpret this udf anyway?

pakk November 22, 2013 04:20

If I try to compile your code, I see
Code:

test.c
..\..\src\test.c(5) : error C2146: syntax error : missing ')' before identifier 'om_index'
..\..\src\test.c(5) : error C2061: syntax error : identifier 'om_index'
..\..\src\test.c(5) : error C2059: syntax error : ';'
..\..\src\test.c(5) : error C2059: syntax error : ','
..\..\src\test.c(5) : error C2059: syntax error : ')'
Done.

If I try to interpret it, I see
Code:

Error: .\test.c: line 5: parse error.
Don't you get similar lines when you try it? They give hints about what is wrong.


All times are GMT -4. The time now is 22:55.