|
[Sponsors] |
How to use DEFINE-ADJUST macro to simulate microbial growth rate? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
April 15, 2019, 04:50 |
How to use DEFINE-ADJUST macro to simulate microbial growth rate?
|
#1 |
New Member
Shakib
Join Date: Mar 2019
Posts: 10
Rep Power: 7 |
Hello guys.
Hope you all good I am trying to solve a microbial growth rate with monod equation. Because of absence of appropriate orders in UDF manual, I tried writing a UDF but i cant see the results as velocity contours in graphic contours. Please help me in correction of UDF. Best Regards. /***** UdF for Microbial Growth Rate (Based on Monod Equation) in a Baffled Stirred Tank *****/ #include <udf.h> 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 x[ND_ND];/*x Array in 2D contains x&y and in 3D contains x&y&z*/ 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_CENTROID(x, c, t);/*Output results of 3D cell centroid in Array x*/ mu = mumax * ( s1 / ( ks1 + s1 ) ) * ( s2 / ( ks2 + s2 ) ); } end_c_loop_all(c,t) } } } |
|
April 16, 2019, 01:18 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
what this UDF should do from your point of view?
how it can influence flow velocity? best regards |
|
April 16, 2019, 07:09 |
|
#3 | |
New Member
Shakib
Join Date: Mar 2019
Posts: 10
Rep Power: 7 |
Quote:
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 |
||
April 17, 2019, 01:39 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
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: 7 |
Quote:
Thanks a lot for your time. |
||
April 17, 2019, 02:34 |
|
#6 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Code:
/***** UdF for Microbial Growth Rate (Based on Monod Equation) in a Baffled Stirred Tank *****/ #include <udf.h> 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: 7 |
Quote:
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: 2,363
Rep Power: 34 |
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: 7 |
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: 10 |
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 |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to define the magnitude of "shear" rate in CFD-Post? | khhan0543 | Fluent UDF and Scheme Programming | 0 | January 24, 2017 12:51 |
Missing math.h header | Travis | FLUENT | 4 | January 15, 2009 12:48 |
How to define a Macro accessing rad intensity | Grey | FLUENT | 0 | May 21, 2007 01:12 |
Free surface boudary conditions with SOLA-VOF | Fan | Main CFD Forum | 10 | September 9, 2006 13:24 |
define my own DEFINE macro? to model pithing naca | calogero | FLUENT | 0 | April 10, 2003 06:10 |