|
[Sponsors] |
March 6, 2010, 09:26 |
laplacian operatorin udf
|
#1 |
Disabled
Join Date: Jul 2009
Posts: 63
Rep Power: 16 |
first hello to all
i would like to know if i am doning this right or wrong i want to ad an laplacian term to fluent´s momentium equation and then in the same iteration just take it away that increase the stability in some cases e.g. like turbluence etc. rho*DV/Dt = - grad (p) + div(tau) + alpha*Laplace(U) - alpha*Laplace(U) '''wich is offcurce an null operator on the right side''' the udf i programmed for fluent and interpretid succsiflully is: ------------------------------------------------------------------- #include "C:\Fluent.Inc\fluent6.3.26\src\udf.h" /* Fluent-Header */ #include "C:\Fluent.Inc\fluent6.3.26\src\sg_press.h" #include "C:\Fluent.Inc\fluent6.3.26\src\mem.h" #include "alpha.h" enum { u_xx, u_yy, v_xx, v_yy, N_REQUIRED_UDS }; DEFINE_ADJUST(first_derivative, domain) { Thread *t; cell_t c; C_UDSI(c,t,u_xx) = C_DUDX(c,t); C_UDSI(c,t,u_yy) = C_DUDY(c,t); C_UDSI(c,t,v_xx) = C_DVDX(c,t); C_UDSI(c,t,v_yy) = C_DVDY(c,t); } //-----------------adding alpha*laplace(U) DEFINE_SOURCE(Positiv_DEVSS_x,c,t,dS,eqn) { real Positiv_u_x; real Positiv_force_x; Positiv_u_x = alpha*(C_UDSI_G(c,t,u_xx)[0] + C_UDSI_G(c,t,u_yy)[1]); Positiv_force_x = Positiv_u_x; dS[eqn] = 0.0; return Positiv_force_x; } DEFINE_SOURCE(Positiv_DEVSS_y,c,t,dS,eqn) { real Positiv_u_y; real Positiv_force_y; Positiv_u_y = alpha*(C_UDSI_G(c,t,v_xx)[0] + C_UDSI_G(c,t,v_yy)[1]); Positiv_force_y = Positiv_u_y; dS[eqn] = 0.0; return Positiv_force_y; } //-----------------taking alpha*laplace(U) away DEFINE_SOURCE(Negativ_DEVSS_x,c,t,dS,eqn) { real Negativ_u_x; real Negativ_force_x; Negativ_u_x = -1.0*(alpha*(C_UDSI_G(c,t,u_xx)[0] + C_UDSI_G(c,t,u_yy)[1])); Negativ_force_x = Negativ_u_x; dS[eqn] = 0.0; return Negativ_force_x; } DEFINE_SOURCE(Negativ_DEVSS_y,c,t,dS,eqn) { real Negativ_u_y; real Negativ_force_y; Negativ_u_y = -1.0*(alpha*(C_UDSI_G(c,t,v_xx)[0] + C_UDSI_G(c,t,v_yy)[1])); Negativ_force_y = Negativ_u_y; dS[eqn] = 0.0; return Negativ_force_y; } i do as flows: just say in define scalars there is 4 uds (but no source for flux) then in material boundary conditions (fluid set) source terms --> there i do for the x_momtium 2 sources on is adding and then take away the same for y then i go to solve and in control slution i just take the uds 0 to uds 4 away so they are not solved then i start the prozess '''' question is that right??? or am i doning some thing wrong???''''' |
|
March 9, 2010, 05:51 |
|
#2 |
Disabled
Join Date: Jul 2009
Posts: 63
Rep Power: 16 |
no ideas ? i mean it should work like this
|
|
July 31, 2013, 17:44 |
|
#3 |
New Member
Qin
Join Date: Feb 2012
Posts: 15
Rep Power: 14 |
Since we can only take the gradient of a scalar in FLUENT, to calculate laplacian of a scalar whose value is stored in a UDS C_UDSI(c,t,0), for example two dimensional d2f/dx2+d2f/dy2, you can use one C_UDSI(c,t,1) to store df/dx (C_UDSI_G(c,t,0)[0]) and a second C_UDSI(c,t,2) to store df/dy(C_UDSI_G(c,t,0)[1]), then, take gradient of C_UDSI(c,t,1)[0] and C_UDSI(c,t,2)[1], then the laplacian = C_UDSI(c,t,1)[0]+C_UDSI(c,t,2)[1]
Hope this will help you Last edited by adam14qin; August 5, 2013 at 17:23. |
|
August 3, 2013, 15:57 |
|
#4 |
Member
Shashank
Join Date: Apr 2011
Posts: 74
Rep Power: 15 |
Sorry but don't you think gradient can also be taken of a scalar, like VOF or temperature? And then the Laplacian of a scalar would lead to a scalar. Would you still do the same thing then?
|
|
August 5, 2013, 17:23 |
|
#5 |
New Member
Qin
Join Date: Feb 2012
Posts: 15
Rep Power: 14 |
Sorry, that was a typo. The gradient is taken from a scalar (gradient is a vector C_UDSI_G(c,t,0)). and the laplacian of a scalar is a scalar:
laplacian = C_UDSI(c,t,1)[0]+C_UDSI(c,t,2)[1] |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Dynamic Mesh UDF | Qureshi | FLUENT | 7 | March 23, 2017 07:37 |
UDF parallel error: chip-exec: function not found????? | shankara.2 | Fluent UDF and Scheme Programming | 1 | January 16, 2012 22:14 |
How to add a UDF to a compiled UDF library | kim | FLUENT | 3 | October 26, 2011 21:38 |
UDF...UDF...UDF...UDF | Luc SEMINEL | FLUENT | 0 | November 25, 2002 04:03 |
UDF, UDF, UDF, UDF | Luc SEMINEL | Main CFD Forum | 0 | November 25, 2002 04:01 |