
[Sponsors] 
viscosity udf don't use correct temperature and strain rate 

LinkBack  Thread Tools  Search this Thread  Display Modes 
May 24, 2021, 07:08 
viscosity udf don't use correct temperature and strain rate

#1 
New Member
yahya rezvani
Join Date: Aug 2019
Posts: 17
Rep Power: 3 
hello. im use udf for calculate strain rate and temperature dependent viscosity. but viscosity udf don't use correct temperature and strain rate. how to solve this problem? this is my udf
Code:
# include <udf.h> int counter=0; DEFINE_PROPERTY(U_Visc,c,t) { real Temp; real Visc; real str; real stress; real asinh_input; real asinh_output; real b; real Z; real A; real alfa; real blfa; real n ; real Q; real R;/* Specific gas constant */ real strlimit; real Visc_limit; real viscmin; A = 2.095E11 ;/* Material constant 304 ss*/ blfa = 3.233E5; alfa= 0.0000050867; n = 1.812; Q = 74640; R = 8.314; Visc_limit = 2.E5; Temp = C_T(c,t); /*0.7Tm*/ begin_c_loop(c, t) { str = C_STRAIN_RATE_MAG(c,t); b=exp(Q/(R*Temp)); Z = str*b; asinh_input = pow(Z/A,1./n); asinh_output = log(asinh_input + sqrt(asinh_input * asinh_input + 1)); stress = (1. /alfa)*asinh_output; Visc = stress/(3. *str); if ( (Visc > Visc_limit)  (str == 0) ) { Visc = Visc_limit; } if ( (Visc < 0) ) { Visc = 0; } C_UDMI(c,t,0)=stress; C_UDMI(c,t,1)=Visc; C_UDMI(c,t,2)=str; C_UDMI(c,t,3)=Temp; C_UDMI(c,t,4)=Z; C_UDMI(c,t,5)=asinh_input; C_UDMI(c,t,6)=asinh_output; C_UDMI(c,t,7)=b; if(counter<=20) { counter++;CX_Message("Strain= %E(1/s) Viscosity =%E PaS\n", str, Visc); /* CX_Message("Strain*1e6= %E\n", str*1e6); */ } return Visc; end_c_loop(c, t) } } thank you best regards Rezvani 

May 24, 2021, 10:31 

#2 
Senior Member
Join Date: Nov 2013
Posts: 1,867
Rep Power: 23 
Temp = C_T(c,t); /*0.7Tm*/
begin_c_loop(c, t) Switch these two lines.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build". 

May 24, 2021, 17:24 

#3 
New Member
yahya rezvani
Join Date: Aug 2019
Posts: 17
Rep Power: 3 
thank you .still udm s are wrong. how to fix udm?


May 24, 2021, 22:06 

#4 
Senior Member
Alexander
Join Date: Apr 2013
Posts: 1,723
Rep Power: 28 
try this code
Code:
# include <udf.h> int counter=0; DEFINE_PROPERTY(U_Visc,c,t) { real Temp; real Visc; real str; real stress; real asinh_input; real asinh_output; real b; real Z; real A; real alfa; real blfa; real n ; real Q; real R;/* Specific gas constant */ real strlimit; real Visc_limit; real viscmin; A = 2.095E11 ;/* Material constant 304 ss*/ blfa = 3.233E5; alfa= 0.0000050867; n = 1.812; Q = 74640; R = 8.314; Visc_limit = 2.E5; Temp = C_T(c,t); /*0.7Tm*/ str = C_STRAIN_RATE_MAG(c,t); b=exp(Q/(R*Temp)); Z = str*b; asinh_input = pow(Z/A,1./n); asinh_output = log(asinh_input + sqrt(asinh_input * asinh_input + 1)); stress = (1. /alfa)*asinh_output; Visc = stress/(3. *str); if ( (Visc > Visc_limit)  (str == 0) ) { Visc = Visc_limit; } if ( (Visc < 0) ) { Visc = 0; } C_UDMI(c,t,0)=stress; C_UDMI(c,t,1)=Visc; C_UDMI(c,t,2)=str; C_UDMI(c,t,3)=Temp; C_UDMI(c,t,4)=Z; C_UDMI(c,t,5)=asinh_input; C_UDMI(c,t,6)=asinh_output; C_UDMI(c,t,7)=b; if(counter<=20) { counter++; Message0("Strain= %E(1/s) Viscosity =%E PaS\n", str, Visc); /* Message0("Strain*1e6= %E\n", str*1e6); */ } return Visc; }
__________________
best regards ****************************** press LIKE if this message was helpful 

May 25, 2021, 15:06 

