Table of Contents
Boundary conditions where the pressure, temperature and other variables do not change with time (called "essential" or Dirichlet boundary conditions) are typically set using "Fixed State" option in a cell. This is done by selecting the cell in the Grid Editor (see the chapter "The Solution Grid" for details).
A cell with fixed conditions will act as a source/sink for fluid and heat flow.
"Tricks" can be used to selectively fix the pressure or temperature independently. For example, to fix the pressure, the material of the cell can be changed so that the thermal conductivity is zero. Then, only fluid will flow to the cell and the cell will act as a fixed pressure. Similarly, the permeability could be set to zero for the cell to act as a fixed temperature condition.
Sources and sinks are used to define flow into or out of the cell. These are typically used to define production from or injection into a cell. This is used for situations such as a well in a reservoir or rainfall on the surface.
The rates can be defined as constant or using a table to give time/rate pairs. By default, PetraSim assumes a step change when a time history of input is specified. This can be changed in the Solution Parameters options.
To define Sources/Sinks, open the Grid Editor and right-click on a cell to display the context menu. Select Sources/Sinks, Figure 10.1. The user now has several options:
Heat - The rate of Heat In can be defined as a constant or though a table as a function of time. Use a negative number to remove heat.
Mass Out - This defines the mass produced from the cell.
Well on Deliverability - This defines a boundary condition where the cell produces to a fixed pressure. The user defines the Productivity Index and the pressure. See page 54 of the TOUGH2 User's Guide for instructions on calculation of the Productivity Index.
Well from File - This is a coupled wellbore flow model. See page 66 of the TOUGH2 User's Guide for instructions on its use.
Injection - Injection parameters will vary depending on the EOS being used. In general, the user will specify a rate and an enthalpy for each component to be injected.
PetraSim provides a basic option to define wells as geometric objects (lines in 3D space). Injection or production options are assigned to the well and PetraSim handles the details of identifying the cells that are intersected by the well and applying the appropriate boundary conditions to each cell. This is not a true coupled well model, it is a means of identifying the cells that intersect a well and creating the individual sources/sinks for each cell. It also provides a way to label and display wells.
Adding a well and defining the boundary conditions is a two step process. Define the well coordinates by selecting Add Well... on the Model menu. Name the well and give the coordinates in order, either starting at the top or bottom of the well. The new well will be displayed in the tree view, double-click on the well to edit it; right-click to delete the well.
Once a well is created, you can define the minimum and maximum Z coordinates of the completion interval (the range over which the well can flow to the porous media). For models that will use the Well on Deliverability option, it is best if these completion bounds correspond to gridlines in the model. This is because the entire cell depth is used when calculating the Well on Deliverability flow. If the well will use the k*h or Uniform options to distribute the flow, then the completion interval does not need to correspond to the gridlines.
Select the appropriate production or injection option. When flow rates are specified, the number is for the entire well. Flow into each cell the well intersects is apportioned either by k*h (permeability*height) or uniformly. If k*h is used, the total k*h is calculated for the entire well and then the flow into each cell is determined by the permeability and height (intersection length) for that cell. Using this approach, more flow is injected (produced) into cells with higher permeability. The uniform distribution proportions flow by the intersection length of each cell. In either of these cases, PetraSim creates individual sources/sinks for each cell intersected by the well. These sources/sinks are independent of each other.
For the Well on Deliverability option, the user can select the Well Model or User Defined gradient. The Well Model option activates the TOUGH2 well on deliverability model, where the pressure gradient is calculated using a depth dependent flowing density in the wellbore (see the TOUGH2 user manual). In this case, the specified pressure corresponds to the pressure at the center of the top cell in the well. If the User Defined gradient is selected, the pressure is that at the top of the completion interval and the user specifies the gradient directly. For both cases, follow the TOUGH2 guidelines for calculating the Productivity Index.
Although TOUGH2 provides an easy way to set constant essential (Dirichlet) boundary conditions using the "Inactive" cell option, there is no similar provision for time-dependent boundary conditions. There are two reasons for this decision:
This places a significant burden on the user to ensure that all specified states would be physically meaningful.
"The user could get into terrible problems when phase compositions change in the boundary cell, because then primary variables get switched. The user could end up interpolating between one number that means temperature, and another that means saturation [Pruess, 2003]."
The alternate approach is to inject or withdraw mass and/or heat from cells, thus accommodating any phase changes easily and naturally. That is, use natural (Neumann) boundary conditions to obtain the desired essential boundary conditions in the cell. However, since this is an indirect way to accomplish the desired goal, the user needs some guidance on how to accomplish this.
The boundary condition cells should be thought of as cells that are not part of the solution. Therefore, we can set material properties and other parameters in ways that are not tied to the actual problem to be solved. The following sections describe some useful "tricks."
The first concept is to make the volume of the cell with the boundary condition "very large" relative to the other cells in the grid. There is no absolute definition of "very large" but the concept is that the volume should be so large that flow in and out of the boundary condition cell to connected cells will have negligible effect on temperature or pressure in the boundary condition cell. A typical value could be a volume of 1.0E50 m3. In PetraSim, this can be accomplished by setting the volume multiplication factor to a large number (select a cell and then Edit Properties in the Grid Editor).
For a simple temperature boundary condition, we do not want flow into or out of the cell. This can be accomplished by making a special material that has zero permeability and small porosity and applying it to this cell. It is also necessary that the connections between the temperature boundary condition cells and the other cells in the model have a non-zero length in the boundary condition cell. The use of zero permeability and small porosity has two effects:
Because of the small porosity, calculating the necessary heat input/output to change the cell temperature is easy, since there is negligible fluid in the cell and the rock specific heat can be assumed for the entire cell.
Because of zero permeability, no fluid will flow from this cell into any connected cells (the non-zero length connections are also necessary). Note: Although zero permeability is the correct approach, the user should be aware that for upstream weighting of absolute permeability (MOP(11) = 0 or 1), it is still possible to force flow into a cell with zero permeability and non-zero nodal distance [Pruess, 2003].
We now set cell to the desired initial temperature and then specify the heat flow into (or out) of the cell to obtain the desired change in temperature.
This method is directly applicable in PetraSim.
Setting a pressure boundary condition can be accomplished in a similar manner as that used to set a temperature. In this case, a new material is created with zero thermal conductivity and assigned to the cell. As before, it is also necessary that the connections between the temperature boundary condition cells and the other cells in the model have a non-zero length in the boundary condition cell. The pressures in the cell can now be controlled by flow into and out of the cell (see the following example).
This method is directly applicable in PetraSim.
Caution: If the specified pressure results in flow from the boundary condition cell to connected cells, the heat transported by that flow will affect the temperature in the connected cells.
Experienced TOUGH2 users often apply simultaneous temperature and pressure boundary conditions by creating two boundary condition cells, as described above, and then connecting both boundary condition cells to the same cell in the model. TOUGH2 accommodates this, since it is not required that connections represent physically meaningful geometries. As noted, one danger with this approach is that the pressure boundary condition can lead to unwanted heat transport if the fluid flows from the boundary condition cell to connected cells. PetraSim supports this option through the use of "extra cells."
In the following we describe a way to accomplish the same objective, but using only physically meaningful geometry. This method also handles the combined pressure and temperature conditions in a way that usually corresponds to the desired physical behavior with respect to heat transport by flow out of the boundary condition cell.
Setting combined pressure and temperature boundary conditions will use the following concepts:
A "very large" volume in the boundary condition cell. Consequently, "real" flow to connected cells in the model will have negligible change on either pressure or temperature in the boundary condition cell.
A "somewhat larger" permeability in the boundary condition cell (maybe 1000 times the normal value). This means that fluid can flow into or out of the cell but that the pressure drop in the boundary condition cell will be approximately zero. Note: Pruess does not recommend changing the permeability due to possible numerical problems, but instead suggests changing the nodal distance to be small (1.0E-10). Since PetraSim uses true geometry, this approach can be approximated in PetraSim by using "thin" elements for the boundary cells.
A "small" value for the porosity of the boundary condition cell. As a result, the rock heat capacity can be used to calculate the required heat flow to change temperatures.
A "large" value of pore compressibility. This means that water compressibility can be neglected in the calculation of pressure changes due to flow into or out of the boundary condition cell and that changes in volume due to temperature changes will have negligible effect on pressure.
Heat flow to the boundary condition cell will be specified to obtain the desired time-dependent boundary temperature.
Water flow to the boundary condition cell will be specified to obtain the desired time-dependent boundary pressure.
For multi-phase conditions, the pore compressibility can be left as zero, since the gas phase will serve the same purpose. The flow to control pressure would probably use the gas phase and would need to account for the mixture compressibility.
The solution can not resolve transients to a level finer than the time step. Therefore, it is necessary to limit the maximum time step. For example, if the period of a transient is one day, it will be necessary to divide the day into several time steps (5 to 10) to capture the transient response.
By default, TOUGH2 averages the flow data at the beginning and end of the time step. This is fine if the transient is smooth and several time steps are used during to resolve the transient. If larger time steps are used, it is important to activate the rigorous step rate option (In PetraSim, Solution Controls/Options).
The following example is based on a desire to specify time-dependent temperatures and pressures that represent the conditions for a stream in a groundwater calculation. The desired values are given in Figure 10.2 and Figure 10.3.
For the example, create a cell with dimensions of 1 m on each side, but set the volume factor to be 1.0E50. We set the material properties as Figure 10.4.
We calculate the heat flux as follows:

where
is the heat flux,
is the cell volume,
is the rock density,
is the rock heat capacity,
is the change in temperature, and
is the change in time. Note that since the porosity is very small, we only use the rock properties and apply this to the entire cell volume. The calculated values are shown in Figure 10.5.
Similarly, we calculate the required fluid flow rates using:

where:
is the density of water,
is the porosity,
is the pore compressibility, and
is the change in pressure. The calculated values are shown in Figure 10.6.
These are input to TOUGH2. Note that this is a bit tricky, since injection and production must both be set on the same cell. This means that two separate conditions must be set. The injection for flow in and the production for flow out. Set these terms zero when the other is acting, that is, during injection, the production is zero and during production the injection is zero.
The resulting plots show excellent agreement between temperatures, and not quite as good agreement for pressures.