-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexpon_field_decay.cpp
59 lines (40 loc) · 1.74 KB
/
expon_field_decay.cpp
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
#include <cmath>
#include "stars.h"
using namespace std;
double MFDExpon::get_B (double t, double B, double i_incl, double P) {
double res, A_1 = 0.65, A_2 = 0.35;
// t = t - tau;
res = B*(exp(-t/tau_ohm));
return res;
}
double MFDExpon::get_incl (double t, double B, double i_incl, double P) {
return i_incl;
}
double MFDExpon::get_P(double t, double B, double i_incl, double P) {
//double res, I, t_tmp, A_1 = 0.85766, A_2 = 0.14234;
double res, I, t_tmp, A_1 = 0.65, A_2 = 0.35;
res = sqrt(P*P + 1.6e-39 * B*B * 3.156e7 * tau_ohm * (1.0 - exp(-2.0 * t / tau_ohm)));
// I = 1e45;
// res = sqrt(P*P+16.*pi*pi*pow(1e6,6)*B*B*A_1*A_1/3./pow(light_velocity, 3)/I*(3.156e7*tau_ohm/2.*(1-exp(-2.*t/tau_ohm))+2*3.156e7*tau_ohm*A_2/A_1*(1-exp(-t/tau_ohm)) + 3.156e7*pow(A_2/A_1, 2)*t));
return res;
}
double MFDExpon::get_dot_P (double t, double B, double i_incl, double P) {
double res, I;
I = 1e45;
res = 1.6e-39 * pow(get_B(t, B, i_incl, P), 2.)/get_P(t, B, i_incl, P);
return res;
}
MFDExpon::MFDExpon (vector <double> * values) {
tau_ohm = values->at(1);
}
void MFDExpon::print_description (ostream * out) {
*out<<"#//This model is the sum of exponential and constant value //"<<endl;
*out<<"#//Magnetic field decay law is smooth. //"<<endl;
*out<<"#//----------------------------------------------------------//"<<endl;
}
void MFDExpon::print_parameters (ostream * out) {
*out<<"#// Parameters of magnetic field decay //"<<endl;
*out<<"#//----------------------------------------------------------//"<<endl;
*out<<"#// tau_ohm - "<<tau_ohm<<endl;
*out<<"#//----------------------------------------------------------//"<<endl;
}