With the help from the expert Nasser I am able to write the code for a PDE with variable coefficients and mixed boundary conditions, defined on a square domain:
ClearAll[y, x1, x2];
a = x1 + x2;
pde = D[a D[y[x1, x2], x1], x1] + D[a D[y[x1, x2], x2], x2] - 4;
bc = {y[x1, 2] == 2 + x1, y[x1, 3] == 3 + x1};
sol =
NDSolve[
{pde == NeumannValue[-1*a, x2 == 2] + NeumannValue[1*a, x2 == 3], bc},
y, {x1, 2, 3}, {x2, 2, 3}]
Plot3D[Evaluate[y[x1, x2] /. sol], {x1, 2, 3}, {x2, 2, 3},
PlotRange -> All, AxesLabel -> {"x1", "X2", "y[x1,x2]"}, BaseStyle -> 12]
where the Neumann boundary condition is defined for this problem as
$\qquad a(x)\,dy/dn,$
which is equal to
$\qquad a(x)\,(grad(y, x1)\,n1 + grad(y, x2)\,n2,$
which is equal, in this problem (using the known solution just to check the accuracy, to
$\qquad y = x1 + x2 = a(x)\,(n1 + n2),$
where $n1, n2$ are components of the normal vector.
Can we
Evaluate the numerical values of the solution on the domain?
Evaluate the relative error between the numerical and the exact solution which is equal to $y = x1 + x2$?