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_3Ddouble (*faceEqA)[4]; /* face equation acceleration - for face equations moving in time */
#endifdouble (*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_3Ddouble (*edgeEqA)[4]; /* for edge equations moving in time */
#endifdouble (*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 stoppedint n_stripped;int n_separated;int n_filmrelease;
#if RP_3D && RP_WALL_FILMint n_absorbed;
#endifint 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_CACHEint 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

顆粒在邊界面不斷破碎,意味著顆粒軌跡計算不會終止,陷入死循環