CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

UDF for solving body force of plasma actuator

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 1, 2024, 04:20
Default UDF for solving body force of plasma actuator
  #1
New Member
 
Yijun Lu
Join Date: May 2024
Posts: 3
Rep Power: 2
Yijun Lu is on a distinguished road
In "Modeling of Dielectric-Barrier Discharge ActuatorImplementation, validation and generalization of an electrostatic model", there is a UDF :

#include "udf.h"
#include "math.h"
#include "sg_udms.h"
#define debye 0.001
#define rhomax 0.0008
#define phimax 5000
#define sigma 0.003
#define rholoc 0.5

enum {
phi,
rho
};

enum {
Ex,
Ey,
Fx,
Fy,
Fm
};

/* CALCULATION OF ELECTRIC FIELD STRENGTH */

DEFINE_ADJUST(udf_adjust, domain)
{
Thread *t;
cell_t c;

thread_loop_c(t,domain)
{
begin_c_loop(c,t)
{
C_UDMI(c,t,Ex)=-C_UDSI_G(c,t,phi)[0];
C_UDMI(c,t,Ey)=-C_UDSI_G(c,t,phi)[1];
}
end_c_loop(c,t)
}
}

/* DEFINITION OF SOURCE OF HELMHOLTZ EQUATION */

DEFINE_SOURCE(rho_source, c, t, dS, eqn)
{
real source;
source=-pow(debye,-2)*C_UDSI(c,t,rho);
dS[eqn]=-pow(debye,-2);
return source;
}

/* DEFINITION OF X-MOMENTUM SOURCE TERM */

DEFINE_SOURCE(X_Source, c, t, dS, eqn)
{
real Sourcex;
Sourcex=-rhomax*phimax*C_UDSI(c,t,rho)*C_UDSI_G(c,t,phi)[0];
dS[eqn]=-rhomax*phimax;
C_UDMI(c,t,Fx)=Sourcex;
return Sourcex;
}

/* DEFINITION OF Y-MOMENTUM SOURCE TERM */

DEFINE_SOURCE(Y_Source, c, t, dS, eqn)
{
real Sourcey;
Sourcey=-rhomax*phimax*C_UDSI(c,t,rho)*C_UDSI_G(c,t,phi)[1];
dS[eqn]=-rhomax*phimax;
C_UDMI(c,t,Fy)=Sourcey;
C_UDMI(c,t,Fm)=sqrt(C_UDMI(c,t,Fx)*C_UDMI(c,t,Fx)+ C_UDMI(c,t,Fy)*C_UDMI(c,t,Fy));
return Sourcey;
}

/* DISTRIBUTION FUNCTION ON WALL */

DEFINE_PROFILE(rho_profile,thread,i)
{
float r[3];
float x;
real xloc;
face_t f;

begin_f_loop(f,thread)
{
F_CENTROID(r,f,thread);
xloc = r[0];
F_PROFILE(f,thread,i)=exp(-pow((xloc-rholoc),2)/(2*pow(sigma,2)));
}
end_f_loop(f,thread)
}

here are the steps I take:
(1) [IMG]C:\Users\Luyijun\Desktop\complie udf.png[/IMG]

compile the UDF successfully.

(2) [IMG]C:\Users\Luyijun\Desktop\define UDM.png[/IMG]

then define the number of UDM, which is 5.

(3) [IMG]C:\Users\Luyijun\Desktop\define UDS.png[/IMG]

then define the number of UDS, which is 2.

(4) [IMG]C:\Users\Luyijun\Desktop\x mom.png[/IMG]

then insert the x momentum as a source term, as well as y momentum, which is not shown here, but the same process.

(5) [IMG]C:\Users\Luyijun\Desktop\confuse UDS.png[/IMG]

then this is what confuses me. User Scalar 0 should be "udf rho_source::lib.." and User scalar 1 should be "udf rho_profile..."?

(6) [IMG]C:\Users\Luyijun\Desktop\control.png[/IMG]

then should I solve the 4 equations here?


Could someone help me solve this UDF problem? I would appreciate that!

Last edited by Yijun Lu; June 3, 2024 at 21:56.
Yijun Lu is offline   Reply With Quote

Reply

Tags
plasma actuator modeling, udf and programming


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Addition of body force as function of position in icoFoam solver. FluidFox OpenFOAM Running, Solving & CFD 1 September 4, 2020 05:18
plasma actuator UDF babakmonfared FLUENT 1 March 11, 2017 16:36
UDF for body force for rotating cavity with natural convection s.jaiswal FLUENT 0 February 18, 2014 03:01
UDF for body force in DPM elah599 Fluent UDF and Scheme Programming 52 June 17, 2012 08:38


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