|
User's Maxwell's Equation
Maxwell's Equation
_________
-
Differential form in a vacuum:
| I. Gauss' law
for electricity |
∇ ⋅ E = 0
|
| II. Gauss'
law for magnetism |
∇ ⋅ B = 0
|
| III. Faraday's law of
induction |
|
| IV. Ampere's law |
∇ x B = ε0
μ0i ∂E/∂t ∫ E ⋅ dA
|
- Have a Maxwell'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 Maxwell's Equation Source
Code:
-
For 1-dimensional (1D) Maxwell's Equation:
global all
problem MaxwellsPDE
C ------------------------------------------------------------------------
C --- Calculus Programming example: Maxwell's 1D Equation; a PDE Initial
C --- Value Problem solved using Method of Lines.
C ------------------------------------------------------------------------
dynamic U, Ux, Uxx
C
C User parameters ...
e0 = 8.854187817e-12 ! F/m or A2 s4 kg-1m−3 permittivity of free space
pi = 4*atan(1)
u0 = 4*pi*e-7 ! N·A−2 ... permeability of free space
! ipoints = 100 ! grid pts. over x-axis
! tFinal = 1 ! final time
C
C x-parameter initial settings: x ==> i
! xFinal = 1: xPrint = xFinal/ipoints: ip = ipoints
C
C t-parameter initial settings: t ==> m
pi = 4*atan(1): mp = mpoints: dt = tFinal/mpoints
allot U( mp), Ux( mp), Uxx( mp)
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
Initiate janis; for PDE;
~ equations Uxx/Ux, Ux/U; of x; step dx; to xPrt
do while (x .lt. xFinal)
Integrate PDE; by janis
if( x .ge. xPrt) then
print 79, x, (U( mm), mm = 1, mp)
xPrt = xPrt + xPrint
end if
end do
79 format( 1h , f8.4, / 3x, 10(g14.5, 1x))
end
model PDE ! Partial Differential Equation
C ! Method of Lines
! U(1) = U0(x): Ux(1) = 0: Uxx(1) = 0 ! Initial Conditions
do 20 mm = 2, mpoints-1 ! System of ODEs
Ut = (U(mm)-U(mm-1))/dt ! approx. partial of U w.r.t. t
Utt = (U(mm+1) - 2*U(mm) + U(mm-1))/dt**2
! Uxx(mm)= ... f(x, U(mm), Ux(mm), Ut)
! Help! What's the Maxwell PDE(s)? Uxx = ???
20 continue
end
Fmodel U0(xx) ! Initial starting values @ t = 0
! if( xx .le. 0) then
! U0 = 0
! elseif( xx .lt. .5 ) then
! U0 = (1 - cos( 4 * pi * xx))/2
! else
! U0 = 0
! endif
end
-
For 2-dimensional (2D) Maxwell's Equation:
global all
problem MaxwellsPDE
C ------------------------------------------------------------------------
C --- Calculus Programming example: Maxwell's Equation; a PDE (2D) Initial
C --- Value Problem solved using Method of Lines.
C ------------------------------------------------------------------------
dynamic U, Ux, Uxx
C
C User parameters ...
e0 = 8.854187817e-12 ! F/m or A2 s4 kg-1m−3 permittivity of free space
pi = 4*atan(1)
u0 = 4*pi*e-7 ! N·A−2 ... permeability of free space
! ipoints = 100 ! grid pts. over x-axis
! jpoints = 50 ! grid pts. over y-axis
! mpoints = 10 ! grid pts. over t-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
C
C t-parameter initial settings: t ==> m
pi= 4*atan(1): mp = mpoints: dt = tFinal/mpoints
allot U(jp,mp), Ux(jp,mp), Uxx(jp,mp)
C
call xAxis !
end ! Stmt.s not necessary in IVP, but used in BVP version
model xAxis !
C ... Integrate over x-axis
x= 0: xPrt = xPrint: dx = xPrt / 10
Initiate gemini; for PDE;
~ equations Uxx/Ux, Ux/U; of x; step dx; to xPrt
do while (x .lt. xFinal)
Integrate PDE; by gemini
if( x .ge. xPrt) then
do 30 jj = 2, jpoints
y = (jj - 1) * dy
print 79, x, y, (U(jj,mm), mm = 1, mp)
30 continue
xPrt = xPrt + xPrint
end if
end do
79 format( 1h , f8.4, 1x, f8.4, / 3x, 10(g14.5, 1x))
end
model PDE ! Partial Differential Equation
C ! Method of Lines
! U(1,1) = U0(x): Ux(1,1) = 0: Uxx(1,1) = 0 ! Initial Conditions
do 40 jj = 2, jpoints-1 ! System of ODEs
y = (jj - 1) * dy
do 20 mm = 2, mpoints-1
Ut = (U(jj,mm)-U(jj,mm-1))/dt ! approx. partial of U w.r.t. t
Utt = (U(jj,mm+1) - 2*U(jj,mm) + U(jj,mm-1))/dt**2
! Uxx(jj,mm)= ... f(x, U(jj,mm), Ux(jj,mm), Ut, Utt)
! Help! What's the Maxwell PDE(s)? Uxx = ???
20 continue
! Ux(jj,mp)= ???: Uxx(jj,mp)= ??? ! Initial Conditions, if any
40 continue
! Ux(jp,mp)= ???: Uxx(jp,mp)= ??? ! Initial Conditions
end
Fmodel U0(xx) ! Initial starting values @ t = 0
! if( xx .le. 0) then
! U0 = 0
! elseif( xx .lt. .5 ) then
! U0 = (1 - cos( 4 * pi * xx))/2
! else
! U0 = 0
! endif
end
-
For 3-dimensional (3D) Maxwell's Equation:
global all
problem MaxwellsPDE
C ------------------------------------------------------------------------
C --- Calculus Programming example: Maxwell's Equation; a PDE (3D) Initial
C --- Value Problem solved using Method of Lines.
C ------------------------------------------------------------------------
dynamic U, Ux, Uxx
C
C User parameters ...
e0 = 8.854187817e-12 ! F/m or A2 s4 kg-1m−3 permittivity of free space
pi = 4*atan(1)
u0 = 4*pi*e-7 ! N·A−2 ... permeability of free space
! ipoints = 100 ! grid pts. over x-axis
! jpoints = 50 ! grid pts. over y-axis
! kpoints = 50 ! grid pts. over z-axis
! mpoints = 10 ! grid pts. over t-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
C
C z-parameter initial settings: z ==> k
! zFinal = 1: dz = zFinal/(kpoints-1): kp = kpoints
C
C t-parameter initial settings: t ==> m
pi= 4*atan(1): mp = mpoints: dt = tFinal/mpoints
allot U(jp,kp,mp), Ux(jp,kp,mp), Uxx(jp,kp,mp)
C
call xAxis !
end ! Stmt.s not necessary in IVP, but used in BVP version
model xAxis !
C ... Integrate over x-axis
x= 0: xPrt = xPrint: dx = xPrt / 10
Initiate isis; for PDE;
~ equations Uxx/Ux, Ux/U; of x; step dx; to xPrt
do while (x .lt. xFinal)
Integrate PDE; by isis
if( x .ge. xPrt) then
do 30 kk = 2, kpoints
z = (kk - 1) * dz
do 25 jj = 2, jpoints
y = (jj - 1) * dy
print 79, x, y, z, (U(jj,kk,mm), mm = 1, mp)
25 continue
30 continue
xPrt = xPrt + xPrint
end if
end do
79 format( 1h , 3(f8.4, 1x), /1x, 10(g14.5, 1x))
end
model PDE ! Partial Differential Equation
C ! Method of Lines
! U(1,1,1) = U0(x): Ux(1,1,1) = 0: Uxx(1,1,1) = 0 ! Initial Conditions
do 60 kk = 2, kpoints-1 ! System of ODEs
z = (kk - 1) * dz
do 40 jj = 2, jpoints-1
y = (jj - 1) * dy
do 20 mm = 2, mpoints-1
Ut = (U(jj,kk,mm)-U(jj,kk,mm-1))/dt ! approx. partial of U w.r.t. t
Utt = (U(jj,kk,mm+1) - 2*U(jj,kk,mm) + U(jj,kk,mm-1))/dt**2
! Uxx(jj,kk,mm)= ... f(x, U(jj,kk,mm), Ux(jj,kk,mm), Ut, Utt)
! Help! What's the Maxwell PDE(s)? Uxx = ???
20 continue
40 continue
60 continue
end
Fmodel U0(zz) ! Initial starting values @ x = 0 and 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 Maxwell's 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/maxwell-equation.html"><img
align="middle" width="100"
src="http://www.digitalcalculus.com/image/fc-win-icon.gif"/>
<strong>Maxwell's (Partial Differential) Equation</strong>
</a>; Simulation to Optimization, Tweak Parameters for Optimal
Solution.
Go to top
|
|