Presentation is loading. Please wait.

Presentation is loading. Please wait.

UNICAMP BOUNDARY CONDITIONS AND SOURCE TERMS Differential equations need to be supplemented by boundary conditions before they can be solved. The boundary.

Similar presentations


Presentation on theme: "UNICAMP BOUNDARY CONDITIONS AND SOURCE TERMS Differential equations need to be supplemented by boundary conditions before they can be solved. The boundary."— Presentation transcript:

1 UNICAMP BOUNDARY CONDITIONS AND SOURCE TERMS Differential equations need to be supplemented by boundary conditions before they can be solved. The boundary conditions which define a fluid- or heat-flow problem usually convey the necessary information about how much fluid enters the domain, where it can leave, what is its temperature on entry, what are the temperatures of the walls, etc. Of course, fluid may be caused to enter or leave at points within the domain, not only at its external limits; and temperatures of structural elements within the domain may also be externally imposed, and exert an influence upon the flow. PHOENICS makes no distinction between "boundary" and "internal" conditions, or between these and "source" terms, so the former term will be used here for all of them.

2 UNICAMP TRANSPORT EQ. & SOURCE TERMS In PHOENICS, boundary conditions and sources appear on the r.h.s. of the differential equation for a variable . Thus S  represents conventionally recognized source terms, such as pressure gradients or viscous heating terms. These are 'built-in' to EARTH. S b1 etc. represent various boundary conditions. These may be present only in certain regions of the domain. More terms of this kind may be also be present in other regions of the domain, and these regions may overlap.

3 UNICAMP BOUNDARY CONDITIONS x SOURCE TERMS The source terms are specific of each phenomenon. They may express area dependent terms such as heat fluxes, internal momentum fluxes imparted by jets, centrifugal forces, etc but also volumetric dependent terms such as buoyancy force, internal heat sources/sink, KE production etc… On the other hand, the b.c. involves the specification of convective and diffusive fluxes at surfaces bounding the domain. At the boundaries there are no neighboring cell and one needs to provide information to this link y x PE W S N we s n Cells inside domain Boundary cells External information transmitted thru b.c. link thru b.c.

4 UNICAMP GENERIC FORM TO DIFFUSIVE & CONVECTIVE FLUXES The diffusive and convective fluxes inside of the domain are expressed generally as: where C  and C P refer to the diffusive and convective coefficients and T is a geometrical multiplier. For short they can be written as:

5 UNICAMP DISCRETIZED EQS. & SOURCE TERMS REPRESENTATION In fact any kind of boundary conditions and source terms can be expressed on the form S = +TC (V -  ), not only the diffusive and convective terms. The plus (+) sign in front of S is because in PHOENICS the source term always appears on the r.h.s. of the transport equation. Representing the external and internal links by TC(V -  ), the discretized equation takes the form: or in a more compact form:

6 UNICAMP IMPLICATIONS OF TC(V -  ) PRACTICE This is a flexible procedure in PHOENICS to implement B.C. & Sources. It involve the following points: 1.PHOENICS always treats a boundary condition as a source of the entity in question (mass, momentum, energy, chemical species, turbulence energy, etc). It therefore does NOT insert boundary values directly. 2.Since sources are inserted at the CENTERS of cells, not at their walls, "boundary conditions" are not truly inserted at boundaries. Of course, near-boundary cells can be made small enough for the shift of location to be unimportant; but PHOENICS also has other ways of effecting what is want. 3.PHOENICS accepts specifications of sources (and therefore of boundary conditions) in terms of a geometrical multiplier ´type´ (T), a 'coefficient' (C) and a 'value' (V). The source for variable  determined by C  and V  is then calculated from: C  * (V  -  P ),

7 UNICAMP SOURCE TERM SPECIFICATION To properly specify SOURCE terms one needs: (1) define the spatial region (PATCH) where the source will be applied (2) define if it is applied in an cell area, cell volume or other type of geometrical parameter (TYPE) (3) define the diffusion coefficient (if it exists) (CO) (4) define the value of  at the boundary (VAL) For short, the specification of B.C. requires two kinds of information: a. Where (and when) the boundary is b. The values of T, C and V

