-
-
December 13, 2019 at 7:15 am
Outy95
SubscriberHello all,
I want to write a udf to calculate the properties (mainly viscosity) as attached in the file and not use the regular linear interpolation at the interface in case of VOF method. Any help will be appreciated. I used DEFINE_PROPERTY macro and i had some issues with the parse error and other things.
I want to ask fluent to calculate the properties based on the equation attached and not on the linear method with VOF.
P = P1 + (P1-P2)*(VOF^C) instead of P = P1 + (P1-P2)*(VOF).
I'm looking to alter the calculations for viscosity, generally. Can you suggest how to proceed? -
December 13, 2019 at 8:59 am
DrAmine
Ansys EmployeeUse the same viscosity information /formula for each phase so that the mixture viscosity is what you expect
-
December 13, 2019 at 5:22 pm
Outy95
SubscriberHi. Thank you for taking time to answer the question. Can you please elaborate it? Because for individual phase VOF would be either 1 or zero and essentially the formula would result in the same thing that I want to alter.
-
December 13, 2019 at 7:06 pm
DrAmine
Ansys EmployeeYou use the same function for viscosity for both phases. Let us assume the function is myvisc. The mixture viscosity will be then alpha1×myvisc+alpha2×myvisc. -
December 14, 2019 at 5:48 am
Outy95
SubscriberHello Amine,
I tried your suggestion but there seems to be a problem in UDF in employing the volume fraction for phase 1(primary phase). Let me elaborate.
Suppose viscosity for air is A and for liquid is L and "a" is the volume fraction of water and c is a constant.The desired equation for viscosity is:
V(mixture) = A + (L-A)*(a^c)
Now assuming the viscosity functions for air and liquid as suggested,
V(air) = A
V(liquid) = A +(L-A)*a^(c-1)
From the formula, V(mixture) = V(air)*(1-a) + V(water)*a = A*(1-a) + A*a + (L-A)*(a^c) = A + (L-A)*a^c.
Okay, so part one is clear. Can you suggest how to incorporate the volume fraction of liquid into the DEFINE_PROPERTY UDF? Or is there another way for defining the vof? I mean C_VOF() would evaluate for each cell and then I have to loop the VOF in order to cover the entire domain, but the DEFINE_PROPERTY macro already seems to do the looping. Can you help me with setting up the UDF? I know Ansys staff isn't supposed to help in Udf but any ideas/clues would be appreciated.
Thanks in advance.
-
December 16, 2019 at 11:58 am
Rob
Ansys EmployeeBut if you're looking at multiphase the viscosity is linked to each PHASE. The phase volume fraction doesn't matter as the phase motion is calculated by Fluent. You also need to read up on the approach (and limitations) of the VOF model.
-
December 16, 2019 at 3:09 pm
DrAmine
Ansys EmployeeNo: I suggested to use the same expression for both phases: V(mixture) = A + (L-A)*(a^c)= Vair=Vliquid
-
December 18, 2019 at 2:57 am
Outy95
SubscriberHello Amine,
As per your suggestion I used the same formula for both phases. Below is my udf:
#include "udf.h"
#include "math.h"
DEFINE_PROPERTY(Liquid_viscosity,c,t)
{
cell_t c;
Thread *t;
Thread **pt;
real mu_L = 0; /*A is the value for C; Equation is PHI=PHI2+(PHI1-PHI2)*VOF^(1.5*(NU1/NU2)+0.75)*/
real mu_liquid = 0.0497; /*Put respective value*/
real mu_air = 0.00001789; /*Put respective value*/
real A = 4.967; /*Calculate A from A = 1.5*(Nu1/Nu2)+0.75*/
real vof = 0;
vof = C_VOF(c,pt[0]);
mu_L = mu_air + (mu_liquid - mu_air)*(pow(vof,A));
return mu_L;
}
When I interpret them, I do a message stating values of c definition shadows previous definition;
t definition shadows previous definition.
When I run the solution, it comes with an error:
fl process could not be started
-
December 18, 2019 at 3:01 am
Outy95
SubscriberHi rwoolhou,
I'm running a special case for highly viscous fluids where the interface properties have to be calculated in the stated manner, not as a linear one. I'm sort of modifying VOF specially for the viscosity part.
-
December 18, 2019 at 5:47 am
DrAmine
Ansys EmployeeFirst of all I would compile. Second, UDF is wrong. Please check customization manual. -
March 11, 2021 at 3:50 pm
Venky_94
SubscriberHey, were you able to sort out the issue? I need to use the exact same equation for the fluid property estimation in my work and in my case the viscosity of the primary fluid is non-Newtonian based on an asymptotic power law as well and is not a fixed value unlike in yours. So I was wondering if Fluent UDFs can handle that sort of manipulation or if I would have to go with OpenFOAM for this issue. Any help in this regard would be much appreciated.n -
March 11, 2021 at 5:36 pm
Rob
Ansys EmployeeWe can do pretty much anything with UDFs or Expressions in the current releases. The fluid viscosities are easy, adding in terms for when you're near the interface may need more work. n -
March 11, 2021 at 5:54 pm
Venky_94
SubscriberHey Rob, thanks for the response. I've explained my problem in specific detail in the below post. Could you please have a look at it and suggest a way?nhttps://forum.ansys.com/discussion/25526/udf-for-fluid-property-determination-in-vof#latestn
-
- You must be logged in to reply to this topic.

Boost Ansys Fluent Simulations with AWS
Computational Fluid Dynamics (CFD) helps engineers design products in which the flow of fluid components is a significant challenge. These different use cases often require large complex models to solve on a traditional workstation. Click here to join this event to learn how to leverage Ansys Fluids on the cloud, thanks to Ansys Gateway powered by AWS.

Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.

Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
- Suppress Fluent to open with GUI while performing in journal file
- Floating point exception in Fluent
- What are the differences between CFX and Fluent?
- Heat transfer coefficient
- Getting graph and tabular data from result in workbench mechanical
- Difference between K-epsilon and K-omega Turbulence Model
- The solver failed with a non-zero exit code of : 2
- Time Step Size and Courant Number
- Mesh Interfaces in ANSYS FLUENT
- error: Received signal SIGSEGV
-
5290
-
3311
-
2469
-
1308
-
1016
© 2023 Copyright ANSYS, Inc. All rights reserved.