当前位置: 首页 > news >正文

fluent_UDF学习笔记

UDF源代码路径

D:\Program Files\ANSYS Inc\v231\fluent\fluent23.1.0\src

关于颗粒反弹速度的计算

 /* 通过面法向单位向量计算速度的法向向量、切向向量,再通过法向、切向恢复系数重新计算反弹速度*/
         /* Compute normal velocity.将颗粒速度向面法线方向投影,即计算颗粒速度与法线向量的点乘:V(V1,V2)·n(n1,n2)=V1n1+V2n2 */
         for(i=0; i<idim; i++)
           vn += TP_VEL(tp)[i]*normal[i];
         /* Subtract off normal velocity. 新的颗粒速度为切向速度,及原颗粒速度减去法向速度*/
           for(i=0; i<idim; i++)
             TP_VEL(tp)[i] -= vn*normal[i];
         /* Apply tangential coefficient of restitution. 使用切向恢复系数计算反弹后的切向速度*/
           for(i=0; i<idim; i++)
             TP_VEL(tp)[i] *= tan_coeff;
         /* Add reflected normal velocity.使用法向系数计算反弹后的法向速度,再计算合速度,反弹法向速度为法线反方向,即-n(n1,n2) */
           for(i=0; i<idim; i++)
             TP_VEL(tp)[i] -= nor_coeff*vn*normal[i];
         /* Store new velocity in TP_VEL0 of particle */
         for(i=0; i<idim; i++)
           TP_VEL0(tp)[i] = TP_VEL(tp)[i]

在这里插入图片描述
在这里插入图片描述

关于颗粒追踪类型 gtpv_t gvtp;

typedef struct global_tracked_particle_vars_struct
{

#if RP_DPM_CACHE
  /* avoids having to pass additional arguments to AddSources();
   * later should add extra function args to make clean */
  dpm_source_cache_t *source_cache;
  int source_cache_size;
  int source_cache_count;

  film_prop_cache_t *film_prop_cache;
  int film_prop_cache_size;
  int film_prop_cache_count;

  dpm_real_cache_t *real_cache;
  int real_cache_size;
  int real_cache_count;
  dpm_workpile_t *workpile;
  int workpile_size;
  int workpile_count;
  int next_particle;
  float *random_cache;         /* store precomputed random numbers */
  int random_cache_size;
  int next_random;
  float next_gauss_random;     /* save second random generated by gauss_random() */
#endif /* RP_DPM_CACHE */

  /*
   * Current cell type and number of faces in current cell.  Don't use
   * cxfaces_per_cell[ctype] for number of faces as hanging nodes may
   * add additional faces.
   */
  int path_ctype, path_n_faces, path_incl_test;
  int path_n_nodes;               /* number of nodes in current cell */
  int path_face_num;

  /* all of the following global data pertains to the cell in which the current
   * particle is currently located. Should be updated whenever we start a new
   * particle or the particle enters a new cell.
   */
  real prevVel[3];                  /* velocity of particle in prev step. */

  double (*faceEq)[5];              /* faceEq[6*MAX_CELL_NODES][5];  MAX is 6*MAX_CELL_NODES -- polyhedral cell with hanging nodes.
                                     * last element holds magnitude of cross product of edges, e.g., for intersections */
  double (*faceEqV)[5];             /* face equation velocity - for face equations moving in time */
#if RP_3D
  double (*faceEqA)[4];             /* face equation acceleration - for face equations moving in time */
#endif
  double (*facePts)[3][3];          /* facePts[6*MAX_CELL_NODES][3][3]; */
  double (*facePtV)[3][3];          /* facePtV[6*MAX_CELL_NODES][3][3]; */

  int *validEq;                     /* validEq[6*MAX_CELL_NODES];    */
  cxboolean validMovingEquations;   /* safeguard missuse of uninitialized variables */
  int *numFacePts;                  /* numFacePts[6*MAX_CELL_NODES]; */
  int *faceIndx;                    /* faceIndx[6*MAX_CELL_NODES];   */
  real zoneEq[3];
  int zoneEqSet;
  int numCellVisited;

  /* equations for perpendicular planes at each edge on the wall film face (max of 4 edges of physical face, not cortex face) */
  int  *edge_valid;                 /* edge_valid[MAX_FACE_NODES]; */
  double (*edgeEq)[4];              /* edgeEq[MAX_FACE_NODES][4]; */
  double (*edgeEqV)[5];             /* for edge equations moving in time */
#if RP_3D
  double (*edgeEqA)[4];             /* for edge equations moving in time */
#endif
  double (*edgePts)[2][3];          /* for edges moving in time */
  double (*edgePtV)[2][3];          /* for edges moving in time */

  /* interpolation factors for function values at the current location of the particle. updated every step. */
  float *intFact;                 /* intFact[MAX_CELL_NODES]; */

  int n_tracked;
  int n_escaped;
  int n_aborted;
  int n_trapped;//被捕捉颗粒数,无论是aborted or stopped
  int n_stripped;
  int n_separated;
  int n_filmrelease;
#if RP_3D && RP_WALL_FILM
  int n_absorbed;
#endif
  int n_transformed;
  int n_inserted;
  int n_evaporated;
  int n_incomplete;
  int n_incomplete_parallel;
  int n_coalesced;
  int n_collided;
  int n_splashed;
  int n_shed;
  int n_stick;
  int n_rebound;
  int n_spread;
#if RP_DPM_CACHE
  int n_source_cache_deposits;
  int n_cell_updates;
  int n_workpile_updates;
#endif /* RP_DPM_CACHE */
  int n_migrant;
  int n_tracked_migrants;
  double dpm_time;

  float fldmax[3], fldmin[3];        /* also part of c_par */

  struct particle_struct *p_spawned; /* list to carry spawned particles */
  struct particle_struct *p_impinging; /* list for impinging particles */

  /* subtet tracking */
  struct subtet_tracking_location_struct *subtet;

  int mc_convergence_failure;  /* to report when the RK solver does not converge for multicomponent particles */

} gtpv_t; /* type for global tracked particle vars */