8 UNICAMP PIL COMMANDS FOR BOUNDARY CONDITIONS The ´where´ and ´when´ definitions for the B.C. are set thru PATCH command defined as: PATCH (name, type, IXF,IXL, IYF,IYL, IZF,IZL, ITF,ITL) where: - name is a unique patch name for future reference; - type is T and conveys a geometrical (area, volume) information - IXF,IXL are the first and last IX in the patch; and similarly for y, z and t (time)

9 UNICAMP PIL COMMANDS FOR BOUNDARY CONDITIONS(cont) The specification of C and V is done thru COVAL command: COVAL (name, variable, coefficient, value), where: - name is the patch name to which the command refers - variable is a SOLVEd - for variable - coefficient is C - value is V

10 UNICAMP SOME TYPES OF BOUNDARY CONDITION SETTINGS The types of boundary conditions which have to be provided for are: Fixed value Fixed flux / fixed source Linear boundary condition Non-linear boundary condition Wall conditions Inflows and outflows General sources Each of these will now be explained and illustrated with examples.

11 UNICAMP FIXED VALUE BOUNDARY CONDITION Practical example: we wish to fix the temperature in one corner of a cube to 0.0, and to 1.0 in the diagonally opposite corner. Numerical practice: the value of phi can be fixed in any cell by setting C to a large number, and V to the required value. The equation then becomes: The PIL variable FIXVAL is provided for this purpose. A typical PATCH/COVAL would be: PATCH (FIXED, CELL, IXF,IXL, IYF,IYL, IZF,IZL, ITF,ITL) COVAL (FIXED, phi, FIXVAL, required_value) The PIL variable FIXVAL is a real flag to PHOENICS which is replaced by 2E+10. This value is big enough to prevail over any sum of coefficients and to fix the desired Value.

12 UNICAMP FIXED VALUE BOUNDARY CONDITION - Example From The Library Case A solid cube of material, in which one corner is held at a low temperature, and the diagonally opposite corner is held at a high temperature: GROUP 13. Boundary conditions and special sources **Corner at IX=IY=IZ=1 PATCH(COLD,CELL,1,1,1,1,1,1,1,1) **Fix temperature to zero COVAL(COLD,TEMP,FIXVAL,0.0) **Corner at IX=NX, IY=NY, IZ=NZ PATCH(HOT,CELL,NX,NX,NY,NY,NZ,NZ,1,1) **Fix temperature to 1.0 COVAL(HOT,TEMP,FIXVAL,1.0)

13 UNICAMP FIXED FLUX/FIXED SOURCE BOUNDARY CONDITION Practical example: heat is being generated at a constant (fixed) rate per square meter (W/m 2 ). Numerical practice: a fixed source can be put into the equation by setting C to a small number, so that the denominator is not changed, and by setting V to (source/C). T then ensures that the final source is per cell. The equation then becomes: The PIL variable FIXFLU is provided for this purpose. A typical PATCH/COVAL setting would be: PATCH (SOURCE, area, IXF,IXL, IYF,IYL, IZF,IZL, ITF,ITL) COVAL (SOURCE, phi, FIXFLU, source_per_unit_area)

14 UNICAMP FIXED FLUX/FIXED SOURCE BOUNDARY CONDITION - Example from Library case The PIL variable FIXFLU is a real flag to PHOENICS which is replaced by 2.0E-10. This value is small enough to be negligible over any sum of coefficients and to set the desired flux per area or volume. Library case 921 concerns the prediction of the flow and temperature fields in a closed cavity with one moving wall and a heated block. The heated block appears as shown: Heat source in block = 10 MW/m 3 PATCH(HEATEDBL,VOLUME,NX/4+1,3*NX/4,NY/4+1,3*NY/4,1,1,1,1) COVAL(HEATEDBL,TEM1,FIXFLU,1.0E7) The patch type VOLUME converts the source from (W/m 3 ) to W per cell, by multiplying by the appropriate cell volumes.

