|
[Sponsors] |
November 30, 2017, 15:04 |
UDF for Density
|
#1 |
New Member
Priyank
Join Date: Sep 2017
Posts: 16
Rep Power: 9 |
Hello I want to make UDF for density in which density will depend on temperature , pressure and also on species..here I am attaching my density formula and my UDF ...Please help thank you in adavnce
|
|
November 30, 2017, 15:05 |
|
#2 | |
New Member
Priyank
Join Date: Sep 2017
Posts: 16
Rep Power: 9 |
Quote:
#include "mem.h" #include " materials.h" DEFINE_PROPERTY(dust, c, t) { real rho_s,rho_g,alphav,dT,dP,totaly,al,o2,al2,n2,Dust_ rho; rho_g=1.225; rho_s=2700; alphav=0.0001859; totaly=0; dT=C_T(c,t); dP=C_P(c,t); mixture_species_loop (m,sp,i) al=C_YI(c,t,1); o2=C_YI(c,t,2); al2=C_YI(c,t,3); n2=C_YI(c,t,4); totaly=(al/26.9815)+(o2/31.9988)+(al2/101.96)+(n2/28.0134); dust_rho = (1+alphav*((rho_s/rho_g)-1))*(dP/(dT*totaly*8314.34)); return dust_rho; } |
||
December 1, 2017, 04:41 |
|
#4 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
So, you want a UDF, and you have a UDF. What is the problem that you want us to solve?
|
|
December 1, 2017, 05:57 |
|
#5 | |
New Member
Priyank
Join Date: Sep 2017
Posts: 16
Rep Power: 9 |
Quote:
2. The probable reason of my error is extracting mass fraction... Hoping for your reply Thank you |
||
December 1, 2017, 06:48 |
|
#6 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
If you want help, be specific! Don't let us guess what you need help with!
So something is wrong with your UDF. You get errors. But be specific: which errors??? Show them here! If there are too many errors to show, the first ones are usually the most relevant. And about compiling or interpreting: if possible, compile. |
|
December 1, 2017, 07:00 |
|
#7 | |
New Member
Priyank
Join Date: Sep 2017
Posts: 16
Rep Power: 9 |
Quote:
1. While interpret...It is showing structure reference not implemented... 2. While compile..It is showing the system can not find the path specified... This are the problem related to the UDF error.. Other then this I am facing problem while writing a code. 1. I don't understand how to extract value for the mass fraction..As it is required in density formula. Hope now you understand my problem..Thank you in advance |
||
December 1, 2017, 08:40 |
|
#8 |
Member
Kirill Borodin
Join Date: Mar 2016
Posts: 60
Rep Power: 10 |
Hello! Study user defined real gas model in the udf guide. Only in such a way you can hook your own density law
|
|
December 1, 2017, 09:52 |
|
#9 | |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Quote:
|
||
December 1, 2017, 11:42 |
|
#10 |
New Member
Priyank
Join Date: Sep 2017
Posts: 16
Rep Power: 9 |
Hello....This is error I am getting while compiling
The system can not find the file specified. The UDF library you are trying to load (D:\fluent _thesis \ dp0\ FFF\Fluent\libudf) is not compiled for 2ddp on the current platform (win64). Thank you in advance Last edited by Priyank Mehta; December 1, 2017 at 13:50. |
|
December 1, 2017, 13:51 |
|
#11 |
New Member
Priyank
Join Date: Sep 2017
Posts: 16
Rep Power: 9 |
The system can not find the file specified.
The UDF library you are trying to load (D:\fluent _thesis \ dp0\ FFF\Fluent\libudf) is not compiled for 2ddp on the current platform (win64). |
|
December 1, 2017, 14:32 |
|
#12 |
Senior Member
Micael
Join Date: Mar 2009
Location: Canada
Posts: 157
Rep Power: 18 |
At first glance, there is at least a problem with "mixture_species_loop"
It needs brackets Code:
mixture_species_loop(m,sp,i) { /* some instruction goes here */ } |
|
December 4, 2017, 06:03 |
|
#13 | |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Quote:
|
||
December 5, 2017, 14:02 |
|
#14 |
New Member
Priyank
Join Date: Sep 2017
Posts: 16
Rep Power: 9 |
Hello thank you for suggestion
please help me to solve this error Received a fatal Signal (segmental fault) Error object: #f #include "udf.h" DEFINE_PROPERTY(dust,c,t) { int i; float dT,dP,r,al,o2,al2,n2; float Mw_i(int i); Material *sp; float rho_g=1.225; float rho_s=2700; float alp=0.0001859; float sum=0.0; dT=C_T(c, t); dP=C_P(c, t); mixture_species_loop(THREAD_MATERIAL(t),sp,i) { al=C_YI(c,t,1)/26.9815; o2=C_YI(c,t,2)/31.9988; al2=C_YI(c,t,3)/101.96; n2=C_YI(c,t,4)/28.0134; sum=al+o2+al2+n2; } r = (1+alp*((rho_s/rho_g)-1))*(dP/(sum*dT*8314.34)); return r; } hoping for reply thank you |
|
December 5, 2017, 16:26 |
|
#15 | |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Quote:
Please read carefully: you have to give the error that comes up after you compile. You click 'build', and something comes on your screen. What? Show me! |
||
December 5, 2017, 17:35 |
|
#16 |
Senior Member
Micael
Join Date: Mar 2009
Location: Canada
Posts: 157
Rep Power: 18 |
How many species do you have defined? If you have 4, then C_YI(c,t,4) is not going to work as index starts at zero (fourth species would be index 3).
|
|
December 6, 2017, 02:33 |
|
#17 |
New Member
Priyank
Join Date: Sep 2017
Posts: 16
Rep Power: 9 |
Thank you, Micael...this is very helpful and now it is working.
Thank you very much "pakk" and "Micael" for the help One more question I have while using dP=C_P(c, t); which pressure it will give static pressure of that cell or total pressure (operating pressure + over pressure) |
|
December 6, 2017, 05:00 |
|
#18 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Static pressure.
To get absolute pressure, do Code:
dP=C_P(c, t)+RP_Get_Float("operating-pressure"); |
|
December 6, 2017, 07:32 |
|
#19 |
New Member
Priyank
Join Date: Sep 2017
Posts: 16
Rep Power: 9 |
Thank you pakk
So what is the difference between dP=C_P(c, t)+ p_operating; dP=C_P(c, t)+RP_Get_Float("operating-pressure"); where o_operating I will define it as 101325 Pa Thank you |
|
December 6, 2017, 08:07 |
|
#20 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
The difference is that RP_Get_Float("operating-pressure") takes the value that you put into the Fluent simulation. If you change it in the Fluent set-up, it will also be changed in the UDF. So fewer chances of making a mistake.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF Compilation Error - Loading Library - COMMON Problem! Help! | robtheslob | Fluent UDF and Scheme Programming | 8 | July 24, 2015 01:53 |
Parallelize UDF? Which kind of UDF? | Lilly | FLUENT | 5 | March 25, 2014 03:05 |
Help! Delete the UDM codes in the UDF | Messi | Fluent UDF and Scheme Programming | 2 | January 28, 2014 10:01 |
UDF parallel error: chip-exec: function not found????? | shankara.2 | Fluent UDF and Scheme Programming | 1 | January 16, 2012 23:14 |
UDF, UDF, UDF, UDF | Luc SEMINEL | Main CFD Forum | 0 | November 25, 2002 05:01 |