CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

what is the syntax for writing inverse hyperbolic functions in UDFs ANSYS FLUENT

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 1, 2016, 03:05
Default what is the syntax for writing inverse hyperbolic functions in UDFs ANSYS FLUENT
  #1
New Member
 
krishna murthy
Join Date: Mar 2016
Posts: 7
Rep Power: 10
murthya3 is on a distinguished road
hi
i am writing a UDF(FLUENT) for VISCOSITY, in which the equation contains inverse hyperbolic function of sin. what is the syntax for the inverse hyperbolic functions.

Thanks in advance

Last edited by murthya3; March 1, 2016 at 08:38.
murthya3 is offline   Reply With Quote

Old   March 1, 2016, 05:30
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
The function for the inverse hyperbolic function of sin is asinh(x), and you may need to include the math library:

Code:
#include "math.h"
`e` is offline   Reply With Quote

Old   March 1, 2016, 08:28
Default
  #3
New Member
 
krishna murthy
Join Date: Mar 2016
Posts: 7
Rep Power: 10
murthya3 is on a distinguished road
Quote:
Originally Posted by `e` View Post
The function for the inverse hyperbolic function of sin is asinh(x), and you may need to include the math library:

Code:
#include "math.h"
thanks 'e'
although, i add math library to my UDF i am getting error like" unresolved external symbol asinh referenced in function cell_viscosity", any library i need to add?
the usage of 'asinh' in the following equation

Flow_stress=(1/alpha)*(asinh(pow((Z/A),(1/n))));
murthya3 is offline   Reply With Quote

Old   March 1, 2016, 17:19
Default
  #4
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
I've tested the asinh function with and without including the math header file and it worked fine both times (possibly this function is included elsewhere in Fluent as well). First, add trailing dots to your numbers (for example, "1.") so the fractions aren't rounded incorrectly. Second, try solving a simpler number: asinh(5) which should return 2.31...

I've now tried interpreting the UDF and it's returning the same error. Compile your UDFs.
`e` is offline   Reply With Quote

Old   March 2, 2016, 01:59
Default
  #5
New Member
 
krishna murthy
Join Date: Mar 2016
Posts: 7
Rep Power: 10
murthya3 is on a distinguished road
Quote:
Originally Posted by `e` View Post
I've tested the asinh function with and without including the math header file and it worked fine both times (possibly this function is included elsewhere in Fluent as well). First, add trailing dots to your numbers (for example, "1.") so the fractions aren't rounded incorrectly. Second, try solving a simpler number: asinh(5) which should return 2.31...

I've now tried interpreting the UDF and it's returning the same error. Compile your UDFs.
Thanks 'e'
i have tried everything what you have posted. still i am getting same error. Here i am posting my program please tell me where i made mistake.


and also i am getting error: 'not all control paths return a value'

Last edited by murthya3; March 15, 2016 at 05:11.
murthya3 is offline   Reply With Quote

Old   March 2, 2016, 10:13
Default
  #6
Senior Member
 
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13
Bruno Machado is on a distinguished road
Quote:
Originally Posted by murthya3 View Post
Thanks 'e'
i have tried everything what you have posted. still i am getting same error. Here i am posting my program please tell me where i made mistake.

This is the program for creating viscosity for a material
#include "udf.h"

#include "math.h"

#define Q 232560.0 //J/mol
#define A 7.86e+06
#define n 5.37
#define R 8.314 //J/molK
#define alpha 0.038e-06
#define Temp 578.5 //K
DEFINE_PROPERTY(cell_viscosity,c,t)
{
double mu_lam;
double strain;
double Z;
double Flow_stress;
begin_c_loop(c,t)
{
strain = C_STRAIN_RATE_MAG(c,t);
Z=strain*exp(Q/(R*Temp));
Flow_stress=(1./alpha)*(asinh(pow((Z/A),(1./n))));
mu_lam = Flow_stress/(3.*strain);
if(mu_lam>0)
return;

else
return 0;
}
end_c_loop(c,t)
}

and also i am getting error: 'not all control paths return a value'
you are returning nothing. i think you want it to be

return Flow_stress;
Bruno Machado is offline   Reply With Quote

Old   March 2, 2016, 10:47
Default
  #7
New Member
 
krishna murthy
Join Date: Mar 2016
Posts: 7
Rep Power: 10
murthya3 is on a distinguished road
Quote:
Originally Posted by Bruno Machado View Post
you are returning nothing. i think you want it to be

return Flow_stress;
not flow stress, i should get viscosity(mu_lam), hence return mu_lam, is it wrong?

i have written logarithamic formula for an inverse hyperbolic sine function, but while running it flow is getting reversed, without UDF which means with a constant value of viscosity flow is taking place by keeping boundary conditions same. What would be the reason?

Thanks.
murthya3 is offline   Reply With Quote

Old   March 2, 2016, 10:49
Default
  #8
Senior Member
 
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13
Bruno Machado is on a distinguished road
Quote:
Originally Posted by murthya3 View Post
not flow stress i should get viscosity(mu_lam), hence return mu_lam, is it wrong?
yes, sorry. type it quickly and did not realize it was wrong. you should return the mu_lam value.

return mu_lam;
Bruno Machado is offline   Reply With Quote

Old   March 2, 2016, 15:04
Default
  #9
New Member
 
krishna murthy
Join Date: Mar 2016
Posts: 7
Rep Power: 10
murthya3 is on a distinguished road
Quote:
Originally Posted by Bruno Machado View Post
yes, sorry. type it quickly and did not realize it was wrong. you should return the mu_lam value.

return mu_lam;
Thanks, Bruno Machado;

yes I did it, and the flow is reversed as stated in previous post.
is that program is correct for getting strain rate from each cell, evaluating viscosity and assigning viscosity to the cell?
murthya3 is offline   Reply With Quote

Old   March 2, 2016, 16:35
Default
  #10
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Quote:
Originally Posted by `e` View Post
I've now tried interpreting the UDF and it's returning the same error. Compile your UDFs.
If you're still getting that same error, try compiling your UDF.
`e` is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
looking for a smart interface matlab fluent chary FLUENT 24 June 18, 2021 10:07
UDF Defining in ANSYS FLUENT 16.2 in Win 10 Sadegh.A Fluent UDF and Scheme Programming 11 February 15, 2017 15:45
2-way FSI in Ansys CFX 15 LucasGasparino CFX 3 August 6, 2015 04:17
Problem in using parallel process in fluent 14 Tleja FLUENT 3 September 13, 2013 11:54
problem in using parallel process in fluent 14 aydinkabir88 FLUENT 1 July 10, 2013 03:00


All times are GMT -4. The time now is 22:28.