-
Notifications
You must be signed in to change notification settings - Fork 1
/
cross_section.cxx
83 lines (73 loc) · 2.06 KB
/
cross_section.cxx
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
80
81
82
83
#include "cross_section.hxx"
#include <boutexception.hxx>
#include <globals.hxx>
// Here should be the crosssections();
CrossSection::CrossSection(RadiatedPower *atom) : atom(atom) { ; }
Field3D CrossSection::ionisation_rate(const Field3D &T_e) {
Field3D result;
result.allocate();
#pragma omp parallel
for (auto i = T_e.begin(); !i.done(); ++i) {
const BoutReal Te = T_e[i];
result[i] = atom->ionisation(Te);
}
return result;
}
// BoutReal CrossSection::ionisation_rate(const BoutReal T_e) {
// return atom.ionisation(T_e);
// }
Field3D CrossSection::recombination_rate(const Field3D &n, const Field3D &T_e) {
Field3D result;
result.allocate();
for (auto i : result) {
result[i] = atom->recombination(n[i], T_e[i]);
}
return result;
}
Field3D CrossSection::power(const Field3D &T, const Field3D &n, const Field3D &imp) {
Field3D result;
result.allocate();
for (auto i : result) {
result[i] = atom->power(T[i], n[i], imp[i]);
}
return result;
}
// // TODO: only compute for actual domain
// Field3D CrossSection::recombination_rate(const Field3D &n, const BoutReal T_e) {
// Field3D result;
// // result.allocate();
// for (auto i: result){
// result[i]= atom.recombination(n[i],T_e);
// }
// //#endif*/
// return result;
// }
/*
Field3D CrossSection::recombination_rate(const BoutReal n, const Field3D & T_e){
Field3D result;
result.allocate();
for(int i=0;i<mesh->LocalNx;i++)
for(int j=0;j<mesh->LocalNy;j++)
for(int k=0;k<mesh->LocalNz;k++){
BoutReal Te=T_e(i,j,k);
result(i,j,k) = atom.recombination(n,Te);
}
return result;
}
BoutReal CrossSection::recombination_rate(const BoutReal n, const BoutReal T_e){
return atom.recombination(n,T_e);
}
*/
Field3D CrossSection::cx_rate(const Field3D &T_e) {
Field3D result;
result.allocate();
for (auto i : T_e) {
result[i] = atom->chargeExchange(T_e[i]);
}
//#endif
return result;
}
// BoutReal CrossSection::cx_rate(const BoutReal T_e) {
// // std::cerr << atom.chargeExchange(T_e)<<"\t";
// return atom.chargeExchange(T_e);
// }