Changeset 197:a6bbc4b54fb8


Ignore:
Timestamp:
Feb 2, 2011, 8:04:15 PM (14 years ago)
Author:
fnevgeny
Branch:
default
Phase:
public
Message:

All physics redone using atomic units internally.

Location:
source
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • source/class/pf/Application.js

    r184 r197  
    103103{
    104104    var e = ev.getTarget();
    105     var M_i = parseInt(e.getValue());
     105    var M_i = e.getNumValue();
    106106   
    107107    if (isFinite(M_i)) {
     
    114114{
    115115    var e = ev.getTarget();
    116     var M_r = parseInt(e.getValue());
     116    var M_r = e.getNumValue();
    117117   
    118118    if (isFinite(M_r)) {
     
    423423            this.gui_T_i.setNumValue(this.plasma.i.getT());
    424424            this.gui_Z_i.setValue(this.plasma.i.getQ());
    425             this.gui_M_i.setValue(this.plasma.i.getM());
     425            this.gui_M_i.setNumValue(this.plasma.i.getM());
    426426
    427427            this.gui_P_r.setValue(100*this.plasma.P_r);
     
    431431            this.gui_Z_r.setValue(this.plasma.r.getQ());
    432432            this.gui_Zcore.setValue((this.plasma.r.getQ() + 1) + '');
    433             this.gui_M_r.setValue(this.plasma.r.getM());
     433            this.gui_M_r.setNumValue(this.plasma.r.getM());
    434434           
    435435            this.gui_B.setNumValue(this.plasma.B);
     
    818818            fr.add(gl);
    819819
    820             var l, e;
     820            var l, e, au_fn, au_fT;
     821           
     822            au_fn = pf.base.Bohr.n0;
     823            au_fT = pf.base.Bohr.E0;
    821824
    822825            // N_e
     
    824827            l.setRich(true);
    825828            gl.add(l, {row: 0, column: 0});
    826             e = new pf.ui.TextField(this.plasma.e.getN());
     829            e = new pf.ui.TextField(this.plasma.e.getN(), au_fn);
    827830            gl.add(e, {row: 0, column: 1});
    828831            e.addListener("changeValue", changeN_e, this);
     
    833836            l.setRich(true);
    834837            gl.add(l, {row: 1, column: 0});
    835             e = new pf.ui.TextField(this.plasma.e.getT());
     838            e = new pf.ui.TextField(this.plasma.e.getT(), au_fT);
    836839            gl.add(e, {row: 1, column: 1});
    837840            e.addListener("changeValue", changeT_e, this);
     
    864867            l.setRich(true);
    865868            gl.add(l, {row: 1, column: 0});
    866             e = new qx.ui.form.Spinner(1, this.plasma.i.getM(), 200);
     869            e = new pf.ui.TextField(this.plasma.i.getM(), 1/pf.base.Bohr.m_p);
    867870            gl.add(e, {row: 1, column: 1});
    868871            e.addListener("changeValue", changeM_i, this);
     
    873876            l.setRich(true);
    874877            gl.add(l, {row: 2, column: 0});
    875             e = new pf.ui.TextField(this.plasma.i.getT());
     878            e = new pf.ui.TextField(this.plasma.i.getT(), au_fT);
    876879            gl.add(e, {row: 2, column: 1});
    877880            e.addListener("changeValue", changeT_i, this);
     
    882885            l.setRich(true);
    883886            gl.add(l, {row: 3, column: 0});
    884             e = new pf.ui.TextField(this.plasma.i.getN());
     887            e = new pf.ui.TextField(this.plasma.i.getN(), au_fn);
    885888            gl.add(e, {row: 3, column: 1});
    886889            e.setReadOnly(true);
     
    913916            l.setRich(true);
    914917            gl.add(l, {row: 1, column: 0});
    915             e = new qx.ui.form.Spinner(1, this.plasma.r.getM(), 200);
     918            e = new pf.ui.TextField(this.plasma.r.getM(), 1/pf.base.Bohr.m_p);
    916919            gl.add(e, {row: 1, column: 1});
    917920            e.addListener("changeValue", changeM_r, this);
     
    922925            l.setRich(true);
    923926            gl.add(l, {row: 2, column: 0});
    924             e = new pf.ui.TextField(this.plasma.r.getT());
     927            e = new pf.ui.TextField(this.plasma.r.getT(), au_fT);
    925928            gl.add(e, {row: 2, column: 1});
    926929            e.addListener("changeValue", changeT_r, this);
     
    940943            l.setRich(true);
    941944            gl.add(l, {row: 4, column: 0});
    942             e = new pf.ui.TextField(this.plasma.r.getN());
     945            e = new pf.ui.TextField(this.plasma.r.getN(), au_fn);
    943946            e.setReadOnly(true);
    944947            gl.add(e, {row: 4, column: 1});
     
    963966            l.setRich(true);
    964967            gl.add(l, {row: 0, column: 0});
    965             e = new pf.ui.TextField(this.plasma.B);
     968            e = new pf.ui.TextField(this.plasma.B, pf.base.Bohr.B0);
    966969            gl.add(e, {row: 0, column: 1});
    967970            e.addListener("changeValue", changeB, this);
     
    12641267            var scale = this.gui_compare_units.getSelectedValue();
    12651268
    1266             var par0;
     1269            var par0, au_f;
    12671270            var label;
    12681271            switch (pname) {
    12691272            case "N_e":
    12701273                par0 = this.plasma.e.getN();
     1274                au_f = pf.base.Bohr.n0;
    12711275                label = "N<sub>e</sub> (cm<sup>-3</sup>)"
    12721276                break;
    12731277            case "T":
    12741278                par0 = this.plasma.e.getT();
     1279                au_f = pf.base.Bohr.E0;
    12751280                label = "T (eV)"
    12761281                break;
    12771282            case "T_e":
    12781283                par0 = this.plasma.e.getT();
     1284                au_f = pf.base.Bohr.E0;
    12791285                label = "T<sub>e</sub> (eV)"
    12801286                break;
    12811287            case "T_i":
    12821288                par0 = this.plasma.i.getT();
     1289                au_f = pf.base.Bohr.E0;
    12831290                label = "T<sub>i</sub> (eV)"
    12841291                break;
    12851292            case "T_r":
    12861293                par0 = this.plasma.r.getT();
     1294                au_f = pf.base.Bohr.E0;
    12871295                label = "T<sub>r</sub> (eV)"
    12881296                break;
    12891297            case "T_i,r":
    12901298                par0 = this.plasma.i.getT();
     1299                au_f = pf.base.Bohr.E0;
    12911300                label = "T<sub>i,r</sub> (eV)"
    12921301                break;
    12931302            case "B":
    12941303                par0 = this.plasma.B;
     1304                au_f = pf.base.Bohr.B0;
    12951305                label = "B (T)"
    12961306                break;
     
    12991309            }
    13001310           
     1311            var x_au  = new Array;
    13011312            var xdata = new Array;
    13021313            for (var j = 0; j < npoints; j++) {
    13031314                var x = par0*(vmin + (vmax - vmin)*j/(npoints - 1));
    1304                 xdata.push(x);
     1315                x_au.push(x);
     1316                xdata.push(au_f*x);
    13051317            }
    13061318                       
     
    13241336                var vname = this.getEntityFullName(entity, species);
    13251337
    1326                 var set   = new Array;
     1338                var set   = new Object;
    13271339                var ydata = new Array;
    13281340                for (var j = 0; j < npoints; j++) {
    1329                     var par = xdata[j];
     1341                    var par = x_au[j];
    13301342
    13311343                    switch (pname) {
     
    14381450            // Mark initial value of the varied parameter
    14391451            canvas.setColor("#c0c0c0");
    1440             canvas.drawPolyLineW(new Array(par0, par0),
     1452            canvas.drawPolyLineW(new Array(par0*au_f, par0*au_f),
    14411453                new Array(wymin, wymax));
    14421454           
  • source/class/pf/Plasma.js

    r190 r197  
    1313        B  : 0,
    1414       
    15         getWavenumber: function()
     15        getTransitionEnergy: function()
    1616        {
    1717            var n_u = this.n_u;
     
    5252           
    5353            return Math.pow(Z_core, 4)*
    54                 (pf.base.Bohr.LymanA(n_u) + pf.base.Bohr.LymanA(n_l))/3e10/(2*Math.PI);
     54              (pf.base.Bohr.LymanA(n_u) + pf.base.Bohr.LymanA(n_l));
    5555        },
    5656       
     
    5858        {
    5959            var v   = this.r.getThermalVelocity();
    60             var nu  = this.getWavenumber();
    61            
    62             return Math.sqrt(2*Math.log(2))*nu*v/3e10;
     60            var nu  = this.getTransitionEnergy();
     61           
     62            return Math.sqrt(2*Math.log(2))*nu*v/pf.base.Bohr.c;
    6363        },
    6464       
     
    131131           
    132132            // 1.4385 is S_1 HWHM
    133             var hwhm = 1.4385*4.271417e-5*3/2*(n_u*n_u - n_l*n_l)/Z_core*ef*ppi*rpi;
     133            var hwhm = 1.4385*3/2*(n_u*n_u - n_l*n_l)/Z_core*ef*ppi*rpi;
    134134           
    135135            // rude correction for alpha lines
     
    148148            var rpi = this.getRpiFactor(s);
    149149
    150             var fwhm = this.getMicrofieldFrequency(s)/3e10/(2*Math.PI)*ppi*rpi;
     150            var fwhm = this.getMicrofieldFrequency(s)*ppi*rpi;
    151151           
    152152            return fwhm/2;
     
    191191        getZeemanSplitting: function()
    192192        {
    193             return 0.466860*this.B;
     193            return pf.base.Bohr.mu_B*this.B;
    194194        },
    195195
     
    201201            return 2*Math.sqrt(s_hwhm*s_hwhm + z_hwhm*z_hwhm + d_hwhm*d_hwhm);
    202202        },
    203        
     203
    204204        getBremsstrahlungLosses: function()
    205205        {
    206206            var z_i = this.i.getQ();
    207207            var z_r = this.r.getQ();
    208             return 1.69e-32*this.e.getN()*Math.sqrt(this.e.getT())*
     208            var v_e = this.e.getThermalVelocity();
     209           
     210            return 8*Math.PI/(3*Math.pow(pf.base.Bohr.c, 3))*v_e*this.e.getN()*
    209211                (this.i.getN()*z_i*z_i + this.r.getN()*z_r*z_r);
    210212        },
     
    212214        getBremsstrahlungSpectralDensity: function()
    213215        {
    214             var photon_eV = this.getWavenumber()/8065.5;
    215             return this.getBremsstrahlungLosses()/(8065.5*this.e.getT())*
    216                 Math.exp(-photon_eV/this.e.getT());
     216            var photon_en = this.getTransitionEnergy();
     217            return this.getBremsstrahlungLosses()/this.e.getT()*
     218                Math.exp(-photon_en/this.e.getT());
    217219        },
    218220       
     
    221223            var z_i = this.i.getQ();
    222224            var z_r = this.r.getQ();
    223             return -1.69e-32/8065.5*this.e.getN()/Math.sqrt(this.e.getT())*
     225            var v_e = this.e.getThermalVelocity();
     226
     227            return -8*Math.PI/(3*Math.pow(pf.base.Bohr.c, 3))*v_e*this.e.getN()*
    224228                (this.i.getN()*z_i*z_i*pf.base.Bohr.bindingEnergy(z_i, 1) +
    225                  this.r.getN()*z_r*z_r*pf.base.Bohr.bindingEnergy(z_r, 1));
     229                 this.r.getN()*z_r*z_r*pf.base.Bohr.bindingEnergy(z_r, 1))/
     230                 this.e.getT();
    226231        },
    227232       
    228233        getFreeBoundSpectralDensity: function()
    229234        {
    230             var photon_eV = this.getWavenumber()/8065.5;
    231             return this.getFreeBoundLosses()/(8065.5*this.e.getT())*
    232                 Math.exp(-photon_eV/this.e.getT());
     235            var photon_en = this.getTransitionEnergy();
     236            return this.getFreeBoundLosses()/this.e.getT()*
     237                Math.exp(-photon_en/this.e.getT());
    233238        },
    234239       
     
    236241        {
    237242            var Z_core = this.r.getQ() + 1;
    238             var photon_eV =
    239                 pf.base.Bohr.transitionEnergy(Z_core, 2, 1)/8065.5;
     243            var photon_en =
     244                pf.base.Bohr.transitionEnergy(Z_core, 2, 1);
    240245           
    241246            // FIXME!!
    242             var level_pop = Math.exp(-photon_eV/this.e.getT());
     247            var level_pop = Math.exp(-photon_en/this.e.getT());
    243248           
    244249            return level_pop*Math.pow(Z_core, 4)*pf.base.Bohr.LymanA(2)*
    245                 1.6022e-19*photon_eV*this.r.getN();
     250                photon_en*this.r.getN();
    246251        },
    247252       
     
    255260        getMagneticFieldPressure: function()
    256261        {
    257             return 3.98e6*this.B*this.B;
     262            return this.B*this.B/(8*Math.PI);
    258263        },
    259264       
     
    322327    construct: function()
    323328    {
    324         // Defaults
    325         this.r = new pf.base.Species("r", 1.0,           0, 0,    1.0, null);
    326         this.e = new pf.base.Species("e", (1.0/1836.2), -1, 1e16, 1.0, this.r);
    327         this.i = new pf.base.Species("i", 1.0,          +1, 1e16, 1.0, this.r);
     329        var m_p = pf.base.Bohr.m_p;
     330        var V0  = pf.base.Bohr.V0;
     331        var E0  = pf.base.Bohr.E0;
     332       
     333        // Defaults: 1e16 1/cc, 1 eV
     334        this.r = new pf.base.Species("r", m_p,  0,       0, 1.0/E0, null);
     335        this.e = new pf.base.Species("e", 1.0, -1, 1e16*V0, 1.0/E0, this.r);
     336        this.i = new pf.base.Species("i", m_p, +1, 1e16*V0, 1.0/E0, this.r);
    328337
    329338        this.P_r = 0;
  • source/class/pf/UnitSelector.js

    r146 r197  
    2121
    2222            var selected;
     23            var au_f;
    2324
    2425            switch (dimension) {
    2526            case "frequency":
    26                            this.addNumItem("Rad/s", 2*Math.PI);
    27                 selected = this.addNumItem("Hz",    1.0);
     27                au_f = pf.base.Bohr.f0;
     28                           this.addNumItem("a.u.",  1.0);
     29                           this.addNumItem("Rad/s", 2*Math.PI*au_f);
     30                selected = this.addNumItem("Hz",    1.0*au_f);
    2831                break;
    2932            case "length":
    30                            this.addNumItem("A",  1.0e8);
    31                            this.addNumItem("nm", 1.0e7);
    32                 selected = this.addNumItem("cm", 1.0);
    33                            this.addNumItem("m",  1.0e-2);
     33                au_f = pf.base.Bohr.a0;
     34                           this.addNumItem("a.u.", 1.0);
     35                           this.addNumItem("A",    1.0e8*au_f);
     36                           this.addNumItem("nm",   1.0e7*au_f);
     37                selected = this.addNumItem("cm",   1.0*au_f);
     38                           this.addNumItem("m",    1.0e-2*au_f);
    3439                break;
    3540            case "area":
    36                            this.addNumItem("Barn", 1.0e24);
    37                 selected = this.addNumItem("cm^2", 1.0);
    38                            this.addNumItem("m^2",  1.0e-4);
     41                au_f = Math.pow(pf.base.Bohr.a0, 2);
     42                           this.addNumItem("a.u.", 1.0);
     43                           this.addNumItem("Barn", 1.0e24*au_f);
     44                selected = this.addNumItem("cm^2", 1.0*au_f);
     45                           this.addNumItem("m^2",  1.0e-4*au_f);
    3946                break;
    4047            case "velocity":
    41                 selected = this.addNumItem("cm/s", 1.0);
    42                            this.addNumItem("m/s",  1.0e-2);
    43                            this.addNumItem("v/c",  1.0/3e10);
     48                au_f = pf.base.Bohr.v0;
     49                           this.addNumItem("a.u.", 1.0);
     50                selected = this.addNumItem("cm/s", 1.0*au_f);
     51                           this.addNumItem("m/s",  1.0e-2*au_f);
     52                           this.addNumItem("v/c",  1.0/3e10*au_f);
    4453                break;
    4554            case "energy":
    46                 selected = this.addNumItem("cm^-1", 1.0);
    47                            this.addNumItem("eV",    1.0/8065.5);
    48                            this.addNumItem("erg",   1.9864e-16);
     55                au_f = pf.base.Bohr.E0;
     56                           this.addNumItem("a.u.",  1.0);
     57                selected = this.addNumItem("cm^-1", 8065.5*au_f);
     58                           this.addNumItem("eV",    1.0*au_f);
     59                           this.addNumItem("erg",   1.6022e-12*au_f);
    4960                break;
    5061            case "pressure":
    51                 selected = this.addNumItem("Dyn/cm^2", 1.0);
    52                            this.addNumItem("Pa",       0.1);
    53                            this.addNumItem("Torr",     7.5006e-4);
    54                            this.addNumItem("bar",      1.0e-6);
    55                            this.addNumItem("atm",      9.8692e-7);
     62                au_f = pf.base.Bohr.P0;
     63                           this.addNumItem("a.u.",     1.0);
     64                selected = this.addNumItem("Dyn/cm^2", 1.0*au_f);
     65                           this.addNumItem("Pa",       0.1*au_f);
     66                           this.addNumItem("Torr",     7.5006e-4*au_f);
     67                           this.addNumItem("bar",      1.0e-6*au_f);
     68                           this.addNumItem("atm",      9.8692e-7*au_f);
    5669                break;
    5770            case "power_density":
    58                            this.addNumItem("erg/cm^3/s", 1.0e7);
    59                            this.addNumItem("W/m^3",      1.0e6);
    60                 selected = this.addNumItem("W/cm^3",     1.0);
     71                au_f = pf.base.Bohr.E0/pf.base.Bohr.V0/pf.base.Bohr.t0;
     72                           this.addNumItem("a.u.",       1.0);
     73                           this.addNumItem("erg/cm^3/s", 1.6022e-12*au_f);
     74                           this.addNumItem("W/m^3",      1.6022e-13*au_f);
     75                selected = this.addNumItem("W/cm^3",     1.6022e-19*au_f);
    6176                break;
    6277            case "spectral_power_density":
    63                            this.addNumItem("erg/s/cm^3/eV",    1.0e7*8065.5);
    64                            this.addNumItem("erg/s/cm^3/cm^-1", 1.0e7);
    65                            this.addNumItem("W/cm^3/eV",        8065.5);
    66                 selected = this.addNumItem("W/cm^3/cm^-1",     1.0);
     78                au_f = 1.0/pf.base.Bohr.V0/pf.base.Bohr.t0;
     79                           this.addNumItem("a.u.",             1.0);
     80                           this.addNumItem("erg/s/cm^3/eV",    1.6022e-12*au_f);
     81                           this.addNumItem("W/m^3/eV",         1.6022e-13*au_f);
     82                selected = this.addNumItem("W/cm^3/eV",        1.6022e-19*au_f);
     83                           this.addNumItem("1/s/cm^3",         1.0*au_f);
    6784                break;
    6885            case "efield":
    69                            this.addNumItem("V/m",      1.0e2);
    70                 selected = this.addNumItem("V/cm",     1.0);
    71                            this.addNumItem("StatV/cm", 1.0/300);
    72                            this.addNumItem("MV/cm",    1.0e-6);
     86                au_f = pf.base.Bohr.F0;
     87                           this.addNumItem("a.u.",     1.0);
     88                           this.addNumItem("V/m",      1.0e2*au_f);
     89                selected = this.addNumItem("V/cm",     1.0*au_f);
     90                           this.addNumItem("StatV/cm", 1.0/300*au_f);
     91                           this.addNumItem("MV/cm",    1.0e-6*au_f);
    7392                break;
    7493            case "none":
  • source/class/pf/base/Bohr.js

    r190 r197  
    33    statics :
    44    {
    5         alpha : 7.2974e-3,
     5        // Fine-structure constant
     6        alpha  : 7.297352570e-3,
    67       
    7         /* in cm^-1 */
    8         Rydberg : 1.0974e5,
     8        // alpha^2
     9        alpha2 : 5.325135e-05,
     10       
     11        // Speed of light (1/alpha)
     12        c      : 137.036,
     13       
     14        // Bohr magneton (alpha/2), must be in sync with B0!
     15        mu_B   : 3.64867635e-3,
     16       
     17        // Proton mass
     18        m_p    : 1836.2,
     19       
     20        // Hartree (eV)
     21        E0 : 27.2113845,
     22        // Bohr radius (cm)
     23        a0 : 5.291772108e-9,
     24        // Atomic unit time (s)
     25        t0 : 2.418884327e-17,
     26        // Atomic unit velocity (cm/s)
     27        v0 : 2.1876912633e8,
     28        // Electric field unit (V/cm)
     29        F0 : 5.14220632e9,
     30        // Magnetic field unit (T), must be in sync with mu_B!
     31        B0 : 1.7152553e3,
     32        // Volume unit (a0^3)
     33        V0 : 1.481847e-25,
     34        // Particle density unit (1/V0)
     35        n0 : 6.748334e+24,
     36        // Frequency unit (Hz)
     37        f0 : 4.1341373e16,
     38        // Pressure unit (dyne/cm^2)
     39        P0 : 2.9421912e14,
    940       
    1041        bindingEnergy : function(Z_core, n)
    1142        {
    12             return -this.Rydberg*Z_core*Z_core/(n*n);
     43            return -Z_core*Z_core/(n*n)/2;
    1344        },
    1445
     
    2152        fineStructureCorrection : function(Z_core, n, j)
    2253        {
    23             return -this.Rydberg*Math.pow(Z_core, 4)*(this.alpha*this.alpha)/
    24                 (n*n*n)*(1.0/(j + 0.5) - 3.0/(4*n));
     54            return -Math.pow(Z_core, 4)*(this.alpha*this.alpha)/
     55                (n*n*n)*(1.0/(j + 0.5) - 3.0/(4*n))/2;
    2556        },
    2657       
     
    3768        },
    3869
    39         /* Einstein A coefficient of Lyman series (1/sec) */
     70        /* Einstein A coefficient of Lyman series of H */
    4071        LymanA : function(n)
    4172        {
     
    4374                return 0;
    4475            } else {
    45                 return 8e9*256/9*n*Math.pow((n - 1)/(n + 1), 2*n)/((n*n - 1)*(n*n - 1));
     76                return Math.pow(this.alpha, 3)*
     77                   128/9*n*Math.pow((n - 1)/(n + 1), 2*n)/((n*n - 1)*(n*n - 1));
    4678            }
    4779        }
  • source/class/pf/base/Species.js

    r133 r197  
    8686        getDebyeLength: function()
    8787        {
    88             return 7.43e2/Math.abs(this._q)*Math.sqrt(this._t/this._n);
    89         },
    90 
     88            return Math.sqrt(this._t/(4*Math.PI*this._n))/Math.abs(this._q);
     89        },
     90
     91        getPlasmaFrequencyW: function()
     92        {
     93            return Math.abs(this._q)*Math.sqrt(4*Math.PI*this._n/this._m);
     94        },
    9195        getPlasmaFrequency: function()
    9296        {
    93             return 2.10e2*Math.abs(this._q)*Math.sqrt(this._n/this._m);
     97            return this.getPlasmaFrequencyW()/(2*Math.PI);
    9498        },
    9599
    96100        getInertialLength: function()
    97101        {
    98             return 3e10/this.getPlasmaFrequency();
     102            return pf.base.Bohr.c/this.getPlasmaFrequencyW();
    99103        },
    100104
    101105        getThermalVelocity: function()
    102106        {
    103             return 9.79e5*Math.sqrt(this._t/this._m);
     107            return Math.sqrt(this._t/this._m);
    104108        },
    105109       
    106110        getDeBroglieLength: function()
    107111        {
    108             return 6.44e-10/Math.sqrt(this._m*this._t);
     112            return pf.base.Thermo.thermalDeBroglieLength(this._m, this._t)/
     113                Math.sqrt(2*Math.PI);
    109114        },
    110115       
    111116        getMinApproachDistance: function()
    112117        {
    113             return 1.44e-7*this._q*this._q/this._t;
     118            return this._q*this._q/this._t;
    114119        },
    115120       
     
    119124        },
    120125       
     126        getGyroFrequencyW: function(B)
     127        {
     128            return Math.abs(this._q)*B/this._m/pf.base.Bohr.c;
     129        },
    121130        getGyroFrequency: function(B)
    122131        {
    123             return 1.52e7*Math.abs(this._q)/this._m*B;
     132            return this.getGyroFrequencyW(B)/(2*Math.PI);
    124133        },
    125134       
     
    129138                return 0;
    130139            } else {
    131                 return 2.18e15*B/Math.sqrt(this._m*this._n);
     140                return B/Math.sqrt(4*Math.PI*this._m*this._n);
    132141            }
    133142        },
     
    135144        getGyroRadius: function(B)
    136145        {
    137             return this.getThermalVelocity()/
    138                 (2*Math.PI*this.getGyroFrequency(B));
     146            return this.getThermalVelocity()/this.getGyroFrequencyW(B);
    139147        },
    140148       
     
    151159        getHoltsmarkField: function()
    152160        {
    153             return 3.751e-7*Math.abs(this._q)*Math.pow(this._n, 2/3);
     161            return 2*Math.PI*Math.abs(this._q)*Math.pow(this._n*4/15, 2.0/3.0);
    154162        },
    155163       
    156164        getClassicalRadius: function()
    157165        {
    158             return 1.535e-16*this._q*this._q/this._m;
     166            return pf.base.Bohr.alpha2*this._q*this._q/this._m;
    159167        },
    160168       
     
    172180        getCyclotronLosses: function(B)
    173181        {
    174             var v_T = this.getThermalVelocity();
    175             // 1e-7 is erg -> joule
    176             return 1e-7*4/3*this.getThomsonXsDiff()*B*B*v_T*v_T/3e10*this._n;
     182            var w_c = this.getGyroFrequencyW(B);
     183           
     184            return 4/3*this._q*this._q*w_c*w_c*
     185                this._t/(this._m*Math.pow(pf.base.Bohr.c, 3))*this._n;
    177186        },
    178187       
    179188        getPressure: function()
    180189        {
    181             return 1.602164e-12*this._n*this._t;
     190            return this._n*this._t;
    182191        },
    183192       
     
    185194        {
    186195            var lambda;
     196           
     197            var au_fT = pf.base.Bohr.E0;
     198            var au_fn = pf.base.Bohr.n0;
     199            var au_fm = pf.base.Bohr.m_p;
     200           
    187201            if (this.id == "e" && s2.id == "e") {
    188                 lambda = 24 - Math.log(Math.sqrt(this._n)/this._t)
     202                lambda = 24 - Math.log(Math.sqrt(this._n*au_fn)/(this._t*au_fT))
    189203            } else
    190204            if (this.id != "e" && s2.id != "e") {
    191                 lambda = 23 - Math.log(
     205                lambda = 23 - Math.log(Math.sqrt(au_fn/au_fT)/au_fT*
    192206                    this._q*s2._q*(this._m + s2._m)/(this._m*s2._t + s2._m*this._t)*
    193207                    Math.sqrt(this._n*this._q*this._q/this._t + s2._n*s2._q*s2._q/s2._t));
     
    205219               
    206220                if (se._t < si._q*tmm) {
    207                     lambda = 30 - Math.log(Math.sqrt(si._n)/Math.pow(si._t, 3/2)*
    208                         si._q*si._q/si._m);
     221                    lambda = 30 -
     222                    Math.log(Math.sqrt(si._n*au_fn)/Math.pow(si._t*au_fT, 3/2)*
     223                             si._q*si._q/(si._m/au_fm));
    209224                } else
    210                 if (tmm   < 10*si._q*si._q && se._t > 10*si._q*si._q) {
    211                     lambda = 24 - Math.log(Math.sqrt(se._n)/se._t);
     225                if (tmm   < 10*si._q*si._q/au_fT && se._t > 10*si._q*si._q/au_fT) {
     226                    lambda = 24 -
     227                        Math.log(Math.sqrt(se._n*au_fn)/(se._t*au_fT));
    212228                } else
    213                 if (tmm < se._t && se._t < 10*si._q*si._q) {
     229                if (tmm < se._t && se._t < 10*si._q*si._q/au_fT) {
    214230                    lambda = 23 -
    215                         Math.log(Math.sqrt(se._n)*si._q/Math.pow(se._t, 3/2));
     231                        Math.log(Math.sqrt(se._n*au_fn)*si._q/Math.pow(se._t*au_fT, 3/2));
    216232                } else {
    217233                    // no way???
  • source/class/pf/base/Thermo.js

    r132 r197  
    55        thermalDeBroglieLength: function(m, T)
    66        {
    7             return 1.61e-9/Math.sqrt(m*T);
     7            return Math.sqrt(2*Math.PI/(m*T));
    88        },
    99
     
    1515            } else {
    1616                var Lambda = this.thermalDeBroglieLength(m, T);
    17                 return 8065.5*T*Math.log(n*Math.pow(Lambda, 3));
     17                return T*Math.log(n*Math.pow(Lambda, 3));
    1818            }
    1919        },
     
    2222        fermiEnergy : function(n_e)
    2323        {
    24             return 2.94128e-11*Math.pow(n_e, 2/3);
     24            return 0.5*Math.pow(3*Math.PI*Math.PI*n_e, 2.0/3.0);
    2525        },
    2626       
     
    6363
    6464            if (E_F > 0.0) {
    65                 return E_F*this.reducedMuFD(8065.5*T/E_F);
     65                return E_F*this.reducedMuFD(T/E_F);
    6666            } else {
    6767                return 0.0;
  • source/entities.js

    r192 r197  
    125125        nspecies  : 0,
    126126        section   : "spectroscopy",
    127         formula   : "this.plasma.getWavenumber()"
     127        formula   : "this.plasma.getTransitionEnergy()"
    128128    },
    129129    {
     
    195195        nspecies  : 1,
    196196        section   : "spectroscopy",
    197         formula   : "this.plasma.getMicrofieldFrequency(%s1)/3e10/(2*Math.PI)"
     197        formula   : "this.plasma.getMicrofieldFrequency(%s1)"
    198198    },
    199199
     
    258258        nspecies  : 0,
    259259        section   : "spectroscopy",
    260         formula   : "1/this.plasma.getWavenumber()"
     260        formula   : "pf.base.Bohr.c/this.plasma.getTransitionEnergy()*(2*Math.PI)"
    261261    },
    262262
     
    267267        nspecies  : 0,
    268268        section   : "spectroscopy",
    269         formula   : "3e10*this.plasma.getWavenumber()"
     269        formula   : "this.plasma.getTransitionEnergy()/(2*Math.PI)"
    270270    },
    271271
Note: See TracChangeset for help on using the changeset viewer.