CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Fluent UDF and Scheme Programming

Define- mass

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   November 13, 2013, 23:38
Wink Define- mass
  #1
Member
 
mehdimoradi
Join Date: Jun 2013
Posts: 50
Rep Power: 4
mehdimoradi. is on a distinguished road
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.

Last edited by mehdimoradi.; November 17, 2013 at 08:56.
mehdimoradi. is offline   Reply With Quote

Old   November 18, 2013, 05:21
Default
  #2
Member
 
Mohsen
Join Date: Jul 2012
Posts: 40
Rep Power: 4
smhosseini is on a distinguished road
Hi mehdi,
Compile your UDF after some iterate and then use it.
smhosseini is offline   Reply With Quote

Old   November 18, 2013, 05:45
Default
  #3
Member
 
mehdimoradi
Join Date: Jun 2013
Posts: 50
Rep Power: 4
mehdimoradi. is on a distinguished road
Quote:
Originally Posted by smhosseini View Post
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.
mehdimoradi. is offline   Reply With Quote

Old   November 18, 2013, 07:11
Default
  #4
Member
 
Mohsen
Join Date: Jul 2012
Posts: 40
Rep Power: 4
smhosseini is on a distinguished road
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.
smhosseini is offline   Reply With Quote

Old   November 18, 2013, 12:27
Default
  #5
Member
 
mehdimoradi
Join Date: Jun 2013
Posts: 50
Rep Power: 4
mehdimoradi. is on a distinguished road
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
mehdimoradi. is offline   Reply With Quote

Old   November 18, 2013, 13:43
Default
  #6
Member
 
Mohsen
Join Date: Jul 2012
Posts: 40
Rep Power: 4
smhosseini is on a distinguished road
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.
smhosseini is offline   Reply With Quote

Old   November 18, 2013, 14:34
Default
  #7
Member
 
mehdimoradi
Join Date: Jun 2013
Posts: 50
Rep Power: 4
mehdimoradi. is on a distinguished road
Thanks alot ag.Mohsen.
mehdimoradi. is offline   Reply With Quote

Old   November 19, 2013, 13:05
Default
  #8
Member
 
mehdimoradi
Join Date: Jun 2013
Posts: 50
Rep Power: 4
mehdimoradi. is on a distinguished road
Quote:
Originally Posted by smhosseini View Post
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
mehdimoradi. is offline   Reply With Quote

Old   November 19, 2013, 13:38
Default
  #9
Member
 
Mohsen
Join Date: Jul 2012
Posts: 40
Rep Power: 4
smhosseini is on a distinguished road
Did you install every requirements? Please read this link:
Error: The UDF library you are trying to load (libudf) is not compiled for 2d on the
smhosseini is offline   Reply With Quote

Old   November 20, 2013, 12:17
Default
  #10
Member
 
mehdimoradi
Join Date: Jun 2013
Posts: 50
Rep Power: 4
mehdimoradi. is on a distinguished road
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??

Last edited by mehdimoradi.; November 20, 2013 at 13:45.
mehdimoradi. is offline   Reply With Quote

Old   November 20, 2013, 14:28
Default
  #11
Member
 
Mohsen
Join Date: Jul 2012
Posts: 40
Rep Power: 4
smhosseini is on a distinguished road
Is your UDF in the same place with your case file?

Last edited by smhosseini; November 20, 2013 at 16:34.
smhosseini is offline   Reply With Quote

Old   November 20, 2013, 14:54
Default
  #12
Member
 
mehdimoradi
Join Date: Jun 2013
Posts: 50
Rep Power: 4
mehdimoradi. is on a distinguished road
Quote:
Originally Posted by smhosseini View Post
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?
mehdimoradi. is offline   Reply With Quote

Old   November 20, 2013, 16:38
Default
  #13
Member
 
Mohsen
Join Date: Jul 2012
Posts: 40
Rep Power: 4
smhosseini is on a distinguished road
Your UDF must be in the same folder with your case.
I'm sorry, what I said you about Nmake was not correct.
smhosseini is offline   Reply With Quote

Old   November 21, 2013, 02:07
Default
  #14
Member
 
mehdimoradi
Join Date: Jun 2013
Posts: 50
Rep Power: 4
mehdimoradi. is on a distinguished road
Thak you Mohsen;
these two files are in the same folder.
mehdimoradi. is offline   Reply With Quote

Old   November 21, 2013, 02:26
Default
  #15
Member
 
Mohsen
Join Date: Jul 2012
Posts: 40
Rep Power: 4
smhosseini is on a distinguished road
Did you start fluent from visual studio command prompt?
smhosseini is offline   Reply With Quote

Old   November 21, 2013, 03:51
Default
  #16
Member
 
mehdimoradi
Join Date: Jun 2013
Posts: 50
Rep Power: 4
mehdimoradi. is on a distinguished road
yes
i started fluent from VS command prompt 2012.
mehdimoradi. is offline   Reply With Quote

Old   November 21, 2013, 11:30
Default
  #17
Senior Member
 
Join Date: Nov 2013
Posts: 670
Rep Power: 9
pakk is on a distinguished road
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.
pakk is offline   Reply With Quote

Old   November 21, 2013, 15:12
Default
  #18
Member
 
mehdimoradi
Join Date: Jun 2013
Posts: 50
Rep Power: 4
mehdimoradi. is on a distinguished road
Quote:
Originally Posted by pakk View Post
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. is offline   Reply With Quote

Old   November 21, 2013, 15:28
Default
  #19
Member
 
mehdimoradi
Join Date: Jun 2013
Posts: 50
Rep Power: 4
mehdimoradi. is on a distinguished road
Excues me another question; Cannot interpret this udf anyway?
mehdimoradi. is offline   Reply With Quote

Old   November 22, 2013, 04:20
Default
  #20
Senior Member
 
Join Date: Nov 2013
Posts: 670
Rep Power: 9
pakk is on a distinguished road
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.
pakk is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
using define mass transfer udf for cavitation Komon Fluent UDF and Scheme Programming 10 December 23, 2014 02:00
mass flow inlet and pressure outlet with target mass flow rate Zigainer FLUENT 10 January 5, 2013 22:51
Robin B.C. Yu FLUENT 3 May 27, 2012 04:19
UDF problem libia87 Fluent UDF and Scheme Programming 1 May 4, 2012 21:49
DEFINE MASS TRANSFER Maciej FLUENT 0 November 27, 2005 21:33


All times are GMT -4. The time now is 13:31.