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

UDF - Anisotropic Conductivity

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 25, 2020, 09:30
Default UDF - Anisotropic Conductivity
  #1
Senior Member
 
Sasan Ghomi
Join Date: Sep 2012
Location: Denmark
Posts: 292
Rep Power: 15
sasanghomi is on a distinguished road
Dear friends

The following UDF is about the anisotropic conductivity matrix for a cylindrical shell.

ِDoes anybody understand different parts of this code?
I have some questions and I would be thankful if someone could help me.

1) What is the role of x Matrix? at first, the code is calculating x Matrix, but it is not understandable to me.

2) dmatrix is the tensor responsible for conductivity in cylindrical coordinate.
/* dmatrix is computed as xT*cond*x */
This line implies that matrix X transpose *vector cond*matrix X

This multiplication is not possible, I suppose. because;

matrix X[3*3]
matrix X transpose[3*3]
Vector cond [1*3]

Could anybody give me some hints? How dmatrix is calculated in the rest of the code?


Code:
/******************************************************************************
 UDF for defining the anisotropic conductivity matrix for a cylindrical shell
 ******************************************************************************/
 #include "udf.h"
 /* Computation of anisotropic conductivity matrix for
 * cylindrical orthotropic conductivity */
 /* axis definition for cylindrical conductivity */
 static const real origin[3] = {0.0, 0.0, 0.0};
 static const real axis[3] = {0.0, 0.0, 1.0};
 /* conductivities in radial, tangential and axial directions */
 static const real cond[3] = {1.0, 0.01, 0.01};
 DEFINE_ANISOTROPIC_CONDUCTIVITY(cyl_ortho_cond,c,t,dmatrix)
 {
 real x[3][3]; /* principal direction matrix for cell in cartesian coords. */
 real xcent[ND_ND];
 real R;
 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 is computed as xT*cond*x */
dmatrix[0][0] = cond[0]*x[0][0]*x[0][0]
 + cond[1]*x[1][0]*x[1][0]
 #if RP_3D
 + cond[2]*x[2][0]*x[2][0]
 #endif
 ;
 dmatrix[1][1] = cond[0]*x[0][1]*x[0][1]
 + cond[1]*x[1][1]*x[1][1]
 #if RP_3D
 + cond[2]*x[2][1]*x[2][1]
 #endif
 ;
 dmatrix[1][0] = cond[0]*x[0][1]*x[0][0]
 + cond[1]*x[1][1]*x[1][0]
 #if RP_3D
 + cond[2]*x[2][1]*x[2][0]
 #endif
 ;
 dmatrix[0][1] = dmatrix[1][0];
 #if RP_3D
 dmatrix[2][2] = cond[0]*x[0][2]*x[0][2]
 + cond[1]*x[1][2]*x[1][2]
 + cond[2]*x[2][2]*x[2][2]
 ;
 dmatrix[0][2] = cond[0]*x[0][0]*x[0][2]
 + cond[1]*x[1][0]*x[1][2]
 + cond[2]*x[2][0]*x[2][2]
 ;
 dmatrix[2][0] = dmatrix[0][2];
 dmatrix[1][2] = cond[0]*x[0][1]*x[0][2]
 + cond[1]*x[1][1]*x[1][2]
 + cond[2]*x[2][1]*x[2][2]
 ;
 dmatrix[2][1] = dmatrix[1][2];
 #endif
 }
__________________
Best regards,
Sasan Ghomi
sasanghomi is offline   Reply With Quote

Reply


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
Anisotropic thermal Conductivity sasanghomi CFX 5 August 5, 2020 17:56
I need one simple udf code for effective thermal conductivity of nanofluid mvf Fluent UDF and Scheme Programming 1 February 10, 2017 19:05
UDF for specific heat and electrical conductivity walied123 Fluent UDF and Scheme Programming 4 February 20, 2015 06:17
UDF for thermal conductivity aghamohammad Fluent UDF and Scheme Programming 1 April 13, 2014 04:03
UDF for effective thermal conductivity Rashmi FLUENT 1 November 6, 2007 20:08


All times are GMT -4. The time now is 00:03.