E = CellVariable(name="$E(t,x,y)$", mesh=mesh, value=0.0, hasOld=1)

# -------------------- Homogeneous distribution of naive immune cells ------------------------------------------
S = CellVariable(mesh=mesh, value=0.0, hasOld=1)
S.setValue(params.S / np.sum(mesK))

# -------------------- Heterogeneous distribution of naive immune cells ------------------------------------------
# center_x1 = 0.207
# center_x2 = 0.907
# Sh.setValue(params.S * numerix.exp(-(((xt - 0.) ** 2)/0.5 +((yt - 1.) ** 2))/0.125) +
#            params.S * numerix.exp(-(((xt - center_x1) ** 2)/0.25 +((yt + center_x2) ** 2))/0.125) +
#            params.S * numerix.exp(-(((xt + center_x1) ** 2)/0.25 +((yt + center_x2) ** 2))/0.125))
# Sh.setValue(Sh/numerix.sum(mesK*Sh))

delta = CellVariable(name="$\delta(x,y)$", mesh=mesh, value=0.)
delta.setValue(delt.GaussianImmuneResponse2D(params.delta, xt, yt, Ra=0.02))

# pf = pF.GaussianConversionRate2D(amppf, xt, yt, mean=0, Rp=1.)
pf = params.pf * np.ones(nVol)
pfh = 0.0 * params.pf * np.ones(nVol)
# gF = gammaF.gaussianGammaF2D(ampgF, xt, yt, Rs=0.3)
gF = params.gf * np.ones(nVol)

Id = sp.spdiags(numerix.ones(nVol), [0], nVol, nVol)

# -------------------------Solutions representation -----------------------------------
# fig, axes = plt.subplots(1, 3)
# cmap = plt.get_cmap("Spectral_r")
# Tfigure = Matplotlib1DViewer(vars=T, axes=axes[0], datamin=0., datamax=10., figaspect='auto', cmap=cmap)
# Efigure = Matplotlib2DViewer(vars=E, axes=axes[1], figaspect='auto', cmap=cmap)
# Phifigure = MatplotlibStreamViewer(vars=phi.grad, axes=axes[2], figaspect='auto', cmap=cmap)
Id = sp.spdiags(numerix.ones(nVol), [0], nVol, nVol)

# ---------------Variables and parameters for the Immune Cells Displacement equation---------
# E = CellVariable(name="$E(t,x,y)$", mesh=mesh, value=0.53235e6/c_s, hasOld=1)
E = CellVariable(name="$E(t,x,y)$", mesh=mesh, value=0., hasOld=1)
# S = CellVariable(mesh=mesh, value=0., hasOld=1)
# # S.setValue(params.S / np.sum(mesK))
# S.setValue(Q)
# S.updateOld()

# delta = CellVariable(name="$\delta(x,y)$", mesh=mesh, value=0.)
# delta.setValue(delt.GaussianImmuneResponse2D(params.delta, xt, yt, Ra=0.02))

delta_tild = CellVariable(name="$\delta_t(x,y)$", mesh=mesh, value=0.)
delta_tild.setValue(
    delt.GaussianImmuneResponse2D(1. / x_s, xt, yt, Ra=0.02 / x_s**2))

# pf = pF.GaussianConversionRate2D(amppf, xt, yt, mean=0, Rp=1.)
pf = params.pf * np.ones(nVol)
# pfh = 0.0*params.pf * np.ones(nVol)
# gF = gammaF.gaussianGammaF2D(ampgF, xt, yt, Rs=0.3)
gF = params.gf * np.ones(nVol)

Id = sp.spdiags(numerix.ones(nVol), [0], nVol, nVol)

# -------------------------Solutions representation -----------------------------------
# fig, axes = plt.subplots(1, 3)
# cmap = plt.get_cmap("Spectral_r")
# Efigure = Matplotlib2DViewer(vars=E, axes=axes[1], figaspect='auto', cmap=cmap)
# Phifigure = MatplotlibStreamViewer(vars=phi.grad, axes=axes[2], figaspect='auto', cmap=cmap)
# axes[0].set_title('The Tumor $T$',fontsize=10, fontweight='bold')