%%DEVRIESHW
% Example of calculations of thermal conductivity based on examples by D.A.
% DE VRIES, 1963 in Physics of Plant Environment by W.R. VAN WIJK, 1963.
% Chapter 7.
%
%% ASSUMPTIONS:
% * Granules have ellipsoidal shape;
% * Granules are so far apart that they do not interfere with each other,
% meaning that the temperature in and around of each granule is not
% affected by neighboring granules. 
%
% OBLATE SPHEROID: an ellipsoid in which axes a=b>c.
% ga, gb, and gc depend on the ratios among a,b,and c, meaning that
% the shape factors (also known as depolarisation factor) ga, gb, and gc
% are tightly related to the shape of the ellipsoid and not the its size.
%
% NOTE: Variables originally expressed in calories were converted in Joules by using the factor 0.004184 J/mcal.
%

% Andres Patrignani        23-Oct-2013 17:35:29

%% QUARTZ SAND 

%%% *SATURATED SAND* 
% This is a simple case in which only three substances are assumed to be
% present (quartz, feldspar, and liquid water).  The temperature is assumed
% to be 20 degrees Celsius

quartz = 0.89; % volume fraction of quartz in sand.
feldspar = 0.11; % fraction of feldspar (and other solid particles) in sand.
rho_p = 2.64; % Particle density [g cm-3]
Vs = 0.573; % Volume fraction of solids.
porosity = 1-Vs; % Soil total porosity;
theta_v = porosity; % In this case soil water content is equal to total porosity.
x1 = quartz*Vs; % Volume fraction of quartz.
x2 = feldspar*Vs; % Volume fraction of feldspar (and other solid particles).
lambda_q = 20.4*0.004184*100; % Thermal conductivity (lambda) values [W/m/K] for quartz at 20, 40, 60, and 75 °C. 
lambda_f = 7.0*0.004184*100; % For other minerals, such as feldspar, values of lambda are approximately 7.0 mcal cm-1 sec-1 °C-1.
lambda_w = 1.42*0.004184*100; % Thermal conductivity [W/m/K] of water at 20 °C. Howver, at 10 °C, water has lambda equal to 1.37 mcal cm-1 s-1 °C-1.
ga = 0.144; % Shape factor for the solid particles, this corresponds to a ratio of ~4 between the axes of an oblate spheroid.
gb = ga; % According to the assumption that we are working with an oblate ellipsoid.
gc = 1-ga-gb; % Since all factors must add to 1.

% Calculate k
% k is the ratio of the average temperature gradient in the granules and
% the corresponding quantity in the medium (DE VRIES, 1963. p 214).
k1 = 1/3*(2/(1+(lambda_q(1)/lambda_w-1)*ga)+1/(1+(lambda_q(1)/lambda_w-1)*gc));
k2 = 1/3*(2/(1+(lambda_f/lambda_w-1)*ga)+1/(1+(lambda_f/lambda_w-1)*gc));

lambda_satsoil = % BLANK #1: Write the code that calculate the thermal conductivity of saturated soil.



