2nd derivative in UDS
Please Please Help someone. I am trying to model a diffuion  convection  migration problem with a UDS. The transport equation I want to model is this:
del(vel * C) + del( D * del[C]) + del(D * C * A * del[thi]) = 0 Where del is the gradient (sometimes called nabla), vel is the velocity vector, C is the concentration, D is the diffusion coefficient, A is a constant and thi is another UDS (say UDS1). I can write a diffusion/convection UDF easily using the F_FLUX macro, but I have no idea where to start with the last term for migration. Please Please someone help me. 
Re: 2nd derivative in UDS
Hi Andrew,
if D and A are costant you could try to rewrite the third term in this way: del(D * C * A * del[thi]) = D*A*(del[thi]*del[C]+C*del(del[thi]). Giordano Bruno 
Re: 2nd derivative in UDS
Thanks Giordano, I can't say that I fully understand how that equation was derived, but, assuming that it is correct, how do I implement solving for C using a user defined scalar. With this equation I now have a first AND second derivative of thi and another first derivative of of C to deal with.

Re: 2nd derivative in UDS
You could implement the first term:
D*A*(del[thi]*del[C] as dot product of C_UDSI_G(...thi) and C_UDSI_G(...C), but for the last part of second term: del(del[thi]) maybe you have to implement a code for partial derivative of thi gradient but I don't know if this is possible... Good luck!!! Giordano Bruno 
Re: 2nd derivative in UDS
So, I am back where I started in the equation I first put up.  I can't get del(del[thi]).
The irritating thing is I have read a paper buy someone who has done it in fluent, I just have no idea how. Hopefully they will get back to me about it. 
Re: 2nd derivative in UDS
Hi Andrew,
will it be possible to view the second derivative of thi as first derivative of its first derivative? will you be able to find del(thi) first and then find del of del(thi). i guess you may have to use same macro twice some way. swarup. 
Re: 2nd derivative in UDS
Thanks for all your comments, but the person who did it got back to me. The way to do it is actually very simple. If you define the UDS flux, then you the term the UDF returns sits inside a del function anway, so you simply retun the first derivative and fluent takes care of the second part for you. I was trying to set it as a source term

"Thanks for all your comments, but the person who did it got back to me. The way to do it is actually very simple. If you define the UDS flux, then you the term the UDF returns sits inside a del function anway, so you simply retun the first derivative and fluent takes care of the second part for you. I was trying to set it as a source term"
dear friend, i have the same problem of solving the same equation in fluent ,i can't really understand your mean about what you say, could you explain it in detail one more time? 
I try to understand and explain:
 the first approach tried by Andrew was to implement the last term as a source term. It seems it didn't worked. Still, i don't see why it shouldn't; you just need to define the scalar (an actual UDS) UDS1 = (some stuff) * del (UDS0). At this point, the gradient of UDS1 is also available and you can use it as a source term.  the second approach, which turns out to work (but i kinda see problematic) is: as the required term has to appear under a divergence term, it is not much different from the convective term. Hence, the idea is to modify the definition of the convective flux (trough the UDS_FLUX routine) in order to take into account both the real convective part and the required additional term. 
Thank you for your posts.

All times are GMT 4. The time now is 00:39. 