UDF-使用VOF计算泡沫的内部循环
2017-01-19 by:CAE仿真在线 来源:互联网
Problem: |
It is important to get the
internal circulation inside a bubble in many cases. Here the
observer is sitting at the bubble itself. 1) Get the converged solution 2) The define on demand function below computes the velocity of the centroid of the bubble (and also the coordinates of the centroid). 3) The velocity vectors are modified depending upon this velocities. Note: If you save this case file after executing the udf, then you will lose the actual velocity data. So make sure you have the original data securely saved. |
Resolution: | ||
************************************************************************** * Udf to compute the velocity of the centroid of the bubble * change the absolute velocity field to velocity field relative to * the centroid of the bubble * Written by Suman Basu of Fluent India **************************************************************************/ #include "udf.h" DEFINE_ON_DEMAND(move_with_bubble) { int phase_domain_index; real vel_sum[ND_ND],co_ord1[ND_ND],co_ord[ND_ND],volume,average_velocity[ND_ND],x[ND_ND]; cell_t cell; Thread *cell_thread; Domain *subdomain,*mixture_domain=Get_Domain(1); NV_S(vel_sum,=,0.); NV_S(co_ord,=,0.); volume=0.; NV_S( average_velocity,=,0.); NV_S(co_ord1,=,0.); /* loop over all subdomains (phases) in the superdomain (mixture) */ sub_domain_loop(subdomain, mixture_domain, phase_domain_index) { /* loop if secondary phase */ if (DOMAIN_ID(subdomain) == 3) /* loop over all cell threads in the secondary phase domain */ { thread_loop_c (cell_thread,subdomain) { /* loop over all cells in secondary phase cell threads */ begin_c_loop(cell,cell_thread) { C_CENTROID(x,cell,cell_thread); co_ord[0]+=C_VOF(cell,cell_thread)*C_VOLUME(cell,cell_thread)*x[0]; co_ord[1]+=C_VOF(cell,cell_thread)*C_VOLUME(cell,cell_thread)*x[1]; vel_sum[0]+= C_VOF(cell,cell_thread)*C_VOLUME(cell,cell_thread)*C_U(cell,cell_thread); vel_sum[1]+= C_VOF(cell,cell_thread)*C_VOLUME(cell,cell_thread)*C_V(cell,cell_thread); volume+=C_VOF(cell,cell_thread)*C_VOLUME(cell,cell_thread); } end_c_loop(cell,cell_thread) } } } NV_VS(co_ord1,=,co_ord,/,volume); NV_VS(average_velocity,=,vel_sum,/,volume); Message("Centroid[0]=%f\nCentroid[1]=%f\n",co_ord1[0],co_ord1[1]); Message("V_Centroid[0]=%f\nV_Centroid[1]=%f\n",average_velocity[0],average_velocity[1]); thread_loop_c (cell_thread,mixture_domain) { begin_c_loop(cell,cell_thread) { C_U(cell,cell_thread)=C_U(cell,cell_thread)-average_velocity[0]; C_V(cell,cell_thread)=C_V(cell,cell_thread)-average_velocity[1]; } end_c_loop(cell,cell_thread) } } |
开放分享:优质有限元技术文章,助你自学成才
相关标签搜索:UDF-使用VOF计算泡沫的内部循环 Fluent培训 Fluent流体培训 Fluent软件培训 fluent技术教程 fluent在线视频教程 fluent资料下载 fluent分析理论 fluent化学反应 fluent软件下载 UDF编程代做 Fluent、CFX流体分析 HFSS电磁分析
编辑