function G=ttdGnd(x,t,Pe,tau)

% USAGE: G = ttdGnd(x,t,Pe,tau)
% Returns the TTD for the 1-d advection-diffusion equation with mean age tau 
% and Peclet number Pe at x,t.
% INPUTS: 
%  x = nondimensional position x
%  t = time (same units as tau)
%  Pe = Peclet number
%  tau = mean age
% x is nondimensionalized by L
%  where,
%   L = u*tau
%   Pe = L*u/k

% Samar Khatiwala (spk@ldeo.columbia.edu)

warning off

alpha = sqrt(Pe./(4*tau));
alphasqr = Pe./(4*tau);

G=alpha.*tau.*x.*(1./sqrt(pi*t.^3)).*exp(-alphasqr.*((tau*x-t).^2)./t)
% G=sqrt(Pe./(4*tau))*tau*x.*(1./sqrt(pi*t.^3)).*exp(-(P/(4*tau))*((tau*x-t).^2)./t);

G(t==0)=0;
