forked from ligq/MatlabES1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlasmaSetup.m
79 lines (61 loc) · 1.91 KB
/
PlasmaSetup.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
function species = PlasmaSetup(p,L)
% This function is a repository of various standard plasmas/initial
% conditions, making it easy to set up a plasma in project/problem scripts.
switch p
case 1 % Equal # ions and electrons, even distribution, alternating offset electrons, no initial velocities, immobile ions
N=4;
offset=L/N/4;
altdx=zeros(1,N);
for i=1:N
altdx(i)=(-1)^(i)*offset;
end
% Ions
ion=Species(N,L);
ion.move_yn='n';
% Electrons
electron=Species(N,L);
electron.qm=-1;
electron.x0=electron.x0+altdx;
species=[ion electron];
case 2 % Electrons, even distribution with same offset, no initial velocities
N=4;
offset=L/N/4;
% Electrons
electron=Species(N,L);
electron.qm=-1;
electron.x0=electron.x0+offset;
species=electron;
case 3 % Electrons, even distribution with alternating offset, no initial velocities
N=4;
offset=L/N/4;
altdx=zeros(1,N);
for i=1:N
altdx(i)=(-1)^(i)*offset;
end
% Electrons
electron=Species(N,L);
electron.qm=-1;
electron.x0=electron.x0+altdx;
species=electron;
case 4 % Alternating offset electrons, no initial velocities, large number of immobile neutralizing ions
fac=100;
Ne=4;
Ni=fac*Ne;
offset=L/Ne/4;
altdx=zeros(1,Ne);
for i=1:Ne
altdx(i)=(-1)^(i)*offset;
end
% Ions
ion=Species(Ni,L);
ion.N=Ni;
ion.qm=1/fac;
ion.move_yn='n';
% Electrons
electron=Species(Ne,L);
electron.qm=-1;
electron.x0=electron.x0+altdx;
species=[ion electron];
case 5 %
end
end