This workshop is intended to provide extensive practice with boundary conditions and sources. The following topics are covered:
For some of the steps involved, either the solution or a helpful hint is given at the end of this document. (Such steps are marked see note in the main text). However, participants are advised to try for themselves before turning to the solution.
Library cases are loaded by clicking on File, Load from libraries, and entering the required case number in the 'Case number' data entry box.
Results are saved by clicking on File, Save as a case.
If you prefer to do the tutorial in 'Command mode' using PIL, click on 'File', 'Start New Case', then on 'Core' to get an 'empty' Q1. Now, instead of loading the library cases as above, click on Run, Satellite to run in command mode.
The Q1 file can be edited by clicking on File, Open file for editing, Q1.
The 'Hints and Solutions' section gives answers for both VR and command modes.
Load core library case 240 (2D channel flow) and learn about the case through VR Editor and the main menu, or by editing the Q1 file. Change the surface enthalpy of the plate from 0 J/kg to 5 J/kg. Activate the graphical convergence monitor. (see note 1).
Run the case, and inspect the results (particularly, the Z-direction velocity). See how the VR settings in the Q1 have been translated into PIL settings in the RESULT file. You might want, at this stage, to save the Q1, PHI and RESULT files as a new case, for future reference.
Now try to change the surface enthalpy of 5J/kg to a surface heat flux along the wall, with a value of 5 W/m2 (see note 2). Run the case, and look in the RESULT file. The net source of enthalpy (reNAMEd to TEMP) reported in the RESULT file (lines starting NET SOURCE OF) for this PATCH is 10.0 why? (see note 3). Save the Q1, PHI and RESULT files.
In the original Q1 file for this case, fix the enthalpy in the near-wall cells to 5 J/Kg. (see note 4). How is the solution changed, and why? Check the net source printout in the RESULT file. Why has the H1 source for this object vanished, and can anything be done about it? (see note 5).
What is the difference between the original case, and the two versions above? (note 6).
Wall-type boundary-conditions
Load core library case 921 using the VR Editor and the 2D menu. Learn about the case through VR Editor and the main menu, or by inspecting the Q1 file. Activate the graphical convergence monitor, then run the case and save the results as before. (See note 7)
In the RESULT file, find the net momentum source for the moving wall. Why is it negative? (see note 8)
Change the direction / and / or speed of the moving wall. Make some or all of the other walls move. See what happens to the signs of the wall momentum sources when the flow direction is reversed.
Inlet boundary-conditions
Load library case 240 again.
Activate the graphical convergence monitor. (see note 1).
Change in the inlet boundary-condition, the VALUE command for W1 to a COVAL command with FIXVAL as coefficient (see note 9). Then run the case. What is the difference with the standard case (see note 10). Why is this?
In a new Q1 file for case 240, set the density to 5.0 (see note 11.) Then run the case and check, in the RESULT file, the new velocity and pressure distribution. What has happened and why? (see note 12). What corrections should be made in VR-Editor or the Q1 file to avoid this? (See note 13)
In a fresh copy of the Q1 file for this case, change the input data where needed so that the inlet velocity is 10.0 (see note 14). Run the case and check the RESULT file.
FIXP (outlet) boundary-conditions
Locate, in the RESULT file for case 240, the outlet boundary-condition. Which kind of boundary condition is it (see note 15)
Run the standard case and examine the RESULT file: is the exit pressure close enough to 0.0? If not, why not and how can you tell? (see note 16). Modify the case so as to bring the outlet pressure closer to 0.0, and check the results. (see note 17)
Increase the number of grid cells to 10 x 10. Then modify the outlet boundary condition, so that it only covers the upper half of the duct. (see note 18). Run the case and examine the results with VR-Viewer. What happens and why? (see note 19)
Hints and Solutions
Click on the 'Object management' button on the hand set. This will bring up the 'Object managemnet' dialog box.
Select the objecty name 'NORTH' (north wall) and double clik on it. This will bring up the 'Object specification' dialog box.
Click on Attributes. Enter 5.0 in the 'Value' data entry box.
Click on 'OK' to close the 'Attributes' dialog and then click on 'OK' to exit from the object specification dialog box.
Click on Main menu / Output / ASCII (this will toggle to GRAPHICS)
Group 22
Set TSTSWP=-1
The surface enthalpy would be set by a PATCH/COVAL combination such as:
Group 13
PATCH (NORTH, NWALL, 1, 1,NY, NY, 1, NZ, 1, LSTEP)
COVAL (NORTH, TEMP, 1.0, 5.0)
Note also that the enthalpy equation has had its NAME changed to TEMP. From that line on, any reference to enthalpy must be by the name TEMP.
A heat source can be attached to an existing feature (the wall) by the following sequence:
Click on the 'Object management' button on the hand set. This will bring up the 'Object managemnet' dialog box.
Select the objecty name 'NORTH' (north wall) and double clik on it. This will bring up the 'Object specification' dialog box.
Click on Attributes, then on 'Surface Enthalpy' next to Energy source.
From the list of heat sources select 'Surface Heat Flux', and click on OK.
Enter 5.0 in the 'Value' data entry box. Click on 'Total Heat Flux' to toggle to 'per unit area'.
Click on 'OK' to close the 'Attributes' dialog box.
Click on 'OK' to exist from the object specification dialog box.
The flux of enthalpy would be set by a PATCH/COVAL combination such as:
Group 13
PATCH (HOTNORTH, NORTH, 1, 1,NY, NY, 1, NZ, 1, LSTEP)
COVAL (HOTNORTH, TEMP, FIXFLU, 5.0)
The total source of enthalpy (TEMP) for the wall is the product of the flux per unit area times the wall area. The first is 5.0, and the second is 2.0 x 1; the product is therefore 10.0.
A constant temperature can be attached to an existing feature (the wall) by the following sequence:
Click on the 'Object management' button on the hand set. This will bring up the 'Object managemnet' dialog box.
Select the objecty name 'NORTH' (north wall) and double clik on it. This will bring up the 'Object specification' dialog box.
Click on Attributes, then on 'Surface Heat Flux' next to Energy source. From the list of heat sources select 'Linear Heat Source'.
Enter 1.0E10 in the 'Coefficient' data entry box.
The values of enthalpy in the near wall cells would be fixed by a PATCH/COVAL combination such as:
Group 13
PATCH (FIXED, NORTH, 1,1, NY,NY, 1,NZ, 1, LSTEP)
COVAL (FIXED, TEMP, FIXVAL, 5.0)
The source for a PATCH/COVAL pair is S = C (V - f ). With a large coefficient, the effect of the source is to fix the value, V = f (allowing for rounding errors). In such a case, S = 0. Earth is programmed not to print the source whenever 1E10 or more appears as the coefficient, to avoid rounding error. FIXVAL is a huge number - 1E20. If you use a smaller large number, say 1E6, for the coefficient, the value will still be fixed, but not so closely that the resulting source is lost in rounding error.
The original case 240 treats the north boundary as a wall - the surface enthalpy is fixed to 0, but the enthalpy in the near-wall cell is calculated. The heat flux is calculated from the local enthalpy differences. In the second example, the heat flux in each cell is set to 5, and the local enthalpy calculated accordingly. In the last case, the near-wall cell enthalpies themselves are fixed to 5.
The case concerns a closed cavity with one moving and three stationary walls. It contains a centrally-located heated steel block.
Velocity, and hence momentum, is a vector quantity. The wall velocity is set to -0.1, so it is imparting negative momentum to the fluid (accelerating in the minus x direction). The NORTHW patch also has a negative momentum source, as it is slowing down (removing momentum from) fluid moving the positive x direction.
This part of the exercise can only be done with the 'Object management' by changing the type of the inlet object from INLET to USER_DEFINED.
Click on the 'Object management' button on the hand set
Select the inlet object, IN and then double click on it to bring up the object specification dialog box.
From the list of types, select USER_DEFINED.
Click on Attributes to bring up the PATCH/COVAL dialog box. In the 'New' data entry box type IN.
Click on 'Page Dn' and 'Apply'.
Clic kon 'Page Up'
In the 'Type' entry box type LOW and click 'Apply'. Now set Coefficient and Value for the variables as below:
Variable | P1 | V1 | W1 | TEMP |
Coefficient | FIXFLU | 0.0 | FIXVAL | 0.0 |
Value | 5.0 | 0.0 | 5.0 | 9.0 |
Click 'Apply' to check that the values have been entered correctly, then Click OK.
In group 13 use COVAL (IN, W1, FIXVAL, 5.0)
By using FIXVAL, the velocity is 5.0 throughout the inlet section, whereas it was not constant with the other command. This is so because FIXVAL fixes the value of velocity at the faces of the cells involved, whereas the other commands (COVAL / ONLYMS or VALUE) only set the momentum convected in, but allow the cell velocities to change in response, for instance, to wall friction.
Main menu/ Properties / RHO = 5.0
Insert RHO1 = 5 in Group 9
The resulting inlet velocity is now smaller, and the pressure in the first row of cells is also low. The W1 velocity at IZ=1 is therefore seeing a pressure rise - (P(iz=2) - (P(iz=1)). This is because the inlet mass-flux is still set to 5.0 for an inlet velocity of 5.0. This causes an imbalance between momentum and velocity.
The FIXFLU COVAL for P1 (mass) specifies the total inlet mass-flux, which is
m"in = 5.0*inlet_velocity
The outflow from the first row of cells is
m"out = RHO1*W1(iz=1)
Since RHO1 has been increased, the W1(iz=1) velocity has to be smaller if continuity is to be satisfied. The pressure rise is there to decelerate the flow in line with continuity. The continuity equation for IZ=1 states:
m"in =m"out
Hence W1(iz=1) = m"in / RHO1 = 5 / 5 = 1.
The (simplified) momentum equation is
m"in.Win - rho. W1. W1 = -D P
Hence D P = rho.W1.W1 - m"in. Win = 5 * 1 * 1 - 5 * 5 = -20
Click on inlet object twice, then on Attributes. Click on Inlet density is 'User-set' to toggle it to 'Domain fluid'. The mass flux at the inlet will now be calculated from the set velocity, and the density set for the domain fluid in the properties panel of the main menu.
In Group 13, multiply the value in the FIXFLU COVAL for P1 by RHO1. i.e.,
COVAL(IN, P1, FIXFLU, RHO1 * 5).
RHO1 is set to 1.0 by default, so its presence is implicit in the original set-up.
Click on inlet object twice, then on Attributes. Change the Z component of the inlet velocity from 5.0 to 10.0.
Changes will be needed in the COVAL commands for P1 (total mass-flux) and W1 (inlet velocity). This is best done by parameterisation:
Group 13
REAL(WIN)
WIN=10
PATCH (IN, LOW, ...
COVAL (IN, P1, FIXFLU, RHO1 * WIN)
COVAL(IN, W1, ONLMS, WIN)
The pressure is held close to 0.0 at the outlet. Fluid can pass in either direction, depending on the local pressure difference.
Inspection of the RESULT file shows that the pressures at IZ=5 are of the order 5. There are also positive V1 velocities - VR-Viewer shows that the vector field near the exit is peculiar. In a fully developed flow, there should be no pressure gradient normal to the wall, but the internal pressure has been allowed to drift too far away from the constant external pressure.
The internal pressure at the exit can be made closer to the fixed external pressure by increasing the coefficients in the COVAL command (e.g., multiply it by 1000).
Click on outlet object twice/Attributes/enter 1000.0 under coefficient for P1
Group 13
COVAL (OUTLET, P1, 1E3, 0.0)
Click on the Mesh Toggle button on the hand-set. Click on the image of the solution domain to bring up the grid mesh Settings dialog box. Change the Number of cells in the y-direction to 10 and the z-direction to 10.
Click on OK, then on the mesh Toggle button again to remove the display of the mesh.
Click on outlet object twice/change Ysize to 0.5/change Ypos to 0.5/OK
Make the following changes:
Group 4
GRDPWR(Y, 10, 1, 1)
Group 5
GRDPWR(Z, 10, 2, 1)
Group 13
PATCH (OUTLET, HIGH, 1, NX, NY/2+1, NY, NZ, NZ, 1, 1)
The outlet has been particularly blocked or restricted, with the fluid leaving only through those cells in the PATCH. This is because, for the domain boundary cells not covered by FIXP PATCH the default boundary condition applies; no flux of matter, no flux of properties.