|
[Sponsors] |
March 17, 2020, 10:37 |
UDRGM and Viscosity UDF
|
#1 |
New Member
Dinis Nunes
Join Date: Jan 2020
Posts: 16
Rep Power: 6 |
Dear all,
I'm currently using a user-defined real gas model and I want to include a non-Newtonian model for viscosity. As I understand, the real gas model only allows to define the viscosity as a function of state variables such as temperature, pressure, etc. How can I define viscosity as a function of shear strain only (using DEFINE_PROPERTY) and not having it being overridden by what's in the UDRGM code? Thanks in advance, Dinis |
|
March 17, 2020, 11:12 |
non-Newtonian Gas
|
#2 |
Senior Member
|
Does a non-Newtonian gas exist? Even if it does, I doubt it would have fluidic characteristics, so, it won't be governed by N-S (in reality, no non-Newtonian fluid is governed by N-S but we can still use it for liquids and suspensions).
UDF for Real gas has a material scope and not a mesh scope, i.e., there are not cell index or zone threads available. Hence, you cannot fetch any values for a cell within these UDFs. This is quite similar to DEFINE_SPECIFIC_HEAT
__________________
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. |
|
March 17, 2020, 11:32 |
|
#3 |
New Member
Dinis Nunes
Join Date: Jan 2020
Posts: 16
Rep Power: 6 |
I understand that the question in itself might not seem very reasonable, I just wanted to know if it's technically possible. I want to simulate the mixing of two streams and was instructed to avoid multiphase modelling. However, the viscosities between the 2 streams are different, hence the need to override the viscosity definition of the UDRGM.
Would a multiphase model be best suited then? I could define the properties of one stream with the UDRGM and the other with DEFINE_PROPERTY macros, although I fear it might affect the mixing behaviour (this is the reason why I am avoiding multiphase). Thank you. |
|
March 17, 2020, 11:38 |
Real Gas Models
|
#4 |
Senior Member
|
Multiphase modeling is incompatible with real gas models. If both are gases, then you can use species transport but multiphase option is unavailable with real gas models.
__________________
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. |
|
March 17, 2020, 11:52 |
|
#5 |
New Member
Dinis Nunes
Join Date: Jan 2020
Posts: 16
Rep Power: 6 |
That is the issue, they are actually both liquids, but the pressure and temperature conditions are close to critical point of water, that's the justification for using the real gas model in this case. The NIST real gas model actually has an option for liquid phase, so I guess this makes sense?
I can enable the multiphase option and the mixing zone doesn't change in comparison to the single phase counterpart, however, if this is producing feasible value I have no idea. |
|
March 17, 2020, 11:59 |
Multiphase with Real Gas
|
#6 |
Senior Member
|
As far as Fluent is concerned, I don't think multiphase and any real gas model are compatible, even in the latest version. So, either it has to be real gas or multiphase. Mixing phenomenon close to critical points is subtle; there is no known physical model for that.
__________________
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. |
|
March 25, 2020, 18:59 |
|
#7 |
New Member
Dinis Nunes
Join Date: Jan 2020
Posts: 16
Rep Power: 6 |
Hey, I have a somehow related question and so I will ask it here instead of opening a new thread. Is it possible, keeping the model as single phase, to define for the same property 2 different expressions in different regions of my domain?
Thank you in advance. |
|
March 26, 2020, 03:25 |
Yes but partially
|
#8 |
Senior Member
|
Within a UDF, property values are returned on a cell by cell by basis, i.e., you are already returning different value for each region. However, this is not doable for each material property, such as, not possible for specific heat in general and none of the property being defined using UDRGM.
__________________
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. |
|
March 26, 2020, 03:42 |
|
#9 |
New Member
Dinis Nunes
Join Date: Jan 2020
Posts: 16
Rep Power: 6 |
But could I have a separate UDF defining one of the properties differently than the UDRGM just for one region?
|
|
March 26, 2020, 04:22 |
Property UDF
|
#10 |
Senior Member
|
Whenever UDRGM is used, it does not give option to apply another property UDF. You can certainly try to modify a property using DEFINE_ADJUST, however, this might lead to conservation issues.
__________________
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. |
|
March 26, 2020, 18:46 |
|
#11 |
New Member
Dinis Nunes
Join Date: Jan 2020
Posts: 16
Rep Power: 6 |
Dear vinerm,
I tried to change viscosity through the DEFINE_ADJUST function, but I couldn't get it to work. Maybe you can help me? Thank you in advance. Code: Code:
/* Defines viscosity just for the specified zone ID */ DEFINE_ADJUST(rkeos_visc, domain) { cell_t c; real temp, mu, tr, tc, pcatm; int ID = 7; /* Set desired Zone ID from Boundary Conditions task page */ Thread* t = Lookup_Thread(domain, ID); /* loop over all cells in thread */ begin_c_loop(c, t) { temp = C_T(c, t); /* get cell temperature */ /* RKEOS viscosity EoS */ tr = temp / TCRIT; tc = TCRIT; pcatm = PCRIT / 101325.; mu = 6.3e-7 * sqrt(MWT) * pow(pcatm, 0.6666) / pow(tc, 0.16666) * (pow(tr, 1.5) / (tr + 0.8)); C_MU_L(c,t) = mu; } end_c_loop(c, t) } |
|
March 27, 2020, 04:13 |
Code
|
#12 |
Senior Member
|
The code is correct, provided
1. ID 7 belongs to a cell zone and not a boundary zone. 2. TCRIT, PCRIT are defined somewhere. Fluent does not have these inbuilt. If you want to use these values from what Fluent has for real gas, then you have to use generic_property function as given in the Example 2 at the following link https://www.afs.enea.it/project/nept...udf/node46.htm Use PROP_critical_temperature, PROP_critical_pressure to fetch these values. Though the UDF will compile and work, however, there is no guarantee that Fluent will use this viscosity for the calculations. DEFINE_ADJUST is executed before every iteration. This will modify the viscosity. However, during the calculation, it is quite possible that Fluent will pick-up values from PROPERTY UDF for Real Gas. You have to test it on a simple case by running a few iterations and then comparing results against another case where you do not use DEFINE_ADJUST function. If results are same, then this function is not useful.
__________________
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. |
|
March 27, 2020, 06:39 |
|
#13 |
New Member
Dinis Nunes
Join Date: Jan 2020
Posts: 16
Rep Power: 6 |
Dear vinerm,
The the code is just an excerpt, ID 7 corresponds to the zone I want to adjust the viscosity and the critical properties are also defined in the beginning of the file. I've runned both with and without the DEFINE_ADJUST on and the results are the same. |
|
March 27, 2020, 07:25 |
Same Results
|
#14 |
Senior Member
|
If the results are same, then, you cannot use this UDF to adjust. However, I doubt you need it. As I stated in my earlier post, even DEFINE_PROPERTY UDF as well as Real Gas UDF define the properties on a cell by cell basis. So, you can identify the domain within the real gas UDF and apply this equation. That would work. To identify thread, you need to do following within _viscosity UDF of real gas
if(THREAD_ID(t) == 7) the equation for mu that you want to use within zone 7 else whatever equation you are currently using t is the second argument of _viscosity UDF in real gas. This was not doable in earlier versions but current versions have cell ID and thread avalaible.
__________________
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. |
|
March 27, 2020, 07:45 |
|
#15 |
New Member
Dinis Nunes
Join Date: Jan 2020
Posts: 16
Rep Power: 6 |
7 is the zone ID, not the thread ID, hence why I use:
Code:
Thread* t = Lookup_Thread(domain, ID) I could print the thread ID to the console, though and then use your solution. EDIT: The Fluent documentation states that the THREAD_ID macro does the inverse of Lookup_Thread. |
|
March 27, 2020, 08:38 |
Thread and Zone
|
#16 |
Senior Member
|
Yes, 7 cannot be thread id; thread ID is always long. THREAD_ID command returns the zone ID. Therefore, I asked you to compare it against 7.
__________________
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. |
|
March 27, 2020, 09:43 |
|
#17 |
New Member
Dinis Nunes
Join Date: Jan 2020
Posts: 16
Rep Power: 6 |
||
March 27, 2020, 10:40 |
Good
|
#18 |
Senior Member
|
Nice to know that it worked.
__________________
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. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Compile User-Defined Real Gas Model (UDRGM) | Captain Convergence | Fluent UDF and Scheme Programming | 31 | November 6, 2020 07:30 |