15 UNICAMP LINEAR BOUNDARY CONDITION Practical example: One of the domain boundaries is losing heat to the surroundings. The external heat transfer coefficient, H, and the external temperature, Text (K), are both known and constant. Numerical practice: The heat source for a cell with area A is: This is obviously in TC(V-phi) form if T=A, C=H and V=Text. A typical PATCH/COVAL would be: PATCH (HEATL, area, IXF,IXL, IYF,IYL, IZF,IZL, ITF,ITL) COVAL (HEATL, TEM1, heat_transf_coeff, external_temp)

16 UNICAMP COMMENT ABOUT THE FIXVAL PRACTICE FIXVAL fix the value of the variable at the center of the cell. Considering a scalar (temperature) one may have as b.c. the temperature value on the west face, not on P. One have two ways to go: (1) use a fine grid where the difference between T w and T P is negligible and employ the FIXVAL practice; (2) set the face temperature. To close the overall energy balance, one has to specify the heat flux on the west face as: x P w  wP

17 UNICAMP COMMENT ABOUT THE LINEAR B.C. PRACTICE The linear boundary condition practice for setting a heat transfer flux is correct if the ´west´ face temperature is close enough to point P temperature. or if the cell Biot =  wP H/k <<1 means that the conductivity thermal resistance is much smaller than the convective resistance. One can control Bi size by choosing a grid which results in a small  The other way to fix it is to insert the total heat transfer resistance P w T ext

18 UNICAMP LAMINAR WALL BOUNDARY CONDITION The force exerted by the shear stresses on a stationary wall, in laminar flow, is expressed by: where area A is the cell face area,  y is the distance from the cell face to the cell center and Uwall is the velocity on the first node next to the wall. This can be put into form TC(V-  ) if : The problem with this approach is that the density and laminar viscosity may be varying, whilst the distance to the wall will change as the grid is refined, and indeed may change from cell to cell in a BFC grid. This simple method is therefore not recommended, as all the quantities causing problems to the user are known to EARTH. A special PATCH type is provided which automatically sets:

19 UNICAMP MOMENTUM LAMINAR WALL BOUNDARY CONDITION The coefficient, CO, is then a further multiplier, which is usually set to 1.0. These special PATCH types are NWALL, SWALL, EWALL, WWALL, HWALL and LWALL. Example From The Library: The stationary and moving walls in case 921 are specified as shown: Moving wall at South side of domain at –0.1 m/s PATCH (MOVING,SWALL,1,NX,1,1,1,1,1,1) COVAL(MOVING,U1,1.0,-WALLVEL) Stationary wall at North side at 0 deg PATCH (NORTHW,NWALL,1,NX,NY,NY,1,1,1,1) COVAL(NORTHW,U1,1.0,0.0) Note that the coefficients have all been set to 1.0, and the values to the wall surface values. This suffices for momentum laminar wall conditions.

