Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

/******************************************************************************

UDF 用于定义圆柱壳的各向异性电导率矩阵
******************************************************************************/
#include "udf.h"

/* 各向异性电导率矩阵的计算
* 圆柱形正交各向异性电导率 */

/* 圆柱形电导率的轴定义 */
static const real origin[3] = {0.0, 0.0, 0.0};
static const real axis[3] = {0.0, 0.0, 1.0};

/*径向、切向和轴向的电导率*/
static const real cond[3] = {1.0, 0.01, 0.01};

DEFINE_ANISOTROPIC_CONDUCTIVITY(cyl_ortho_cond,c,t,dmatrix)
{
real x[3][3]; /* 笛卡尔坐标中单元格的主方向矩阵 */
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
}

You might also like