This is probably very elementary, but I am a new Maple user (first day) and would appreciate any help. I am using Maple 11.
I am trying to solve Laplace's equation in a circle and so have set up the pde in polar coordinates.
pde := Diff(u(r, theta), r, r)+(Diff(u(r, theta), r))/r+(Diff(u(r, theta), theta, theta))/r^2 = 0
My problem is that I want to specify initial conditions over a range.
i.e.
u(r,theta)=1 for r=0.5 to 1 for theta=0 and theta=2*pi, and
u(r,theta)=-1 for r=0.5 to 1 for theta=pi.
My problem is that I don't know how to specify the condition for a limited part of the r range.
(I will also need to specify a derivative condition for r=1 and all theta, but this seems straightforward.)
I shall be very grateful to anyone who who can offer any help on this.
Piecewise
You may get some inspiration from the help pages at piecewise,dsolve.
Hope this helps,
J. Tarr
piecewise
Thanks for the tip, but this seems to apply to variables of a single function only.
However I have now got Maple to accept conditions defined on a range using a range variable:
> bc := {u(.5 .. 1, Pi) = -1, (D[1](u))(1, theta) = 0, u(.5 .. 1, 0) = 1, u(.5 .. 1, 2*Pi) = 1};
which it accepts (although I am not sure whether it has interpreted it as I hope) but I now get an error message:
Error, (in pdsolve/numeric/par_hyp) Incorrect number of boundary conditions, expected 0, got 2
I am now confused about the whole pde solution system which seems to require one of the variables to be time. I just have two space variables.
I shall return to the Help pages.
Thanks again.
John Brew
piecewise
You may well be right.
I thought I had effectively 2 ranges for r. I can add an extra theta point (zero at r=0) from symmetry conditions.
I could also halve the problem (semi-circle by symmetry) and get rid of the s third r condition - which is a duplicate because I have a wrap around at theta = 0 and 2*pi.
It sounds as if the boundary conditions are not really designed to cope with polar coordinates - or perhaps it is my (total) unfamiliarity with Maple that is the problem.
I will look out the book. It sounds as if it would be a big help.
Piecewise
If I understood well, you have a PDE of second order (with respect to r and theta). So you will need 2 boundary conditions for r and 2 for theta. But you have 3 for theta (one of them is not needed) and none for r. Perhaps, you have to treat the range [0.5, 1] as a continuous range, and not as a part of the BCs.
Nevertheless, there is a helpful book for this instance: David Betounes, Partial Differential Equations for Computational Science: With Maple & Vector Analysis (Cd-rom included). Try Chapter 12 which deals with Laplacian and its BCs/ICs in polar coordinates.
pantole
Periodic conditions
Once you enter the boundary conditions get back to the forum; maybe we can help you. Note that you (may) have periodic conditions, since u(r,0)=u(r,2*pi), which is a bit more complex (if not scary), but you may as well find sth. relevant in the literature by adding the keywords "periodic boundary conditions".
pantole
Elliptic PDE
Unfortunately Maple does not currently support Elliptic PDE numerical solutions.
It is currently restricted to finite interval hyperbolc and parabolic PDE problems.
If this is not what you are looking for, then please ignore this message.
- Allan
I am now getting quite
I am now getting quite bogged down.
I have cut the problem down to a quadrant by symmetry.
The two radii are maintained at potential 1 and 0, and the circular boundary is a no-flow boundary so that potential is normal there.
I have u(r,theta)=1 at theta=0 for r>0.5, and u(r,theta)=0 at theta=pi/2.
Also du/d_theta=0 for r=1, all theta, and du/d_theta=0 for r<0.5 and theta=0.
I have used 3 oundary conditions on which is a piecewise 1. Thus:
qbc1 := piecewise(0 < r and r <= .5, (D[2](u))(r, 0) = 0, 1 > r and r > .5, u(r, 0) = 1)
qbc2 := (D[1](u))(1, theta) = 0
qbc3 := u(r, (1/2)*Pi) = 0
qbc := {qbc2, qbc3, qbc1}
With pde:
pde := Diff(u(r, theta), r, r)+(Diff(u(r, theta), r))/r+(Diff(u(r, theta), theta, theta))/r^2 = 0
I then try and solve:
ans := pdsolve(pde, qbc, numeric)
and get the error message:
Error, (in pdsolve/numeric/par_hyp) Incorrect number of boundary conditions, expected 0, got 2
This puzzles me. I thought I had an elliptic equation, I thought I had given 4 (or possibly only 3) boundary conditions, and I thought it would expect 4.
I am very grateful for all the suggetsions you have made on this problem. I now wonder whether pdsolve is the right bit of Maple to be using on this problem. It is Dirichlet's problem - solution of Laplace's equation subject to boundary conditions. Perhaps there is some other bit of Maple that solves this problem?
Thanks again.
John Brew
Elliptic PDEs
Still, one can discretize the derivatives with finite differences (or better, orthogonal collocation: using this method a similar problem is solved in p. 593, Rice & Do, Applied Mathematics and Modeling for Chemical Engineers) ending up to coupled algebraic equations. Of course, the corresponding boundary conditions are needed. Nevertheless, there might be an analytical solution as well, depending on the BCs.
Thank you Allan for the feedback [I didn't know that].
pantole
Dirichlet/Neumann BCs
Since you have BCs in terms of derivatives equal to a constant, then these are of Neumann type. But still I didn't understand the BCs with respect to r. Is du/dr=0 (for r=1)? And which is the second one?
I have mixed BCs.
I have mixed BCs.
I am trying to find a potential function in a quadrant. (Whole circle really but I am using symmetry.)
The BCs are, considering the 1st quadrant:
1) The potential is 0 at the left-hand radius (all r, theta=pi/2).
2) The potential is 1 at the right-hand end of the bottom radius (r>1/2 and theta=0).
3) The BC is of Neumann type around the curved edge of the quadrant (r=1, all theta), and
4) at also the left-hand end of the bottom radius (r<0.5 and theta=0).
I expect the contours of the solution to be the upper halves of hyperbolae (or something like). The solution will be very like the conformal map using a w=sin(z) mapping except that this sits inside an ellipse rather than a circle.
I am feeling increasingly uneasy about my choice of Maple's pdsolve to get a numeric solution to this since it seems to be explicitly geared to time-dependent problems.
My actual interest is a bit further than this solution.
Later I want to look at other shapes (rather than circles) that may be not so neat, and also other definitions of the potential positions.
Consequently I am not looking for an analytical solution for this case as they are unlikely to exist for the more complex cases I will be looking for later.
I was hoping to get a numerical solution and then find something in Maple that would allow me generate contour lines. (An easier way than by integrating a pde.)
In fact I am also looking for the conjugate harmonic function to the solution which I can find by switching the 'neumann' and the 'potential' boundary conditions.
I am beginning to feel I should have tried something easier as an intro to Maple.
Thanks again,
John
VectorCalculus to verify given result
From symmetry its clear that the solution is phi=1-2/Pi*theta, for theta from 0 to Pi. This is easily verified with the VectorCalculus package:
with(VectorCalculus): SetCoordinates('polar[r,theta]'): phi := 1-2/Pi*theta: Nabla(phi); 2 _ - ---- e r Pi theta Laplacian(phi); 0I'm afraid that solution
I'm afraid that solution doesn't satisfy the 4th constraint.
(My last post was truncated - so it wasn't given there.)
It is du/d_theta=0 at theta=0 and r<0.5.
The solution will be a little like the complex map w=sin(z) but will sit in a circle rather than an ellipse.
However I am actually trying to find the numerical solution as the next step is to find solutions to other problms - similar but not so neat - that are unlikely to have analytical solutions.
My ultimate goal is the curves fitted to the contours of this potential function, and to its conjugate harmonic function, but the plan is beginning to seem increasingly unrealistic.
I solved this in Mathcad using a rectangular mesh, fitting a bicubic spline function to the solution and integrating along contours. Presumably I could do the same in Maple but I was hoping that there would be superior power in Maple.
Thanks for your help here.
John Brew
truncation frustration
Use < to create a less-than sign and > to create a greater-than sign: not doing so causes the truncation of your posts. You could also change the input format to "Plain Text" [click on "Input Format" below the box].
If I understand your specification (questionable, with the text truncation), then the problem you pose is not soluble, at least not with a uniform dielectric and no sources in the interior (laplacian of zero). One cannot generally specify both Von Neumann and Dirichlet boundary conditions on the same boundary segment. The analogous 1D problem is specifying both the voltage and current through a given resistor---they are not independent.
Thanks for the formatting
Thanks for the formatting tip, Joe.
The mathematical problem I am trying to solve is like the conformal map:
w=sin(z)
which gives a pair of conjugate functions either of which can be considered to be a potential function. This function is bounded by an ellipse but is otherwise the the solution I am looking for.
I am setting up the problem with the varied conditions on one side in a way that reflects this mapping - the straight edge is really two distinct boundaries that have becom remapped.
There may be an analytical solution to this problem but I think I really need know how to do it numerically as I also want to look at 'untidy' variations on the boundary conditions.
The problem is quite easy to solve numerically - although I have used a rectangular grid, and not in Maple - but it is not then easy to get to a usable approximation of the potential surface.
I used bicubic spline surface fit which gave awkward edges with my cartesian coords. I then got gradients from the fit and integrated to get the contour lines of the potential function which is what I am really after.
It is very messy and I was hoping that Maple may have built-in procedures to ease the process.
I am licking my wounds at the moment and looking around for another line of attack.
Thanks again.
JB