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

UDF for anisotropic diffusivity

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

Reply
 
LinkBack Thread Tools Display Modes
Old   November 24, 2015, 09:00
Default UDF for anisotropic diffusivity
  #1
New Member
 
Zerzura
Join Date: Nov 2015
Posts: 14
Rep Power: 2
Zerzura is on a distinguished road
Good day all,

I would like to implement an Anisotropic Diffusivity for my UDS in a cylinder. This is actually mimicking a drug that is distributing in the arterial wall.
There was a nice example in the UDF manual 12.0 how to do this, unfortunately this does not work in my fluent program and I do not know why. There is already a error message for line 4.
Can somebody please help me?
(I do not know exactly what line 4 and 5 do)

I really appreciate your help!
Have a good day.

UDF:

#include "udf.h"

/* computation of anisotropic diffusivity matrix for cylindrical orthotropic diffusivity */
static const real origin[3] = {0.0, 0.0, 0.0};
static const real axis[3] = {0.0, 0.0, 1.0};

DEFINE_ANISOTROPIC_DIFFUSIVITY(cylc_diff,c,t,i,dma trix)
{
real x[3][3];
real xcent[ND_ND];
real R;
/*diffusivities in radia, tangential and axial directions */
real dd1, dd2, dd3;
dd1 = 3e-14*C_R(c,t);
dd2 = 7e-11*C_R(c,t);
dd3 = 7e-11*C_R(c,t);

static const real diff[3] = {dd1,dd2,dd3};

C_CENTROID(xcent,c,t);

NV_VV(x[0],=,xcent,-,origin);
#if RP_3D
NV_V(x[2],=,axis);
#endif
#if RP_3D
R = NV_DOT(x[0],x[2]);
NV_VS(x[0],-=,x[2],*,R);
#endif
R= NV_MAG(x[0]);
if (R>0.0)
NV_S(x[0],/=,R);
#if RP_3D
N3V_CROSS(x[1],x[2],x[0]);
#else
x[1][0] = -x[0][1];
x[1][1] = x[0][0];
#endif

dmatrix[0][0] = diff[0]*x[0][0]*x[0][0]+diff[1]*x[1][0]*[1][0]
#if RP_3D
+diff[2]*x[2][0]*x[2][0]
#endif
;
dmatrix[1][1]=diff[0]*x[0][1]*x[0][1]
+diff[1]*x[1][1]*x[1][1]
#if RP_3D
+diff[2]*x[2][1]*x[2][1]
#endif
;
dmatrix[1][0] = diff[0]*x[0][1]*x[0][0]
+diff[1]*x[1][1]*x[1][0]
#if RP_3D
+diff[2]*x[2][1]*[2][0]
#endif
;
dmatrix[0][1] = dmatrix[1][0];

#if RP_3D
dmatrix[2][2] =diff[0]*x[0][2]*x[0][2]
+diff[1]*x[1][2]*x[1][2]
+diff[2]*x[2][2]*x[2][2]
;
dmatrix[0][2] = diff[0] *x[0][2]*x[0][2]
+diff[1]*x[1][0]*x[1][2]
+diff[2]*x[2][0]*x[2][2]
;
dmatrix[2][0] =dmatrxi[0][2];

dmatrix[1][2] = diff[0] *x[0][1]*x[0][2]
+diff[1]*x[1][1]*x[1][2]
+diff[2]*x[2][1]*x[2][2]
;
dmatrix[2][1] =dmatrxi[1][2];
#endif
}
Zerzura is offline   Reply With Quote

Old   November 24, 2015, 18:15
Default
  #2
Senior Member
 
anonymous
Join Date: Aug 2014
Posts: 198
Rep Power: 4
ssss is on a distinguished road
There is a bug in your code, dmatrxi[1][2] should be dmatrix
ssss is offline   Reply With Quote

Old   December 20, 2015, 10:37
Default
  #3
New Member
 
Zerzura
Join Date: Nov 2015
Posts: 14
Rep Power: 2
Zerzura is on a distinguished road
I am sorry for my late reply!
Thank you for your answer, you are indeed correct! However I changed my method and no longer need this UDF.

Kind regards, and thanks again!
Zerzura is offline   Reply With Quote

Reply

Tags
anisotropic, diffusivity, udf, uds diffusive

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add a UDF to a compiled UDF library kim FLUENT 3 October 26, 2011 21:38
UDF Fluent binary diffusivity (stefan Maxwell) natantyt Fluent UDF and Scheme Programming 0 September 19, 2011 11:42
UDF programming fullmonty FLUENT 5 June 30, 2011 02:40
Dynamic Mesh UDF Qureshi FLUENT 1 December 2, 2009 01:27
UDF, UDF, UDF, UDF Luc SEMINEL Main CFD Forum 0 November 25, 2002 05:01


All times are GMT -4. The time now is 01:35.