Changes between Version 7 and Version 8 of fortran

Oct 18, 2016, 4:40:34 PM (4 years ago)



  • fortran

    v7 v8  
     7!There are three methods which are using for calculation definite integrals in Fortran.
     8!First is rectangle method, where the function is integrated using segment integration
     9!and like a resultant we obtain rectangle formula. Second is trapeze method and the same like !in the first method after integration we obtain the trapeze formula. And the third method is !Simpson method where the function which is integrated, is parabolic and after integration   
     10!we obtain Simpson's formula. In all methods are used segment integration, which means that  ! interval of integration a and b is divided into N segments. The splitting points xn are 
     11!called nodes.   
     12!In this program we calculate the same integral but using different methods the get the
     13!difference between each method   
    714real x,dx,s
    36 == 2. Integral function calculation using Simspon method  ==
     43== 2. Integral function calculation using Simpson method  ==
     46! Calculate an integral using only Simpson method. Look at program 1 for introduction
    3947real x,dx,s
    67 ! Get a graph of the dependence in Origin, differentiate and integrate the graph and
    68 !compare the resultants with the integrals which are calculated in the first program
     75!To compare the resultants which are obtained in the program 1 with a graphical integration
     76!and to get the precision of integration, in this program first is obtained the graph of the
     77!integral dependence in Origin,and after that it is compared with the resultants in program 1
    6978real x,dx, a, b
    7079open(1,file='y2.dat', status='unknown')!the document y2 is in the project folder
    84 ! Get a graph of the dependence in Origin, differentiate and integrate the graph and
    85 !compare the resultant with the integral which is calculated in the second program
     93!The introduction is the same like in program 3. But here the resultant of integration is
     94!compare with program 2.
    8696real x,dx, a, b
    8797open(1,file='y2.dat', status='unknown')!the document y2 is in the project folder
     111!To understand the algorithm of how is working Simpson method, in this program is obtain
     112!how with Simpson formula and using the functions f1, f2 and f3 can be integrated a definite
    101114program Simpson
     151!To main characteristics if the electron motion are the coordinate and the velocity.
     152!This program it is a solution of a task which is written below. All units for the input
     153!values are in CGS system.
    138154!Between two coaxial rings, charged with q1=q2=1nC and their radius are equal to r1=1cm
    139155!and r2=2cm, are located at distance 5 cm between each other. At halfway between the rings is
    141157!velocity(energy)and the time,and electron coordinate with time. Also plot the phase
    142158!trajectory V(x). And explain the resultants.   
    143160program rings
    170 !Using the equation of electron motion find the phase trajectory. Electron filed E=0
    171 !Part 1. Using only dependence of B0
     187!The main idea in plasma physics is to understand the motion of the charge particles. For
     188!that reason first we will make a solution of the electron motion but only in magnetic
     189!filed. Solving this problem by using the equation of electron motion can be obtain the
     190!phase trajectory. Electron filed E0=0
     191!Part 1. Using only dependence of B0 or initial magnetic filed
    172192integer :: n=1000
    173193real(8) :: dt, t, vm, b, rl, om, x, y, vx, vy, B0
    212 == 8. Electron motion in electric and magnetic filed.  ==
     232== 8. Electron motion in magnetic filed.  ==
    215 !Like in program 7.Part 1
     235!The introduction is like in program 7. The difference is to solve the problem how will be
     236!the electron motion if the velocities vx and vy depends of the magnetic filed Bz which is a
     237!function of the coordinate y. E0=0
     238!Part 2
    216239integer :: n=1000
    217240real(8) :: dt, t, vm, om, x, y, vx, vy, B0,b
    284 !Like in program 8. Part 2. the differnece is that here we are using different functions
    285 !for vx and vy
     307!To make a conclusion how is the electric motion looks like using plus electric filed. And to
     308!get a picture of the motion in the plasma in this program we are using different functions
     309!of dependencies for vx and vy. And the electric filed is E0=3. The particle begins to drift.
    286311integer :: n=1000
    287312real(8) :: dt, t, vm, om, x, y, vx, vy, B0,b
    341 ! Like in program 7. Part 2 here we have dependence of magnetic filed in z coordinate
     366!The introduction is like in program 8, but the difference is that here we have
     367!trigonometrical dependencies of the initial velocities. 
     368!Part 3
    342369integer :: N = 1500
    343370real(8) :: x = 2.5, y = 0.5, B0 = 500.0, We = 4.0054e-08, b = 2.0, pi = 3.14159, m = 9.1e-28, e = -4.8e-10, c = 2.99e10
     407!Also for one of the main characteristics in the plasma is the energy and the power of the
     408!charge particles. In this program are obtained the energy and the power of the protons in
     409!the plasma. Using the basics equations for it.
    380410integer :: n=1000
    381411real(8) :: dt, t, x, y, vx, vy, v, E, W
    425 !  metod Runge-Kuta. Oscillator. Part 1
     455!To solve a partial differential equations need to satisfy the condition y(x0)=y0 which is
     456!called Cauchy task. The most effective and the commonly used method of the solution of
     457!Cauchy task is Runge-Kuta method. It is based on a approximation of the function y, which is
     458!obtained by expanding the function in Taylor series. 
     459!Using method Runge-Kuta can be obtain the basic differential equation for oscillator.
     460!Part 1
    639 !  metod Runge-Kuta. Oscillator. Part 2 (the differnece between part 1 is that here we are
    640 !  using onother function for du(1))
     674!Using method Runge-Kuta obtain the differential equations for oscillator, the same like in
     675!program 12 but the difference is that here we are using onother function for du(1) which
     676!is velocity
     677!Part 2
    642679external fct, out
    856 !Part 3. Another example and using another function for du(1)
     893!The same like in program 12 and 12 using Runge Kutta obtain the differential equations but
     894!with another example and using !another function for du(1)
     895!Part 3
    857896external fct, out
    858897real aux(8,2)
    1058 !  Using metod Runge-Kuta. .
     1097!The method Runge-Kuta is not used only for obtaining the differential equation for
     1098!oscilloscope. The same method can be used in different tasks where the differential
     1099!equations need be solve. Using method Runge-Kuta, it is easy to find the electron
     1100!acceleration in electric filed
    10601102external fct, out
    1288 !  Using metod Runge-Kuta. Resonant and auto resonant.
    1289 ! SGA (synchrotron gyro-magnetic auto resonant) is a self sustaining ECR plasma in
    1290 !magnetic field which is rising in time.
     1330!Also the method Runge Kuta is used for solving more complex problems in plasma physics, like
     1331!SGA (synchrotron gyro-magnetic auto resonant) which is a self sustaining ECR plasma in
     1332!magnetic field where the time is rising up.
     1333!First the method Runge-Kuta is used for auto resonant condition and after that using the
     1334!equations of plasma physics for the SGA mode it are determined the conditions.
    12921336external fct, out
    15301574!  Using the same condition like in program 16
    1531 metod Runge-Kuta.
     1575Using method Runge-Kuta for determination the conditions of the electron motion.
    15321576external fct, out
    15331577real aux(8,4)
     1814!The same introductions like in programs 16 and 17 but the difference is that here we have
     1815!dependence of speed light. To  get the relative conditions for the motion.
    17701816! Using metod Runge-Kuta
    2003 ! Using Boris method get the equations of the charge particle motion. And analyze the ECR
    2004 !(electron cyclotron resonance) phenomenon in parabolic approximation of the magnetic
     2049!One of the most important thing in plasma physics is to get the motion equations of the
     2050!particles. To get that equations it is used Boris method. This method is divided in for
     2051!sections: using the momentum of the particles, their rotations, using the electrical field
     2052!and at the end to determinate the coordinates.
     2053!Using this method in this program is analyzed the ECR(electron cyclotron resonance)
     2054!phenomenon in parabolic approximation of the magnetic
    20052055!field (mirror trap) for different input values
    2171 !using method Newton-Raphson
     2221!To find a solutions for solving nonlinear equation first need to find the roots in the
     2222!initial interval. There are a lot of methods for how can these roots be obtained. In this
     2223!program we are using method Newton-Raphson. This method is more rapidly convergent. To find
     2224!the roots in the interval we are choosing a number which will serve as an initial
    21722226    program heat1
    2242 ! Using swap method in one dimensional case, determine the electric filed of the
    2243 ! electron layer
    2244 ! Get the plots of the dependencies between the density and the electric filed with   
    2245 ! coordinate z
     2296!To obtain the one dimensional Poisson equation is used the swap method and after the
     2297!solving the Poisson equation can be determinate the electric filed of the electron layer.
     2298!Get the plots of the dependencies between the density and the electric filed with   
     2299!coordinate z
    22462300      program poisn1
    22472301real d,n0
    2802 !using method Euler
     2856!To integrate the ordinary differential equations is used method Euler. This method is
     2857!applicable to a system of first order differential equations. In this program this method
     2858!will help to find the velocity of the electron in uniform electric filed. 
    28032859real v,x,dt,t,dv,Fm
    28042860open(2,file='y2.dat', status='unknown')