	function [v, gamma] = savage_prescott(x,D,t,H,tR,T);

%[v, gamma] = savage_prescott(x,D,t,H,tR,T);
%
% Velocities and strain-rates due to periodic slip on fault to
% depth D and creep at constant rate from D to bottom of elastic layer
% overlying Maxwell viscoelastic half-space. (After Savage and Prescott
% model, 1978). Fault is infinitely-long strike-slip fault (antiplane).
%
% inputs:	x  = location of points on free surface
%				D  = depth of bottom of periodic fault and top of creeping fault 
%				t  = time since last earthquake
%				H  = thicness of elastic layer
%				tR = Maxwell relaxation time in same units as time
%				T  = recurrence interval
%
% outputs:      v  = velocities at points x
%           gamma  = shear strain-rates at points x 
%
% Kaj Johnson, last modified May 29 2003


%normalize times by tR
t=t/tR;
T=T/tR;
tR=1;

%get velocities and strain-rates for periodic part of fault
[v_period, gamma_period] = savpres_patch(x,0,D,t,H,tR,T);

%get velocities and strain-rates for creeping part of fault
[v_creep, gamma_creep] = savpres_creep(x,D,H,H,tR,150);

%total solution is sum of periodic and creeping parts
v = v_period + v_creep;
gamma = gamma_period + gamma_creep;

