|
[Sponsors] |
UDF value different when computed from results variable |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 23, 2020, 23:42 |
UDF value different when computed from results variable
|
#1 |
New Member
Yoshi Toshi
Join Date: Mar 2016
Posts: 29
Rep Power: 10 |
Hi,
I have a velocity inlet BC which I am tweaking to get a Reynolds number of say 100. I made a UDF for it such as 1.225*U/eff-viscosity and monitored this value as i changed the inlet BC value. The case in constant density. Once I converged the case I got the individual values for U and eff-viscosity and am finding that when I plug this into the Reynolds number equation, it doesn't equal the UDF that is defined exactly the same way. The only difference I can imagine being is that somehow the value of eff-viscosity being used in the UDF and results-variable of eff-viscosity are different since the velocity remain the same but I don't get how or why. Or how I can make them equal. Any help would be appreciated, thanks. |
|
April 24, 2020, 02:15 |
|
#2 | |
Senior Member
duri
Join Date: May 2010
Posts: 245
Rep Power: 17 |
Quote:
Effective viscosity could be a post processing variable which may not be updated each iteration. Check by printing turbulent viscosity and molecular viscosity and the sum of this should equal to effective viscosity on a given cell. |
||
April 24, 2020, 04:54 |
Reynolds Number
|
#3 |
Senior Member
|
Reynolds number is never defined using effective viscosity. Effective viscosity is a sum of molecular viscosity, which is property of fluid, and turbulent viscosity, which is a property of flow and not fluid. If you have constant property fluid, then Re of 100 implies a constant velocity, which you can easily calculate and apply directly. No UDF is needed for that.
However, if you really want to use the definition using effective viscosity, then the first thing you need to include in your definition is a length scale, which is missing. Secondly, as I mentioned earlier, turbulent viscosity is a flow property, so, until and unless flow is converged, you will not have a fixed value for effective viscosity; this will change every iteration. However, you might be applying certain value of Turbulent quantities at the inlet. Just use those to determine effective viscosity, calculate viscosity for Re of 100, and apply that velocity. You don't need a UDF in any case.
__________________
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. |
|
April 24, 2020, 08:54 |
|
#4 |
New Member
Yoshi Toshi
Join Date: Mar 2016
Posts: 29
Rep Power: 10 |
Thanks for the input!
So first off I believe I have a well enough converged case where values aren't changing too much iteration to iteration. I also attached a few images as yes I forgot to mention that I am multiplying by a length term (0.5m). So my confusion comes from that when I post process these variables in Fluent, they still end up giving different values if you calculate Re manually which doesn't make too much sense to me. Yes I know i don't need a udf but I was getting some weird results before and so I just wanted this monitor variable do double check that things are going how I want them to. EDIT: I confirmed the non-varying results by making report definitions for both the velocity and eff-viscosity term and neither change with iterations. |
|
April 24, 2020, 09:13 |
Averaging
|
#5 |
Senior Member
|
Density and length scale, as well as, molecular viscosity are constant. However, velocity and turbulent viscosity change from face to face over the inlet. So, for Re that you calculated using Custom Field Function, the equation is
while when you are calculating it yourself, then you are using averaged values, so, the equation becomes Until and unless all are equal, the values may not match.
__________________
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. |
|
April 24, 2020, 09:28 |
|
#6 |
New Member
Yoshi Toshi
Join Date: Mar 2016
Posts: 29
Rep Power: 10 |
ah okay thank you for going into the details for me.
So I guess my next question would have to be why is it that the solver is changing the area when the inlet has a fixed value of 0.5m? I don't necessarily understand how or why that value would change relative to what variable I want. |
|
April 24, 2020, 09:39 |
Area
|
#7 |
Senior Member
|
Solver is not changing the area. However, if you look at the inlet, you will observe that it is made up of many mesh faces. Area of each face is used to determine area-weighted average. And then there is total area, which is sum of all these area values.
__________________
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. |
|
April 24, 2020, 09:50 |
|
#8 | |
New Member
Yoshi Toshi
Join Date: Mar 2016
Posts: 29
Rep Power: 10 |
Quote:
Are you perhaps saying that the area term would be constant for all variables only across all cell faces only if all the cells have exactly the same size? And if that is the case, then wouldn't that mean that this error in values would apply everywhere in the domain when post-processing? How does one even resolve this discrepancy? Also, how exactly would the solver calculate if not by doing ? |
||
April 24, 2020, 09:57 |
Averaging
|
#9 |
Senior Member
|
When Re is defined as a CFF, then Re is calculated for each face and then its area-weighted average is calculated. For CFF, Re is calculated at the cell-centers adjacent to the inlet boundary. Then, these values are interpolated to inlet face centers. And then, the average is calculated.
The other way you are doing is calculating area-weighted average for velocity and turbulent viscosity and then determining the Re. In this case, values for the velocity magnitude and effective viscosity are interpolated to the inlet and then averaged. You use these averaged values to determine Re. Both could lead to different results. There is no discrepancy here. These are two different methods. Ideally, the values should be rather close to each other. It is quite possible that the reason I have given is not enough to explain the discrepancy. You can try to export face area, velocity, and effective viscosity for inlet into a text file via File > Export > Solution. This will give you raw data for each face. Then you can determine it yourself.
__________________
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 |
fluent, udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF print results into .dat file more than once per time step? how to fix it? | xuwenhua625 | Fluent UDF and Scheme Programming | 5 | May 15, 2019 06:33 |
Evaluating UDF variable to change boundary conditions | saml | FLUENT | 0 | July 12, 2016 09:22 |
Using a calculated variable in another UDF | hwet | Fluent UDF and Scheme Programming | 12 | November 26, 2015 04:36 |
changing scheme variable with UDF? | Wagemakers | FLUENT | 17 | September 30, 2015 15:34 |
UDF: exporting a variable between two DEFINE function | Carlo | FLUENT | 3 | August 19, 2009 13:21 |