要素
境界表面
において、
法線方向成分がスカラー関数
であるベクトル量を数値積分する
関数のテンプレートは、以下のようになる。
/* 表面上の法線方向成分指定の積分:三次元ボリューム */
void WH_Fem__Isoparam3D__Volume__int_S_Iface_f_whV_n_whD_S__TEMPLATE
(WH_Fem__Shape3DType shapeType,
WH_Fem__Element3DType elementType,
int nNodes,
double whV_x_arrayIn[/* nNodes */][3],
int Iface,
double OUT__int_S_Iface_f_whV_n_whD_S[3])
/*
入力引数:
shapeType は要素形状のタイプ
elementType は要素のタイプ
nNodes は整数で、要素節点数
whV_x_arrayIn はベクトルの節点配列で、位置(節点座標)
Iface は整数で、要素面ID
出力引数:
OUT__int_S_Iface_f_whV_n_whD_S はベクトルで、
スカラー値を法線方向成分としたベクトルの積分値
*/
{
int order;
int nPoints;
int Ip;
/***********************************************/
/* このテンプレートの利用者は、ここを書き直す */
/***********************************************/
/* 関数 f の多項式の次数を2とする。*/
order = 2;
WH_Tensor3D__assign_whV_OUT_whV
(WH_Tensor3D__whV_O,
OUT__int_S_Iface_f_whV_n_whD_S);
/* 次数 order に対応する積分点数 nPoints を得る */
WH_Fem__NumInt__Gauss3D__nPoints_Iface
(shapeType, order, Iface,
&nPoints);
for (Ip = 0; Ip < nPoints; Ip++) {
double whV_xi_Ip[3];
double w_Ip;
double whP_N_whV_xi_arrayIn[10][3];
double whPt_whV_x_whV_xi[3][3];
double whV_J_S[3];
double f;
double whV_tmp[3];
/* 積分点 Ip の自然座標 whV_xi_Ip を得る */
WH_Fem__NumInt__Gauss3D__whV_xi_IfaceIp
(shapeType, order, Iface, Ip,
whV_xi_Ip);
/* 積分点 Ip の重み係数 w_Ip を得る */
WH_Fem__NumInt__Gauss3D__w_IfaceIp
(shapeType, order, Iface, Ip,
&w_Ip);
/* 変換子 whV_J_Sを計算する */
WH_Fem__Shape3D__whP_N_whV_xi_arrayIn
(elementType, nNodes, whV_xi_Ip,
whP_N_whV_xi_arrayIn);
WH_Fem__Isoparam3D__Volume__whPt_whV_x_whV_xi
(nNodes, whP_N_whV_xi_arrayIn, whV_x_arrayIn,
whPt_whV_x_whV_xi);
WH_Fem__Isoparam3D__Volume__whV_J_S_Iface
(shapeType, Iface, whPt_whV_x_whV_xi,
whV_J_S);
/***********************************************/
/* このテンプレートの利用者は、ここを書き直す */
/***********************************************/
/* スカラー値 f を自然座標 whV_xi_Ip で評価する */
/* 例 f = 1.0 の場合 ( whV_xi_Ip は無視 ) */
f = 1.0;
WH_Tensor3D__s_mul_whV_OUT_whV
(f * w_Ip, whV_J_S,
whV_tmp);
WH_Tensor3D__whV_add_whV_OUT_whV
(OUT__int_S_Iface_f_whV_n_whD_S, whV_tmp,
OUT__int_S_Iface_f_whV_n_whD_S);
}
}