CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   electrostatic force with UDF (http://www.cfd-online.com/Forums/fluent-udf/50870-electrostatic-force-udf.html)

Jinfeng March 14, 2009 17:37

electrostatic force with UDF
 
I am modeling the air flow which is driven by the ionic wind.

I want to include an electrical body force into the Momentum equations to solve the flow field. I already have the electrical field results (voltage and space charge density) in the format of notepad files. How do I use UDF to do this? Do I need to use "DEFINE_SOURCE" to add a source term on each momentum euqation (x, y and z)? Or how should I do it? How do I read a .txt file into Fluent?

Any help or suggestion would be greatly apprecited! Thanks.

Souviktor March 24, 2009 11:52

magnetostatic field in fluent
 
Hi Jinfeng,

I am also doing almost the same thing(rather trying to do :) ),In my case I have to incorporate a magnetostatic body force term in the fluent solver.

Yes, you are absolutely on the right track...you have to use the define_source macro to do that.Just compute the expression of the force in N/m3 unit (because source terms of momentum equation have to be of that unit) for any cell inside the domain...I mean u don't have to loop over the cells.Fluent will do it for you.Just use the passed cell variable c to access cell properties like temperature (c_t macro),centroid of the cell (c_centroid macro) etc . if you need them.
For my case as the field expression is fairly simple I can calculate it in the udf itself.If it is problematic for you,you can possibly read data file (your field) in the udf ,check udf manual...


The problem however in my case is to linearize the source term.For my case it depends on temperature gradient and other parameters which are independent of the flow.So I am confused how to linearize it if at all.

one more thing do anyone know how to access the adjacent cell properties ?because I have to calculate temperature gradient and as fluent does not offer such thing directly I might have to use finite difference formula to compute it from the temperature values of the adjacent cells....

HenrikS March 24, 2009 12:39

You do not need to linearize, unless you benefit from it in solver stability.

You can see in the UDF manual how to access adjacent cell properties. The gradients are available directly, however. C_T_G(c,t) is the temperature gradient vector in the cell, for example. You might need to specify that the solver shall not remove gradient data from memory, if you require at some point the gradient of a variable that is not currently solved for. How to do this is also written in the UDF manual.

Hope this helps.

/Henrik

Souviktor March 24, 2009 15:10

Thanks HenrikS

Yeah I am actually shaping up to do that (c_t_g), although in manual they clearly said it requires a bigger RAM....I have 1 gb ram...just wondering if it will drink up all the memory...I'll give it a definite try.....

HenrikS March 25, 2009 06:48

I guess that will depend on the size of your mesh. I have used it several times and I have never had any problems. Good luck! :-)


All times are GMT -4. The time now is 18:42.