For example i can use Piecewise
when the condition is a Continuous function
NeumannValue[Piecewise[{{x^2 + y^2, Abs[x + y] < 2.5}}],
z == 1]
But when the condition is not continuous
p=Table[Piecewise[{{x^2 + y^2, Abs[x + y] < 2.5}}], {x, -2, 2,
1}, {y, -2, 2, 1}]
how can i apply the p
to NeumannValue
condition? Thanks
$\begingroup$
$\endgroup$
2
-
$\begingroup$ Pointwise Neumann conitions quite certainly don't make sense for a two-dimensional problem... $\endgroup$– Henrik SchumacherCommented Jan 3, 2019 at 15:38
-
$\begingroup$ @Henrik Schumacher how can i apply Pointwise Neumann or DirichletCondition? $\endgroup$– XinBaeCommented Jan 4, 2019 at 1:42
Add a comment
|
1 Answer
$\begingroup$
$\endgroup$
You could, for example, generate an interpolating function like so:
p = Table[
Piecewise[{{x^2 + y^2, Abs[x + y] < 2.5}}], {x, -2, 2, 1}, {y, -2,
2, 1}]
{{0, 0, 4, 5, 8}, {0, 2, 1, 2, 5}, {4, 1, 0, 1, 4}, {5, 2, 1, 2,
0}, {8, 5, 4, 0, 0}}
ifun = ListInterpolation[p, {{-2, 2}, {-2, 2}}]
You can then use that in the NeumannValue
.
NDSolveValue[{Laplacian[u[x, y, z], {x, y, z}] ==
1 + NeumannValue[ifun[x, y], z == 2],
DirichletCondition[u[x, y, z] == 0, z == -2]}, u, {x, y,
z} \[Element] Cuboid[{-2, -2, -2}, {2, 2, 2}]]
You'd need to think a bit how you want the interpolation to work. For example what interpolation order you want to use.