FC Coding is One step from 1st Principles to Solution!

User's Maxwell's Equation
Maxwell's Equation
_________
Wikipedia comments: "Maxwell's equations are a set of partial differential equations that, together with the Lorentz force law, form the foundation of classical electrodynamics, classical optics, and electric circuits. These fields in turn underlie modern electrical and communications technologies. Maxwell's equations describe how electric and magnetic fields are generated and altered by each other and by charges and currents. They are named after the Scottish physicist and mathematician James Clerk Maxwell who published an early form of those equations between 1861 and 1862."
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}
μ_{0}i ∂E/∂t ∫ E ⋅ dA

Have a Maxwell's equation to solve? Or any other math equations? For the next few months of 2014, we are willing to help you solve them using Calculuslevel programming. 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.
Email us your {abc}{123}.fc file. We will compile & execute it and send you the output file. Try compiling you own code with our FCCompiler program. Download and install FCCompiler with more [~60] example problems to choose from. Learn how easy it works.
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 email address on this web page.
Please mention our fortranCalculus.info website to others. Thanks!



User's Maxwell's Equation Source Code:
For 1dimensional (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, Ut, Ut0
C
C User parameters ...
e0 = 8.854187817e12 ! F/m or A^{2 }s^{4} kg^{1}m^{−3} permittivity of free space
pi = 4*atan(1)
u0 = 4*pi*e7 ! N·A^{−2} ... permeability of free space
! ipoints = 101 ! grid pts. over xaxis
! tFinal = 1 ! final time
C
C xparameter initial settings: x ==> i
! xFinal = 1: ip = ipoints: dx= xFinal/(ipoints1)
C
C tparameter initial settings: t ==> m
pi = 4*atan(1): tPrint = tFinal/20
allot U(ip), Ut(ip), Ut0(ip)
C
call tAxis !
end ! Stmt.s not necessary in IVP, but used in BVP versions
model tAxis !
C ... Integrate over taxis
C
t= 0: tPrt = tPrint: dt = tPrt/10
Initiate janis; for PDE;
~ equations Ut/U; of t; step dt; to tPrt
do while (t .lt. tFinal)
Integrate PDE; by janis
if( t .ge. tPrt) then
print 79, t, (U(ij), ij = 1, ip)
tPrt = tPrt + tPrint
end if
end do
79 format( 1x, f8.4, 1x, 20(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 ij = 2, ipoints1 ! System of ODEs
Ux = (U(ij)U(ij1))/dx ! approx. partial of U w.r.t. x
Uxx = (U(ij+1)  2*U(ij) + U(ij1))/dx**2
! Uxx(ij)= ... f(x, U(ij), Ux(ij), Ut)
! Ut = U
20 continue
end
Fmodel U0(xx) ! Initial starting values @ t = 0
! if( xx .lt. 0) then
! U0 = 0
! elseif( xx .lt. .5 ) then
! U0 = (1  cos( 4 * pi * xx))/2
! else
! U0 = 0
! endif
end
User's Maxwell's Equation Output:
selected output goes here ...
HTML code for linking to this page:
<a href="http://fortranCalculus.info/mathproblems/maxwellequation.html"><img style="float:left; width:100px" src="http://fortranCalculus.info/image/fccompilericon.png"/> <strong>Maxwell's (Partial Differential) Equation</strong> </a>; Simulation to Optimization, Tweak Parameters for Optimal Solution.
Go to top
