Sequential integration using Fortran 77 compiler

85 Views Asked by At

Added inline here with is a *.for program segment which perform integration using trapezoidal rule [IMPLICIT REAL*8 (A-H, O-Z)].

        SUM = 0.0
        DO IE = 1, N - 1
            DELTAe(IE) = eMeV(IE + 1) - eMeV(IE)
            AVERAGE(IE) = 0.5 * ( spInverse(IE) + spInverse(IE + 1) )
            aSUM(IE) = (DELTAe(IE) * AVERAGE(IE)) 
            SUM = SUM + aSUM(IE)
            WRITE(60, *) (-1 * SUM)
    9   ENDDO 

The energy, defined here as eMeV(IE), is in equal interval, in descending order from 100.0 to 1.0 at an interval of 0.5 (N = 200), and is fetched from an external file 01ENERGY.TXT.

The Code then calculate a parameter spInverse(IE), and the program segment calculate the integrated value corresponding to the first number which is 100.0, and provide 199 output numbers.

Since the energy is in descending order, b - a is negative, and to make it positive, i have multiplied with a minus sign [WRITE(60, 65) (-1 * SUM)].

This program segment is working fine.

i would like to know how to add 0 as the first number, and then the integrated numbers?

i also need assistance to extend this to perform a sequence of integration such that once 100 is completed, then have to fetch the second number in the energy file which is 99.5 and then perform the integration, write the output as the second column. Then, similarly the loop continues to 99.0 up to 1.0.

Kindly provide some insights as i am a novice in coding.

These output numbers will be again used for the next set of calculations.

0

There are 0 best solutions below