User's Wave Equation


Wave Equation
_________

2 U = Utt / ν2
Have a Wave 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 Wave Equation Source Code:


For 1-Dimensional 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, Ux, Uxx
C
C User parameters ...
!        v = ???		! velocity?
!        ipoints = 20          ! grid pts. over x-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
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 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( mm), mm = 1, mp)
            xPrt = xPrt + xPrint
          end if
        end do
 79     format( 1h , a, 2x, f8.4, 3x, 10(g14.5, 2x))
      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 	! 4 1st order in 't'
          Utt = (U(mm+1)-2*U(mm)+U(mm-1))/(dt*dt)  !4 2nd order in 't'
          Uxx(mm)= 1/v**2 * Utt
 20     continue
!        Ux(mp)= ???:        Uxx(mp)= ???
      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 Wave Equation use following:


      global all
      problem WavePDE
C ------------------------------------------------------------------------
C --- Calculus Programming example: Wave Equation; a PDE (2D) Initial
C --- Value Problem solved using Method of Lines.
C ------------------------------------------------------------------------
        dynamic U, Ux, Uxx
C
C User parameters ...
!        v = ???		! velocity?
!        ipoints = 30          ! grid pts. over x-axis
!        jpoints = 10          ! 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
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
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
            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
!          Ux(jj,1)= ???:          Uxx(jj,1)= ???
          do 20 mm = 2, mpoints-1
            Utt = (U(jj,mm+1) - 2*U(jj,mm) + U(jj,mm-1))/(dt*dt)
            Uyy = (U(jj+1,mm) - 2*U(jj,mm) + U(jj-1,mm))/(dy*dy)
            Uxx(jj,mm)= Utt / (v*v) - Uyy
 20       continue
!          Ux(jj,mp)= ???:      Uxx(jj,mp)= ???   ! Initial Conditions, if any
 40     continue
!        Ux(jp,mp)= ???:        Uxx(jp,mp)= ???   ! 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 = (1 - cos( 4 * pi * xx))/2
        else
!          U0 = 0
        endif
      end

For 3-Dimensional Wave Equation use following:


      global all
      problem WavePDE
C ------------------------------------------------------------------------
C --- Calculus Programming example: Wave Equation; a PDE (3D) Initial
C --- Value Problem solved using Method of Lines.
C ------------------------------------------------------------------------
        dynamic U, Ux, Uxx
C
C User parameters ...
!        v = ???		! velocity?
!        ipoints = 20          ! 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
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( mp), Ux( mp), Uxx( mp)
C
        call xAxis      !
      end               ! Stmt.s not necessary in IVP, but used in BVP version
      model xAxis       !
C ... Integrate over x-axis
C
        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 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
              Uyy = (U(jj+1,kk,mm) - 2*U(jj,kk,mm) + U(jj-1,kk,mm))/dy**2
              Uzz = (U(jj,kk+1,mm) - 2*U(jj,kk,mm) + U(jj,kk-1,mm))/dz**2
              Uxx(jj,kk,mm)= Utt / (v*v) - Uyy - Uzz
 20         continue
 40       continue
 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 Wave 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/wave-equation.html"><img align="middle" width="100" src="http://www.digitalcalculus.com/image/fc-win-icon.gif"/> <strong>Wave Equation</strong> </a>; Simulation to Optimization, Tweak Parameters for Optimal Solution.

Go to top

 

Copyright © 2005 Optimal Designs Enterprise. All rights reserved.

Burgers' PDE - Parameter Estimation 4 ODE/PDE - Signal Analysis / Spectral Estimation - Body Plasma - Solar Cell - Links
Increasing Productivity Examples: AC Motor Design - Matched Filters - Pulse Slimming / InterSymbol Interference - Maxwell's (Differential) Equations - Poisson's (Differential) Equation - Schrodinger (Differential) Equation - Telegraph (Differential) Equations - Wave (Differential) Equation - BVP 4 PDE Equations - Implicit (Differential) Equations -