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

User's Wave Equation
Wave Equation
_________
∇^{2} U = U_{tt}
/ ν^{2}
Wikipedia comments: "The wave equation is an important secondorder linear partial differential equation for the description of waves  as they occur in physics  such as sound waves, light waves and water waves. It arises in fields like acoustics, electromagnetics, and fluid dynamics. Historically, the problem of a vibrating string such as that of a musical instrument was studied by Jean le Rond d'Alembert, Leonhard Euler, Daniel Bernoulli, and JosephLouis Lagrange."
Do you have a Wave 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 Wave Equation Source Code:
For 1Dimensional Wave Equation use following:
global all
problem WavePDE
C 
C  Calculus Programming example: Wave Equation; a PDE Initial
C  Value Problem solved using Method of Lines.
C 
dynamic U, Ut, Utt
C
C User parameters ...
! v = ??? ! velocity?
! ipoints = 21 ! 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/ip
allot U(ip), Ut(ip), Utt(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 janus; for PDE;
~ equations Utt/Ut, Ut/U; of t; step dt; to tPrt
do while (t .lt. tFinal)
Integrate PDE; by janus
if( t .ge. tPrt) then
print 79, t, (U( ij), ij = 1, ip)
tPrt = tPrt + tPrint
end if
end do
79 format( 1h , f8.4, 3x, 20(g14.5, 1x))
end
model PDE ! Partial Differential Equation
C ! Method of Lines
! U(1) = U0: Ut(1)=0: Utt(1)=0 ! Initial Conditions
do 20 ij = 2, ipoints1 ! System of ODEs
Uxx = (U(ij+1)2*U(ij)+U(ij1))/(dx*dx) !4 2nd order in 'x'
Utt(ij)= v**2 * Uxx ! Wave equation
20 continue
! Ut(ip)= ???: Utt(ip)= ??? ! Final conditions
end
Fmodel U0(xx) ! Initial starting values @ t = 0
! if( xx .le. 0) then
! U0 = 0
! elseif( xx .lt. .5 ) then
! U0 = ... f(xx)
else
! U0 = 0
endif
end
User's Wave Equation Output:
selected output goes here ...
HTML code for linking to this page:
<a
href="http://fortranCalculus.info/mathproblems/waveequation.html"><img style="float:left; width:100px" src="http://fortranCalculus.info/image/fccompilericon.png"/> <strong>Wave Equation</strong> </a>; Simulation to Optimization, Tweak Parameters for Optimal Solution.
Go to top
