CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   UDF for non-Newtonian fluid viscosity (https://www.cfd-online.com/Forums/fluent/172276-udf-non-newtonian-fluid-viscosity.html)

moabdi May 27, 2016 10:06

UDF for non-Newtonian fluid viscosity
 
Hi every body
I have Written an UDF for non-Newtonian Fluid, but it doesn't work in both series and parallel fluent run.the code is:

#include "udf.h"
#include "math.h"
#include "sg_udms.h"
#include "sg.h"
#include "stdio.h"
#include "mem.h"
#include "dpm.h"
#include "surf.h"


DEFINE_PROPERTY(cell_viscosity,c,t)
{
#if !RP_NODE
real SR=C_STRAIN_RATE_MAG(c,t);
real n=0.70;
real k=0.29;
real YSR;
real PV=10.00;
real YP=6.00;
real EV;

YSR=YP/(k-PV);

if (SR<YSR)
EV=YP*((2*YSR-SR)/(YSR*YSR))+k*((2-n)+(n-1)*(SR/YSR));
else
EV=(YP/SR)+k*(exp((n-1)*log(SR/YSR)));
return EV;
#endif
}

it's my pleasure if some body could help me
BEST REGARDS

nvarma May 27, 2016 10:13

whats the error you are getting?

moabdi May 27, 2016 11:28

AMG solver ERROR

bhargavbharathan May 31, 2016 10:54

What non-newtonian model are you trying to write a udf for? Bingham? HB? Cross? Power law?

I have one written for HB with n=1.

Reply with more information.

-BB

msbhatti123 May 31, 2016 11:27

Need help for UDF generation
 
Dear All,
I am trying to get formula's for sst kw equations. i found but so many. could you please help me upload formula which are common for use for sst kw model. I want UDF for inlet boundary conditions for wind flow which is fully turbulent. thanks in advance

bhargavbharathan May 31, 2016 11:37

Quote:

Originally Posted by msbhatti123 (Post 602688)
Dear All,
I am trying to get formula's for sst kw equations. i found but so many. could you please help me upload formula which are common for use for sst kw model. I want UDF for inlet boundary conditions for wind flow which is fully turbulent. thanks in advance

Hi,

It is straightforward to write a UDF for velocity inlet. Provide us more details on what you intend to give as the boundary condition i.e. what kind of velocity inlet condition you wish to specify. Then a simple udf can be written and hooked up.

As for the "sst kw", I'm assuming it means steady state k-w turbulence model? You can get the model details and equations from the ANSYS user manual.


-BB

msbhatti123 May 31, 2016 11:40

Quote:

Originally Posted by bhargavbharathan (Post 602691)
Hi,

It is straightforward to write a UDF for velocity inlet. Provide us more details on what you intend to give as the boundary condition i.e. what kind of velocity inlet condition you wish to specify. Then a simple udf can be written and hooked up.

As for the "sst kw", I'm assuming it means steady state k-w turbulence model? You can get the model details and equations from the ANSYS user manual.


-BB

thanks Bhargav, yes it is steady state. but there are so many things like production generation. if possible could you please upload formula which is normal in use. I am from chandigarh and if possible plz share your contact details if i need more help from you. thanks

bhargavbharathan May 31, 2016 11:51

Quote:

Originally Posted by msbhatti123 (Post 602692)
thanks Bhargav, yes it is steady state. but there are so many things like production generation. if possible could you please upload formula which is normal in use. I am from chandigarh and if possible plz share your contact details if i need more help from you. thanks

Hi,

Check out this link from CFD online:
http://www.cfd-online.com/Wiki/SST_k-omega_model

This is from the theory guide:
https://www.sharcnet.ca/Software/Flu...ug/node487.htm

-BB

msbhatti123 May 31, 2016 11:59

Quote:

Originally Posted by bhargavbharathan (Post 602693)
Hi,

Check out this link from CFD online:
http://www.cfd-online.com/Wiki/SST_k-omega_model

This is from the theory guide:
https://www.sharcnet.ca/Software/Flu...ug/node487.htm

-BB

Thanks for sharing but still there is one thing. as my wind profile is steady state and the given equations are with respect to time. but i just ignore them say differentiation thing.

msbhatti123 May 31, 2016 12:38

Quote:

Originally Posted by msbhatti123 (Post 602695)
Thanks for sharing but still there is one thing. as my wind profile is steady state and the given equations are with respect to time. but i just ignore them say differentiation thing.

As i am using steady state situation. i can't use transient formula, because nothing is changing with time. i am keeping wind profile constant in whole domain. wind profile is changing only with height. but in formula differentiation is with respect to time. thanks . any help will be appreciated.

moabdi June 1, 2016 02:26

Hi Bhargav Bharathan
I am trying to write HB(Herschel-Bulkley) for various n,K and Yield Point.
n,k and Yield Point will be change in every run.

pakk June 1, 2016 04:13

The original UDF from moabdi's opening post gives negative viscosities. That is why Fluent will give a solver error. Check if you made no mistake in typing the equations or constants.

moabdi June 1, 2016 04:37

Quote:

Originally Posted by pakk (Post 602792)
The original UDF from moabdi's opening post gives negative viscosities. That is why Fluent will give a solver error. Check if you made no mistake in typing the equations or constants.

Hi pakk and thanks for your attention and trying to check the formula
you are right, negative viscosity caused be this term : k-PV
and must be replaced by PV-k

now, i ask if some body has the better formula for define Herschel-Bulkly non-Newtonian fluid model in UFD

thanks and Best Regards

bhargavbharathan June 1, 2016 10:19

Quote:

Originally Posted by moabdi (Post 602768)
Hi Bhargav Bharathan
I am trying to write HB(Herschel-Bulkley) for various n,K and Yield Point.
n,k and Yield Point will be change in every run.

Hi,

When you say n, K, tau change n every run then I guess you mean they change for every new trial where you have a range of each values? I suggest you write journal files instead of UDFs, since you just want to change the material properties.

All you need to do is prepare the journal file then load it for each case.

-BB

moabdi June 2, 2016 01:21

Quote:

Originally Posted by bhargavbharathan (Post 602852)
Hi,

When you say n, K, tau change n every run then I guess you mean they change for every new trial where you have a range of each values? I suggest you write journal files instead of UDFs, since you just want to change the material properties.

All you need to do is prepare the journal file then load it for each case.

-BB

Hi
yes, i have one model that must be solved with 5 different non-Newtonian fluids, then compare the results, so, what is "journal files" ? and how could create or write a journal file? please, explain more
thanks and Best Regards

bhargavbharathan June 2, 2016 10:05

Hi,

Read up on the internet about it, if you are having troubles I can send over my own journal file for this purpose. Although I must warn you the order of the commands in the journal could change depending on the exact setup you choose. Hence, even if you have my file or a reference from somewhere else always check line by line for errors before implementing.

https://www.sharcnet.ca/Software/Flu.../ug/node94.htm
http://www.cfd-online.com/Wiki/Fluen...TUI.29_Related

-BB

moabdi June 3, 2016 01:56

Quote:

Originally Posted by bhargavbharathan (Post 603094)
Hi,

Read up on the internet about it, if you are having troubles I can send over my own journal file for this purpose. Although I must warn you the order of the commands in the journal could change depending on the exact setup you choose. Hence, even if you have my file or a reference from somewhere else always check line by line for errors before implementing.

https://www.sharcnet.ca/Software/Flu.../ug/node94.htm
http://www.cfd-online.com/Wiki/Fluen...TUI.29_Related

-BB

Hi
thanks and Best Regards

dananefetta May 10, 2018 05:23

pleeezz send me a udf bingham fluid

pakk May 10, 2018 13:46

Please try to implement it yourself, and come here if you have problems.


All times are GMT -4. The time now is 08:41.