20 UNICAMP ENTHALPY LAMINAR WALL B.C. The wall b.c. deserves special attention when the enthalpy equation is in use. Two observations apply: (1)at the wall there is diffusion of heat and not enthalpy. Therefore the heat flux at the wall is: (2) the diffusion coefficient in PHOENICS is always:  = RHO1*ENUL/PRNDTL(  ). If PRANDTL(H1) is set to (  then Note that the temperature is deduced from the ratio H1/Cp

21 UNICAMP TEMPERATURE (TEM1) LAMINAR WALL B.C. When solving directly the temperature (TEM1) instead of the enthalpy (H1), there is no problem with the TYPE *WALL as long the Prandtl number of TEM1 is set to the thermal condutivity of the material. For example, the thermal cond. of the air, at 20 o C, is 2.58E-02 W/m o C. This is set in GROUP 9: Group 9. Properties RHO1 = E+00; CP1 = E+03 ENUL = E-05 ;ENUT = E-03 PRNDTL(TEM1) = E-02 PRNDTL(  ) if negative set the conductivities. See also entry at ENCYCLOPEDIA

22 UNICAMP ENTALPHY X TEMPERATURE WALL B.C. (cont) When using H1 and the *WALL command CO = 1/Prandtl provided that PRNDTL(H1) is positive and equal to the fluid Prandtl number. When using TEM1and the *WALL command CO = 1.0 provided that PRNDTL(TEM1) is negative and equal to the fluid conductivity. ***********GROUP 13******************* ********GROUP 9************ PATCH (MOVING,SWALL,1,NX,1,1,1,1,1,1) COVAL(MOVING, H1, 1.0/PRNDTL(H1), 100); PRNDTL(H1) = COVAL(MOVING, TEM1, 1.0, 100) ; PRNDTL(TEM1) = -2.58E-02 In both statements the temperature is set to 100 despite of the fact that for the 1 st case what is solved is H1.

23 UNICAMP TURBULENT WALL BOUNDARY CONDITION In a turbulent flow, the near-wall grid node normally has to be in the fully-turbulent region, otherwise the assumptions in the turbulence model are invalid. The wall shear stress and heat transfer can no longer be obtained from the simple linear laminar relationships. Unless a low-Reynolds number extension of the turbulence model is used, the normal practice is to bridge the laminar sub-layer with wall functions. These use empirical formulae for the shear stress and heat transfer coefficients. Three types of wall function are available, selected by the COVAL settings: CO = GRND1 for Blasius power law CO = GRND2 for equilibrium Logarithmic wall function CO = GRND3 for Generalized (non-equilibrium) wall function

24 UNICAMP TURBULENT WALL BOUNDARY CONDITION - Example From The Library Case Library case 172 concerns the prediction of developing flow in a channel. The k-epsilon turbulence model is used. The channel surface at the north side is represented as: GROUP 13. Boundary conditions and special sources ** North-Wall Boundary PATCH (WFUN, NORTH, 1, 1, NY, NY, 1, NZ, 1, 1) COVAL( WFUN, W1, GRND2, 0) The GRND2 in the coefficient slot activates logarithmic wall functions

25 UNICAMP SETTING MASS INFLOW & THE PRESSURE EQUATION Mass inflow into the domain have to be set in the Pressure Correction equation, (P1). For example, suppose a mass inlet at west boundary. There will be no ´west´ link, therefore the term (P’ P -P’ W ) does not exist neither the velocity correction for U´ W. In fact U w is known and it will define the mass flux west face mass flux set as b.c. Type T = Area Coefficient CP These velocities are evaluated internally

26 UNICAMP INFLOW BOUNDARY CONDITION TC(V-  ) FORM All mass flow boundary conditions are introduced as linearized sources in the continuity equation, with pressure (P1) as the variable. A mass source is thus: S MASS = (AREA)*(RHO1)*(INLET VELOCITY) At an inflow boundary, the mass flow is fixed irrespective of the internal pressure. This effect is achieved by setting C to FIXFLU, and V to the required mass flow per unit area: (RHO1)*(INLET VELOCITY). The sign convention is that inflows are +ve, outflows are -ve. A fixed outflow rate can thus be fixed by setting a negative mass flow.

27 UNICAMP INFLOW BOUNDARY CONDITION - Example from the Library Case GROUP 13. Boundary conditions ** Upstream boundary: RHOIN = 1.0 kg/m3 & WIN = 14.0 m/s PATCH(UPSTR, LOW, 1, NX, 1, NY, 1, 1, 1, 1) COVAL(UPSTR, P1, FIXFLU, 14.0); COVAL(UPSTR, W1, 0, 14.0) COVAL for P1 sets the mass flux to 14.0, which is (inlet density)*(inlet velocity). The coefficient is FIXFLU because it causes an inlet of mass into domain. The mass flux is fixed, and the in-cell pressure is allowed to float. COVAL for W1 sets only the convective flux of W momentum (m w WIN). The zero for CO means that there is no momentum diffusion from the inlet, and it applies to C , CP is transmitted directly from P1 equation. Library case 274 concerns the flow over a simplified van geometry. The inflow boundary at the low end of the solution domain is represented as:

28 UNICAMP INFLOW BOUNDARY CONDITION - Example from the Library Case 274 (cont) - The previous PATCH and COVAL statements are correct and are the ones echoed in the RESULT file. To avoid mistakes setting inlet properties there are two equivalent commands named INLET and VALUE for this purpose. The advantage relies on the more straight settings GROUP 13. Boundary conditions and special sources ** Upstream boundary INLET(UPSTR, LOW, 1, NX, 1, NY, 1, 1, 1, 1) VALUE(UPSTR, P1, 14.0); VALUE(UPSTR, W1, 14.0) Note that for an INLET, the VALUE command for P1 sets the mass flux. This is often set as RHOIN*VELIN, the (inlet density) * (inlet velocity). The mass flux is fixed, and the in-cell pressure is allowed to float. The VALUE command for W1 sets the velocity of the inflowing stream. In this case all other variables are taken to be 0.0 at the inlet. If they are not, then VALUE commands would have to be added.

29 UNICAMP FIXING PRESSURE & THE PRESSURE EQUATION For example, suppose one wants to fix pressure at the east boundary. There will be no ´east´ link, therefore the term (P’ P -P’ E ) does not exist neither the velocities U* E and U´ E. In fact U E is expressed in terms of the pressure difference:  U e = C P *(P EXT – P P ) Observe,  Ue is determined in terms of the Pressure difference (external minus pressure point P) not its correction, P´. does not exist = C P (P ext -P P )Ae These velocities are evaluated internally

30 UNICAMP FIXED PRESSURE BOUNDARY CONDITION This is the case of a mass flow boundary where the pressure is fixed irrespective of the mass flow. As with any other variable, the pressure is fixed by putting a large number for C P, and the required external pressure for V. For numerical reasons, FIXVAL tends to be too big. A Cp of about 1E3 usually suffices. The direction of flow is then determined for each cell in the PATCH by whether Pp>Pext, or Pp< Pext. The first produces local outflow, the second local inflow. For further guidance see encyclopedia under COVAL.

31 UNICAMP FIXED PRESSURE BOUNDARY CONDITION - Example from the Library Case The exit boundary in case 274 is a fixed pressure B.C., set as: ** Downstream boundary PATCH(DWSTR,HIGH, 1, NX, 1, NY, NZ, NZ, 1, 1) COVAL(DWSTR, P1, 1000, 0.0) COVAL(DWSTR, W1, ONLYMS, 0.0) In this case, the in-cell pressure is fixed by the COVAL for P1 = 0, and the mass flux is adjusted to satisfy continuity. The direction of flow is determined by whether the in-cell pressure is > or < the fixed value. The COVAL for W1 are supplied in case part of the boundary should be an inflow - they specify velocities to be brought in. They are not used in cells where in-cell pressure > external.

32 UNICAMP GENERAL SOURCE TERMS: IMPLEMENTATION Boundary conditions (or sources) cannot always be specified through a constant coefficient and a constant value. In many instances, the coefficient and/or the value are functions of one or several solved-for variables, the value of which cannot be foreseen at the time of data input. As we have already seen, PHOENICS copes with these complex relationships through the insertion of FORTRAN coding in the GROUND module. To do so, special flags (GRND, GRND1,... GRND10) can be specified as coefficients and/or values in the COVAL command. These instruct EARTH to visit special sections of GROUND, where coefficients and/or values can be computed and set back into EARTH. Nearly all the conditions specified in GREX are of this type.

33 UNICAMP NON-LINEAR BOUNDARY CONDITION In the previous example, either or both the heat transfer coefficient and external temperature are likely to be a function of some solved-for variable or other suitable expression. The non-linear source can always be linearized into TC(V-phi) form by arranging to update C and/or V during the course of the calculation. The updating of C and V is signaled to EARTH by setting C or V to one of the 'ground flags' - GRND, GRND1, GRND2,..., GRND10. Thus the following COVALs may be seen: COVAL (HEATLOSS, TEM1, GRNDn, external_temp) or COVAL (HEATLOSS, TEM1, heat_transf_coeff, GRNDn) or COVAL (HEATLOSS, TEM1, GRNDn, GRNDn)

34 UNICAMP EXAMPLES OF NON-LINEAR SOURCES Example 1: The pressure drop through a porous medium can frequently be written in the form: This can be turned into a momentum source (force): where vol is the cell volume.The source is proportional to velocity squared.

35 UNICAMP TREATMENT OF NON-LINEAR SOURCES Non-linear and interconnected sources will normally allow several representations in the linear form. Practice 1: The source can be introduced as a fixed flux (FIXFLU) source, with the value of the source computed from in- store values. This practice is not recommended, as it tends to be numerically unstable. However, in some cases it is the only way. Practice 2: If at all possible, the source should be linearized. Frequently, there will be more than one way to linearize a source. Only experience will show which is the most stable.

36 UNICAMP EXAMPLES OF SOURCE LINEARIZATION The quadratic momentum source can be written as: where v* is the current in-store velocity. In the converged solution, v = v*, and the source is the required one. This is in form if:

37 UNICAMP THE PIL IMPLEMENTATION The PIL implementation for, say, the W1 equation is: PATCH (PDROP, PHASEM, 1,NX, 1,NY, 1,NZ, 1,LSTEP) COVAL (PDROP, W1, GRND, 0.0) Note that the type PHASEM sets T to The GROUND code would set.

38 UNICAMP NON-LINEAR SOURCES FROM Q1 So far, it has been stressed that linear sources can be specified directly from Q1, but that non-linear sources need additional coding in GROUND. Many such sources have already been provided by CHAM. In addition to the GROUND code already supplied in GREX, a wide range of non-linear sources CAN be introduced directly from Q1 without the need for any GROUND coding. A range of these will now be described. A full list can be found in the Encyclopedia, under the PATCH entry. The following non-linear Q1-set sources will be exemplified: Stagnation Pressure Condition Quadratic Source Power Law Source Radiative Heat Loss to the Surroundings These sources can also all be set from the Menu, using the User- Declared Source option of the Boundary Conditions submenu.

39 UNICAMP SUMMARY OF MAIN POINTS Boundary conditions and sources are treated in PHOENICS as linearized sources having the form. Two PIL commands convey the information required: a PATCH command which sets "where", "when" and T, and a COVAL command which sets the values of C and V. For a variable , the main kinds of boundary conditions are: Fixed-value boundary condition (coefficient = FIXVAL) Fixed-flux boundary condition (coefficient = FIXFLU) Wall-type boundary condition (patch type = *WALL) Linear boundary condition (coefficient = proportionality constant)

40 UNICAMP SUMMARY OF MAIN POINTS (cont) Boundary conditions for mass and pressure are both treated as linearized sources in the continuity equation, with pressure as the variable in the linear source:. FIXFLU is used as coefficient for the specification of mass fluxes, and FIXVAL or FIXP for fixing the pressure. Boundary conditions must be supplied for all the variables when there is an inflow mass into the domain. This is done by using ONLYMS as coefficient in the COVAL command for the property, and the inflowing value as value. Linear sources, and certain non-linear sources can be introduced directly from the Q1 or Menu, by appropriate settings of coefficient and/or value. Non-linear sources have to be linearized, and the non-constant part programmed in GROUND. This is flagged by using GRND, GRND1... GRND10 for coefficient or value. Many such sources are already provided in GREX.

41 UNICAMP FURTHER INFORMATION POLIS -> ENCYCLOPEDIA under the entries: PATCHES, PATCHES TYPE settings for PATCHes, TYPE settings for PATCHes COVAL and COVAL BOUNDARY CONDITIONS. BOUNDARY CONDITIONS POLIS -> DOCUMENTATION -> LECTURE ON PHOENICS -> General Lectures for Version 2.2.LECTURE ON PHOENICS


Download ppt "UNICAMP BOUNDARY CONDITIONS AND SOURCE TERMS Differential equations need to be supplemented by boundary conditions before they can be solved. The boundary."

Similar presentations


Ads by Google