# Changes between Version 7 and Version 8 of fortran

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

--

Unmodified
Added
Removed
Modified
• ## fortran

 v7 {{{ #!fortran !There are three methods which are using for calculation definite integrals in Fortran. !First is rectangle method, where the function is integrated using segment integration !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 !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 !called nodes. !In this program we calculate the same integral but using different methods the get the !difference between each method real x,dx,s a=-0.5 }}} == 2. Integral function calculation using Simspon method  == == 2. Integral function calculation using Simpson method  == {{{ #!fortran ! Calculate an integral using only Simpson method. Look at program 1 for introduction real x,dx,s a=0 {{{ #!fortran ! Get a graph of the dependence in Origin, differentiate and integrate the graph and !compare the resultants with the integrals which are calculated in the first program !To compare the resultants which are obtained in the program 1 with a graphical integration !and to get the precision of integration, in this program first is obtained the graph of the !integral dependence in Origin,and after that it is compared with the resultants in program 1 real x,dx, a, b open(1,file='y2.dat', status='unknown')!the document y2 is in the project folder {{{ #!fortran ! Get a graph of the dependence in Origin, differentiate and integrate the graph and !compare the resultant with the integral which is calculated in the second program !The introduction is the same like in program 3. But here the resultant of integration is !compare with program 2. real x,dx, a, b open(1,file='y2.dat', status='unknown')!the document y2 is in the project folder {{{ #!fortran !To understand the algorithm of how is working Simpson method, in this program is obtain !how with Simpson formula and using the functions f1, f2 and f3 can be integrated a definite !integral. program Simpson {{{ #!fortran !To main characteristics if the electron motion are the coordinate and the velocity. !This program it is a solution of a task which is written below. All units for the input !values are in CGS system. !Between two coaxial rings, charged with q1=q2=1nC and their radius are equal to r1=1cm !and r2=2cm, are located at distance 5 cm between each other. At halfway between the rings is !velocity(energy)and the time,and electron coordinate with time. Also plot the phase !trajectory V(x). And explain the resultants. program rings {{{ #!fortran !Using the equation of electron motion find the phase trajectory. Electron filed E=0 !Part 1. Using only dependence of B0 !The main idea in plasma physics is to understand the motion of the charge particles. For !that reason first we will make a solution of the electron motion but only in magnetic !filed. Solving this problem by using the equation of electron motion can be obtain the !phase trajectory. Electron filed E0=0 !Part 1. Using only dependence of B0 or initial magnetic filed integer :: n=1000 real(8) :: dt, t, vm, b, rl, om, x, y, vx, vy, B0 == 8. Electron motion in electric and magnetic filed.  == == 8. Electron motion in magnetic filed.  == {{{ #!fortran !Like in program 7.Part 1 !The introduction is like in program 7. The difference is to solve the problem how will be !the electron motion if the velocities vx and vy depends of the magnetic filed Bz which is a !function of the coordinate y. E0=0 !Part 2 integer :: n=1000 real(8) :: dt, t, vm, om, x, y, vx, vy, B0,b {{{ #!fortran !Like in program 8. Part 2. the differnece is that here we are using different functions !for vx and vy !To make a conclusion how is the electric motion looks like using plus electric filed. And to !get a picture of the motion in the plasma in this program we are using different functions !of dependencies for vx and vy. And the electric filed is E0=3. The particle begins to drift. integer :: n=1000 real(8) :: dt, t, vm, om, x, y, vx, vy, B0,b {{{ #!fortran ! Like in program 7. Part 2 here we have dependence of magnetic filed in z coordinate !The introduction is like in program 8, but the difference is that here we have !trigonometrical dependencies of the initial velocities. !Part 3 integer :: N = 1500 real(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 {{{ #!fortran !Also for one of the main characteristics in the plasma is the energy and the power of the !charge particles. In this program are obtained the energy and the power of the protons in !the plasma. Using the basics equations for it. integer :: n=1000 real(8) :: dt, t, x, y, vx, vy, v, E, W {{{ #!fortran !  metod Runge-Kuta. Oscillator. Part 1 !To solve a partial differential equations need to satisfy the condition y(x0)=y0 which is !called Cauchy task. The most effective and the commonly used method of the solution of !Cauchy task is Runge-Kuta method. It is based on a approximation of the function y, which is !obtained by expanding the function in Taylor series. !Using method Runge-Kuta can be obtain the basic differential equation for oscillator. !Part 1 #!fortran !  metod Runge-Kuta. Oscillator. Part 2 (the differnece between part 1 is that here we are !  using onother function for du(1)) !Using method Runge-Kuta obtain the differential equations for oscillator, the same like in !program 12 but the difference is that here we are using onother function for du(1) which !is velocity !Part 2 external fct, out {{{ #!fortran !Part 3. Another example and using another function for du(1) !The same like in program 12 and 12 using Runge Kutta obtain the differential equations but !with another example and using !another function for du(1) !Part 3 external fct, out real aux(8,2) {{{ #!fortran !  Using metod Runge-Kuta. . !The method Runge-Kuta is not used only for obtaining the differential equation for !oscilloscope. The same method can be used in different tasks where the differential !equations need be solve. Using method Runge-Kuta, it is easy to find the electron !acceleration in electric filed external fct, out {{{ #!fortran !  Using metod Runge-Kuta. Resonant and auto resonant. ! SGA (synchrotron gyro-magnetic auto resonant) is a self sustaining ECR plasma in !magnetic field which is rising in time. !Also the method Runge Kuta is used for solving more complex problems in plasma physics, like !SGA (synchrotron gyro-magnetic auto resonant) which is a self sustaining ECR plasma in !magnetic field where the time is rising up. !First the method Runge-Kuta is used for auto resonant condition and after that using the !equations of plasma physics for the SGA mode it are determined the conditions. external fct, out !  Using the same condition like in program 16 !  metod Runge-Kuta. !  Using method Runge-Kuta for determination the conditions of the electron motion. external fct, out real aux(8,4) {{{ #!fortran !The same introductions like in programs 16 and 17 but the difference is that here we have !dependence of speed light. To  get the relative conditions for the motion. ! Using metod Runge-Kuta {{{ #!fortran ! Using Boris method get the equations of the charge particle motion. And analyze the ECR !(electron cyclotron resonance) phenomenon in parabolic approximation of the magnetic !One of the most important thing in plasma physics is to get the motion equations of the !particles. To get that equations it is used Boris method. This method is divided in for !sections: using the momentum of the particles, their rotations, using the electrical field !and at the end to determinate the coordinates. !Using this method in this program is analyzed the ECR(electron cyclotron resonance) !phenomenon in parabolic approximation of the magnetic !field (mirror trap) for different input values {{{ #!fortran !using method Newton-Raphson !To find a solutions for solving nonlinear equation first need to find the roots in the !initial interval. There are a lot of methods for how can these roots be obtained. In this !program we are using method Newton-Raphson. This method is more rapidly convergent. To find !the roots in the interval we are choosing a number which will serve as an initial !approximation. program heat1 {{{ #!fortran ! Using swap method in one dimensional case, determine the electric filed of the ! electron layer ! Get the plots of the dependencies between the density and the electric filed with ! coordinate z !To obtain the one dimensional Poisson equation is used the swap method and after the !solving the Poisson equation can be determinate the electric filed of the electron layer. !Get the plots of the dependencies between the density and the electric filed with !coordinate z program poisn1 real d,n0 {{{ #!fortran !using method Euler !To integrate the ordinary differential equations is used method Euler. This method is !applicable to a system of first order differential equations. In this program this method !will help to find the velocity of the electron in uniform electric filed. real v,x,dt,t,dv,Fm open(2,file='y2.dat', status='unknown')