Changeset 3:957bfa456237 for source/class/pf
- Timestamp:
- Aug 6, 2007, 1:01:51 PM (17 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- source/class/pf
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
source/class/pf/Application.js
r2 r3 40 40 }, 41 41 { 42 name : "Full Debye length", 43 dimension : "length", 44 nspecies : 1, 45 section : "fundamental", 46 formula : "this.getFullDebyeLength(%s1)" 47 }, 48 { 42 49 name : "deBroglie length", 43 50 dimension : "length", … … 60 67 formula : "%s1.getMinApproachDistance()" 61 68 }, 69 { 70 name : "Inertial length", 71 dimension : "length", 72 nspecies : 1, 73 section : "fundamental", 74 formula : "%s1.getInertialLength()" 75 }, 62 76 63 77 { … … 68 82 formula : "%s1.getThermalVelocity()" 69 83 }, 84 { 85 name : "Alfven velocity", 86 dimension : "velocity", 87 nspecies : 1, 88 section : "fundamental", 89 formula : "%s1.getAlfvenVelocity(this.B)" 90 }, 70 91 71 92 { … … 86 107 87 108 { 109 name : "Transition energy", 110 dimension : "energy", 111 nspecies : 0, 112 section : "spectroscopy", 113 formula : "this.getWavenumber()" 114 }, 115 { 116 name : "Natural linewidth", 117 dimension : "energy", 118 nspecies : 0, 119 section : "spectroscopy", 120 formula : "this.getNaturalWidth()" 121 }, 122 { 123 name : "Doppler FWHM", 124 dimension : "energy", 125 nspecies : 0, 126 section : "spectroscopy", 127 formula : "2*this.getDopplerHwhm()" 128 }, 129 { 130 name : "Zeeman splitting", 131 dimension : "energy", 132 nspecies : 0, 133 section : "spectroscopy", 134 formula : "2*this.getZeemanSplitting()" 135 }, 136 { 137 name : "Stark FWHM", 138 dimension : "energy", 139 nspecies : 0, 140 section : "spectroscopy", 141 formula : "2*this.getStarkHwhm()" 142 }, 143 { 144 name : "QS Stark FWHM", 145 dimension : "energy", 146 nspecies : 1, 147 section : "spectroscopy", 148 formula : "2*this.getQsHwhm(%s1)" 149 }, 150 151 { 152 name : "Dynamic Stark range", 153 dimension : "energy", 154 nspecies : 1, 155 section : "spectroscopy", 156 formula : "this.getMicrofieldFrequency(%s1)/3e10/(2*Math.PI)" 157 }, 158 159 { 160 name : "Static/dynamic Stark ratio", 161 dimension : "none", 162 nspecies : 1, 163 section : "spectroscopy", 164 formula : "this.getStarkRatio(%s1)" 165 }, 166 { 167 name : "Stark quasistaticity", 168 dimension : "none", 169 nspecies : 1, 170 section : "spectroscopy", 171 formula : "this.getStarkQuasistaticity(%s1)" 172 }, 173 174 { 175 name : "Transition wavelength", 176 dimension : "length", 177 nspecies : 0, 178 section : "spectroscopy", 179 formula : "1/this.getWavenumber()" 180 }, 181 182 { 88 183 name : "Holtsmark field", 89 184 dimension : "efield", … … 91 186 section : "spectroscopy", 92 187 formula : "%s1.getHoltsmarkField()" 188 }, 189 190 { 191 name : "Microfield frequency", 192 dimension : "frequency", 193 nspecies : 1, 194 section : "spectroscopy", 195 formula : "this.getMicrofieldFrequency(%s1)" 93 196 } 94 197 ); 95 198 96 199 200 function LymanA(n) 201 { 202 if (n <= 1) { 203 return 0; 204 } else { 205 return 8e9*256/9*n*Math.pow((n - 1)/(n + 1), 2*n)/((n*n - 1)*(n*n - 1)); 206 } 207 } 97 208 98 209 … … 133 244 if (isFinite(T_e)) { 134 245 this.e.setT(T_e); 246 this.i.setT(T_e); 247 this.r.setT(T_e); 135 248 this.updateGUI(); 136 249 } … … 156 269 if (isFinite(T_i)) { 157 270 this.i.setT(T_i); 271 this.r.setT(T_i); 158 272 this.updateGUI(); 159 273 } … … 217 331 } 218 332 333 function changeN_u(ev) 334 { 335 var e = ev.getTarget(); 336 var n_u = parseInt(e.getValue()); 337 338 this.n_u = n_u; 339 this.updateGUI(); 340 } 341 342 function changeN_l(ev) 343 { 344 var e = ev.getTarget(); 345 var n_l = parseInt(e.getValue()); 346 347 this.n_l = n_l; 348 this.updateGUI(); 349 } 350 219 351 function changeB(ev) 220 352 { … … 231 363 var e = ev.getTarget(); 232 364 var entity = e.getUserData("entity"); 233 var species = e.getUserData("species"); 234 var species_str = "this." + species.id; 235 var formula = entity.formula.replace(/\%s1/g, species_str); 365 var formula; 366 if (entity.nspecies == 1) { 367 var species = e.getUserData("species"); 368 var species_str = "this." + species.id; 369 formula = entity.formula.replace(/\%s1/g, species_str); 370 } else { 371 formula = entity.formula; 372 } 236 373 237 374 var v = eval(formula); … … 254 391 members : 255 392 { 256 393 R0 : 1, // 0.3/0.7/1 ?; 394 257 395 checkPlasmaParameters : function() 258 396 { … … 296 434 this.gui_N_i.setNumValue(this.i.getN()); 297 435 this.gui_N_r.setNumValue(this.r.getN()); 436 this.gui_T_i.setNumValue(this.i.getT()); 437 this.gui_T_r.setNumValue(this.r.getT()); 438 }, 439 440 getWavenumber : function() 441 { 442 var n_u = this.n_u; 443 var n_l = this.n_l; 444 var Z_core = this.r.getQ() + 1; 445 446 return 1.0974e5*Z_core*Z_core*(1/(n_l*n_l) - 1/(n_u*n_u)); 447 }, 448 449 getNaturalWidth : function() 450 { 451 var n_u = this.n_u; 452 var n_l = this.n_l; 453 var Z_core = this.r.getQ() + 1; 454 455 return Math.pow(Z_core, 4)* 456 (LymanA(n_u) + LymanA(n_l))/3e10/(2*Math.PI); 457 }, 458 459 getDopplerHwhm : function() 460 { 461 var v = this.r.getThermalVelocity(); 462 var nu = this.getWavenumber(); 463 464 return Math.sqrt(2*Math.log(2))*nu*v/3e10; 465 }, 466 467 getMicrofieldFrequency : function(s) 468 { 469 var r = s.getMeanDistance(); 470 var v_r = this.r.getThermalVelocity(); 471 var v_s = s.getThermalVelocity(); 472 var v = Math.sqrt(v_r*v_r + v_s*v_s); 473 474 return v/r; 475 }, 476 477 getFullDebyeLength : function(s) 478 { 479 var tmp = 0; 480 var m = s.getM(); 481 482 var sa = new Array(this.e, this.i, this.r); 483 for (var i = 0; i < 3; i++) { 484 var os = sa[i]; 485 if (os.getM() <= m) { 486 var ld = os.getDebyeLength(); 487 if (ld) { 488 tmp += 1/(ld*ld); 489 } 490 } 491 492 } 493 494 return 1/Math.sqrt(tmp); 495 }, 496 497 getPpiFactor : function(s) 498 { 499 var dl = this.getFullDebyeLength(s); 500 var r1 = s.getMeanDistance(); 501 var r; 502 if (isFinite(dl) && isFinite(r1)) { 503 r = r1/dl; 504 } else { 505 r = 0; 506 } 507 508 return (1 + r)*Math.exp(-r); 509 // return 1 - 0.6*r 510 }, 511 512 getRpiFactor : function(s) 513 { 514 // FIXME!!! 515 return 1; 516 }, 517 518 getQsHwhm : function(s) 519 { 520 var n_u = this.n_u; 521 var n_l = this.n_l; 522 var Z_core = this.r.getQ() + 1; 523 var ef = s.getHoltsmarkField(); 524 var ppi = this.getPpiFactor(s); 525 var rpi = this.getRpiFactor(s); 526 527 // 1.4385 is S_1 HWHM 528 return 1.4385*4.271417e-5*3/2*(n_u*n_u - n_l*n_l)/Z_core*ef*ppi*rpi; 529 }, 530 531 getStarkRatio : function(s) 532 { 533 var R; 534 var w_qs = this.getQsHwhm(s); 535 if (w_qs == 0) { 536 R = 0; 537 } else { 538 R = 2*w_qs/(this.getMicrofieldFrequency(s)/3e10/(2*Math.PI)); 539 } 540 541 return R; 542 }, 543 544 getStarkQuasistaticity : function(s) 545 { 546 var R = this.getStarkRatio(s); 547 return R/(R + this.R0); 548 }, 549 550 getStarkHwhm : function() 551 { 552 var w = 0; 553 554 var sa = new Array(this.e, this.i, this.r); 555 for (var i = 0; i < 3; i++) { 556 var s = sa[i]; 557 var qs = this.getQsHwhm(s); 558 var f = this.getStarkQuasistaticity(s); 559 560 w += Math.pow(f*qs, 3/2); 561 } 562 563 return Math.pow(w, 2/3); 564 }, 565 566 getZeemanSplitting : function() 567 { 568 return 0.466860*this.B; 298 569 }, 299 570 … … 322 593 323 594 this.B = 0; 595 596 this.n_u = 2; 597 this.n_l = 1; 324 598 325 599 if (this.updatePlasmaParameters() != true) { … … 400 674 gl.add(e, 1, 1); 401 675 e.addEventListener("changeValue", changeT_e, this); 676 e.setLiveUpdate(true); 402 677 403 678 … … 446 721 gl.add(e, 1, 2); 447 722 e.addEventListener("changeValue", changeT_i, this); 723 e.setLiveUpdate(true); 724 this.gui_T_i = e; 448 725 449 726 // N_i … … 501 778 gl.add(e, 1, 2); 502 779 e.addEventListener("changeValue", changeT_r, this); 780 this.gui_T_r = e; 503 781 504 782 // P_r … … 535 813 536 814 fr.add(gl); 537 538 fr.setLeft(330); 539 fr.setTop(202); 815 fr.setTop(268); 816 540 817 541 818 l = new qx.ui.basic.Label("B (T):"); … … 546 823 e.addEventListener("changeValue", changeB, this); 547 824 825 // 826 fr = new qx.ui.groupbox.GroupBox("Atomic system", 827 "pf/image/all_small.png"); 828 fr.setDimension("auto", "auto"); 829 fr.setBackgroundColor("#ffffdd"); 830 831 page_id.add(fr); 832 // fr.addToDocument(); 833 834 gl = new qx.ui.layout.GridLayout; 835 gl.setVerticalSpacing(4); 836 gl.setHorizontalSpacing(6); 837 gl.setColumnCount(2); 838 gl.setColumnWidth(0, 100); 839 gl.setColumnWidth(1, 200); 840 gl.setRowCount(2); 841 gl.setRowHeight(0, 30); 842 gl.setRowHeight(1, 30); 843 844 fr.add(gl); 845 fr.setLeft(330); 846 fr.setTop(202); 847 848 l = new qx.ui.basic.Label("n<sub>u</sub>:"); 849 gl.add(l, 0, 0); 850 e = new qx.ui.form.Spinner(2, this.n_u, 100); 851 gl.add(e, 1, 0); 852 e.addEventListener("change", changeN_u, this); 853 854 l = new qx.ui.basic.Label("n<sub>l</sub>:"); 855 gl.add(l, 0, 1); 856 e = new qx.ui.form.Spinner(1, this.n_l, 100); 857 gl.add(e, 1, 1); 858 e.addEventListener("change", changeN_l, this); 859 548 860 tab_id.setChecked(true); 861 549 862 550 863 var tab_id = new qx.ui.pageview.tabview.Button("Explorer"); … … 613 926 this.gui_folder_none = folder; 614 927 928 folder = new qx.ui.tree.TreeFolder("Energies"); 929 tree.add(folder); 930 this.gui_folder_energy = folder; 931 615 932 folder = new qx.ui.tree.TreeFolder("Miscellaneous"); 616 933 tree.add(folder); … … 621 938 for (var i = 0; i < n; i++) { 622 939 var entity = plasma_entities[i]; 940 var folder; 941 switch (entity.dimension) { 942 case "frequency": 943 folder = this.gui_folder_freq; 944 break; 945 case "length": 946 folder = this.gui_folder_length; 947 break; 948 case "velocity": 949 folder = this.gui_folder_vel; 950 break; 951 case "energy": 952 folder = this.gui_folder_energy; 953 break; 954 case "none": 955 folder = this.gui_folder_none; 956 break; 957 default: 958 folder = this.gui_folder_misc; 959 break; 960 } 623 961 624 for (var j = 0; j < 3; j++) { 625 var s = sa[j]; 626 var icon = "pf/image/" + s.id + "_small.png"; 627 628 var leaf = new qx.ui.tree.TreeFile(entity.name, icon); 962 var leaf; 963 964 switch (entity.nspecies) { 965 case 1: 966 for (var j = 0; j < 3; j++) { 967 var s = sa[j]; 968 var icon = "pf/image/" + s.id + "_small.png"; 969 970 leaf = new qx.ui.tree.TreeFile(entity.name, icon); 971 leaf.addEventListener("click", clickPropertyCB, this); 972 leaf.setUserData("entity", entity); 973 leaf.setUserData("species", s); 974 975 folder.add(leaf); 976 } 977 break; 978 default: 979 leaf = new qx.ui.tree.TreeFile(entity.name, 980 "pf/image/all_small.png"); 629 981 leaf.addEventListener("click", clickPropertyCB, this); 630 982 leaf.setUserData("entity", entity); 631 leaf.setUserData("species", s);632 633 var folder;634 switch (entity.dimension) {635 case "frequency":636 folder = this.gui_folder_freq;637 break;638 case "length":639 folder = this.gui_folder_length;640 break;641 case "velocity":642 folder = this.gui_folder_vel;643 break;644 case "none":645 folder = this.gui_folder_none;646 break;647 default:648 folder = this.gui_folder_misc;649 break;650 }651 983 folder.add(leaf); 984 break; 652 985 } 653 654 986 } 987 tree.setHideNode(true); 988 tree.setRootOpenClose(true); 655 989 656 990 -
source/class/pf/base/Species.js
r2 r3 91 91 }, 92 92 93 getInertialLength: function() 94 { 95 return 3e10/this.getPlasmaFrequency(); 96 }, 97 93 98 getThermalVelocity: function() 94 99 { … … 116 121 }, 117 122 118 getCoupling: function(B) 123 getAlfvenVelocity: function(B) 124 { 125 return 2.18e11*B/Math.sqrt(this._m*this._n); 126 }, 127 128 getCoupling: function() 119 129 { 120 130 if (this._q == 0 || this._n == 0) { … … 128 138 getHoltsmarkField: function() 129 139 { 130 return 3.751e-7*Math. pow(this._q*this._q*this._n, 2/3);140 return 3.751e-7*Math.abs(this._q)*Math.pow(this._n, 2/3); 131 141 } 132 142
Note: See TracChangeset
for help on using the changeset viewer.