Thank Computer guy
i gone through u r suggestions..The second point was not clear for me..can u please describe in detail??
|
Manohar:
1) Numerical integration: http://en.wikipedia.org/wiki/Numerical_integration 2) Custom field functions in Fluent: http://my.fit.edu/itresources/manual...g/node1221.htm If you have an analytical representation of Peq as a function of temperature, you will be able to (without a UDF) have Fluent calculate it for you (#2). You can, under the contours of the solution, examine every custom field function. You can also output the value of the custom field function using a surface or volume monitor. Then, using #1, you can derive a value for C as a function of time. Regards and Happy New Year, ComputerGuy Quote:
|
ِDear ComputerGuy
I tried it but there are some errors when I want to initialize ,of course when I hook another udfs except udfs of viscous and inertial resistances , there is not any error and its done , I think maybe its error is related to C_UDMI(c,t,0), in fluent ,in fluid panel there are 2 directions of viscous and inertial resistances of course I give the same value to both of them while I assume porosity is constant , I saw C_POR in a literature which related to porous media ! Can you some advice about it Happy New Year cheers |
This is unchecked. It doesn't use C_UDMI, and is not as efficient as it could be. However, I think it does what you want. I have looked through the Fluent manual and can't find C_POR, so if you must use it, I'm afraid you're on your own. Let us all know where you find it and if it works.
Code:
#include "udf.h" |
Dear ComputerGuy
I owe thanks to you whose advice and guidance have helped me so much in my project . Really I had to change your code a little , I just eliminated : C_UDMI(c,t,0)=F_PROFILE(c,t,i) , F_PROFILE(c,t,i)=c_2, F_PROFILE(c,t,i)=c_1; from your code andafter that it ran. I don’t know why with these while in initialization , fluent reports error But without these there is not any problem! By the way I don’t have any bias to use C_POR ! I just saw it in a literature . Thank you and wish the best for you . Sarah |
Sarah,
I'm glad it worked. I left C_UDMI(c,t,0)=F_PROFILE(c,t,i); in the code accidentally, and you're right to take it out. However, in the C1 and C2 code, if you take out the line F_PROFILE(c,t,i)=c_2; and F_PROFILE(c,t,i)=c_1;, Fluent will not change your viscous and inertial resistances, and the result will probably not be correct according to the physics you're trying to impose. Make sure you double-check your results. Also, make sure you change Dp; I have assumed a particle diameter of 100 microns, but surely your particles are of a different size. Regards, ComputerGuy Quote:
|
Dear ComputerGuy
You are right but in your code , inside loops you indicated c_1 and c_2 instead of F_PROFILE , in inverse of this statement yes you are right . really how can I chek the result of udfs ? and If I want to plot temp of particles of porous medium how can I specify its zone surface? Yes, I changed the value of Dp to 0.06 . Best regards Sarah |
Hi everyone,
I'm trying simulation porous media in rectangular channel, but the result isn't suitable with any research. So, would you help me. I wish someone can check my simulation and give some reports if there is something wrong. Thank you for your help. Please send your e-mail, than i will send you my works to to your email. my e-mail: oky.andytya.net@gmail.com Regrads, OKY Andytya P note: I use ANSYS Fluent 6.3 [CFD] |
Molixu,
First: You have posted this question in several threads. My suggestion, to help those who are trying to help you, is to please stop posting the same question to multiple threads. Now, to answer your question about cumulative heat. Try the code below. Before you start your simulation, run the On Demand macro UDMInit. You need to have 1 user defined memory location activated in Fluent. I haven't tried this code, so there may be syntax errors, but it should work with minor modifications. ComputerGuy Code:
/*ComputerGuy Code Jan82012*/ |
Really sorry for posting the same question..I was too worried about my problem...:confused: Thank you for your reply.
What I need is the total heat obtained in the domain of each step, acummulating them until a certain value and than change the boundary condition. I wrote the codes as follows, write Q_tot to a txt file and read it before using . But I found that in the txt file, the figure is always zero. and the BC didn't act in the way I want. Could you please give me some advice? Thanks a lot! Code:
#include "udf.h" Quote:
|
Inlet mass flow dependent on pressure at previous time step
Hello,
I am trying to simulate a flow in which the inlet mass flow rate depends on the pressure at previous time step in the domain. I tried implementing this in a udf using C_P_M1(c, t). But interpretation of udf always leads to segmentation violation. Can someone suggest a way to implement this using udf. Thanks, Varun. |
Quote:
Hope this could help. |
CFD Simulation of Gas turbine Engine_ Combustion Chamber
Hello everyone,
Can anyone suggest me a good document/book to start with simulation in gas turbine engine (combustion chamber). I am planning to do the post processing in FLUENT. Is Openfoam software better than Fluent for combustion purpose? Also, I intend to use C language to develop the code. Does Fluent take code written in Fortran. And which one is better? Fortran or C? Please help me as I'm a beginner in this field. |
I am planning to code advance combustion model and then link it to fluent/openfoam to simulate combustion chamber in a gas turbine.
I have certain parts of the code written in Fortran. Is there anyway I can directly use the fortran code in FLUENT? Do I need to convert all the FORTRAn code into C language to be able to use it in FLUENT? Any method? Please help. |
2D position dependent heat source
hi,
I need to write an UDF for 2D heat source (on a face).The source has a parabolic position dependent & time independent function (source=x*x+2*x+1 ). Slould I use C-CENTROID or F-CENTROID in my programm?What is wrong with my programm? With thanks & regards. #include "udf.h" DEFINE_SOURCE(energy_source,c,t,dS,eqn) { real x[ND_ND]; real source; cell_t c; begin_c_loop(c,t) { C_CENTROID(x,c,t); source = x[0]*x[0]+2*x[0]+1; dS[eqn] = 2*x[0]+2; return source; } end_c_loop(c,t) } |
gas turbine combustor
Quote:
i think you could able simulate this model, in OpenFoam, more easy than fluent, and OF is much better than fluent. your question is wrong, that you say witch one is better c or fortran both are language for writing program, if you want to use fluent you should write udf function, basically it use c. but Openfoam is much simpler than all. i myself now working of modeling one dimensional gas turbine combustor and i must use FORTRAN, have you ever seen ATEC code? many regards. Reza khodadadi. |
problem with implementing porosity variation as a function of distance from the wall
Hi all,
It looks like you were able to solve a similar problem earlier. Now I am also trying to implement porosity variation as a function of distance from the wall for a packed bed reactor. My UDF has separate functions to define profiles for interfacial heat transfer coefficient, porosity and the specific surface area. I've pasted my code herewith. I am using this .c file to load for the profiles of porosity, heat transfer coefficient and the specific surface area in FLUENT 14 with a thermal non-equilibrium model selected for the porous medium. I seem to be getting an error message when I load the porosity profile function. It says - error - invalid argument [1] wrong type. Again, the .c file compiles and builds without any issues but pops this up when I try to use the porosity function.. Would you by any chance know what the bug is? Any help would be much appreciated. /************************************************** *** This is a UDF to calculate heat transfer coefficient and interfacial area for the packed bed reactor example provided in FLUENT so that the 2 temperature non-equilibrium model can be put to use ************************************************** ******/ #include "udf.h" #define d_b 0.008 /* mean diameter of particles */ real A_V_sphere = 6.0/d_b; /* area-to-volume ratio of a sphere*/ DEFINE_PROFILE(Heat_trans_coeff,t,i) { cell_t c; real Nu,Re,Pr; real dens, visc; /*Fluid*/ real cond, cp; /* Fluid*/ real eps_b; /*Porosity of the bed*/ begin_c_loop(c,t) { eps_b = C_POR(c,t); /*Porosity fluid*/ dens = C_R(c,t); /*Density of fluid*/ visc = C_MU_L(c,t); /*Viscosity fluid*/ cond = C_K_L(c,t); /*Conductivity fluid*/ cp = C_CP(c,t); /*Specific heat fluid*/ Re = ND_MAG(C_U(c,t),C_V(c,t),C_W(c,t))*d_b*dens*eps_b/visc ; /*Reynolds number has been calculated based on pore velocity*/ Pr = cp*visc/cond ; Nu = 2.+ 1.1 * pow(Re,0.6) * pow(Pr,1./3.); F_PROFILE(c,t,i) = Nu*cond/d_b ; } end_c_loop(c,t) } DEFINE_PROFILE(Interfacial_Area_Density,t,i) { cell_t c; real eps_b; real A_b_V; /* area-to-volume ratio or the required specific surface area */ begin_c_loop(c,t) { eps_b = C_POR(c,t); F_PROFILE(c,t,i) = (1.-eps_b)*A_V_sphere; } end_c_loop(c,t) } DEFINE_PROFILE(porosity_function,t,i) { cell_t c; real x[ND_ND]; /*This will hold the position vectors*/ real y; real a1; real a2=6; /*to specifiy the porosity variation function*/ real eps_inf=0.37; real eps; a1 = (1./eps_inf)-1; begin_c_loop(c,t) { C_CENTROID(x,c,t); y = (H - x[1])/ d_b ; eps = eps_inf*(1. + a1*exp(-1*a2*y)); F_PROFILE(c,t,i) = eps; } end_c_loop(c,t) } |
Quote:
DEFINE_SOURCE(energy_source,c,t,ds,eqn) { real x=1.0; ds[eqn]=0.3*cos(0.3*x); return sin(0.3*x) ; } |
Hi,
I'm writing an udf to assign heat flux profile on the outer wall of (symmetric right hand side half section) of a 3D annular fluid domain of 33mm radius. This fluid is flowing through a 35 mm radius and 8 m long horizontal tube. The heat flux (q) profile varies along the circumference (horizontal x & vertical y direction) of the tube, and assumed constant & steady state along the length (horizontal z direction). Coordinates of the axis of rotation of the tube are (0,0,0) and (0,0,8.0). My earnest request to you, please check the udf written for a Fluent 3D model. I'll remain grateful to you. Also please check the logic of assigning radius value in the macro. Since my model contains only fluid domain of 33 mm, then what should be assigned value for radius among 33 mm of fluid body or 35 mm including tube? Please suggest me. #include "udf.h" #define RADIUS 0.033 #define CONVEC_LOS_COFICENT 0.05 #define TUBE_EMISIVITY 0.1378 #define GLAS_EMISIVITY 0.05 #define SIGMA 5.67e-08 #define DIRECT_NORMAL_INSOLATION 937.9 #define T_KELVIN 273.0 DEFINE_PROFILE(wallheatfluxprofile,thread,index) { real x[ND_ND]; real z,glas_tube_emsivity,T_amb,T_sky,T_glass,T_gas,rad _loss,convec_loss; double a,q; face_t f; begin_f_loop(f,thread) { F_CENTROID(x,f,thread); glas_tube_emsivity=(TUBE_EMISIVITY*GLAS_EMISIVITY)/((TUBE_EMISIVITY+GLAS_EMISIVITY-(TUBE_EMISIVITY*GLAS_EMISIVITY)); T_amb =T_KELVIN+28.5; T_sky =T_KELVIN+14.0; T_glass =T_KELVIN+121.0; T_gas =T_KELVIN+30.0; rad_loss =TUBE_EMISIVITY*SIGMA*((2*pow(WALL_TEMP_INNER (f,thread),4)-pow(T_amb,4)-pow(T_sky,4))+glas_tube_emsivity*SIGMA*(pow(WALL_T EMP_INNER (f,thread),4)-pow(T_glass,4)); convec_loss =CONVEC_LOS_COFICENT*(WALL_TEMP_INNER (f,thread)- T_gas); z =x[2]; for(z=0.0; z<=1.5; z++) { if ((z>=0.0) && (z<=1.2)) { for(a=0.0; a<=180.0; a++) { x[0] =RADIUS*sin(a); x[1] =-RADIUS*cos(a); if ((a>=0.0) && (a<=15.9)) { q =4.1643*pow(a,3)-60.818*pow(a,2)+485.19*a+32320; } if ((a>15.9) && (a<=47.5)) { q =0.1288*pow(a,3)-6.7478*pow(a,2)+293.03*a+37992; } if ((a>47.5) && (a<=86.5)) { q =1.2582*pow(a,3)-256.73*pow(a,2)+15690*a-250299; } if ((a>86.5) && (a<=180.0)) { q =-0.0004*pow(a,3)-0.0716*pow(a,2)+47.947*a-3026.1; } F_PROFILE(f,thread,index) =(q*DIRECT_NORMAL_INSOLATION/937.9)-rad_loss-convec_loss; } } else { F_PROFILE(f,thread,index) =0.0; } } end_f_loop(f,thread) } |
All times are GMT -4. The time now is 15:25. |