source: source/class/pf/base/Species.js @ 60:ec9a209e1f04

Last change on this file since 60:ec9a209e1f04 was 60:ec9a209e1f04, checked in by fnevgeny, 17 years ago

Added getPressure() - ideal gas approximation.

File size: 4.4 KB
Line 
1qx.Class.define("pf.base.Species",
2{
3    extend : qx.core.Object,
4   
5    members: {
6        id : "",
7        _m : 0.0,
8        _q : 0,
9        _n : 0.0,
10        _t : 0.0,
11       
12        _reference : null,
13       
14        _m_reduced : 0.0,
15       
16        _update: function()
17        {
18            var reference = this._reference;
19            if (reference) {
20                this._m_reduced = reference._m*this._m/(reference._m + this._m);
21            }
22        },
23       
24        setM: function(m)
25        {
26            if (m > 0.0) {
27                this._m = m;
28                this._update();
29                return true;
30            } else {
31                return false;
32            }
33        },
34       
35        setQ: function(q)
36        {
37            this._q = q;
38            this._update();
39        },
40       
41        setN: function(n)
42        {
43            if (n >= 0.0) {
44                this._n = n;
45                this._update();
46                return true;
47            } else {
48                return false;
49            }
50        },
51       
52        setT: function(t)
53        {
54            if (t > 0.0) {
55                this._t = t;
56                this._update();
57                return true;
58            } else {
59                return false;
60            }
61        },
62
63        getN: function()
64        {
65            return this._n;
66        },
67       
68        getQ: function()
69        {
70            return this._q;
71        },
72       
73        getT: function()
74        {
75            return this._t;
76        },
77       
78        getM: function()
79        {
80            return this._m;
81        },
82       
83        getDebyeLength: function()
84        {
85            return 7.43e2/Math.abs(this._q)*Math.sqrt(this._t/this._n);
86        },
87
88        getPlasmaFrequency: function()
89        {
90            return 2.10e2*Math.abs(this._q)*Math.sqrt(this._n/this._m);
91        },
92
93        getInertialLength: function()
94        {
95            return 3e10/this.getPlasmaFrequency();
96        },
97
98        getThermalVelocity: function()
99        {
100            return 9.79e5*Math.sqrt(this._t/this._m);
101        },
102       
103        getDeBroglieLength: function()
104        {
105            return 6.44e-10/Math.sqrt(this._m*this._t);
106        },
107       
108        getMinApproachDistance: function()
109        {
110            return 1.44e-7*this._q*this._q/this._t;
111        },
112       
113        getMeanDistance: function()
114        {
115            return Math.pow(4*Math.PI/3*this._n, -1/3);
116        },
117       
118        getGyroFrequency: function(B)
119        {
120            return 1.52e7*Math.abs(this._q)/this._m*B;
121        },
122       
123        getAlfvenVelocity: function(B)
124        {
125            if (B == 0) {
126                return 0;
127            } else {
128                return 2.18e15*B/Math.sqrt(this._m*this._n);
129            }
130        },
131       
132        getGyroRadius: function(B)
133        {
134            return this.getThermalVelocity()/
135                (2*Math.PI*this.getGyroFrequency(B));
136        },
137       
138        getCoupling: function()
139        {
140            if (this._q == 0 || this._n == 0) {
141                return 0;
142            } else {
143                var r = this.getMeanDistance()/this.getDebyeLength();
144                return 1/3*r*r;
145            }
146        },
147       
148        getHoltsmarkField: function()
149        {
150            return 3.751e-7*Math.abs(this._q)*Math.pow(this._n, 2/3);
151        },
152       
153        getClassicalRadius: function()
154        {
155            return 1.535e-16*this._q*this._q/this._m;
156        },
157       
158        getThomsonXsDiff: function()
159        {
160            var r0 = this.getClassicalRadius();
161            return r0*r0;
162        },
163       
164        getThomsonXsTotal: function()
165        {
166            return 8*Math.PI/3*this.getThomsonXsDiff();
167        },
168       
169        getCyclotronLosses: function(B)
170        {
171            var v_T = this.getThermalVelocity();
172            // 1e-7 is erg -> joule
173            return 1e-7*4/3*this.getThomsonXsDiff()*B*B*v_T*v_T/3e10*this._n;
174        },
175       
176        getPressure: function()
177        {
178            return 1.602164e-12*this._n*this._t;
179        }
180    },
181   
182    construct: function(id, m, q, n, t, reference)
183    {
184        if (m <= 0.0 || n < 0.0 || t <= 0.0) {
185            return null;
186        }
187         
188        this.id = id;
189        this._m  = m;
190        this._q  = q;
191        this._n  = n;
192        this._t  = t;
193       
194        this._reference = reference;
195       
196        this._update();
197    }
198   
199});
Note: See TracBrowser for help on using the repository browser.