Changes between Version 7 and Version 8 of fortran
- Timestamp:
- Oct 18, 2016, 4:40:34 PM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
fortran
v7 v8 5 5 {{{ 6 6 #!fortran 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 7 14 real x,dx,s 8 15 a=-0.5 … … 34 41 }}} 35 42 36 == 2. Integral function calculation using Sim spon method ==43 == 2. Integral function calculation using Simpson method == 37 44 {{{ 38 45 #!fortran 46 ! Calculate an integral using only Simpson method. Look at program 1 for introduction 39 47 real x,dx,s 40 48 a=0 … … 65 73 {{{ 66 74 #!fortran 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 69 78 real x,dx, a, b 70 79 open(1,file='y2.dat', status='unknown')!the document y2 is in the project folder … … 82 91 {{{ 83 92 #!fortran 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. 95 86 96 real x,dx, a, b 87 97 open(1,file='y2.dat', status='unknown')!the document y2 is in the project folder … … 99 109 {{{ 100 110 #!fortran 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 113 !integral. 101 114 program Simpson 102 115 … … 136 149 {{{ 137 150 #!fortran 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. 138 154 !Between two coaxial rings, charged with q1=q2=1nC and their radius are equal to r1=1cm 139 155 !and r2=2cm, are located at distance 5 cm between each other. At halfway between the rings is … … 141 157 !velocity(energy)and the time,and electron coordinate with time. Also plot the phase 142 158 !trajectory V(x). And explain the resultants. 159 143 160 program rings 144 161 … … 168 185 {{{ 169 186 #!fortran 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 172 192 integer :: n=1000 173 193 real(8) :: dt, t, vm, b, rl, om, x, y, vx, vy, B0 … … 210 230 211 231 212 == 8. Electron motion in electric andmagnetic filed. ==232 == 8. Electron motion in magnetic filed. == 213 233 {{{ 214 234 #!fortran 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 216 239 integer :: n=1000 217 240 real(8) :: dt, t, vm, om, x, y, vx, vy, B0,b … … 282 305 {{{ 283 306 #!fortran 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. 310 286 311 integer :: n=1000 287 312 real(8) :: dt, t, vm, om, x, y, vx, vy, B0,b … … 339 364 {{{ 340 365 #!fortran 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 342 369 integer :: N = 1500 343 370 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 … … 378 405 {{{ 379 406 #!fortran 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. 380 410 integer :: n=1000 381 411 real(8) :: dt, t, x, y, vx, vy, v, E, W … … 423 453 {{{ 424 454 #!fortran 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 426 461 427 462 … … 637 672 #!fortran 638 673 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 641 678 642 679 external fct, out … … 854 891 {{{ 855 892 #!fortran 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 857 896 external fct, out 858 897 real aux(8,2) … … 1056 1095 {{{ 1057 1096 #!fortran 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 1059 1101 1060 1102 external fct, out … … 1286 1328 {{{ 1287 1329 #!fortran 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. 1291 1335 1292 1336 external fct, out … … 1529 1573 1530 1574 ! Using the same condition like in program 16 1531 ! metod Runge-Kuta.1575 ! Using method Runge-Kuta for determination the conditions of the electron motion. 1532 1576 external fct, out 1533 1577 real aux(8,4) … … 1768 1812 {{{ 1769 1813 #!fortran 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. 1770 1816 ! Using metod Runge-Kuta 1771 1817 … … 2001 2047 {{{ 2002 2048 #!fortran 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 2005 2055 !field (mirror trap) for different input values 2006 2056 … … 2169 2219 {{{ 2170 2220 #!fortran 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 2225 !approximation. 2172 2226 program heat1 2173 2227 … … 2240 2294 {{{ 2241 2295 #!fortran 2242 ! Using swap method in one dimensional case, determine the electric filed of the2243 ! electron layer2244 ! 2245 ! 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 2246 2300 program poisn1 2247 2301 real d,n0 … … 2800 2854 {{{ 2801 2855 #!fortran 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. 2803 2859 real v,x,dt,t,dv,Fm 2804 2860 open(2,file='y2.dat', status='unknown')