|
[Sponsors] |
January 20, 2015, 08:02 |
update UDM via DEFINE_ADJUST
|
#1 |
Member
Peter Aestas
Join Date: Dec 2013
Posts: 64
Rep Power: 13 |
hi,friends,i am still work on a MHD problem, i defined current density of three dimensions,Jx,Jy,Jz, and treated them as UDM. Every iteration i put them in UDF DEFINE_ADJUST to update.
the UDM i put in the DEFINE_ADJUST is cell value such as #define Jx C_UDMI(c,t,0) One problems are confusing me: on the boundary of cathode(zone_ID=1), the current density should be treated as evenly distributed as current I/(pi*r^2),how should i define this in UDM? my ADJUST marco is as follows Code:
DEFINE_ADJUST(uds,d) { Thread *t; cell_t c; face_t,f; /* Make sure there are enough user defined-scalars. */ if (n_uds < N_REQUIRED_UDS) Internal_Error("not enough user-defined scalars allocated"); thread_loop_c(t,d) { begin_c_loop_all(c,t) { Be=e*Bad/me*3.0e10*pow(1.5,3./2.)/(Zi*Zi*C_R(c,t)/mi) Jx=sigma*(-C_UDSI_G(c,t,phi)[0]+k*Te/e)*Nz*C_R(c,t)/mi); Jy=sigma/(1+Be*Be)*(-C_UDSI_G(c,t,phi)[1]+(k*Te/e)*Ny*C_R(c,t)/mi); Jz=Be*Jy; J=sqrt(Jx*Jx+Jy*Jy+Jz*Jz); } end_c_loop_all(c,t) } } |
|
January 20, 2015, 08:18 |
|
#2 |
Member
Peter Aestas
Join Date: Dec 2013
Posts: 64
Rep Power: 13 |
I came up with one using THREAD_ID to decide how to do in the loop:
Code:
DEFINE_ADJUST(uds,d) { Thread *t; cell_t c; face_t,f; int zone_ID; /* Make sure there are enough user defined-scalars. */ if (n_uds < N_REQUIRED_UDS) Internal_Error("not enough user-defined scalars allocated"); thread_loop_c(t,d) { zone_ID=THREAD_ID(t); if zone_ID==1 { begin_c_loop_all(c,t) { Jx=6.4e5; Jy=0; Jz=0; J=sqrt(Jx*Jx+Jy*Jy+Jz*Jz); } end_c_loop_all(c,t) } else { begin_c_loop_all(c,t) { Be=e*Bad/me*3.0e10*pow(1.5,3./2.)/(Zi*Zi*C_R(c,t)/mi) Jx=sigma*(-C_UDSI_G(c,t,phi)[0]+(k*Te/e)*Nz*C_R(c,t)/mi); Jy=sigma/(1+Be*Be)*(-C_UDSI_G(c,t,phi)[1]+(k*Te/e)*Ny*C_R(c,t)/mi); Jz=Be*Jy; J=sqrt(Jx*Jx+Jy*Jy+Jz*Jz); } end_c_loop_all(c,t) } } } |
|
April 4, 2015, 00:21 |
|
#3 |
New Member
WG Lin
Join Date: Apr 2015
Posts: 1
Rep Power: 0 |
DEFINE_PROFILE(current_density,thread,position)
{ real x[ND_ND],x1,y1,r; face_t f; begin_f_loop(f,thread) { F_CENTROID(x,f,thread); x1=x[0],y1=x[1]; r=sqrt(x1*x1+((y1-0.0055)*(y1-0.0055))); if(r<0.003) { F_PROFILE(f,thread,position)=-1.2e8*exp(-1920.88*r); } else { F_PROFILE(f,thread,position)=0; } } end_f_loop(f,thread) } I think you can try like this |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Change "Implicit Mesh Update Interval" using UDF | ASimonsen | Fluent UDF and Scheme Programming | 2 | October 12, 2017 10:38 |
Segmentation violation | louiza | FLUENT | 16 | June 27, 2017 16:41 |
Cleaning UDM | CeesH | Fluent UDF and Scheme Programming | 8 | August 7, 2014 08:17 |
Help! Delete the UDM codes in the UDF | Messi | Fluent UDF and Scheme Programming | 2 | January 28, 2014 10:01 |
Udm | nasser | FLUENT | 0 | April 7, 2013 10:19 |