轉載自:http://blog.sina.com.cn/s/blog_a0b4201d0102v7jt.htmlhtml
用習慣了FLUENT的操做界面,再使用OpenFOAM就會以爲很是繁瑣。遇到的第一個問題就是邊界條件的設定。在FLUENT中,例如給定了一個進口邊界(質量或者壓力或者速度)和一個出口邊界(通常是壓力),並在進口處設定湍流強度就能夠了,沒必要關心這三個量在求解的各個方程中的分配。而在OpenFOAM中,這個問題就要顯得複雜的多,以k-epsl模型求解可壓縮流爲例爲例,要求解質量守恆方程,動量守恆方程和能量守恆方程,湍動能方程以及耗散率方程,分別對應P方程,U方程,T方程,k方程和epsl方程,其中U方程是矢量方程,包含三個標量方程。在求解以前要爲每一個方程指定邊界條件。如今的問題就是:只知道壓力進口條件和壓力出口迴流條件,以及進出口都是室溫條件,也就是說只能顯式的給定P方程的進口條件和出口迴流條件,T方程的進口和出口條件,而U方程的邊界條件須要由已知的P方程和T方程的邊界條件間接的獲得。對於這個問題,OpenFOAM提供了各類各樣的邊界條件給定方式,多的足夠讓你眼花繚亂,因此很是有必要深刻的扒一扒。先從OpenFOAM在tutorial中給出的例子入手。 app
以rhoSimplecFoam中的squareBend爲例,給出了alphat,epsilon, k, mut, p, T, U 等7個量的初始條件,固然也包括了邊界條件。其中alphat指的是turbulence thermaldom
diffusivity, 例子中給定的壁面邊界是 ide
compressible::alphatWallFunction; 進口邊界是calculated, value uniform 0;ui
出口邊界是 calculated, value uniform 0; epsilon指的是turbulencethis
kinetic energy dissipationlua
rate, k指的是turbulencespa
kinetic energy,mut指的是turbulence.net
viscosity,同時alphat, epsilon, k, mutcomponent
這個幾個參數都是要給定壁麪條件模型的。像其餘的tutorial例子中給出的也都是速度進口邊界條件,跟個人算例所須要的壓力進口邊界條件不太吻合。
好在OpenFoam給出了各類不一樣類型的邊界條件類型供你們挑選使用,(固然是在不行就只能本身寫了,這纔是OF最強大的的地方嘛)。具體的不一樣內容能夠查詢頁面: http://openfoam.org/docs/cpp/
最終我選擇的邊界條件是:
|
U |
p |
T |
inlet |
pressureInletVelocity |
totalPressure |
inletOutlet |
outlet |
inletOutlet |
totalPressure |
inletOutlet |
wall |
fixedValue |
zeroGradient |
zeroGradient |
k |
Epsilon |
mut |
alpha |
inletOutlet |
inletOutlet |
calculated |
calculated |
inletOutlet |
inletOutlet |
calculated |
calculated |
wallFunction |
wallFunction |
wallFunction |
wallFunction |
歷經千辛萬苦終於可以無報錯運行啦
下面是openFoam給出的根據各類進出口條件分類的邊界條件:
inlet boundary
conditions:
turbulentInletFvPatchField< Type >: This boundary condition generates a fluctuating inlet condition by adding a random component to a reference (mean) field.
surfaceNormalFixedValueFvPatchVectorField:This boundary condition provides a surface-normal vector boundary condition by its magnitude
outletMappedUniformInletFvPatchField< Type >:This boundary conditon averages the field over the "outlet" patch specified by name "outletPatchName" and applies this as the uniform value of the field over this patch
outletInletFvPatchField< Type >:This boundary condition provides a generic inflow condition, with specified outflow for the case of return flow
freestreamFvPatchField< Type >:This boundary condition provides a free-stream condition. It is a 'mixed' condition derived from the inletOutlet condition, whereby the mode of operation switches between fixed (free stream) value and zero gradient based on the sign of the flux
壓力進口條件:
1: fixedPressureCompressibleDensityFvPatchScalarField: This boundary condition calculates a (liquid) compressible density as a function of pressure and fluid properties (這是屬於密度進口條件)
2: uniformTotalPressureFvPatchScalarField: This boundary condition provides a time-varying form of the uniform total pressure boundary condition
3: totalPressureFvPatchScalarField: This boundary condition provides a total pressure condition. Four variants are possible:
4:freestreamPressureFvPatchScalarField:This boundary condition provides a free-stream condition for pressure. It is a zero-gradient condition that constrains the flux across the patch based on the free-stream velocity.
速度進口條件:
1: flowRateInletVelocityFvPatchVectorField: This boundary condition provides a velocity boundary condition, derived from the flux (volumetric or mass-based), whose direction is assumed to be normal to the patch.
2:atmBoundaryLayerInletVelocityFvPatchVectorField:This boundary condition specifies a velocity inlet profile appropriate for atmospheric boundary layers (ABL). The profile is derived from the friction velocity, flow direction and the direction of the parabolic co-ordinate z.
3: pressureNormalInletOutletVelocityFvPatchVectorField: This velocity inlet/outlet boundary condition is applied to patches where the pressure is specified. A zero-gradient condition is applied for outflow (as defined by the flux); for inflow, the velocity is obtained from the flux with a direction normal to the patch faces.
4:pressureInletVelocityFvPatchVectorField: This velocity inlet boundary condition is applied to patches where the pressure is specified. The inflow velocity is obtained from the flux with a direction normal to the patch faces
5: pressureInletUniformVelocityFvPatchVectorField: This velocity inlet boundary condition is applied to patches where the pressure is specified. The uniform inflow velocity is obtained by averaging the flux over the patch, and then applying it in the direction normal to the patch faces
6:pressureInletOutletParSlipVelocityFvPatchVectorField: This velocity inlet/outlet boundary condition for pressure boundary where the pressure is specified. A zero-gradient is applied for outflow (as defined by the flux); for inflow, the velocity is obtained from the flux with the specified inlet direction.
7: pressureDirectedInletVelocityFvPatchVectorField: This velocity inlet boundary condition is applied to patches where the pressure is specified. The inflow velocity is obtained from the flux with the specified inlet direction" direction.
8:pressureDirectedInletOutletVelocityFvPatchVectorField: This velocity inlet/outlet boundary condition is applied to pressure boundaries where the pressure is specified. A zero-gradient condtion is applied for outflow (as defined by the flux); for inflow, the velocity is obtained from the flux with the specified inlet direction.
9: flowRateInletVelocityFvPatchVectorField: This boundary condition provides a velocity boundary condition, derived from the flux (volumetric or mass-based), whose direction is assumed to be normal to the patch.
溫度進口條件:
1: totalTemperatureFvPatchScalarField: This boundary condition provides a total temperature condition.
耗散率進口條件:epsilon進口條件:
1: turbulentMixingLengthDissipationRateInletFvPatchScalarField:This boundary condition provides a turbulence dissipation, $\epsilon$ (epsilon) inlet condition based on a specified mixing length
2: atmBoundaryLayerInletEpsilonFvPatchScalarField: This boundary condition specifies an inlet value for the turbulence dissipation, $\epsilon$ (epsilon), appropriate for atmospheric boundary layers (ABL), and designed to be used in conjunction with the ABLInletVelocity inlet velocity boundary condition.
3:
湍動能進口條件:
1: turbulentIntensityKineticEnergyInletFvPatchScalarField: This boundary condition provides a turbulent kinetic energy condition, based on user-supplied turbulence intensity, defined as a fraction of the mean velocity:
outlet boundary condition出口邊界條件:
freestreamFvPatchField< Type >:This boundary condition provides a free-stream condition. It is a 'mixed' condition derived from the inletOutlet condition, whereby the mode of operation switches between fixed (free stream) value and zero gradient based on the sign of the flux.
inletOutletFvPatchField< Type >:This boundary condition provides a generic outflow condition, with specified inflow for the case of return flow.
uniformInletOutletFvPatchField< Type >:Variant of inletOutlet boundary condition with uniform inletValue.
速度出口條件:
fixedNormalInletOutletVelocityFvPatchVectorField: This velocity inlet/outlet boundary condition combines a fixed normal component obtained from the "normalVelocity" patchField supplied with a fixed or zero-gradiented tangential component depending on the direction of the flow and the setting of "fixTangentialInflow"
fluxCorrectedVelocityFvPatchVectorField: This boundary condition provides a velocity outlet boundary condition for patches where the pressure is specified. The outflow velocity is obtained by "zeroGradient" and then corrected from the flux:
pressureDirectedInletOutletVelocityFvPatchVectorField:This velocity inlet/outlet boundary condition is applied to pressure boundaries where the pressure is specified. A zero-gradient condtion is applied for outflow (as defined by the flux); for inflow, the velocity is obtained from the flux with the specified inlet direction.
pressureInletOutletVelocityFvPatchVectorField:This velocity inlet/outlet boundary condition is applied to pressure boundaries where the pressure is specified. A zero-gradient condition is applied for outflow (as defined by the flux); for inflow, the velocity is obtained from the patch-face normal component of the internal-cell value
pressureNormalInletOutletVelocityFvPatchVectorField:This velocity inlet/outlet boundary condition is applied to patches where the pressure is specified. A zero-gradient condition is applied for outflow (as defined by the flux); for inflow, the velocity is obtained from the flux with a direction normal to the patch faces.
壓力出口條件:
uniformTotalPressureFvPatchScalarField:This boundary condition provides a time-varying form of the uniform total pressure boundary condition.
totalPressureFvPatchScalarField:This boundary condition provides a total pressure condition. Four variants are possible
溫度出口條件:
inletOutletTotalTemperatureFvPatchScalarField:This boundary condition provides an outflow condition for total temperature for use with supersonic cases, where a user-specified value is applied in the case of reverse flow
totalTemperatureFvPatchScalarField:This boundary condition provides a total temperature condition.
通常性的邊界條件: generic boundary conditions:http://foam.sourceforge.net/docs/cpp/a10590.html
calculatedFvPatchField< Type >:This boundary condition is not designed to be evaluated; it is assmued that the value is assigned via field assignment, and not via a call to e.g. updateCoeffs or evaluate.
directionMixedFvPatchField< Type >:Base class for direction-mixed boundary conditions
fixedGradientFvPatchField< Type >:This boundary condition supplies a fixed gradient condition, such that the patch values are calculated using
fixedValueFvPatchField< Type >: This boundary condition supplies a fixed value constraint, and is the base class for a number of other boundary conditions.
zeroGradientFvPatchField< Type >:This boundary condition applies a zero-gradient condition from the patch internal field onto the patch faces.
oscillatingFixedValueFvPatchField< Type >:This boundary condition provides an oscillating condition in terms of amplitude and frequency.
uniformFixedGradientFvPatchField< Type >:This boundary condition provides a uniform fixed gradient condition.
uniformFixedValueFvPatchField< Type >:This boundary condition provides a uniform fixed value condition