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

laplacian operatorin udf

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 6, 2010, 09:26
Default laplacian operatorin udf
  #1
Disabled
 
Join Date: Jul 2009
Posts: 63
Rep Power: 16
anon_c is on a distinguished road
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???'''''
anon_c is offline   Reply With Quote

Old   March 9, 2010, 05:51
Default
  #2
Disabled
 
Join Date: Jul 2009
Posts: 63
Rep Power: 16
anon_c is on a distinguished road
no ideas ? i mean it should work like this
anon_c is offline   Reply With Quote

Old   July 31, 2013, 17:44
Default
  #3
New Member
 
Qin
Join Date: Feb 2012
Posts: 15
Rep Power: 14
adam14qin is on a distinguished road
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.
adam14qin is offline   Reply With Quote

Old   August 3, 2013, 15:57
Default
  #4
Member
 
Shashank
Join Date: Apr 2011
Posts: 74
Rep Power: 15
shashank312 is on a distinguished road
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?
shashank312 is offline   Reply With Quote

Old   August 5, 2013, 17:23
Default
  #5
New Member
 
Qin
Join Date: Feb 2012
Posts: 15
Rep Power: 14
adam14qin is on a distinguished road
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]
adam14qin is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
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


All times are GMT -4. The time now is 21:16.