UDRGM and Viscosity UDF
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 |
non-Newtonian Gas
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 |
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. |
Real Gas Models
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.
|
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. |
Multiphase with Real Gas
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.
|
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. |
Yes but partially
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.
|
But could I have a separate UDF defining one of the properties differently than the UDRGM just for one region?
|
Property UDF
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.
|
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 */ |
Code
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. |
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. |
Same Results
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. |
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. |
Thread and Zone
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.
|
Quote:
|
Good
Nice to know that it worked.
|
All times are GMT -4. The time now is 12:25. |