|
[Sponsors] |
August 17, 2000, 06:26 |
Change porous properties in UDF?
|
#1 |
Guest
Posts: n/a
|
How do I change the porous properties, for a porous zone, from a UDF? Especially I want to change the viscous and inertial resistances.
|
|
August 17, 2000, 15:38 |
Re: Change porous properties in UDF?
|
#2 |
Guest
Posts: n/a
|
Take a look at the first example on the UDF section 5.2.1 maybe is what you need.
Regards |
|
August 30, 2000, 23:48 |
Re: Change porous properties in UDF?
|
#3 |
Guest
Posts: n/a
|
You can use the following UDFs I've written to do it. They just implement the standard Fluent porous media source terms in the momentum eqns - but you can then specify the co-efficients in any way you like.
(Below I've just copied all the code I developed - the Materials Properties function is used to return the co-efficients as a function of x,y,z - you can make it more efficient by eliminating this function and directly conding into the source UDFs) /************************************************** **********************/ /* Porous Media Source Code */ /* */ /* By Greg Perkins */ /* CANCES, Australian Technology Park */ /* Ph: 02 9318 0004, Fax: 02 9319 2328 */ /* Email: perkinsg@cances.atp.com.au */ /* */ /* Started: 10-11-99 */ /* */ /* Revised: 22-11-99 */ /************************************************** **********************/ /* ---- These routines implement a porous media model (same as standard Fluent model) that can vary spatially and temporily. To use in Fluent compile and link source library as described in the Fluent UDF manual. Then use the udf in the source terms for momentum equations */ #include "udf.h" #include "sg.h" /* ---- use a user defined scalar to track material properties of the domain */ enum { PERM, N_REQUIRED_UDS }; /* --- misc defines */ #define PERM_EXP_VOID 35.0 #define PERM_EXP_MATERIAL -20.0 #define PERM_ADJ_FALSE 0 #define PERM_ADJ_TRUE 1 #define UDS_PERM(alpha) log10(alpha) /* --- permeability function for scalar-0 */ #define WEIGHT 1.0e20 /* --- weighting co-eff in linearized eqn */ #define WEIGHT2 1.0e20 #define INLET_VELOCITY 10.0 /* --- inlet velocity in m/s */ /* ---- define criteria for various possible configurations */ #define MAT_CHANNEL(x,y,z) ((y<=0.25) || (y>=0.75)) #define MAT_STEP(x,y,z) ( ((x<=1.0)&&(y<=0.5)) || ((x>1.0)&&(y<=0.25)) ) #define MAT_ONECHANNEL(x,y,z) (y<=0.5) #define MAT_CHANNEL2(x,y,z) ( ((x<=1.0)&&(y<=0.5)) || ((x>1.0)&&(y<=0.25)) || (y>=0.95) ) /* ------------------------------------------------------------------------ Material Properties This routine returns the local properties of the material (alpha,C2) for a given location in the domain (x,y,z). ------------------------------------------------------------------------ */ void Material_Properties(real x, real y, real z, real *alpha, real *C2) { /* --- use this routine to return the permeability, alpha and the co-efficient C2, for each location x,y,z in the domain. No Modifications needed for 2D. For time dependent porous media use the RP_Get_Real("flow time") function to find out t (secs) */ if MAT_STEP(x,y,z) { *alpha = pow(10.0,PERM_EXP_MATERIAL); *C2 = 0.0; } else { *alpha = pow(10.0,PERM_EXP_VOID); *C2 = 0.0; } } /* ------------------------------------------------------------------------ X_Momentum_Source This routine returns the source term for the X-momentum term for each control volume in the domain. The local properties are obtained by calling Material_Properties ------------------------------------------------------------------------ */ DEFINE_SOURCE(SRCE_Xmom,cell,thread,dS,eqn) { real x[ND_ND]; real alpha, C2, constant1, constant2, Ux, source; /* --- determine x,y,z co-ordinates of cell */ C_CENTROID(x,cell,thread); /* --- determine local properties */ Material_Properties(x[0], x[1], x[2], &alpha, &C2); /* --- determine constants 1,2 */ constant1 = C_MU_L(cell,thread)/alpha; constant2 = 0.5 * C_R(cell,thread) * C2; /* --- determine x-velocity */ Ux = C_U(cell,thread); source = -(constant1*Ux + constant2 * fabs(Ux) * Ux); dS[eqn] = -(constant1 + 2 * constant2 * fabs(Ux)); /* XXX CHECK */ return source; } /* ------------------------------------------------------------------------ Y_Momentum_Source This routine returns the source term for the Y-momentum term for each control volume in the domain. The local properties are obtained by calling Material_Properties ------------------------------------------------------------------------ */ DEFINE_SOURCE(SRCE_Ymom, cell, thread, dS, eqn) { real x[ND_ND]; real alpha, C2, constant1, constant2, Uy, source; /* --- determine x,y,z co-ordinates of cell */ C_CENTROID(x,cell,thread); /* --- determine local properties */ Material_Properties(x[0], x[1], x[2], &alpha, &C2); /* --- determine constants 1,2 */ constant1 = C_MU_L(cell,thread)/alpha; constant2 = 0.5 * C_R(cell,thread) * C2; /* --- determine y-velocity */ Uy = C_V(cell,thread); source = -(constant1*Uy + constant2 * fabs(Uy) * Uy); dS[eqn] = -(constant1 + 2 * constant2 * fabs(Uy)); /* XXX CHECK */ return source; } /* ------------------------------------------------------------------------ Z_Momentum_Source This routine returns the source term for the Z-momentum term for each control volume in the domain. The local properties are obtained by calling Material_Properties ------------------------------------------------------------------------ */ DEFINE_SOURCE(SRCE_Zmom, cell, thread, dS, eqn) { real x[ND_ND]; real alpha, C2, constant1, constant2, Uz, source; /* --- determine x,y,z co-ordinates of cell */ C_CENTROID(x,cell,thread); /* --- determine local properties */ Material_Properties(x[0], x[1], x[2], &alpha, &C2); /* --- determine constants 1,2 */ constant1 = C_MU_L(cell,thread)/alpha; constant2 = 0.5 * C_R(cell,thread) * C2; /* --- determine z-velocity */ Uz = C_W(cell,thread); source = -(constant1*Uz + constant2 * fabs(Uz) * Uz); dS[eqn] = -(constant1 + 2 * constant2 * fabs(Uz)); /* XXX CHECK */ return source; } |
|
August 31, 2000, 09:29 |
Re: Change porous properties in UDF?
|
#4 |
Guest
Posts: n/a
|
Thanks Greg!
Since you obviously know what you are doing, I have another question. My "Porous Zone" also rotates around an "Axis Origin" (x,y) with a "Rotational Velocity" (rad/s). How should I do to include this as well, i.e. a REVOLVING POROUS ZONE? |
|
August 31, 2000, 22:17 |
Re: Change porous properties in UDF?
|
#5 |
Guest
Posts: n/a
|
There's probably a couple of ways - have you looked at the moving reference frame option in Fluent - you could use that. I have never used it so I really don't know.
If you just want to rotate the source terms in the momentum eqns you can modify the udfs - bear in mind you won't account for other forces like centrifugal/coirolis (?) etc this way. Here's how I might approach it . . . Assume you have a 2D porous zone rotating at w rad/s about the origin and you know the material property distribution at time t=0 - this will be the values of C2 and alpha - ie. alpha(x,y,0) and C2(x,y,0). Now given a cell x,y at time t, you want to know alpha(x,y,t) and C2(x,y,t). Then 1. use the RP function (see udf) to determine the current time t. 2. determine how much rotation has occurred - this is wt (in rads). But we only need to know the extra above a whole revolution so let r = (wt mod 2*pi) (psuedo code, where mod returns the remainder after dividing wt by 2*pi) 3. determine the angle from the x axis (say) of the current point (x,y), thi. This is thi = arctan(y/x) Note: you need to add checks etc to avoid division by zero and to ensure it works in all quadrants - usual thing using trig functions on computers.... 4. also determine distance from origin (or centr of rotation). dist = sqrt(x^2+y^2) 5. Now the position at time t=0 which has the value of (x,y) at the current time t, can be determined:- x1 = dist*cos(thi+r) y1 = dist*sin(thi+r) again add necessary checks to make universal. 6. now use properties at the computed locations and return, ie. alpha(x,y,t) = alpha(x1,y1,0) C2(x,y,t) = C2(x1,y1,0) Hope it helps. Regards Greg Perkins |
|
September 4, 2000, 00:11 |
Re: Change porous properties in UDF?
|
#6 |
Guest
Posts: n/a
|
For Gregg
Hi... I am also working on porous media with variable ( time and spacially) properties and would like to ask you a question. As I analyzed your code you constructed the source in the porous media using the standard form of fluent, S=mu/alpha*Vi+(1/2)C2 rho* abs(Vi)*Vi. In the sort of porous material I am simulating, the source is in terms of the porosity and I would like to vary it with time and space. My question is the following: with Fluent I can define a constant value for the porosity of the media, if I change it in the UDF can I have some kind of problem or I can set it as default ( porosity=1) and change it in the UDF?. Or can I just define a region and as I am defining the source, can I leave it as non porous and proceed with the calculations?. Do you handle the problem of the non accelerating flow in any way? I am a beginer as you can see. Hope you can find time to answer and I thank you in advance. Arturo |
|
September 4, 2000, 00:24 |
Re: Change porous properties in UDF?
|
#7 |
Guest
Posts: n/a
|
The source terms I have written as UDFs are just those as detailed in the Fluent manual. In the examples I think I just set high or low values for the permeability. Normally I use the Ergun equation to determine values of alpha and C2 from the materials porosity and particle diameter - this eqn assumes the porous material is a packed bed of particles - see Ch6 of Fluent 5 manuals (I think).
If you use these UDFs you shouldn't activate the zone as a porous media zone using the Fluent GUI. These UDFs replace the standard terms, and allow you to program and variation as a function of x,y,z and t. If you have another form of the source term - just program it in - ultimately the term should have units compatible with the momentum eqn. All these udfs do is add a source term to the momentum eqns, which attempt to account for the effect of the solid material on the flow of fluid in the region. All models have a range of validity for your application - you need to establish what model is best for you and then program it in. You may like to evaluate several different cases to determine which is best. |
|
September 4, 2000, 12:26 |
Re: Change porous properties in UDF?
|
#8 |
Guest
Posts: n/a
|
Thanks Greg.
I also use some kind of generalized Ergun Equations and I would like to program in fluent. Do you have some experience in using VOF in porous media? Best regards. Arturo Ortiz |
|
September 10, 2000, 01:17 |
Re: Change porous properties in UDF?
|
#9 |
Guest
Posts: n/a
|
No experience of VOF and porous media - sorry! But I imagine so long as you can derive reasonable source terms you shouldn't have too many problems implementing them in Fluent. Getting convergence is often the hard part!
Greg |
|
April 23, 2020, 14:31 |
How to change permeability properties?
|
#10 |
New Member
Rohan Jindal
Join Date: Apr 2020
Posts: 3
Rep Power: 6 |
I am working on a project involving flow through heterogeneous permeability material. How do I write such and UDF? Or is it possible to vary it as a gradient inside a geometry?
I need help urgently!! |
|
April 23, 2020, 15:31 |
Porous Zone Coefficients via UDF
|
#11 |
Senior Member
|
The resistance coefficients in the porous zone can be modified using DEFINE_PROFILE UDF.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
how to change particle properties using udf? | ljp | Fluent UDF and Scheme Programming | 0 | April 2, 2010 10:57 |
with UDF to change mesh by external mesh generator | zou_mo | FLUENT | 0 | June 30, 2009 08:15 |
Change diffusivity in porous media | Jose | FLUENT | 0 | February 23, 2006 19:24 |
UDF to change BC from Wall to Grid Line | Aaron Smith | FLUENT | 0 | February 21, 2006 10:14 |
Cell properties in UDF | Arturo Ortiz | FLUENT | 7 | October 14, 2000 00:34 |