       Boundary Value problem

• To: mathgroup at smc.vnet.net
• Subject: [mg6199] Boundary Value problem
• From: Jeff Copes <jcopes at winnie.fit.edu>
• Date: Thu, 27 Feb 1997 02:53:59 -0500
• Sender: owner-wri-mathgroup at wolfram.com

```Dear fellow mathgroupies,
What follows is a long problem:
I have a boundary value problem, a laplacian d2u/dx2 + d2u/dy2 = 0, with
all four edges = 0 (u(x,0) = 0, u(x,1) = 0, u(0,y) = 0, u(1,y) = 0). This
part is no problem. However, if u(0.5,y) = 1, 0 < y < 0.5, I cannot get
mma to incorporate this part of the eqn into the sln. For ordinary
boundary conditions, I haven't run into any problems. Here is my code:

This part just clears everything, then sets up a grid scheme:

Clear[n,na,h,u,a1,a2,a3,a4,b1,b2,b3,b4,b5,b6,b,c,d,a];
Share[];
na = 3;
n = 2 na;
h = 1.0/n;

This part gives the PDE for the interior points, all the points except the
edges and the set of points jutting up (u[0.5,y], 0 < y < 0.5 )

a1 = Flatten[
Table[(u[i+1,j] - 2 u[i,j] + u[i-1,j])/h^2 +
(u[i,j+1] - 2 u[i,j] + u[i,j-1])/h^2 ==
0, {i, 1, na - 1},{j,1,na}]];
a2 = Flatten[
Table[(u[i+1,j] - 2 u[i,j] + u[i-1,j])/h^2 +
(u[i,j+1] - 2 u[i,j] + u[i,j-1])/h^2 ==
0, {i, na + 1, n - 1},{j,1,na}]];
a3 = Flatten[
Table[(u[i+1,j] - 2 u[i,j] + u[i-1,j])/h^2 +
(u[i,j+1] - 2 u[i,j] + u[i,j-1])/h^2 ==
0, {i, 1, n - 1},{j,na + 1,n-1}]];
a4 = Union[a1, a2, a3]

This part gives the boundary conditions and the jutting up part, and sets
up a table of variables.

a = a4/.b
c = Flatten[ Table[ u[i,j],{i,1,n-1},{j,1,n-1}]]

This part solves the PDE:

d = Flatten[Solve[Reduce[a,c]]]

Here is that output:
{u[1, 1] -> 0.1659305202815088385,  u[1, 2] -> 0.235490823363843116,

u[1, 3] -> 0.2290382624066035122,

u[1, 4] -> 0.1564062643195658334, etc. up to

u[5, 5] -> 0.07559572027350304904}

Here is my print scheme, using an interpolation scheme from Dr. Dennis
Jackson at FIT:

Clear[f2,f,g];
f2[x_] := Max[0,1- Abs[x]/h]
f[x_,y_] := f2[x] f2[y]
g[x_,y_] := Sum[(u[i,j]/.d)[] f[x - i h, y - j h],
{i,1,n-1},{j,1,n-1}];
Plot3D[g[x,y], {x,0,1},{y,0,1}]

I get output, but the jutting up part is missing. I realize this is a long
problem, and if no one picks it up, I understand. But, I need to find out
how to make this work. The interpolation scheme is necessary for the
project, and has worked fine in other BVP's. Leaving out the jutting up
part makes the problem run fine, but is uninteresting.

Thanks,

Jeff Copes

```

• Prev by Date: barfing on an integral
• Next by Date: read files
• Previous by thread: Re: barfing on an integral