|
User's Poisson Equation
Poisson's Equation
_________
-
- Have a Poisson's equation to solve? Or
any other math equations? For the first few months of 2009, we are
willing to help you solve them using Calculus-level programming.
(Fortran Calculus is scheduled to be online in mid-2009 so take
advantage of this free offer will it last.) To start, copy and modify
the source code below in a file we'll call it {abc}{123}.fc where {abc}
= your initials and {123} = any number or id; 8 characters max. for
filename. Edit your {abc}{123}.fc file, especially lines starting with
a "!" character.
E-mail
us your {abc}{123}.fc file. We will compile & execute it and
send you the output file. (For more [~60] example
problems to choose from, download FC-Win
program.)
- All "!" characters in columns 1 or 2 must
be deleted before compiling. These "!" were added in order to point out
areas needing work.
- Next, you may modify a copy of this web
page and send it to us for viewing. If accepted, we will post your
webpage showing your problem with solution. If you want people to be
able to contact you, please include your e-mail address on this web
page.
- Please mention our
www.digitalCalculus.com website to others. Thanks!
|
|
|
User's Poisson Equation Source
Code:
-
For 1-dimensional (1D) Poisson Equation use
following:
global all
problem PoissonsPDE
C ------------------------------------------------------------------------
C --- Calculus Programming example: Poisson's Equation; a PDE (1D) Initial
C --- Value Problem solved using Method of Lines.
C ------------------------------------------------------------------------
C
C User parameters ...
! rho = ...
e0 = 8.854187817e-12 ! F/m or A2 s4 kg-1m−3 permittivity of free space
! ipoints = 10 ! grid pts. over x-axis
C
C x-parameter initial settings: x ==> i
! xFinal = 1: xPrint = xFinal/ipoints: ip = ipoints
pi= 4*atan(1)
C
call xAxis !
end ! Stmt.s not necessary in IVP, but used in BVP versions
model xAxis !
C ... Integrate over x-axis
C
x= 0: xPrt = xPrint: dx = xPrt / 10
! U = ??? ! @ x = 0 ... initial value
! Ux = ??? ! @ x = 0
Initiate janus; for PDE;
~ equations Uxx/Ux, Ux/U; of x; step dx; to xPrt
do while (x .lt. xFinal)
Integrate PDE; by janus
if( x .ge. xPrt) then
print 79, x, U, Ux, Uxx
xPrt = xPrt + xPrint
end if
end do
79 format( 1h , f8.4, /2x, 10(g14.5, 2x))
end
model PDE ! Partial Differential Equation
Uxx = - rho/e0
end
-
For 2-dimensional (2D) Poisson Equation use
following:
global all
problem PoissonsPDE
C ------------------------------------------------------------------------
C --- Calculus Programming example: Poisson's Equation; a PDE (2D) Initial
C --- Value Problem solved using Method of Lines.
C ------------------------------------------------------------------------
dynamic U, Ux, Uxx
C
C User parameters ...
! rho = ...
e0 = 8.854187817e-12 ! F/m or A2 s4 kg-1m−3 permittivity of free space
! ipoints = 10 ! grid pts. over x-axis
! jpoints = 64 ! grid pts. over y-axis
! tFinal = 1 ! final time
C
C x-parameter initial settings: x ==> i
! xFinal = 1: xPrint = xFinal/ipoints: ip = ipoints
C
C y-parameter initial settings: y ==> j
! yFinal = 1: dy = yFinal/(jpoints-1): jp = jpoints
pi= 4*atan(1)
allot U( jp), Ux( jp), Uxx( jp)
C
call xAxis !
end ! Stmt.s not necessary in IVP, but used in BVP version
model xAxis !
C ... Integrate over x-axis
C settings at x = 0
do 10 jj = 1, jpoints ! Initial Conditions, if any
yPrt = jj * yPrint
! U(jj) = U0(yPrt): Ux(jj) = ???: Uxx(jj) = ???
10 continue
x= 0: xPrt = xPrint: dx = xPrt / 10
Initiate merlin; for PDE;
~ equations Uxx/Ux, Ux/U; of x; step dx; to xPrt
do while (x .lt. xFinal)
Integrate PDE; by merlin
if( x .ge. xPrt) then
print 79, x, (U(jj), jj = 1, jp)
xPrt = xPrt + xPrint
end if
end do
79 format( 1h , f8.4, /2x, 10(g14.5, 1x))
end
model PDE ! Partial Differential Equation
C ! Method of Lines
! Ux(1)= ???: Uxx(1)= ??? ! Initial Conditions, if any
do 40 jj = 2, jpoints-1 ! System of ODEs
Uyy = (U(jj+1)- 2*U(jj) + U(jj-1))/dy**2
Uxx(jj)= - rho/e0 - Uyy
40 continue
end
Fmodel U0(yy) ! Initial starting values @ x = 0
if( yy .le. 0) then
U0 = 0
elseif( yy .lt. .5 ) then
U0 = (1 - cos( 4 * pi * yy))/2
else
U0 = 0
endif
end
-
For 3-dimensional (3D) Poisson Equation use
following:
global all
problem PoissonsPDE
C ------------------------------------------------------------------------
C --- Calculus Programming example: Poisson's Equation; a PDE (3D) Initial
C --- Value Problem solved using Method of Lines.
C ------------------------------------------------------------------------
dynamic U, Ux, Uxx
C
C User parameters ...
! rho = ...
e0 = 8.854187817e-12 ! F/m or A2 s4 kg-1m−3 permittivity of free space
! ipoints = 10 ! grid pts. over x-axis
! jpoints = 50 ! grid pts. over y-axis
! kpoints = 10 ! grid pts. over z-axis
C
C x-parameter initial settings: x ==> i
! xFinal = 1: xPrint = xFinal/ipoints: ip = ipoints
C
C y-parameter initial settings: y ==> j
! yFinal = 1: dy = yFinal/(jpoints-1): jp = jpoints
C
C z-parameter initial settings: z ==> k
! zFinal = 1: dz = zFinal/(kpoints-1): kp = kpoints
pi= 4*atan(1)
allot U(jp,kp), Ux(jp,kp), Uxx(jp,kp)
C
call xAxis !
end ! Stmt.s not necessary in IVP, but used in BVP version
model xAxis !
C ... Integrate over x-axis
C settings at x = 0
do 10 kk = 1, kpoints ! initial values
zPrt = kk * zPrint: jj = 1
! U(jj,kk) = U0(zPrt): Ux(jj,kk) = ???: Uxx(jj,kk) = ???
10 continue
x= 0: xPrt = xPrint: dx = xPrt / 10
Initiate neptune; for PDE;
~ equations Uxx/Ux, Ux/U; of x; step dx; to xPrt
do while (x .lt. xFinal)
Integrate PDE; by neptune
if( x .ge. xPrt) then
do 30 jj = 2, jpoints
y = (jj - 1) * dy
print 79, x, y, (U(jj,kk), kk = 1, kp)
30 continue
xPrt = xPrt + xPrint
end if
end do
79 format( 1h , f8.4, 1x, f8.4, /2x, 10(g14.5, 1x))
end
model PDE ! Partial Differential Equation
C ! Method of Lines
! Ux(1,1)= ???: Uxx(1,1)= ??? ! Initial Conditions, if any
do 40 jj = 2, jpoints-1 ! System of ODEs
y = (jj - 1) * dy
do 20 kk = 2, kpoints-1
z = (kk - 1) * dz
Uyy = (U(jj+1,kk)- 2*U(jj,kk) + U(jj-1,kk))/dy**2
Uzz = (U(jj,kk+1)- 2*U(jj,kk) + U(jj,kk-1))/dz**2
Uxx(jj)= - rho/e0 - Uyy - Uzz
20 continue
! Ux(jj,kp)= ???: Uxx(jj,kp)= ??? ! Initial Conditions, if any
40 continue
! Ux(jp,kp)= ???: Uxx(jp,kp)= ??? ! Initial Conditions, if any
end
Fmodel U0(zz) ! Initial starting values @ x = 0 & y = 0
! if( zz .le. 0) then
! U0 = 0
! elseif( zz .lt. .5 ) then
! U0 = (1 - cos( 4 * pi * zz))/2
else
! U0 = 0
endif
end
-
User's Poisson Equation Output:
-
selected output goes here ...
- Visit ODEcalc
for an Ordinary Differential
Equations Calculator. Try it and see the power of Calculus programming.
HTML code for linking to this page:
- <a
href="http://www.digitalcalculus.com/math-problems/poisson-equation.html"><img
align="middle" width="100"
src="http://www.digitalcalculus.com/image/fc-win-icon.gif"/>
<strong>Poisson's (Partial Differential) Equation</strong>
</a>; Simulation to Optimization, Tweak Parameters for Optimal
Solution.
Go to top
|
|