1 / 7

Solving Stiff ODEs with Explicit Euler Method in Fortran

This document outlines the process of solving a stiff ordinary differential equation (ODE) using the Explicit Euler method in Fortran. The problem is approached by applying small step sizes (dt values: 0.0005, 0.0001, 0.002, and 0.0025) for high accuracy. The results are compared against the exact solution, ( y = -exp(-1000t) + t + 2 ). The methodology includes code snippets and data output to demonstrate the performance and accuracy of the numerical solution versus the exact one over an interval from ( t = 0 ) to ( t = 0.01 ).

anthea
Télécharger la présentation

Solving Stiff ODEs with Explicit Euler Method in Fortran

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 전자 전기 공학과 최선미 The following problem involving sitff ODEs require small step sizes and large numbers of steps. Consequently, this problem should be worked by writing computer program to perform the calcuation. 182. Consider the model stiff ODE Solve this ODE by the Explicit Euler Method from t=0 to0.01 with dt=0.0005, 0.0001,0.002, and 0.0025. Compare the solution with the exact solution. The Exact Solution is

  2. REAL T,Y,H,EXACT PARAMETER(U=20) PRINT *,'ODE BY EXPLICIT EULER METHOD' DATA T,Y,H /0.0,1.0,0.0005/ PRINT *,' T Y EXAXCT' PRINT 1,T,Y,EXACT 1 FORMAT(F10.5,F10.5,F10.5) OPEN(U,FILE='ANSWER.TXT') WRITE(U,*)'ODE BY EXPLICIT EULER METHOD' WRITE(U,*)'THE EXACT SOLUTION IS Y=-EXP(-1000t)+t+2' WRITE(U,*)' T Y EXACT' DO 10 N=1,20 Y=Y+H*(1-1000*(Y-(H+2))) T=T+H EXACT=T+2-EXP(-1000*T) PRINT 1,T,Y,EXACT WRITE(U,1) T,Y,EXACT 10 CONTINUE STOP END

  3. ODE BY EXPLICIT EULER METHOD THE EXACT SOLUTION IS Y=-EXP(-1000t)+t+2 T Y EXACT 0.00010 1.10011 1.09526 0.00020 1.19021 1.18147 0.00030 1.27130 1.25948 0.00040 1.34428 1.33008 0.00050 1.40996 1.39397 0.00060 1.46907 1.45179 0.00070 1.52228 1.50411 0.00080 1.57016 1.55147 0.00090 1.61325 1.59433 0.00100 1.65204 1.63312 0.00110 1.68694 1.66823 0.00120 1.71836 1.70001 0.00130 1.74663 1.72877 0.00140 1.77208 1.75480 0.00150 1.79498 1.77837 0.00160 1.81559 1.79970 0.00170 1.83414 1.81902 0.00180 1.85084 1.83650 0.00190 1.86587 1.85233 ………………………………………………. ODE BY EXPLICIT EULER METHOD THE EXACT SOLUTION IS Y=-EXP(-1000t)+t+2 T Y EXACT 0.00050 1.50075 1.39397 0.00100 1.75113 1.63312 0.00150 1.87631 1.77837 0.00200 1.93891 1.86666 0.00250 1.97020 1.92042 0.00300 1.98585 1.95321 0.00350 1.99368 1.97330 0.00400 1.99759 1.98568 0.00450 1.99954 1.99339 0.00500 2.00052 1.99826 0.00550 2.00101 2.00141 0.00600 2.00126 2.00352 0.00650 2.00138 2.00500 0.00700 2.00144 2.00609 0.00750 2.00147 2.00695 0.00800 2.00148 2.00766 0.00850 2.00149 2.00830 0.00900 2.00150 2.00888 0.00950 2.00150 2.00943 0.01000 2.00150 2.00995 By explicit Euler dt=0.0001) By explicit Euler dt=0.0005) ODE BY EXPLICIT EULER METHOD THE EXACT SOLUTION IS Y=-EXP(-1000t)+t+2 T Y EXACT 0.00200 3.00600 1.86666 0.00400 1.00000 1.98568 0.00600 3.00600 2.00352 0.00800 1.00000 2.00766 0.01000 3.00600 2.00995 ODE BY EXPLICIT EULER METHOD THE EXACT SOLUTION IS Y=-EXP(-1000t)+t+2 T Y EXACT 0.00250 3.50875 1.92042 0.00500 -0.25437 1.99826 0.00750 5.39031 2.00695 0.01000 -3.07672 2.00995 By explicit Euler dt=0.002) By explicit Euler dt=0.0025)

  4. By using Fortran

  5. All Figure Error By using Fortran

  6. By explicit Euler dt=0.0005) By explicit Euler dt=0.0001) By explicit Euler dt=0.0001) By using Mathematica By explicit Euler dt=0.002) By explicit Euler dt=0.0025)

  7. All Figure Error By using Mathematica

More Related