The PDF can be simplified by integrating the equation for $f (x,t)$ independently of $c (x,t)$, and then completing the definition of $f (x,t)$ on the line $c(x,t)=Cc$. The result is shown below.
xInit = 1;
xMax = 10;
wid = 0.01;
T = 1000000;
Cc = 0.5;
tMax = 1;
PDE = {D[c[x, t], t] ==
D[c[x, t], {x, 2}] +
If[c[x, t] == Cc, 1,
Exp[-t/T]*(-ArcTan[(x - xInit)/wid] + Pi/2)/Pi], c[x, 0] == 0,
Derivative[1, 0][c][0, t] == 0, c[xMax, t] == 0};
sol = NDSolveValue[PDE, c, {t, 0, tMax}, {x, 0, xMax},
MaxStepFraction -> 0.001];
f[x_, t_] :=
If[sol[x, t] == Cc, 1,
Exp[-t/T]*(-ArcTan[(x - xInit)/wid] + Pi/2)/Pi]
{ContourPlot[sol[x, t], {x, 0, 4}, {t, 0, 1}, Contours -> 20,
PlotRange -> All, ColorFunction -> Hue, PlotLegends -> Automatic,
PlotLabel -> "c(t,x)", FrameLabel -> {"x", "t"}],
ContourPlot[f[x, t], {x, 0, 2}, {t, 0, 1}, Contours -> 20,
PlotRange -> All, PlotLegends -> Automatic,
ColorFunction -> "Rainbow", FrameLabel -> {"x", "t"},
PlotLabel -> "f(x,t)"],
Plot[f[x, 0], {x, 0, 2}, AxesLabel -> {"x", "f(x,0)"}]}
In the statement of the author can not even see the line c[x,t]-Cc==0
. I added code to solve this problem.
xInit = 1;
xMax = 10;
wid = 0.01;
T = 1000000;
Cc = 0.5;
tMax = 1;
PDE = {D[c[x, t], t] == D[c[x, t], {x, 2}] + f[x, t],
D[f[x, t], t] == -f[x, t]/T,
f[x, 0] == (-ArcTan[(x - xInit)/wid] + Pi/2)/Pi, c[x, 0] == 0,
Derivative[1, 0][c][0, t] == 0, c[xMax, t] == 0,
WhenEvent[c[x, t] - Cc == 0, f[x, t] -> 1]};
sol = NDSolve[PDE, {c[x, t], f[x, t]}, {t, 0, tMax}, {x, 0, xMax},
Method -> {"MethodOfLines",
"SpatialDiscretization" -> {"TensorProductGrid",
"MinPoints" -> 80, "MaxPoints" -> 100,
"DifferenceOrder" -> "Pseudospectral"}}] // Quiet
{ContourPlot[c[x, t] /. sol, {x, 0, 4}, {t, 0, tMax}, Contours -> 20,
PlotRange -> All, ColorFunction -> Hue, PlotLegends -> Automatic,
PlotLabel -> "c(t,x)", FrameLabel -> {"x", "t"}],
ContourPlot[f[x, t] /. sol, {x, 0, 2}, {t, 0, tMax}, Contours -> 20,
PlotRange -> All, PlotLegends -> Automatic,
ColorFunction -> "Rainbow", FrameLabel -> {"x", "t"},
PlotLabel -> "f(x,t)"],
Plot[{(-ArcTan[(x - xInit)/wid] + Pi/2)/Pi, f[x, t] /. sol /. t -> 0,
f[x, t] /. sol /. t -> tMax}, {x, 0, 2}, AxesLabel -> {"x", "f"}]}
Generally speaking the optionWhenEvent[c[x, t] - Cc == 0, f[x, t] -> 1]
does not give the desired effect, so I wrote another code in which on the line $c (x, t) = Cc$, the function is defined as $t = t0 (x)$.Then the solution is determined. So that we can clearly see the effect I put T = 10.
xInit = 1;
xMax = 10;
wid = 0.01;
T = 10;
Cc = 0.5;
tMax = 1;
PDE1 = {D[c[x, t], t] ==
D[c[x, t], {x, 2}] +
If[t >= t0[x], Exp[-(t - t0[x])/T],
Exp[-t/T]*(-ArcTan[(x - xInit)/wid] + Pi/2)/Pi], c[x, 0] == 0,
Derivative[1, 0][c][0, t] == 0, c[xMax, t] == 0};
PDE = {D[c[x, t], t] == D[c[x, t], {x, 2}] + f[x, t],
D[f[x, t], t] == -f[x, t]/T,
f[x, 0] == (-ArcTan[(x - xInit)/wid] + Pi/2)/Pi, c[x, 0] == 0,
Derivative[1, 0][c][0, t] == 0, c[xMax, t] == 0};
sol1 = NDSolveValue[PDE, c, {t, 0, tMax}, {x, 0, xMax},
Method -> {"MethodOfLines",
"SpatialDiscretization" -> {"TensorProductGrid",
"MinPoints" -> 800, "MaxPoints" -> 1000,
"DifferenceOrder" -> "Pseudospectral"}}];
t0 = Interpolation[
Table[{x, t /. FindRoot[sol1[x, t] == Cc, {t, .5}]}, {x, 0, 2, .1}]]
Sol2 = NDSolveValue[PDE1, c, {t, 0, tMax}, {x, 0, xMax},
Method -> {"MethodOfLines",
"SpatialDiscretization" -> {"TensorProductGrid",
"MinPoints" -> 800, "MaxPoints" -> 1000,
"DifferenceOrder" -> "Pseudospectral"}}];
f1[x_, t_] :=
If[t >= t0[x], Exp[-(t - t0[x])/T],
Exp[-t/T]*(-ArcTan[(x - xInit)/wid] + Pi/2)/Pi]
{ContourPlot[Sol2[x, t], {x, 0, 4}, {t, 0, tMax}, Contours -> 20,
PlotRange -> All, ColorFunction -> Hue, PlotLegends -> Automatic,
PlotLabel -> "c(t,x)", FrameLabel -> {"x", "t"}],
ContourPlot[f1[x, t], {x, 0, 2}, {t, 0, tMax}, Contours -> 20,
PlotRange -> All, PlotLegends -> Automatic,
ColorFunction -> "Rainbow", FrameLabel -> {"x", "t"},
PlotLabel -> "f(x,t)"],
Plot[{(-ArcTan[(x - xInit)/wid] + Pi/2)/Pi, f1[x, t] /. t -> 0,
f1[x, t] /. t -> tMax}, {x, 0, 2}, AxesLabel -> {"x", "f"}]}