|
User's Telegraph Equation
Telegraph Equation
_________
-
c2 ∇2
U = Utt + (α + β) Ut + αβU
- Have a Telegraph 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 Telegraph Equation Source
Code:
-
For 1-Dimensional Telegraph Equation use
following:
global all
problem TelegraphPDE
C ------------------------------------------------------------------------
C --- Calculus Programming example: Telegraph Equation; a PDE Initial
C --- Value Problem solved using Method of Lines.
C ------------------------------------------------------------------------
dynamic U, Ut, Utt
C
C User parameters ...
! alpha = ...
! beta = ...
! c = ...
! ipoints = 100 ! grid pts. over x-axis
! mpoints = 10 ! grid pts. over t-axis
! tFinal = 1 ! final time
C
C x-parameter initial settings: x ==> i
pi= 4*atan(1): ip = ipoints: dx = xFinal/ipoints
C
C t-parameter initial settings: t ==> m
! tFinal = 1: tPrint = tFinal/mpoints
allot U( ip), Ut( ip), Utt( ip)
C
call tAxis !
end ! Stmt.s not necessary in IVP, but used in BVP version
model tAxis !
C ... Integrate over t-axis
C
t= 0: tPrt = tPrint: dt = tPrt / 10
Initiate gemini; for PDE;
~ equations Utt/Ut, Ut/U; of t; step dt; to tPrt
do while (t .lt. tFinal)
Integrate PDE; by gemini
if( t .ge. tPrt) then
print 79, t, (U(ii), ii = 1, ip)
tPrt = tPrt + tPrint
end if
end do
79 format( 1h , 1(f8.4, 1x), /1x, 10(g14.5, 1x))
end
model PDE ! Partial Differential Equation
C ! Method of Lines
! U(1) = U0(t): Ut(1) = 0: Utt(1) = 0 ! Initial Conditions
do 20 ii = 2, ipoints-1 ! System of ODEs
Ux = (U(ii)-U(ii-1))/dx ! 4 1st order in 'x'
Uxx = (U(ii+1)-2*U(ii)+U(ii-1))/(dx*dx) !4 2nd order in 'x'
Utt(ii)= c**2 * Uxx + (alpha+beta)* Ut - alpha*beta*U
20 continue
! Ut(ip)= ???: Utt(ip)= ??? ! Initial Conditions, if any
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
-
For 2-Dimensional Telegraph Equation use
following:
global all
problem TelegraphPDE
C ------------------------------------------------------------------------
C --- Calculus Programming example: Telegraph Equation; a PDE (2D) Initial
C --- Value Problem solved using Method of Lines.
C ------------------------------------------------------------------------
dynamic U, Ut, Utt
C
C User parameters ...
! alpha = ...
! beta = ...
! c = ...
! 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
pi= 4*atan(1): ip = ipoints: dx = xFinal/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
! tFinal = 1: tPrint = tFinal/mpoints
allot U(ip,jp), Ut(ip,jp), Utt(ip,jp)
C
call tAxis !
end ! Stmt.s not necessary in IVP, but used in BVP version
model tAxis !
C ... Integrate over t-axis
C
t= 0: tPrt = tPrint: dt = tPrt / 10
Initiate gemini; for PDE;
~ equations Utt/Ut, Ut/U; of t; step dt; to tPrt
do while (t .lt. tFinal)
Integrate PDE; by gemini
if( t .ge. tPrt) then
do 10 jj = 2, jpoints
y = (jj - 1) * dy
print 79, t, y, (U(ii,jj), ii = 1, ip)
10 continue
tPrt = tPrt + tPrint
end if
end do
79 format( 1h , 2(f8.4, 1x), /1x, 10(g14.5, 1x))
end
model PDE ! Partial Differential Equation
C ! Method of Lines
! U(1,1) = U0(t): Ut(1,1) = 0: Utt(1,1) = 0 ! Initial Conditions
do 40 jj = 2, jpoints - 1 ! System of ODEs
y = (jj - 1) * dy
! Ut(1,jj)= ???: Utt(1,jj)= ??? ! Initial Conditions, if any
do 20 ii = 2, ipoints-1
Uxx = (U(ii+1,jj) - 2*U(ii,jj) + U(ii-1,jj))/(dx*dx)
Uyy = (U(ii,jj+1) - 2*U(ii,jj) + U(ii,jj-1))/(dy*dy)
Usum = Uxx + Uyy
Utt(ii,jj)= c**2 * Usum + (alpha+beta)* Ut - alpha*beta*U
20 continue
40 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 3-Dimensional Telegraph Equation use
following:
global all
problem TelegraphPDE
C ------------------------------------------------------------------------
C --- Calculus Programming example: Telegraph Equation; a PDE (3D) Initial
C --- Value Problem solved using Method of Lines.
C ------------------------------------------------------------------------
dynamic U, Ut, Utt
C
C User parameters ...
! alpha = ...
! beta = ...
! c = ...
! 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
pi= 4*atan(1): ip = ipoints: dx = xFinal/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
! tFinal = 1: tPrint = tFinal/mpoints
allot U(ip,jp,kp), Ut(ip,jp,kp), Utt(ip,jp,kp)
C
call tAxis !
end ! Stmt.s not necessary in IVP, but used in BVP version
model tAxis !
C ... Integrate over t-axis
C
t= 0: tPrt = tPrint: dt = tPrt / 10
Initiate gemini; for PDE;
~ equations Utt/Ut, Ut/U; of t; step dt; to tPrt
do while (t .lt. tFinal)
Integrate PDE; by gemini
if( t .ge. tPrt) then
do 30 kk = 2, kpoints
z = (kk - 1) * dz
do 10 jj = 2, jpoints
y = (jj - 1) * dy
print 79, t, y, z, (U(ii,jj,kk), ii = 1, ip)
10 continue
30 continue
tPrt = tPrt + tPrint
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(t): Ut(1,1,1) = 0: Utt(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 ii = 2, ipoints-1
Uxx = (U(ii+1,jj,kk) - 2*U(ii,jj,kk) + U(ii-1,jj,kk))/dx**2
Uyy = (U(ii,jj+1,kk) - 2*U(ii,jj,kk) + U(ii,jj-1,kk))/dy**2
Uzz = (U(ii,jj,kk+1) - 2*U(ii,jj,kk) + U(ii,jj,kk-1))/dz**2
Usum = Uxx + Uyy + Uzz
Utt(ii,jj,kk)= c**2 * Usum + (alpha+beta)* Ut - alpha*beta*U
20 continue
40 continue
! Ut(ip,jp,kk)= ???: Utt(ip,jp,kk)= ??? ! Initial Conditions, if any
60 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
User's Telegraph 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/telegraph-equation.html"><img
align="middle" width="100"
src="http://www.digitalcalculus.com/image/fc-win-icon.gif"/>
<strong>Telegraph Equation</strong>
</a>; Simulation to Optimization, Tweak Parameters for Optimal
Solution.
Go to top
|
|