关于颗粒PATH类型 ;

typedef enum
{
PATH_END,//escape
PATH_FINAL_STEP,
PATH_ACTIVE,//继续追踪,track
PATH_BREAK,//
PATH_ABORT,//终止,不再追踪
PATH_STOP,//停止,继续追踪
PATH_NON_LOCAL_PERIODIC,
PATH_NON_LOCAL_OVERSET,
PATH_NON_LOCAL_GTI,
PATH_NON_LOCAL,
PATH_REINJECT,
PATH_MAX_STATUS
} Path_Status;

PATH_STOP

在这里插入图片描述
=**

表示颗粒停止移动,颗粒静止在壁面上,不过颗粒轨迹仍参与计算,应该能用做颗粒的沉积再剥离

PATH_ABORT与n_aborted对应

在这里插入图片描述
在这里插入图片描述

颗粒中止计算,从后续计算中移除,不再存在于计算域中,减少计算负担,方便后处理

PATH_END:与n_escaped对应

在这里插入图片描述
在这里插入图片描述

一般用于计算域的出入口,对于一些壁面也能用作颗粒壁面边界条件的简化处理。

PATH__BREAK

颗粒PATH类型之PATH


在这里插入图片描述

颗粒在边界面不断破碎,意味着颗粒轨迹计算不会终止,陷入死循环

相关文章:

  • 进程间通信——信号量
  • git 如何统计还尚未合并完成的文件
  • UE4学习笔记 FPS游戏制作31 显示计分板
  • flex和bison笔记
  • 2025最新“科研创新与智能化转型“暨AI智能体开发与大语言模型的本地化部署、优化技术实践
  • 【MySQL基础-14】MySQL的INSERT语句详解:高效数据插入的艺术
  • 数据特征的判断
  • 机器学习算法
  • mysql不能远程访问可能有哪些原因,及如何解决
  • ubuntu 创建新用户
  • 权值线段树算法讲解及例题
  • 性能测试理论基础-测试流程及方案设计要点
  • 内联函数/函数重载/函数参数缺省
  • 211 本硕研三,已拿 C++ 桌面应用研发 offer,计划转音视频或嵌入式如何规划学习路线?
  • 前端框架入门:Angular
  • Flutter中实现拍照识题的功能
  • Starrocks架构及如何选择
  • 60V单通道高精度线性恒流LED驱动器防60V反接SOD123封装
  • 智能物流调度:AI如何让快递更快更省?
  • 04-SpringBoot3入门-配置文件(多环境配置)
  • 订婚不等于性同意!山西订婚强奸案入选最高法案例
  • 中国乒协坚决抵制恶意造谣,刘国梁21日将前往多哈参加国际乒联会议
  • 人民日报评外卖平台被约谈:合法规范经营,公平有序竞争
  • 内塔尼亚胡:以军将在未来几天“全力进入”加沙
  • 地下5300米开辟“人造气路”,我国页岩气井垂深纪录再刷新
  • 受贿3501万余元,中石油原董事长王宜林一审被判13年