|
[Sponsors] |
Temperature and Strain Rate Dependent Viscosity UDF Code |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 28, 2022, 03:45 |
Temperature and Strain Rate Dependent Viscosity UDF Code
|
#1 |
New Member
SANDIPSINH
Join Date: Mar 2022
Posts: 2
Rep Power: 0 |
#include "udf.h"
#include "mem.h" #define Q 145000 //J/mol #define A 8.86e+6 #define n 3.55 #define R 8.314 //J/molK #define alpha 0.045 DEFINE_PROPERTY(cell_viscosity, c, t) { real temp = C_T(c, t); real mu_lam; real Z; real Flow_stress; real x; real strain; if (strain < 0) { strain = 10; } else { strain = C_STRAIN_RATE_MAG(c, t); } Z = (strain)*exp(Q / (R*temp)); x = pow((Z / A), (1. / n)); Flow_stress = (1. / alpha)*(log(x + sqrt(pow(x, 2) + 1.))); mu_lam = Flow_stress / (3.*strain); if (mu_lam > 0) return mu_lam; } we are trying to define the viscosity in term of strain rate and temperature using UDF code but, we are not getting value as expected. |
|
March 31, 2022, 23:57 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
you should specify what exactly is different from your expectations
compile the code and you will get following output: Code:
warning C4715: 'cell_viscosity' : not all control paths return a value warning C4700: uninitialized local variable 'strain' used take into account that DEFINE_PROPERTY macro is a loop over all cells in domain, but your variable strain contains only 1 value for the last cell, it overwrites each other cell. You may use used defined memory to store strain on each cell Also I would initialize strain for the 0-time moment
__________________
best regards ****************************** press LIKE if this message was helpful |
|
April 5, 2022, 12:48 |
|
#3 |
New Member
SANDIPSINH
Join Date: Mar 2022
Posts: 2
Rep Power: 0 |
Can you please show us how to do that because I am new to this and when I try this code every cell get's same viscosity value.
|
|
Tags |
ansys fluent, strain rate dependent, temperature dependent, udf code, viscosity |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[openSmoke] libOpenSMOKE | Tobi | OpenFOAM Community Contributions | 562 | January 25, 2023 10:21 |
viscosity udf don't use correct temperature and strain rate | rezvani | Fluent UDF and Scheme Programming | 8 | May 27, 2021 06:40 |
Problem in convergence regarding constant viscosity and UDF related Viscosity. | alexskerhut | FLUENT | 0 | May 9, 2016 09:43 |
Problems in converging viscosity UDF dependent upon strain rate and temperature. | alexskerhut | Fluent UDF and Scheme Programming | 1 | March 17, 2016 08:19 |
Temperature dependent Non-Newtonian viscosity UDF | cric92 | Fluent UDF and Scheme Programming | 0 | April 14, 2013 07:31 |