#5 
New Member
yahya rezvani
Join Date: Aug 2019
Posts: 17
Rep Power: 3 
hello. if dont use begin_c_loop(c, t) fluent show this error
Code:
4 1.0000e+00 4.1831e02 1.6884e02 1.7000e02 3.5638e04 0:22:44 46 Stabilizing temperature to enhance linear solver robustness. temperature limited to 1.000000e+00 in 4967024 cells on zone 4 in domain 1 temperature limited to 5.000000e+03 in 19391 cells on zone 4 in domain 1 Artificial walls on 82 faces (0.7% area) of pressureoutlet 9 to prevent fluid from flowing into the boundary. 5 1.0000e+00 3.9380e02 2.1037e02 2.0857e02 1.6664e03 0:27:24 45 Error at Node 1: floating point exceptiEon rror at Node 0: floating point exception Stabilizing pressure correction to enhance linear solver robustness. Stabilizing pressure correction using GMRES to enhance linear solver robustness. Divergence detected in AMG solver: pressure correction Stabilizing pressure correction to enhance linear solver robustness. Stabilizing pressure correction using GMRES to enhance linear solver robustness. Divergence detected in AMG solver: pressure correction Stabilizing pressure correction to enhance linear solver robustness. Stabilizing pressure correction using GMRES to enhance linear solver robustness. Divergence detected in AMG solver: pressure correction Stabilizing pressure correction to enhance linear solver robustness. Stabilizing pressure correction using GMRES to enhance linear solver robustness. Divergence detected in AMG solver: pressure correction Stabilizing pressure correction to enhance linear solver robustness. Stabilizing pressure correction using GMRES to enhance linear solver robustness. Divergence detected in AMG solver: pressure correction Stabilizing pressure correction to enhance linear solver robustness. Stabilizing pressure correction using GMRES to enhance linear solver robustness. Divergence detected in AMG solver: pressure correction Stabilizing pressure correction to enhance linear solver robustness. Stabilizing pressure correction using GMRES to enhance linear solver robustness. Divergence detected in AMG solver: pressure correction Stabilizing pressure correction to enhance linear solver robustness. Stabilizing pressure correction using GMRES to enhance linear solver robustness. Divergence detected in AMG solver: pressure correction Stabilizing pressure correction to enhance linear solver robustness. Stabilizing pressure correction using GMRES to enhance linear solver robustness. Divergence detected in AMG solver: pressure correction Stabilizing pressure correction to enhance linear solver robustness. Stabilizing pressure correction using GMRES to enhance linear solver robustness. Divergence detected in AMG solver: pressure correction Stabilizing pressure correction to enhance linear solver robustness. Stabilizing pressure correction using GMRES to enhance linear solver robustness. Divergence detected in AMG solver: pressure correction Stabilizing pressure correction to enhance linear solver robustness. Stabilizing pressure correction using GMRES to enhance linear solver robustness. Divergence detected in AMG solver: pressure correction Stabilizing pressure correction to enhance linear solver robustness. Stabilizing pressure correction using GMRES to enhance linear solver robustness. Divergence detected in AMG solver: pressure correction Stabilizing temperature to enhance linear solver robustness. Stabilizing temperature using GMRES to enhance linear solver robustness. Divergence detected in AMG solver: temperature Artificial walls on 5428 faces (46.2% area) of pressureoutlet 9 to prevent fluid from flowing into the boundary. Divergence detected in AMG solver: pressure correction Divergence detected in AMG solver: pressure correction Divergence detected in AMG solver: pressure correction Divergence detected in AMG solver: pressure correction Divergence detected in AMG solver: pressure correction Divergence detected in AMG solver: pressure correction Divergence detected in AMG solver: pressure correction Divergence detected in AMG solver: pressure correction Divergence detected in AMG solver: pressure correction Divergence detected in AMG solver: pressure correction Divergence detected in AMG solver: pressure correction Divergence detected in AMG solver: pressure correction Divergence detected in AMG solver: pressure correction Divergence detected in AMG solver: temperature Error at host: floating point exception ===============Message from the Cortex Process================================ Compute processes interrupted. Processing can be resumed. ============================================================================== thank you 

May 25, 2021, 15:31 

#6 
Senior Member
Join Date: Nov 2013
Posts: 1,867
Rep Power: 23 
Check those UDMs that you used. Plot them, see which one is not what you expect.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build". 

May 26, 2021, 04:14 

#7  
New Member
yahya rezvani
Join Date: Aug 2019
Posts: 17
Rep Power: 3 
Quote:
but udm s(temperature, stress,... ) are wrong. if i use begin_c_loop(c, t) udm s are wrong. if i dont use begin_c_loop(c, t) then give error!! thank you. best regards. 

May 26, 2021, 08:11 

#8 
Senior Member
Join Date: Nov 2013
Posts: 1,867
Rep Power: 23 
If temperature and stress are wrong, focus on that.
You don't give me much to work with, so I can't help more.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build". 

May 27, 2021, 05:40 

#9  
Senior Member
Alexander
Join Date: Apr 2013
Posts: 1,723
Rep Power: 28 
begin_c_loop(c, t) is already included in DEFINE_PROPERTY macro
you don't need to make additional loop over cell from your log I can see the error comes out on 4th iteration. look at domain on 3th iteration, check udms distribution, analyse all variable you have applied to model: temperature, stresses so on Quote:
in that case simulation doesn't work cause of viscosity values you've applied
__________________
best regards ****************************** press LIKE if this message was helpful 

Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
[openSmoke] libOpenSMOKE  Tobi  OpenFOAM Community Contributions  554  July 12, 2021 10:22 
UDF srivastava and sundaresan friction model  divergence of the solutor  Luca_Panariello  Fluent Multiphase  1  January 18, 2017 10:07 
Problem in convergence regarding constant viscosity and UDF related Viscosity.  alexskerhut  FLUENT  0  May 9, 2016 08:43 
Problems in converging viscosity UDF dependent upon strain rate and temperature.  alexskerhut  Fluent UDF and Scheme Programming  1  March 17, 2016 07:19 
Temperature dependent NonNewtonian viscosity UDF  cric92  Fluent UDF and Scheme Programming  0  April 14, 2013 06:31 