fluent UDF ManualÀïÃæDEFINE_PROPERTY µÄ Example 4 - Density Function for Compressible Liquids£¬¶¨Òå¿ÉѹËõÒºÌåµÄÃܶȣ¬ÇëÎÊÕâ¸öUDFÀïÃæµÄÃܶȺÍÉùËÙ¹«Ê½Ô´×ÔÄÄÀUDF³ÌÐòÀïÃæµÄÉùËÙ¹«Ê½ºÃÏñºÍÇ°ÃæÌáµ½µÄ ÉùËÙ=£¨Ñ¹Á¦¶ÔÃÜ¶ÈÆ«µ¼ÊýµÄ¿ª·½£©²»Ì«Ò»Ñù£¬ÎªÊ²Ã´£¿ÁíÍ⣬ʹÓÃÕâ¸öudfʱ ³õʼ»¯Ñ¡ÔñÇøÓò¾Í»áÌáʾ´íÎ󣬵«ÊÇÈç¹û°´Ãæ°åÀïÃæµÄÖµ½øÐгõʼ»¯£¬Ò²ÄܼÆËãµÄ£¬²»Çå³þÔÒò¡£
¸½ Example 4 - Density Function for Compressible LiquidsµÄÔÎÄÈçÏ£º
Liquid density is not a constant but is instead a function of the pressure field. In order to stabilize the pressure solution for compressible flows in FLUENT, an extra term related to the speed of sound is needed in the pressure correction equation. Consequently, when you want to define a custom density function for a compressible flow, your model must also include a speed of sound function. Although you can direct FLUENT to calculate a speed of sound function by choosing one of the available methods (e.g., piecewise-linear, polynomial) in the Materials panel, as a general guideline you should define a speed of sound function along with your density UDF using the formulation:
£¨Ñ¹Á¦¶ÔÃÜ¶ÈÆ«µ¼ÊýµÄ¿ª·½£©£¨²»ÄÜÊäÈ빫ʽ£¬Ö»ºÃÎÄ×Ö±í´ï£©
For simplicity, it is recommended that you concatenate the density and speed of sound functions into a single UDF source file.
The following UDF source code example contains two concatenated functions: a density function named superfluid_density that is defined in terms of pressure and a custom speed of sound function named sound_speed .
/********************************************************************
Density and speed of sound UDFs for compressible liquid flows.
For use with pressure-based solver, for single phase, multiphase mixture
or cavitation models only.
Note that for density function, dp is the difference between a cell
absolute pressure and reference pressure.
*********************************************************************/
#include "udf.h"
#define BMODULUS 2.2e9
#define rho_ref 1000.0
#define p_ref 101325
DEFINE_PROPERTY(superfluid_density, c, t)
{
real rho;
real p, dp;
real p_operating;
p_operating = RP_Get_Real ("operating-pressure" ;
p = C_P(c,t) + p_operating;
dp = p-p_ref;
rho = rho_ref/(1.0-dp/BMODULUS);
return rho;
}
DEFINE_PROPERTY(sound_speed, c,t)
{
real a;
real p, dp,p_operating;
p_operating = RP_Get_Real ("operating-pressure" ;
p = C_P(c,t) + p_operating;
dp = p-p_ref;
a = (1.-dp/BMODULUS)*sqrt(BMODULUS/rho_ref);
return a;
}
![fluent udf°ïÖúÎļþÀïÃæ¿ÉѹËõÒºÌåµÄ¼ÆË㹫ʽԴ×ÔÄÄÀ]()
![fluent udf°ïÖúÎļþÀïÃæ¿ÉѹËõÒºÌåµÄ¼ÆË㹫ʽԴ×ÔÄÄÀ-1]()
udf manualÀïÃæµÄÉùËÙ¹«Ê½.gif |