I tried to solve the following delayed PDE, but it's not working at all.
Almost Periodic Case: $$ \begin{equation} \begin{array}{lc} \displaystyle\frac{\partial}{\partial t}w(t,x)= \frac{\partial^2}{\partial x^2 }w(t,x) +\bigg(\dfrac{\cos(2\pi t)}{e^{x+1}+e^1}\bigg) w(t-1,x) + \big(\sin(\pi t)+\sin(t)\big) x(\pi-x)e^x \ \ \\ \\ \hspace{5cm} \text{for} \ \ t\in (0,5) \ \ \text{and} \ \ x\in [0,\pi], \\ \\ w(t,0)=w(t,\pi)=0 \ \ \text{for} \ \ t\in (0,5), \\ \\ w(\theta,x)=(\theta^2-0.2)\big(1-\cos(2x)\big)\ \ \ \text{for} \ \ \ \theta \in [-1,0]\ \ \text{and} \ \ x\in [0,\pi], \end{array} \label{Ex 1} \end{equation}$$
This is my code:
ClearAll["Global`*"]
(* Define the PDE *)
eqn = D[w[t, x], t] == D[w[t, x], x, x] + (Cos[2 π t]/(Exp[x + 1] + Exp[1])) *
w[t - 1, x] + (Sin[π t] + Sin[t]) x (π - x) Exp[x];
(* Specify initial and boundary conditions *)
ic = w[θ, x] == (θ^2 - 0.2) (1 - Cos[2 x]);
bc = {w[t, 0] == 0, w[t, π] == 0};
(* Solve the PDE numerically *)
sol = NDSolve[{eqn, ic, bc}, w, {t, 0, 5}, {x, 0, π}];
(* Plot the solution at t=5 *)
Plot3D[w[5, x] /. sol, {x, 0, π}, PlotRange -> All, AxesLabel -> {"x", "w"},
MeshFunctions -> {#2 &}, MeshStyle -> {{Thick, Red}}, BoxRatios -> {1, 1, 0.6}]
How can I fix my code?

NDSolvedoes not mentioned delay PDEs, so it may not be possible. If it were, then we would expect the initial condition to beic = (w[t /; t < 0, x]) == (t^2 - 0.2) (1 - Cos[2 x]), but that leads to error messages too. I suggest decomposing the PDE into a set of DDEs, as described in tutorial/NDSolveMethodOfLines,. – bbgodfrey Dec 14 '23 at 05:19w[5, x], usePlotwith theAspectRatiooption instead ofPlot3Dwith theBoxRatiooption. – bbgodfrey Dec 14 '23 at 05:28