# How to use DEFINE-ADJUST macro to simulate microbial growth rate?

 Register Blogs Members List Search Today's Posts Mark Forums Read

 April 16, 2019, 01:18 #2 Senior Member   Alexander Join Date: Apr 2013 Posts: 1,567 Rep Power: 21 what this UDF should do from your point of view? how it can influence flow velocity? best regards shakib likes this.

April 16, 2019, 07:09
#3
New Member

Shakib
Join Date: Mar 2019
Posts: 10
Rep Power: 3
Quote:
 Originally Posted by AlexanderZ what this UDF should do from your point of view? how it can influence flow velocity? best regards
Thank you for your quick replay

This UDF should calculate the Monod equation(the picture is attached below) to specify the concentration of bacterias (instead of velocity of species as a second phase! maybe this will be easier and more helpfull to me in this case) as a flow specie in one phase.

Thanks a lot
Attached Images
 Monod Equation.png (18.5 KB, 6 views)

 April 17, 2019, 01:39 #4 Senior Member   Alexander Join Date: Apr 2013 Posts: 1,567 Rep Power: 21 how this equation is connected to transport equation? other words: how this concentration influence velocity? if velocity depends on concentration and you want to simulate this -> this is one story, if doesn't -> another one. by the way, using your coefficients you will get same constant value everywhere in the whole domain best regards

April 17, 2019, 02:22
#5
New Member

Shakib
Join Date: Mar 2019
Posts: 10
Rep Power: 3
Quote:
 Originally Posted by AlexanderZ how this equation is connected to transport equation? other words: how this concentration influence velocity? if velocity depends on concentration and you want to simulate this -> this is one story, if doesn't -> another one. by the way, using your coefficients you will get same constant value everywhere in the whole domain best regards
At first, I decided to write a UDF to calculate this equation in two phases that one of them was fluid and the other one was the bacteria that i had to find out bacterias velocity in the stirred tank but now find out that velocity is not a proper solution so changed my procedure to solve the problem in 1 phase (without any velocity parameter!) thus want to find out bacterias concentration as a flow specie like pressure or density in a particular cut plane (like attached picture below).
Thanks a lot for your time.
Attached Images
 Screenshot (613).jpg (98.5 KB, 6 views)

 April 17, 2019, 02:34 #6 Senior Member   Alexander Join Date: Apr 2013 Posts: 1,567 Rep Power: 21 Code: ```/***** UdF for Microbial Growth Rate (Based on Monod Equation) in a Baffled Stirred Tank *****/ #include DEFINE_ADJUST(bacterial_growth, d) { Domain *domain;/*domain points to domain Thread*/ int ID = 10;/*Number of interior (Fluid) zone*/ Thread *t = Lookup_Thread(domain,ID);/*t points to Thread*/ cell_t c;/*An integer data type that identifies a particular cell within a cell thread that names "c"*/ real mu = 1, s1 = 2, s2 = 3; const real ks1 = 1, ks2 = 2, mumax = 3;/*Using These 3 Orders to declare consistent variables instead of macros that have been written above*/; thread_loop_c(t, domain)/*Looping over Cell threads (e.g. fluid and solid) in Domain*/ { begin_c_loop_all(c,t)/*Loops Over Cells in a Cell Thread*/ { C_UDMI(c,t,0) = mumax * ( s1 / ( ks1 + s1 ) ) * ( s2 / ( ks2 + s2 ) ); } end_c_loop_all(c,t) } }``` C_UDMI(c,t,0) is user define variable, you should allocate memory for it in FLuent GUI go to User-Defined -> Memory -> Number of UDM locations change from 0 to 1 solve Now you can make a contour of C_UDMI(c,t,0) (which is mu): under volume monitors as a field variable select Used Defined Variable and choose memory 0 For more information regarding C_UDMI and UDF look into Ansys Fluent Customization manual best regards

April 17, 2019, 03:40
#7
New Member

Shakib
Join Date: Mar 2019
Posts: 10
Rep Power: 3
Quote:
 Originally Posted by AlexanderZ Code: ```/***** UdF for Microbial Growth Rate (Based on Monod Equation) in a Baffled Stirred Tank *****/ #include DEFINE_ADJUST(bacterial_growth, d) { Domain *domain;/*domain points to domain Thread*/ int ID = 10;/*Number of interior (Fluid) zone*/ Thread *t = Lookup_Thread(domain,ID);/*t points to Thread*/ cell_t c;/*An integer data type that identifies a particular cell within a cell thread that names "c"*/ real mu = 1, s1 = 2, s2 = 3; const real ks1 = 1, ks2 = 2, mumax = 3;/*Using These 3 Orders to declare consistent variables instead of macros that have been written above*/; thread_loop_c(t, domain)/*Looping over Cell threads (e.g. fluid and solid) in Domain*/ { begin_c_loop_all(c,t)/*Loops Over Cells in a Cell Thread*/ { C_UDMI(c,t,0) = mumax * ( s1 / ( ks1 + s1 ) ) * ( s2 / ( ks2 + s2 ) ); } end_c_loop_all(c,t) } }``` C_UDMI(c,t,0) is user define variable, you should allocate memory for it in FLuent GUI go to User-Defined -> Memory -> Number of UDM locations change from 0 to 1 solve Now you can make a contour of C_UDMI(c,t,0) (which is mu): under volume monitors as a field variable select Used Defined Variable and choose memory 0 For more information regarding C_UDMI and UDF look into Ansys Fluent Customization manual best regards
Thank you so much!
my problem solved

I beg your pardon i have another question:is there any differences between writing UDF for moving reference frame and dynamic mesh in this case? I mean something must change in UDF or not?
Because now i am compiling this udf in MRF and in the future i have to use that in dynamic mesh.

Best regards.

 April 17, 2019, 22:53 #8 Senior Member   Alexander Join Date: Apr 2013 Posts: 1,567 Rep Power: 21 You may use it, no modification required This is one function, for dynamic mesh you will make other function (if needed). YOu may use in your UDF as many functions as you want. best regards

 April 20, 2019, 01:41 #9 New Member   Shakib Join Date: Mar 2019 Posts: 10 Rep Power: 3 Thank you so much for your advises Mr Alexander, they were very helpful. I wish best for you. Best regards.

 July 8, 2019, 03:46 #10 Member   Hanye Azimi Join Date: Oct 2016 Posts: 42 Rep Power: 6 Hi everybody Do you know how I should fix this error about a define_adjust UDF 'motion_spec': is not a member of 'tv_cell_struct' thanks in advance

 Tags udf code