Register Blogs Members List Search Today's Posts Mark Forums Read

 February 16, 2007, 06:26 Re: DEFINE_ADJUST Problem #2 Rizwan Guest   Posts: n/a I think (not 100% sure) u surely need to use udmi to store the variables. so that u can use them at a later stage. the problem is due to the fact that, solver contuosly removes gradients at each iteration or timestep to free up memory. make sure u have allocated memory to store ur UDS in first place. the help file mentions a lot about memory when using UDS.

 February 16, 2007, 15:56 Re: DEFINE_ADJUST Problem #3 Bogdan Guest   Posts: n/a remove the line domain=Get_Domain(domain_ID). The domain is already available to your function (via define_adjust argument).

 February 19, 2007, 04:36 Re: DEFINE_ADJUST Problem #4 Davis Guest   Posts: n/a How to make sure that I have allocated memory for UDS? Is it by utilizing Reserve_User_Scalar_Vars? By the way, does somebody know actually what the main difference between user defined scalar (UDS) and user defined memory?

 February 20, 2007, 23:12 Re: DEFINE_ADJUST Problem #6 Davis Yohanes Arifin Guest   Posts: n/a It works now. Thanks. However, I have another question. I would like to have the second gradient of velocity so that I make use UDS as follows. thread_loop_c (t,domain) { begin_c_loop (c,t) { C_UDSI(c,t,0) = C_U_G(c,t)[0]; C_UDSI(c,t,1) = C_V_G(c,t)[1]; C_UDSI(c,t,2) = C_W_G(c,t)[2]; } end_c_loop (c,t) } } double grad2_u = NV_MAG(C_UDSI_G(c,t,0)); double grad2_v = NV_MAG(C_UDSI_G(c,t,1)); double grad2_w = NV_MAG(C_UDSI_G(c,t,2)); But, I am not sure what C_UDSI_G returns. It indeed a gradient; but, in which direction? What I need is d2u/dx2, d2v/dy2, and d2w/dz2. Could please provide advice on this?

 February 21, 2007, 01:37 Re: DEFINE_ADJUST Problem #7 Bogdan Guest   Posts: n/a C_UDSI_G returns a vector which components are the x, y and z directions, so: d2u/dx2 is C_UDSI_G(c,t,0)[0], d2v/dy2 is C_UDSI_G(c,t,1)[1] and d2w/dx2 is C_UDSI_G(c,t,2)[2] sunjian and Hesam_Ami like this.

 February 21, 2007, 10:58 Re: DEFINE_ADJUST Problem #8 Davis Yohanes Arifin Guest   Posts: n/a Thank you. Now my udf works perfectly fine.

 December 24, 2009, 09:37 #10 New Member   emma Join Date: Dec 2009 Posts: 4 Rep Power: 14 Has anyone done the similar or been familar with this problem?

 December 28, 2009, 22:07 #11 New Member   emma Join Date: Dec 2009 Posts: 4 Rep Power: 14 Dear Davis Yohanes Arifin, How do you set boundary conditions for uds1, uds2, uds3 because they are only set for your final need. I now meet a quite similar questions. I have to introduce three uds to compute my source term in another uds equation. However, I have no idea whether should I set the same source term to these three uds with the one I need to comput? Please give me some suggestion. Many thanks.

 June 16, 2014, 04:08 #12 New Member   Join Date: Jun 2014 Posts: 16 Rep Power: 9 Hi,Davis. I meet a similar problem. I need to obtain the second derivation of temperature in DEFINE_SOURCE. Here is the code: DEFINE_ADJUST(my_adjust,d) { Thread *t; cell_t c; if (! Data_Valid_P()) return; thread_loop_c(t,d) { begin_c_loop(c,t) { C_UDSI(c,t,1)=C_T_G(c,t)[0]; C_UDSI(c,t,2)=C_T_G(c,t)[1]; C_UDSI(c,t,3)=C_T_G(c,t)[2]; } end_c_loop(c,t) } } DEFINE_SOURCE(uds_source, c, t, dS, eqn) { real source; source=-0.000143472*(C_UDSI_G(c,t,1)[0]+C_UDSI_G(c,t,2)[1]+C_UDSI_G(c,t,3)[2]); dS[eqn]=0; return source; } I've tried solve/set/expert temporary solver memory [yes], and iterated some steps before hooking DEFINE_ADJUST. After I hook DEFINE_ADJUST, it can calculate without any problems. But once I include the source term, I meet the error access_violation. Can you give me some suggestion? Thank you in advance.

 September 20, 2015, 13:22 #13 Member   Join Date: Nov 2014 Posts: 42 Rep Power: 9 Hi every body I wanted to return derivative of UDS as wall boundary value, but I faced with "fatal signal" while initializing (both Hybrid and standard) that I found this because of boundary condition UDS. this is part of my udf for B.C of UDS( volume fraction of nanoparticle in my case) DEFINE_PROFILE(alpha_bc1,thread,position) { Thread *t; cell_t c; . . . begin_f_loop(f,thread) { C_UDSI_G(c,t,0)[0]=-(D_T/D_B)*C_T_G(c,t)[0]; F_PROFILE(f,thread,position)=C_UDSI_G(c,t,0)[0]; } end_f_loop(f,t) } I would appreciate if anyone can help me about my mistakes.

 September 20, 2015, 14:04 #14 Member   Join Date: Nov 2014 Posts: 42 Rep Power: 9 Furthermore, I used Define_Adjust to calculate laplacian, maybe this is my fault? can I use UDS as scalar variable and then I used it in source function? I will turn off all Uds except one that I wanted to solve. is it true? thread_loop_c(t,d) { begin_c_loop(c,t) { C_UDSI(c,t,1)=D_T*C_T_G(c,t)[0]; C_UDSI(c,t,2)=D_T*C_T_G(c,t)[1]; C_UDSI(c,t,3)=D_T*C_T_G(c,t)[2]; Laplacian=Laplacian+C_UDSI_G(c,t,1)[0]+C_UDSI_G(c,t,2)[1]+C_UDSI_G(c,t,3)[2]; C_UDSI(c,t,5)=dD_T*C_T_G(c,t)[0]; C_UDSI(c,t,6)=dD_T*C_T_G(c,t)[1]; C_UDSI(c,t,7)=dD_T*C_T_G(c,t)[2]; d_Laplacian=d_Laplacian+C_UDSI_G(c,t,4)[0]+C_UDSI_G(c,t,5)[1]+C_UDSI_G(c,t,6)[2]; C_UDSI(c,t,9)=D_D*C_T_G(c,t)[0]; C_UDSI(c,t,10)=D_D*C_T_G(c,t)[1]; C_UDSI(c,t,11)=D_D*C_T_G(c,t)[2]; LL=LL+C_UDSI_G(c,t,9)[0]+C_UDSI_G(c,t,10)[1]+C_UDSI_G(c,t,11)[2]; C_UDSI(c,t,13)=dD_D*C_T_G(c,t)[0]; C_UDSI(c,t,14)=dD_D*C_T_G(c,t)[1]; C_UDSI(c,t,15)=dD_D*C_T_G(c,t)[2]; dLL=dLL+C_UDSI_G(c,t,13)[0]+C_UDSI_G(c,t,14)[1]+C_UDSI_G(c,t,15)[2]; } end_c_loop(c,t) } C_UDSI(c,t,4)=Laplacian; C_UDSI(c,t,8)=d_Laplacian; C_UDSI(c,t,12)=LL; C_UDSI(c,t,16)=dLL; }

February 29, 2020, 04:37
#15
Senior Member

mahdi rostami
Join Date: Jan 2020
Posts: 155
Rep Power: 4
Quote:
hi dear friend

what are the arguments for this macros for accessing species mass fraction?