|
[Sponsors] |
UDF for defining specific heat ratio,gas constant,molecular weight |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 16, 2016, 07:54 |
UDF for defining specific heat ratio,gas constant,molecular weight
|
#1 |
New Member
soumya nanda
Join Date: Aug 2015
Posts: 9
Rep Power: 11 |
Actually i am doing fluent simulation in which i have to initialize one half of the model with different initial conditions and properties of helium where as the other half has to be initialized with different initial conditions and properties of air. With the help of UDF i am able to intialize both the half with their corresponding initial conditions but i am unable to provide different gas properties to both the halves. I am able to assign gas properties like thermal conductivity, viscosity but basically i want to provide different values of coefficient of specific heat, gas constant, Specific heat ratio and molecular weight to both the halves. Is there any such UDF for defining the above mentioned properties or by any method we can assign the properties. I get an UDF for defining the coefficient of specific heat but it does not consider the cell location as the input argument, So also i want to know how to define different value of Cp to different location.
Thanks in advance. |
|
February 16, 2016, 09:21 |
|
#2 | |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 |
Quote:
Regarding different properties for the gas, you can add extra species for your mixture (species A2 and B2, for example), define the different properties for this new species accordingly and in the initial conditions (and inlet, if so) you can define the mass fraction as 0. so in this case you can have HALF Y_A1 = 0.2; Y_B1 = 0.8; Y_A2 = 0.0; Y_B2 = 0.0; OTHER HALF Y_A1 = 0.0; Y_B1 = 0.0; Y_A2 = 0.4; Y_B2 = 0.6; |
||
February 17, 2016, 00:32 |
|
#3 | |
New Member
soumya nanda
Join Date: Aug 2015
Posts: 9
Rep Power: 11 |
Quote:
I am still a bit confused. let me explain the problem elaborately. I am simulating a tube of length 720 mm which comprises of first section as 120 mm and rest is the second section.All the boundary of the tube is considered as wall. I am initializing pressure properly. To ensure that i am attaching the pressure contour which has different pressure as provided during initialization. I am also initializing the temperature correctly. It has same temperature on both the section as provided during the initialization. Further i am providing density as material property using udf which is also ensured from the density contour. Now the 1st section should contain helium gas and the second section should contain air. As both the gases have different cp and both the section has same temperature, so how to define cp. I have attached the udf of intialization for pressure and temperature. Also i have attached the material define udf for density. So please help me in writing the udf for R,Cp,Gamma and Molecular weight. DEFINE_INIT(soumya_init,d) { cell_t c; Thread *t; real xc[ND_ND]; thread_loop_c(t,d) { begin_c_loop_all(c,t) { C_CENTROID(xc,c,t); if (xc[0] < 0.12 ) { C_U(c,t) = 0.; C_V(c,t) = 0.; C_P(c,t) = 1965000.; C_T(c,t) = 298.; } else { C_U(c,t) = 0.; C_V(c,t) = 0.; C_P(c,t) = 80000.; C_T(c,t) = 298.; } } end_c_loop_all(c,t) } } DEFINE_PROPERTY(my_density, c, t) { real rho; real cr[ND_ND]; C_CENTROID(cr,c,t); if ( cr[0]<0.12) { rho =3.170173; } else { rho=0.9357141; } return rho; } press.PNGtemp.PNG |
||
February 17, 2016, 06:59 |
|
#4 |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 |
then Ill try to explain better. Create a mixture in which you have helium + air (species 0 and 1). You can use the same loop for initial condition.
PHP Code:
|
|
February 17, 2016, 07:11 |
|
#5 |
New Member
soumya nanda
Join Date: Aug 2015
Posts: 9
Rep Power: 11 |
Hi
thank u for ur help. But i dont any find any define property command for defining R,Cp,Gamma and Molecular weight. Can u tell me the command for same. Actually i am a learner, so less knowledge. Sorry for bothering you |
|
February 17, 2016, 07:22 |
|
#6 | |
Senior Member
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13 |
Quote:
DEFINE_PROPERTY(property, c, t) { int i; real property; if (i == 0) { property = 1.0; /*insert the value here*/ } else if (i == 1) { property = 0.9; /*insert the value here*/ } return property; } ***** EDIT: made a small change in the code ****** |
||
February 17, 2016, 09:37 |
|
#7 |
New Member
soumya nanda
Join Date: Aug 2015
Posts: 9
Rep Power: 11 |
Thanks a lot.
My problem get solved. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF for specific heat - error | tarui23 | Fluent UDF and Scheme Programming | 0 | October 13, 2013 07:30 |
error message | cuteapathy | CFX | 14 | March 20, 2012 07:45 |
How to write udf for specific heat | nanoraja | ANSYS Meshing & Geometry | 1 | September 14, 2011 12:34 |
Concentric tube heat exchanger (Air-Water) | Young | CFX | 5 | October 7, 2008 00:17 |
Two-Phase Buoyant Flow Issue | Miguel Baritto | CFX | 4 | August 31, 2006 13:02 |