source: source/class/pf/Plasma.js @ 319:73a3a3dfbe19

Last change on this file since 319:73a3a3dfbe19 was 317:fdca02c23ded, checked in by Evgeny Stambulchik <Evgeny.Stambulchik@…>, 12 years ago

Added LTE density according to Griem's 3rd book, Eq (7.75).

File size: 11.4 KB
Line 
1qx.Class.define("pf.Plasma",
2{
3    extend: qx.core.Object,
4   
5    members:
6    {
7        R0: 0.5, // 0.3/0.7/1 ?
8       
9        e: null,
10        i: null,
11        r: null,
12        P_r: 0,
13        B  : 0,
14       
15        getMicrofieldFrequency: function(s)
16        {
17            var r = s.getTypicalDistance();
18            var v_r = this.r.getThermalVelocity();
19            var v_s = s.getThermalVelocity();
20            var v = Math.sqrt(v_r*v_r + v_s*v_s);
21           
22            return v/r;
23        },
24       
25        getFullDebyeLength: function(s)
26        {
27            var tmp = 0;
28            var m = s.getM();
29           
30            var sa = new Array(this.e, this.i, this.r);
31            for (var i = 0; i < 3; i++) {
32                var os = sa[i];
33                if (os.getM() <= m) {
34                    var ld = os.getDebyeLength();
35                    if (ld) {
36                        tmp += 1/(ld*ld);
37                    }
38                }
39               
40            }
41           
42            return 1/Math.sqrt(tmp);
43        },
44       
45        getPpiFactor: function(s)
46        {
47            var dl = this.getFullDebyeLength(s);
48            var r1 = s.getTypicalDistance();
49            var r;
50            if (isFinite(dl) && isFinite(r1)) {
51                r = r1/dl;
52            } else {
53                r = 0;
54            }
55           
56            return (1 + r)*Math.exp(-r);
57            // return 1 - 0.6*r
58        },
59       
60        getRpiFactor: function(s)
61        {
62            var r1 = s.getTypicalDistance();
63            var q_r = this.r.getQ();
64            var q_s = s.getQ();
65            if (q_r == 0 || q_s == 0) {
66                return 1;
67            }
68             
69            var r_m = s.getMinApproachDistance()*q_r/q_s;
70            return Math.exp(-r_m/r1);
71        },
72       
73        getDelta0: function(s)
74        {
75            var n_u = this.r.getN_u();
76            var n_l = this.r.getN_l();
77            var Z_core = this.r.getZcore();
78            var ef = s.getHoltsmarkField();
79           
80            return 3/2*(n_u*n_u - n_l*n_l)/Z_core*ef;
81        },
82       
83        getQsHwhm: function(s)
84        {
85            var n_u = this.r.getN_u();
86            var n_l = this.r.getN_l();
87
88            var ppi = this.getPpiFactor(s);
89            var rpi = this.getRpiFactor(s);
90           
91            // 1.4385 is S_1 HWHM
92            var hwhm = 1.4385*this.getDelta0(s)*ppi*rpi;
93           
94            // rude correction for alpha lines
95            if (n_u - n_l == 1) {
96                hwhm /= 2;
97            }
98           
99            return hwhm;
100        },
101       
102        getDynHwhm: function(s)
103        {
104            // neglect dynamic PP effects
105            var ppi = 1.0;
106            // assume dynamic RP effect == static one
107            var rpi = this.getRpiFactor(s);
108
109            var fwhm = this.getMicrofieldFrequency(s)*ppi*rpi;
110           
111            return fwhm/2;
112        },
113       
114        getStarkRatio: function(s)
115        {
116            var R;
117            var w_qs = this.getQsHwhm(s);
118            if (w_qs == 0) {
119                R = 0;
120            } else {
121                var w_dyn = this.getDynHwhm(s);
122                R = w_qs/w_dyn;
123            }
124           
125            return R;
126        },
127       
128        getStarkQuasistaticity: function(s)
129        {
130            var R = this.getStarkRatio(s);
131            return R/(R + this.R0);
132        },
133       
134        getStarkHwhm: function()
135        {
136            var w = 0;
137           
138            var sa = new Array(this.e, this.i, this.r);
139            for (var i = 0; i < 3; i++) {
140                var s = sa[i];
141                var qs = this.getQsHwhm(s);
142                var f  = this.getStarkQuasistaticity(s);
143
144                w += Math.pow(f*qs, 3/2);
145            }
146           
147            return Math.pow(w, 2/3);
148        },
149       
150        getZeemanSplitting: function()
151        {
152            return pf.base.Bohr.mu_B*this.B;
153        },
154
155        getTotalFwhm: function()
156        {
157            var s_hwhm = this.getStarkHwhm();
158            var z_hwhm = this.getZeemanSplitting();
159            var d_hwhm = this.r.getDopplerHwhm();
160            return 2*Math.sqrt(s_hwhm*s_hwhm + z_hwhm*z_hwhm + d_hwhm*d_hwhm);
161        },
162
163        getBremsstrahlungLosses: function()
164        {
165            var z_i = this.i.getQ();
166            var z_r = this.r.getQ();
167            var v_e = this.e.getThermalVelocity();
168           
169            return 8*Math.PI*pf.base.Bohr.alpha3/3*v_e*this.e.getN()*
170                (this.i.getN()*z_i*z_i + this.r.getN()*z_r*z_r);
171        },
172       
173        getBremsstrahlungSpectralDensity: function()
174        {
175            var photon_en = this.r.getTransitionEnergy();
176            return this.getBremsstrahlungLosses()/this.e.getT()*
177                Math.exp(-photon_en/this.e.getT());
178        },
179       
180        getFreeBoundLosses: function()
181        {
182            var T_e = this.e.getT();
183            var v_e = this.e.getThermalVelocity();
184            var N_e = this.e.getN();
185
186            var sum = 0;
187           
188            var sa = [this.i, this.r];
189            for (var i = 0; i < sa.length; i++) {
190                var s = sa[i];
191                var N_s = s.getN();
192                if (!N_s) {
193                    continue;
194                }
195               
196                var z_s = s.getQ();
197                var m_s = s.getM();
198               
199                var Eb = -pf.base.Bohr.bindingEnergy(z_s, m_s, 1);
200               
201                sum += N_s*z_s*z_s*(Eb/T_e);
202            }
203           
204            return 8*Math.PI*pf.base.Bohr.alpha3/3*N_e*v_e*sum;
205        },
206       
207        getFreeBoundSpectralDensity: function()
208        {
209            var photon_en = this.r.getTransitionEnergy();
210            var T_e = this.e.getT();
211            var v_e = this.e.getThermalVelocity();
212            var N_e = this.e.getN();
213           
214            var sum = 0;
215           
216            var sa = [this.i, this.r];
217            for (var i = 0; i < sa.length; i++) {
218                var s = sa[i];
219                var N_s = s.getN();
220                if (!N_s) {
221                    continue;
222                }
223               
224                var z_s = s.getQ();
225                var m_s = s.getM();
226               
227                var Eb = -pf.base.Bohr.bindingEnergy(z_s, m_s, 1);
228               
229                if (photon_en < Eb) {
230                    continue;
231                }
232               
233                sum += N_s*z_s*z_s*(Eb/T_e)*Math.exp(-(photon_en - Eb)/T_e);
234            }
235
236            return 8*Math.PI*pf.base.Bohr.alpha3/3*N_e/v_e*sum;
237        },
238       
239        getPressure: function()
240        {
241            return this.e.getPressure() +
242                   this.i.getPressure() +
243                   this.r.getPressure();
244        },
245       
246        getMagneticFieldPressure: function()
247        {
248            return this.B*this.B/(8*Math.PI);
249        },
250       
251        getBeta: function()
252        {
253            return this.getPressure()/this.getMagneticFieldPressure();
254        },
255       
256        getFermiEnergy: function()
257        {
258            return pf.base.Thermo.fermiEnergy(this.e.getN());
259        },
260       
261        getFermiVelocity: function()
262        {
263            return Math.sqrt(2*this.getFermiEnergy());
264        },
265       
266        getFermiLength: function()
267        {
268            var n_e = this.e.getN();
269            var E_F = this.getFermiEnergy();
270            return Math.sqrt(E_F/(6*Math.PI*n_e));
271        },
272       
273        getAlfvenVelocity: function()
274        {
275            var v_m1;
276           
277            v_m1 = 1/this.e.getAlfvenVelocity(this.B) +
278                   1/this.i.getAlfvenVelocity(this.B);
279       
280            if (this.r.getQ() != 0) {
281                v_m1 += 1/this.r.getAlfvenVelocity(this.B);
282            }
283           
284            return 1/v_m1;
285        },
286
287        getCoulombLog: function(s1, s2)
288        {
289            var lambda;
290           
291            var m1 = s1.getM();
292            var m2 = s2.getM();
293            var v1 = s1.getThermalVelocity();
294            var v2 = s2.getThermalVelocity();
295            var q1 = s1.getQ();
296            var q2 = s2.getQ();
297           
298            // kinetic energy in the CoM frame
299            var Kp = 3*m1*m2/(2*(m1 + m2))*(v1 + v2)*(v1 + v2);
300           
301            var b_min = Math.abs(q1*q1/Kp);
302            var b_max = this.getFullDebyeLength(s1) +
303                        this.getFullDebyeLength(s2);
304           
305            lambda = Math.log(b_max/b_min);
306            if (lambda < 1.0) {
307                lambda = 1.0;
308            }
309           
310            return lambda;
311        },
312
313        getRelaxationRate: function(s1, s2)
314        {
315            var m1 = s1.getM();
316            var m2 = s2.getM();
317            var v1 = s1.getThermalVelocity();
318            var v2 = s2.getThermalVelocity();
319            var q1 = s1.getQ();
320            var q2 = s2.getQ();
321           
322            var n2 = s2.getN();
323           
324            var lambda = this.getCoulombLog(s1, s2);
325           
326            // LL X (42,5) with the missing factor of 3
327            return Math.sqrt(128*Math.PI)/3*q1*q1*q2*q2*n2*lambda/
328                   (Math.pow(v1*v1 + v2*v2, 3/2)*m1*m2);
329        },
330
331        getDreicerField: function()
332        {
333            var n_e = this.e.getN();
334            var T_e = this.e.getT();
335            var lambda = this.getCoulombLog(this.e, this.e);
336           
337            return 4*Math.PI*lambda*n_e/T_e;
338        },
339       
340        getMassDensity: function()
341        {
342            return this.e.getMassDensity() +
343                   this.i.getMassDensity() +
344                   this.r.getMassDensity();
345        },
346       
347        // griem:1997a, Eq (7.75)
348        getLteNe: function()
349        {
350            var Z_core = this.r.getZcore();
351            var E12 = 3.0/8.0*Z_core*Z_core;
352            return 5/Math.sqrt(Math.PI)*pf.base.Bohr.alpha3*
353                Math.pow(E12, 3)*Math.sqrt(2*this.e.getT());
354        },
355       
356        dE2dWl: function(dE)
357        {
358            var E = this.r.getTransitionEnergy();
359            return (2*Math.PI)*pf.base.Bohr.c*dE/(E*E);
360        },
361
362        checkParameters: function()
363        {
364            if ((this.P_r < 0.0 || this.P_r > 1.0) ||
365                this.i.getQ() < 1 ||
366                this.P_r == 1.0 && this.r.getQ() == 0) {
367                return false;
368            } else {
369                return true;
370            }
371        },
372
373        updateParameters: function()
374        {
375            // Safety measures
376            if (this.checkParameters() != true) {
377                return false;
378            }
379           
380            var N_e = this.e.getN();
381            var N_i, N_r;
382           
383            if (this.P_r < 1.0) {
384                N_i = N_e*(1.0 - this.P_r)/
385                    (this.i.getQ()*(1.0 - this.P_r) + this.r.getQ()*this.P_r);
386               
387                N_r = N_i*this.P_r/(1.0 - this.P_r);
388            } else {
389                N_i = 0.0;
390                N_r = N_e/this.r.getQ();
391            }
392           
393            this.i.setN(N_i);
394            this.r.setN(N_r);
395           
396            return true;
397        }
398    },
399   
400    construct: function()
401    {
402        var m_p = pf.base.Bohr.m_p;
403        var V0  = pf.base.Bohr.V0;
404        var E0  = pf.base.Bohr.E0;
405       
406        // Defaults: 1e16 1/cc, 1 eV
407        this.e = new pf.base.Species ("e", 1.0, -1, 1e16*V0, 1.0/E0);
408        this.i = new pf.base.Species ("i", m_p, +1, 1e16*V0, 1.0/E0);
409        this.r = new pf.base.Radiator("r", m_p,  0,       0, 1.0/E0);
410
411        this.P_r = 0;
412
413        this.B   = 0;
414    }
415});
Note: See TracBrowser for help on using the repository browser.