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

Home

User's Heat Equation

Heat Equation
_________

α ∇2 U = Ut

Wikipedia comments: "The heat equation is of fundamental importance in diverse scientific fields. In mathematics, it is the prototypical parabolic partial differential equation. In probability theory, the heat equation is connected with the study of Brownian motion via the Fokker-Planck equation. In financial mathematics it is used to solve the Black-Scholes partial differential equation. The diffusion equation, a more general version of the heat equation, arises in connection with the study of chemical diffusion and other related processes."

Do you have a Heat equation to solve? Or any other math equations? For the next few months of 2014, we are willing to help you solve them using Calculus-level 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. E-mail us your {abc}{123}.fc file. We will compile & execute it and send you the output file. Try compiling you own code with our FC-Compiler program. Download and install FC-Compiler with more [~60] example problems to choose from. Learn how easy it works.

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 goal-driven.net website to others. Thanks!


User's Heat Equation Source Code:



For 1-Dimensional Heat Equation use following:



      global all
      problem HeatPDE
C ------------------------------------------------------------------------
C --- Calculus Programming example: Heat Equation; a PDE Initial
C --- Value Problem solved using Method of Lines.
C ------------------------------------------------------------------------
        dynamic U, U0, Ut, Ut0
C
C User parameters ...
        alpha = 2.e-5         ! thermal diffusion coefficienct
        ipoints = 21          ! grid pts. over x-axis
        tFinal =  600         ! not sure when odd numeric problem surfaces
C
C x-parameter initial settings: x ==> i
        ip = ipoints:   xFinal=1:    dx=xFinal/(ipoints-1)
        allot U(ip), U0(ip), Ut(ip), Ut0(ip)
C
C t-parameter initial settings: t ==> j
        tPrint = tFinal / 20

        Ua = .01:    U00=.1:    prnt = 0
        do 10 i = 1, ipoints
          U0(i) = U00
 10     continue
C
        call tAxis      !
      end               ! Stmt.s not necessary in IVP, but used in BVP versions
      model tAxis       !
C ... Integrate over x-axis   !
C                             !
        do 10 ii = 1, ipoints ! Stmt.s not necessary in IVP, but used in BVP versions
          U(ii) = U0(ii)      !
 10     continue              !
        error = 0:    tPrt = tPrint:    dt = tPrt / 20:    t = 0
        print *, U00, dt, dx, tPrint
C
C ... Integrate over t-axis
        Initiate ISIS;  for PDE;
     ~       equations Ut/U;  of t;  step dt;  to tPrt
        do while (t .lt. tFinal)
          Integrate PDE;  by ISIS
          if( t .ge. tPrt) then
            if(prnt.eq.1) print 79, t,error,(U(ii),ii=1,ip)
            tPrt = tPrt + tPrint
          end if
        end do
 79     format( 1h , g10.4, 1x, 20(g11.5, 1x))
      end
      model PDE                         ! Partial Differential Equation
C                                       ! Method of Lines
!        error = error + (U(1) - Ua)**2      ! BC1: U(1)=Ua @ x=0, for all t
        do 20 ij = 2, ipoints - 1       ! System of ODEs
          Uxx = (U(ij+1) - 2*U(ij) + U(ij-1)) / (dx*dx)  ! using central difference
          Ut(ij)= alpha * Uxx
 20     continue                  ! BC2: partial(U, x)=0, @ x=L, for all t
!        error = error + ((U(ip)-U(ip-1))/dx)**2
      end
                

Go to top

 
Valid CSS! Calculus (level) Problem-Solving for Engineers & Scientists

Textbooks - Parameter Estimation 4 ODE/PDE - Signal Analysis / Spectral Estimation - Body Plasma - Solar Cell
Increasing Productivity Examples: AC Motor Design - Matched Filters - Pulse Slimming / InterSymbol Interference - Pilot (safe) Ejection - PharmacoKinetics Simulation - Business Strategies & War Gaming - BVP - Implicit Equations