Solution
The diffusion equation is also known as the heat equation as shown below;
∂u/∂t=α (∂^2 u)/(∂x^2 )
Whereas the u(x,t) is the unknown function to be solved for the x, in the coordinate space and the t, time. And the α is the diffusion coefficients, which also calculate the changes in time.
And the initial conditions are;
h(x,0)= 0
With the boundary conditions;
h(∞,t)=0
Binary condition at the left side;
dh(0,t)/dx=f(t)
Solution is ;
h(x,t)=-√(α/π) ∫_0^t▒(f(τ))/(t-τ) exp{-x^2/(4α(t-τ))}dr
MATLAB Code

MATLAB Result

Problem 2
Plot solution of the advection-diffusion equation in 1D for several points in time using MATLAB, overlaying the plots on the same figure and making reasonable assumptions for the required parameters. Make sure to label the axes.
Solution
∂C/∂t+∂(uC)/∂x=(D∂^2 C)/(∂x^2 )
The references frame for the advective diffusion equation is same as before;
𝜼= x-(x_o+ut)
Whereas 𝜼 is the moving references frame for the spatial coordinates, and the x_o is the injection point of tracer of u, and the mean flow velocity, plus the ut distance travelled by center of mass;
C(x,t)=M/(A√4πDt) exp(-(x-(x_o+ut))^2/4Dt)
In the case of the 1D diffusion equation becomes u=(u,0,0) and there is no concentration of gradient in the y-direction and z-direction
For the moving system the coordinate transformation is;
η=s-(x_0+ut)
τ=t
By using chain rule the first equations becomes ;
∂C/∂τ ∂τ/∂t+∂C/∂η ∂η/∂t+u(∂C/∂η ∂η/∂t+∂C/∂τ ∂τ/∂t)=D(∂/∂η ∂η/∂x+∂/∂τ ∂τ/∂x)(∂C/∂η ∂η/∂x+∂C/∂τ ∂τ/∂x)
That reduced to;
∂C/∂τ=D (∂^2 C)/(∂η^2 )
Now the advective 1D diffusion equation becomes into the coordinates of η ,τ with the solution for the instantaneous point of sources
C( η ,τ)=M/(A√4πDτ) exp(-η^2/4Dτ)
Matlab Code


Matlab results
Problem 3
For the solution of the diffusion equation in 1D, find an expression for the maximum concentration,C_max Using MATLAB; plot the dependence of C_max on time, while making reasonable assumptions for the required parameters. Make sure to label the axes.
Solution
Now by using the diffusion equation of the 1D then we calculate the maximum concentration, and the in the below Matlab result the plots is dependent on the time.
It is easy for the concentration distributions to take the qualitative look like the function form of the equation. The point of source for the solution has the form;
C(x,t) C_1 (t)exp(-|f(x,t)|)
C_1 (t) is the amplification factor for the independent space , then the maximum concentration is
C_max (t)=C_1 (t)
Then this equation become;
C_max (t)=M/(4πt√Dt)
Where the exponential is zero the maximum concentration occurs at that point;
〖x(C〗_max)=(0)
Then the error function of the concentration distribution occurs at this point;
C(x,t)=C_0/2 (1-erf(x/√4Dt) )
The ranges of the error function over the [-1,1] and the argument ranges form[-∞ ,∞], where the maximum concentration occurs erf(.)= -1
C_max occurs at Arguments function error is -∞
MATLAB Code
Results

Problem 4
A Petri dish contains some cell culture medium (an aqueous solution of various nutrients and growth factors needed by the cells). The profile of oxygen concentration in the laminar sub-layer at the surface of the medium is:
C(z)= C_sat-(C_sat-C_m ) erf(z/(δ√2))
Solution
The time average oxygen of the profile C(z) in the laminar sub layer at the surface of dish is;
C(z)= C_sat-(C_sat-C_m ) erf(z/(δ√2))
C_sat is the concentration of oxygen in water at the saturation , C_m is the concentration of oxygen in medium. δ Concentrations of boundary layer
By using the Flick’s law the concentration gradient in oxygen profile has the diffusive flux of oxygen in dish and uniform concentration of y and x also has the diffusive flux;
q_z= -D dC/dz
Now take the derivative of concentration gradients is;
dC/dz= -(C_sat-Cm) d/dz [erf(z/(δ√2)) ]
dC/dz= -2/√π. ((C_sat-C_1 ))/(δ√2) e^- (z/(δ√2))^2
Surface of the lake, z is zero and the diffusive flux is
q_z=(C_sat-C_m ) (D√2)/(δ√π)
The units of the q_z [M/(L^2.T)] . To obtained the total mass of flux rate multiply with the surface of areas, whereas the surface of the area of the dish is A_m.
Total rate of the mass flux of oxygen into the medium
m ̇=A_m (C_sat-C_m ) (D√2)/(δ√π)
C_m<C_sat the mass flux is positive and indicating the flux down into the dish