## Fluids

#### Electric field in a microfluidic channel

• EmilGr
Subscriber

Hello.

i am modelling a fluid flow in a micorlfuidic channel. I would like to include the influence of an electric field (no current!) on this flow, the electrodes are on the two side walls ofthe channel, there is a thin layer of polymer between them and the fluid in the channel. I know fluent provides the electric potential model, however, as far as i understand it aways include current and as i said i would like to describe a pure el. field. Could you give me some hints of what to do?Thank you!

• Rob
Ansys Employee

If there's no current how is there a field?

• EmilGr
Subscriber

Hello Rob,

Thank you for the responds. You are partially right, It is possible however also to achieve a small field without current. I managed with the activation of the mhd module in ansys. In the next step i try to create an UDF for defining an AC voltage on the walls as a boundary condition. I am sorry to ask this question, I hate when people post random UDF codes, expecting that other help them but I really struggle with this one. So my code looks like this:

#include "udf.h"
#include "math.h"

{
real t = CURRENT_TIME; // get current simulation time
real V0 = 220.0; // set peak voltage to 220 V
real freq = 50.0; // set frequency to 50 Hz
real w = 2.0*M_PI*freq; // calculate angular frequency
face_t f;
real A, V, phase;

A = V0/2.0; // calculate amplitude of sinusoidal voltage
phase = 0.0; // set phase shift to zero

{
{
V = A*sin(w*t + phase); // calculate voltage at current time
F_PROFILE(f, thread, position) = V; // set voltage at wall face
}
}
}

However it is showing me following errors, which are maybe linked to the logic of the code:

Error: C:/Users/49157/AppData/Local/Temp/voltage.c.6596.0.c: line 18: parse error.

Error: C:/Users/49157/AppData/Local/Temp/voltage.c.6596.0.c: line 24: parse error.

Again, I am sorry if this is not the correct place for debugging codes but could you at least give me a small hint.

Best,

Emil

• Rob
Ansys Employee

Profiles are assigned to surfaces manually, so I suspect the if (BOUNDARY_FACE_THREAD_P(f, thread)) part is either unnecessary or undefined within the macro. Check the lines the error is reporting, and then for parse errors look at that line and the few above: the common cause is a missing ; but I can't see that here.

• EmilGr
Subscriber

Thank you for the reply, the UDF works indeed when i delete the if loop. I have a question regarding the electric field again … As mentioned I am using the MHD module in Fluent for simulating electric field in a microchannel. There is however, a certain problem on my side with understanding how exctly this module works. So when I apply the UDF as a boundary condition on one of the walls, it works fine, there is no electric field generated, just potential. There is, however in the boundary condition tab, another menu where one can define a UDS for the potential of the wall. When i define this UDS potential, i get indeed an electric field in my system, even without any current. So can someone please explain me what is the difference between the “standard” boundary condition where i can define with the UDF and the UDS value for the potential which is also in the boundary condition menu. The problem is I cannot apply my UDF for AC voltage into this UDS tab as my simulation crashed. Thank you!

P.S. Yes I already looked into the Users Manual of Fluent, however this type of details are not fully explained there

• Rob
Ansys Employee

Saves me asking the usual question! :)

A scalar is an extra equation we solve over the top of the normal model. Check scalar diffusivity (no one ever looks at the materials panel) but it's also possible the solver is struggling with scalar gradient/motion as not all of the usual stability numerics apply.  If it's not in the manual I can't really comment, and electric fields are one of the areas I know very little about.