|
[Sponsors] |
logic of the DEFINE_PROPERTY macro in UDF manual |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 20, 2020, 07:50 |
logic of the DEFINE_PROPERTY macro in UDF manual
|
#1 |
Senior Member
Weiqiang Liu
Join Date: Feb 2018
Posts: 278
Rep Power: 9 |
Hi all,
I am writting a UDF to define thermal conductivity in my model. I just copied the source code from fluent UDF manual as above picture shows. The source code can be compiled and loaded normally. However, when I tried to initialize my model, fluent complains error which I can not explain. however, if I don't use generic_property macro and give a constant value to ktc, then fluent does not complain error. My understanding is if I use DEFINE_PROPERTY macro to define mixture thermal conductivity, then fluent will not calculte thermal conductivity for single specie. That's why fluent will complain error when generic_property is used. In other words, I have to calculate thermal conductivity of single species by myself either constant value or kinetic theory. Then mixture thermal conductivity will be calculated. Then my question is : what's the point of generic_property macro? is my idea about how fluent calculate thermal conductivity right? Best regards Weiqiang |
|
June 20, 2020, 16:02 |
generic_property
|
#2 |
Senior Member
|
The objective of the generic_property is to return required properties for all the species. It is not used to apply but fetch their values.
The error might be coming because you might have literally used copy procedure to copy the code from the manual. That will give error. You need to write the code yourself since there are hidden characters that come along. These can be removed, but it is better to write the code yourself or copy the code to a file and then select the code from that file and copy to another one. In the latter case, sometimes, hidden characters may not get copied and the code will work. Recommended is to write the code yourself and not copy it from manual.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
June 20, 2020, 23:37 |
|
#3 | |
Senior Member
Weiqiang Liu
Join Date: Feb 2018
Posts: 278
Rep Power: 9 |
Quote:
I can not really understand the logic. I am using DEFINE_PROPERTY to define thermal conductivity. Also I am using generic_property to fetch thermal conductivity. How can I fetch the data before I even define the data? Best regards Weiqiang |
||
June 21, 2020, 17:09 |
Define_property
|
#4 |
Senior Member
|
DEFINE_PROPERTY is executed at the time of initialization. If the properties are field dependent, then the field values used for the initialization are used to determine the properties.
generic_property is required if you want to assign properties for mixture. If you are using DEFINE_PROPERTY for a specie, then you don't need generic_property function.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
June 21, 2020, 23:29 |
|
#5 | |
Senior Member
Weiqiang Liu
Join Date: Feb 2018
Posts: 278
Rep Power: 9 |
Quote:
Therefore, what I did is just use equations of kinetic theory to calculate thermal conductivity of every species in the system and then use mass weighted average method to calculate mixture thermal conductivity. Finaly, the returned thermal conductivity is this mass weighted average value added by some additional terms. I think this makes sense to me. |
||
June 22, 2020, 05:11 |
Procedure
|
#6 |
Senior Member
|
Yes, it does make sense.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
June 22, 2020, 05:15 |
|
#7 |
Senior Member
Weiqiang Liu
Join Date: Feb 2018
Posts: 278
Rep Power: 9 |
Hi Vinerm,
I finished the code. it can be compiled and loaed normally. however, the results are not very reasonable or to say not similar to literature results. Maybe my understanding of the model is wrong or maybe somewhere of the code is wrong. I'll check further. Thanks very much for your patience! Best Weiqiang |
|
June 22, 2020, 10:21 |
|
#8 |
Senior Member
Weiqiang Liu
Join Date: Feb 2018
Posts: 278
Rep Power: 9 |
hi Vinerm,
I met an intreresting phenomenon. Just like you said, fluid will calculate volume averaged thermal conductivity if I seclet porous zone anyway. In order to make fluent use the thermal conductivity I want it to use like porosity*kg, I just return the value in DEFINE_PROPERTY macro like kg-(1-porosity)/porosity*ks . Then when fluent apply volume averaged method, the final thermal conductivity would be porosity*kg. The problem is since conductivity of solid is much higher than fluid gas, the returned value of DEFINE_PROPERTY would become negative. With this nagetive value, I can calculate without any error though results are not very good. if I just return kg which is the value I calculated, divergence would happen since this kg is a magnitude's higher than normal gas conductivity. Do you think this is normal? Best regards Weiqiang |
|
June 22, 2020, 11:26 |
Thermal Conductivity
|
#9 |
Senior Member
|
That's happening because your formulation is incorrect. For porosity of 1, it does return kg, I suppose that implies conductivity of the gas. But for the porosity of 0, i.e., solid, it does not return ks. A simpler solution is to use same properties for solid as that of fluid. Then, you won't need a UDF, until and unless the properties are a function of temperature that is unavailable in Fluent's list of options. If you want to use formulation, then use .
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
Tags |
define_property, generic_property, thermal conductivity |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
ANSYS FLUENT UDF Manual release 17.0 | The_Immortal | Fluent UDF and Scheme Programming | 0 | April 13, 2019 14:50 |
Define_source macro fluent udf | Shehryar | CFD Freelancers | 1 | October 29, 2017 07:25 |
what does FLUID_THREAD_P(t) macro do in udf? | borhan_sd@yahoo.com | Fluent UDF and Scheme Programming | 2 | June 10, 2013 06:49 |
question on UDF manual example | ak6g08 | FLUENT | 0 | June 25, 2009 12:58 |
DEFINE_DPM_OUTPUT macro UDF HELP | Puneet | FLUENT | 3 | November 28, 2003 11:55 |