Porous medium with moving mesh
A case involving porous medium and sliding mesh doesn't give expected results. The reason being, relative velocities are not used in the porous medium inspite of solving with relative velocity formulation. A workaround is to manually provide sink term to the momentum equations which would use relative velocities. Following UDF gives an example for applying above strategy for an isotropic porous medium. /*******************************************************************/ /* UDF for specifying momentum source term to model a fluid zone as a porous zone having moving mesh defined on it. Porous coeffecients are assumed to be isotropic. Hook the UDF to source term of fluid zone(Define--->Boundary Conditions--->Fluid Zone) intended to be modelled as porous medium. /*******************************************************************/ #include "udf.h" /* USER INPUTS*/ /* D is viscous coefficient. C is inertia coefficient. */ #define D 1e9 #define C 10.0 /* USER INPUTS END HERE */ /********************************************************************/ DEFINE_SOURCE(xmom_source, cell, thread, dS, eqn) { real const1,const2,u_rel,v_rel,w_rel,vmag, source; /* vector for grid velocity */ real NV_VEC(g); C_VELOCITY(g, cell, thread); u_rel = C_U(cell, thread) - g[0]; v_rel = C_V(cell, thread) - g[1]; w_rel = C_W(cell,thread) - g[2]; vmag = sqrt(u_rel*u_rel + v_rel*v_rel + w_rel*w_rel); const1= D*C_MU_L(cell,thread); const2= C*0.5*C_R(cell,thread); source = -(const1*u_rel+ const2*vmag*u_rel); dS[eqn]=-(const1+ const2*vmag); return source; } DEFINE_SOURCE(ymom_source, cell, thread, dS, eqn) { real const1,const2,u_rel,v_rel,w_rel,vmag, source; /* vector for grid velocity */ real NV_VEC(g); C_VELOCITY(g, cell, thread); u_rel = C_U(cell, thread) - g[0]; v_rel = C_V(cell, thread) - g[1]; w_rel = C_W(cell,thread) - g[2]; vmag = sqrt(u_rel*u_rel + v_rel*v_rel +w_rel*w_rel); const1= D*C_MU_L(cell,thread); const2= C*0.5*C_R(cell,thread); source = -(const1*v_rel+ const2*vmag*v_rel); dS[eqn]=-(const1+ const2*vmag); return source; } DEFINE_SOURCE(zmom_source, cell, thread, dS, eqn) { real const1,const2,u_rel,v_rel,w_rel,vmag, source; /* vector for grid velocity */ real NV_VEC(g); C_VELOCITY(g, cell, thread); u_rel = C_U(cell, thread) - g[0]; v_rel = C_V(cell, thread) - g[1]; w_rel = C_W(cell,thread) - g[2]; vmag = sqrt(u_rel*u_rel + v_rel*v_rel +w_rel*w_rel); const1= D*C_MU_L(cell,thread); const2= C*0.5*C_R(cell,thread); source = -(const1*w_rel+ const2*vmag*w_rel); dS[eqn]=-(const1+ const2*vmag); return source; } |
||
![]()
|