Numerical Implementation 49 For node 1,d(1) =u(1) +k(0)co(0). Ifk(m) were not zero, thenk(m)co(m+ 1) would have to be added tod(m). Now we utilize the Thomas algorithm to solve the matrix and obtain the unknown concentrations.
50 Soil Gas Phase and Gas Diffusion if i < n:
g[i] = dg / (z[i + 1] - z[i]) else:
g[i] = 0 a[i + 1] = -g[i]
b[i] = g[i - 1] + g[i]
c[i] = -g[i]
d[i] = u[i]
d[1] = d[1] + g[0] * co[0]
ThomasBoundaryCondition(a, b, c, d, co, 1, n) return(z, co)
def main():
R = 8.3143 n = 20
totalDepth = 1.0 bulkDensity = 1300.
particleDensity = 2650.
waterContent = 0.2 respRate = -0.001 oxygenDiff = 1.77e-5 temperature = 25.
atmPressure = 101.3 boundaryLayerCond = 0.01
# O2 concentration in air [g/m^3]
boundaryOxygenConc = (0.21 * atmPressure * 1000. * 32. / (R * (temperature + 273.15))) porosity = 1. - bulkDensity / particleDensity gasPorosity = porosity - waterContent
# binary diffusion coefficient [m2/s]
binaryDiffCoeff = (oxygenDiff * (101.3 / atmPressure)
* ((temperature + 273.15) / 273.15)**1.75) bg = 0.9
mg = 2.3
dg = binaryDiffCoeff * bg * gasPorosity**mg
z, co = gasSolver(boundaryLayerCond, boundaryOxygenConc, dg, respRate, totalDepth, n)
print ("node depth [m] Co [g\m^3]") for i in range(n + 2):
print ("%3d %6.2f %.2f" %(i, z[i], co[i]))
Numerical Implementation 51
# plot results for i in range(n+1):
plt.plot(co[i], -z[i], ’ko’)
plt.xlabel(’Concentration [g m$^{-3}$]’,fontsize=14,labelpad=2) plt.ylabel(’Depth [m]’,fontsize=14,labelpad=2)
plt.show() main()
The filePSP_ThomasAlgorithm.pycontains the Thomas algorithm (as also de- scribed in Appendix B). The first for loop contains the forward elimination scheme, while the second contains the backward substitution. Finally, the functionThomas is called and the results are printed. The functionThomasBoundaryConditionimple- ments the Thomas algorithm with the option of defining the boundary conditions and therefore knowing the first and the last element of the matrix. This is the algorithm used in the numerical solutions presented here:
#PSP_ThomasAlgorithm.py
from _ _future_ _ import division import numpy as np
def Thomas(a, b, c, d):
n=len(d)
x =np.zeros(n, float) for i in range(0, n-1):
c[i] /= b[i]
d[i] /= b[i]
b[i + 1] -= a[i + 1] * c[i]
d[i + 1] -= a[i + 1] * d[i]
# back substitution x[n-1] = d[n-1] / b[n-1]
for i in range(n-2, -1, -1):
x[i] = d[i] - c[i] * x[i + 1]
return(x)
def ThomasBoundaryCondition(a, b, c, d, x, first, last):
for i in range(first, last):
c[i] /= b[i]
d[i] /= b[i]
b[i + 1] -= a[i + 1] * c[i]
d[i + 1] -= a[i + 1] * d[i]
52 Soil Gas Phase and Gas Diffusion
# back substitution
x[last] = d[last] / b[last]
for i in range(last-1, first-1, -1):
x[i] = d[i] - c[i] * x[i + 1]
The grid is generated in a separate file calledPSP_grid.pyshown below. The pro- gram allows one to generate a linear grid (where the elements are of equal dimension) or a geometric grid (where the elements are thinner closer to the soil surface and geomet- rically increasing with depth). The returned variablezis the incremental depth, which is calledzin the function.
from _ _future_ _ import division import numpy as np
def linear(n, depth):
z = np.zeros(n+2, float) dz = depth / n
z[0] = 0 z[1] = 0
for i in range(1, n+1):
z[i + 1] = z[i] + dz return z
def geometric(n, depth):
z = np.zeros(n+2, float) mySum = 0.0
for i in range(1, n+1):
mySum = mySum + i * i dz = depth / mySum
z[0] = 0.0 z[1] = 0.0
for i in range(1, n+1):
z[i + 1] = z[i] + dz * i * i return z
Figure 3.2 shows results of the simulation for a soil column at uniform water content. Typical literature values of O2 uptake rate for surface soil samples are 10–4– 10–3g m–3s–1. In this simulation, a rate of 5×10–4g m–3s–1was used at the sur- face. Using these values, the flux at the surface was 145 mg m–2s–1. Typical values are 36 mg m–2s–1for an undisturbed sandy clay loam soil, 170 mg m–2s–1for a peat soil, and 36, 93 and 50 mg m–2s–1 for potato, kale and tobacco crops. The simulation therefore seems reasonable. Oxygen concentration remains near atmospheric levels when the gas- filled porosity is 0.2 or above, but decreases quickly with depth as the gas filled porosity drops to 0.1 or below. Negative O2concentrations would be obtained for values deeper in the profile. These are an artefact of the model caused by the incorrect assumption that the oxygen consumption rate is independent of O2.
Exercises 53 0.0
–0.2
–0.4
–0.6
–0.8
–1.0
210 220 230 240
Concentration [g m–3]
Depth [m]
250 260 270 280
Figure 3.2 Simulated oxygen concentration as a function of depth in a soil profile.
...
3.6 E X E R C I S E S
3.1. Derive the integration steps to obtain eqns (3.10) and (3.11) from eqn (3.7). Show all the steps.
3.2. Use the program in Python to determine the effects of volumetric water con- tent, bulk density and boundary-layer conductance on oxygen and carbon dioxide concentrations in the soil profile.
3.3. Alter the program main.pyso that it computes and prints percent oxygen and percent CO2 at each level in the soil profile. Then use the program to determine what gas-filled porosity is required to keep the CO2concentration below 5 % and the O2concentration above 15 % in the root zone.
4
Soil Temperature and Heat Flow
Temperature affects all physical, chemical, and biological processes in soils. Biological processes such as the uptake of nutrients and water by roots, the decomposition of or- ganic matter by microbes and the germination of seeds are strongly affected by soil temperature. Rates of some of these processes more than double for each 10◦C increase in temperature. In some cases, growth of above-ground plant parts is more closely cor- related with soil temperature than with air temperature. Physical processes, such as water movement and soil drying, are also strongly influenced by temperature. At larger scales, soil thermal dynamics are important in the conversion of solar radiation into long-wave radiation and latent heat of evaporation. Indeed, the diurnal temperature cycle regulates heat exchange between earth and atmosphere. The modulation of different forms of heat exchange affects the evolution of the atmospheric boundary layer, determining weather patterns. For these reasons, most simulations of soil processes require submodels that predict soil temperature.
The simplest model for soil temperature would be to assume that it is constant or that it is equal to a daily, weekly or monthly mean air temperature. Such models may be adequate for some purposes, but they are limited in providing a realistic description of natural conditions. More accurate models require analysis of heat flow within the soil and heat exchange at the soil surface to determine soil temperature. The transport or loss of latent heat of either fusion or vaporization and the movement of soil moisture are important in determining soil temperature. Analysis of these aspects of the problem must follow the study of moisture movement, and will be considered in Chapters 6–10.
From a thermodynamic standpoint, heat is a transfer of energy as a result of a tem- perature difference. The transfer of energy can occur by conduction and radiation. The transfer by conduction is by means of energy carriers within the material. For instance, in a fluid, the energy carriers are usually individual molecules, while in a solid, they can be electrons or photons. When water evaporates or condenses and carries with it the latent heat of vaporization, the transport is referred as latent heat transport, but it still is a form of heat conduction, where the carriers are the water molecules in the vapour phase.
In this chapter, the differential equations for heat transport and the parameters needed to solve them will be given, followed by methods for solving the equations using numerical procedures. For simplicity, in this chapter, we assume that water
Soil Physics with Python. First Edition. Marco Bittelli, Gaylon S. Campbell and Fausto Tomei.
© Marco Bittelli, Gaylon S. Campbell and Fausto Tomei 2015. Published in 2015 by Oxford University Press.
Differential Equations for Heat Conduction 55 content is constant and there is no water flux in the soil. In the following chapters, the two fluxes (heat and water) will be coupled, to obtain a realistic description of soil fluxes.