How to interpolate solution on the mesh _including_ boundary? #546
Replies: 1 comment
-
This is expected behavior since To obtain the values of the field on the boundary, you need to supply the boundary conditions to the interpolation function: res.interpolate((0, 0.5), bc=bcs) which returns |
Beta Was this translation helpful? Give feedback.
-
Hi,
The problem seems trivial but I cannot find a way of solving it
basing only on package documentation.
I want to solve 2d BVP and generate 3d surface plot of the solution.
Let it be given simple Laplace problem on a 2D grid [0,1]x[0,1]:
nabla^2 u = 0
with BCs as follows:
u = 0, for x = 0
u = 1, for x = 1
du/dn = 0, for y = 0 and y = 1
with exact solution u(x,y) = x.
There are some problems I stumbled upon:
3D plots...
OK, that's no problem - I can always use matplotlib's functions.
In order to do that I need to interpolate obtained solution on a
new grid but...
solution and_including the values on the boundary?
When I print
res.data
it gives me field values only for internal points.The same happens when I try to interpolate -
res.interpolate((0,0))
returns
0.099999999
, not0
, or when the field is plotted withbuilt-in
plot()
function - the plot is from0.1
to0.9
while it is expected to be from0
to1
.Here's my code:
And it's output:
Beta Was this translation helpful? Give feedback.
All reactions