本文共199字,15图片,大概需要5分钟阅读完。
点击蓝字|关注我们
说明
本文详细介绍了4种在Fluent中进行圆柱坐标系各向异性物性设置的方法,对于诸如电池行业可极大提升效率
实现















/******************************************************************************UDF for defining the anisotropic conductivity matrix for a cylindrical shellThis UDF is from Ansys Help document and Dr Du Mengjie modified and tested!******************************************************************************/#include "udf.h"#define CELL_NUM 2 //number of cellsreal origin[CELL_NUM][3]; //coordinates of every single cell axisstatic const real axis[3] = {0, 1, 0};int id[CELL_NUM] = {144,147}; //zone id of cells, a function of assignment can be adapted if there are too many cellsstatic const real cond[3] = {1, 100, 100}; //radial, tangential and axial directionsDEFINE_ON_DEMAND(on_demand_func){int i;cell_t c;Domain *d = Get_Domain(1);Thread *t;real xmin,xmax,ymin,ymax,zmin,zmax;real xcent[ND_ND];for ( i = 0; i < CELL_NUM; i++){xmin = 1e30;xmax = -1e30;ymin = 1e30;ymax = -1e30;zmin = 1e30;zmax = -1e30;t = Lookup_Thread(d,id[i]); //obtain cell[i] thread#if !RP_HOSTbegin_c_loop(c,t) //obtain cell[i] domain x/y/z min/max coordinates{C_CENTROID(xcent,c,t);if ( xcent[0] < xmin ) xmin = xcent[0];if ( xcent[0] > xmax ) xmax = xcent[0];if ( xcent[1] < ymin ) ymin = xcent[1];if ( xcent[1] > ymax ) ymax = xcent[1];if ( xcent[2] < zmin ) zmin = xcent[2];if ( xcent[2] > zmax ) zmax = xcent[2];}end_c_loop(c,t)#if RP_NODE //parallel reductionxmin = PRF_GRLOW1(xmin);xmax = PRF_GRHIGH1(xmax);ymin = PRF_GRLOW1(ymin);ymax = PRF_GRHIGH1(ymax);zmin = PRF_GRLOW1(zmin);zmax = PRF_GRHIGH1(zmax);#endif#endifnode_to_host_real_6(xmin,xmax,ymin,ymax,zmin,zmax); //obtain cell[i] center coordinates value and assign them to global array originorigin[i][0] = (xmax + xmin) / 2;origin[i][1] = (ymax + ymin) / 2;origin[i][2] = (zmax + zmin) / 2;}#if !RP_NODEfor ( i = 0 ; i < CELL_NUM; i++)Message("In zone %d, center is %lf, %lf, %lf.n",id[i], origin[i][0],origin[i][1], origin[i][2]);#endif}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;int i;for ( i = 0; i < CELL_NUM; i++)if ( id[i] == THREAD_ID(t))break;C_CENTROID(xcent,c,t);//Message("In zone %d, center is %lf, %lf, %lf.n",id[i], origin[i][0],origin[i][1], origin[i][2]);NV_VV(x[0],=,xcent,-,origin[i]);#if RP_3DNV_V(x[2],=,axis);#endif#if RP_3DR = NV_DOT(x[0],x[2]);NV_VS(x[0],-=,x[2],*,R);#endifR = NV_MAG(x[0]);if (R > 0.0)NV_S(x[0],/=,R);#if RP_3DN3V_CROSS(x[1],x[2],x[0]);#elsex[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_3Ddmatrix[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}
编辑:井文明
核对:郭晓东
相关文章
【客户案例】基于ANSYS Fluent的仿真技术在锂电池热管理系统及工艺制造过程方面的应用
【Discovery】Discovery Model 的CFD几何前处理功能
【Fluent】Ansys Fluent在隧道通风机中的成功应用案例
【Fluent】基于Fluent的某型商用重卡热管理快速仿真
【Fluent Meshing】Fluent Meshing网格教程(密闭几何流程)
【Fluent Meshing】Fluent Meshing网格教程(密闭几何流程)
【Ensight】基于Ansys Ensight 的流固耦合仿真后处理
Ansys 2022R2 Fluid-Structure 安装软件及本地帮助文件
【仿真技巧】Fluent Meshing网格替换方法-电脑版
【仿真技巧】Spaceclaim对影响网格划分质量的区域检查-电脑版
【仿真技巧】Fluent Meshing网格替换方法-手机版
【仿真技巧】Spaceclaim对影响网格划分质量的区域检查-手机版
【仿真技巧】Fluent Mesh Adaption在外气动中的应用-电脑版
【仿真技巧】Fluent Mesh Adaption在燃烧中的应用-电脑版
【仿真技巧】Fluent Mesh Adaption在多相流中的应用-电脑版
【仿真技巧】Fluent Overset Mesh Adaption-电脑版
【仿真技巧】Fluent Mesh Adaption在外气动中的应用-手机版
【仿真技巧】Fluent Mesh Adaption在燃烧中的应用-手机版
【仿真技巧】Fluent Mesh Adaption在多相流中的应用-手机版
【仿真技巧】Fluent Overset Mesh Adaption-手机版

求分享

求点赞

求在看
本篇文章来源于微信公众号: Ansys 流体大本营








评论前必须登录!
注册