Ignore:
Timestamp:
Aug 6, 2007, 1:01:51 PM (17 years ago)
Author:
fnevgeny
Branch:
default
Phase:
public
Message:

More additions.

Location:
source/class/pf
Files:
2 edited

Legend:

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

    r2 r3  
    4040    },
    4141    {
     42        name      : "Full Debye length",
     43        dimension : "length",
     44        nspecies  : 1,
     45        section   : "fundamental",
     46        formula   : "this.getFullDebyeLength(%s1)"
     47    },
     48    {
    4249        name      : "deBroglie length",
    4350        dimension : "length",
     
    6067        formula   : "%s1.getMinApproachDistance()"
    6168    },
     69    {
     70        name      : "Inertial length",
     71        dimension : "length",
     72        nspecies  : 1,
     73        section   : "fundamental",
     74        formula   : "%s1.getInertialLength()"
     75    },
    6276
    6377    {
     
    6882        formula   : "%s1.getThermalVelocity()"
    6983    },
     84    {
     85        name      : "Alfven velocity",
     86        dimension : "velocity",
     87        nspecies  : 1,
     88        section   : "fundamental",
     89        formula   : "%s1.getAlfvenVelocity(this.B)"
     90    },
    7091
    7192    {
     
    86107
    87108    {
     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    {
    88183        name      : "Holtsmark field",
    89184        dimension : "efield",
     
    91186        section   : "spectroscopy",
    92187        formula   : "%s1.getHoltsmarkField()"
     188    },
     189
     190    {
     191        name      : "Microfield frequency",
     192        dimension : "frequency",
     193        nspecies  : 1,
     194        section   : "spectroscopy",
     195        formula   : "this.getMicrofieldFrequency(%s1)"
    93196    }
    94197);
    95198
    96199
     200function 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}
    97208
    98209
     
    133244    if (isFinite(T_e)) {
    134245        this.e.setT(T_e);
     246        this.i.setT(T_e);
     247        this.r.setT(T_e);
    135248        this.updateGUI();
    136249    }
     
    156269    if (isFinite(T_i)) {
    157270        this.i.setT(T_i);
     271        this.r.setT(T_i);
    158272        this.updateGUI();
    159273    }
     
    217331}
    218332
     333function 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
     342function 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
    219351function changeB(ev)
    220352{
     
    231363    var e = ev.getTarget();
    232364    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    }
    236373   
    237374    var v = eval(formula);
     
    254391    members :
    255392    {
    256        
     393        R0 : 1, // 0.3/0.7/1 ?;
     394
    257395        checkPlasmaParameters : function()
    258396        {
     
    296434            this.gui_N_i.setNumValue(this.i.getN());
    297435            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;
    298569        },
    299570       
     
    322593
    323594            this.B   = 0;
     595           
     596            this.n_u = 2;
     597            this.n_l = 1;
    324598           
    325599            if (this.updatePlasmaParameters() != true) {
     
    400674            gl.add(e, 1, 1);
    401675            e.addEventListener("changeValue", changeT_e, this);
     676            e.setLiveUpdate(true);
    402677
    403678
     
    446721            gl.add(e, 1, 2);
    447722            e.addEventListener("changeValue", changeT_i, this);
     723            e.setLiveUpdate(true);
     724            this.gui_T_i = e;
    448725
    449726            // N_i
     
    501778            gl.add(e, 1, 2);
    502779            e.addEventListener("changeValue", changeT_r, this);
     780            this.gui_T_r = e;
    503781
    504782            // P_r
     
    535813
    536814            fr.add(gl);
    537            
    538             fr.setLeft(330);
    539             fr.setTop(202);
     815            fr.setTop(268);
     816
    540817
    541818            l = new qx.ui.basic.Label("B (T):");
     
    546823            e.addEventListener("changeValue", changeB, this);
    547824
     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
    548860            tab_id.setChecked(true);
     861
    549862
    550863            var tab_id = new qx.ui.pageview.tabview.Button("Explorer");
     
    613926            this.gui_folder_none = folder;
    614927
     928            folder = new qx.ui.tree.TreeFolder("Energies");
     929            tree.add(folder);
     930            this.gui_folder_energy = folder;
     931
    615932            folder = new qx.ui.tree.TreeFolder("Miscellaneous");
    616933            tree.add(folder);
     
    621938            for (var i = 0; i < n; i++) {
    622939                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                }
    623961               
    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");
    629981                    leaf.addEventListener("click", clickPropertyCB, this);
    630982                    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                     }
    651983                    folder.add(leaf);
     984                    break;
    652985                }
    653                
    654986            }
     987            tree.setHideNode(true);
     988            tree.setRootOpenClose(true);
    655989
    656990
  • source/class/pf/base/Species.js

    r2 r3  
    9191        },
    9292
     93        getInertialLength: function()
     94        {
     95            return 3e10/this.getPlasmaFrequency();
     96        },
     97
    9398        getThermalVelocity: function()
    9499        {
     
    116121        },
    117122       
    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()
    119129        {
    120130            if (this._q == 0 || this._n == 0) {
     
    128138        getHoltsmarkField: function()
    129139        {
    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);
    131141        }
    132142       
Note: See TracChangeset for help on using the changeset viewer.