I was doing some reading about Fortran this afternoon and ran across this problem. The story goes that we have a 400-MW nuclear reactor that is 100% efficient in its conversion to energy of the Uranium isotope U-235. Obviously, no reactor is 100% efficient, but the purpose of this exercise is not to find mass consumed, but to practice developing algorithms under that premise.
The program uses Einstein’s mass-energy equivalence formula to find mass consumed by the reactor.
![]()
After putting in the constants for energy produced (400,000,000 joules/second) and the speed of light squared (8.98755179 × 1016 meters/second), it is simply a matter of using the most basic Algebraic manipulation to isolate mass. I will admit, it was an astonishingly small amount of U-235 turned into energy. Perhaps there’s hope for this technology after all.
~Jonathan
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | PROGRAM relativity ! ------------------------------------------------------------------------------ ! Programmer: Jonathan Landrum ! ! Purpose: This program calculates the amount of mass consumed by a ! nuclear power plant over a user-supplied length of time. The ! calculation uses Einstein's relativity formula, E = mc^2. ! ! Assumptions: 1.) The power station has a 400-MW (400,000,000 joules per ! second) nuclear reactor. This is our E constant. ! 2.) The plant is 100% efficient (not realistic, but the losses ! are not part of the point of this exercise.) ! ! Revisions: Date Programmer Description of Change ! =========== ===================== ======================== ! 28 Feb 2012 Jonathan Landrum Original code. ! ------------------------------------------------------------------------------ IMPLICIT NONE ! DATA DICTIONARY: Declared constants INTEGER, PARAMETER :: seconds = 31536000 ! Seconds in a year INTEGER, PARAMETER :: E = 400000000 ! Output in joules/s REAL, PARAMETER :: C = 8.98755179E16 ! Speed of light^2 in m/s ! DATA DICTIONARY: Declared variables CHARACTER :: response ! User-supplied response to exit or not REAL :: time ! User-supplied length of time in years REAL :: mass ! Mass consumed by the generator in kg ! Introduce the program WRITE (*,*) '* * * * * * * * * * * * * * * * * * * * * * * * * * * * *' WRITE (*,*) '* *' WRITE (*,*) '* Fortran Nuclear Power Generator Simulator *' WRITE (*,*) '* *' WRITE (*,*) '* * * * * * * * * * * * * * * * * * * * * * * * * * * * *' WRITE (*,*) WRITE (*,*) 'This program uses Einstein''s theory of relativity to' WRITE (*,*) 'simulate how much mass is consumed by a 400-MW nuclear' WRITE (*,*) 'reactor, given it is 100% efficient.' WRITE (*,*) WRITE (*,*) '---------------------------------------------------------' WRITE (*,*) ! Prompt the user to continue or exit WRITE (*,*) 'Would you like to continue? [Y/N]' READ (*,*) response WRITE (*,*) DO WHILE (response == 'y' .OR. response == 'Y') ! Prompt the user for length of time to run the simulation WRITE (*,*) 'How many years do you want to simulate?' READ (*,*) time WRITE (*,*) ! Perform calculations mass = E / C * seconds * time ! Return results WRITE (*,*) 'The amount of Uranium-235 turned into energy by' WRITE (*,*) 'this station in ', time, ' years is ', mass,' kg.' WRITE (*,*) ! Prompt the user to continue or exit WRITE (*,*) 'Would you like to continue? [Y/N]' READ (*,*) response WRITE (*,*) END DO ! End "continue" loop WRITE (*,*) '\\//_ Live long and prosper.' ! Exit END PROGRAM relativity |
Jonathan Landrum is a full-time husband and student, and a part-time research assistant and IT guy. He both works and studies at Mississippi College, where he is pursuing a Bachelor of Science in Computer Science. Continue reading…
Pingback: Creating a Decimal-to-Binary Converter in Fortran :: Jonathan Landrum