-
Notifications
You must be signed in to change notification settings - Fork 1
/
simplebounce.h
115 lines (102 loc) · 2.91 KB
/
simplebounce.h
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#ifndef SIMPLEBOUNCE_H
#define SIMPLEBOUNCE_H
namespace simplebounce{
double integral(const double* integrand, const double dr, const int n);
////////////////////////////////////////////////////////////////////////////////
class Scalarfield{
private:
int n_, nphi_, dim_;
double rmax_, dr_, drinv_;
double *phi_, *rinv_, *r_dminusoneth_;
public:
Scalarfield(const int nphi_, const int n_, const int rmax_, const int dim_);
~Scalarfield();
double phi(const int i, const int iphi) const;
void setPhi(const int i, const int iphi, const double phi_);
void addToPhi(const int i, const int iphi, const double phi_);
double* phivec(const int i) const;
double r(const int i) const;
double lap(const int i, const int iphi) const;
void updateInfo();
void setRmax(const double rmax_);
void setDimension(const int dim_);
void setN(const int n_);
void setNphi(const int nphi_);
int n() const;
int nphi() const;
int dim() const;
double rmax() const;
double dr() const;
double r_dminusoneth(const int i) const;
};
////////////////////////////////////////////////////////////////////////////////
class GenericModel{
private:
int nphi_;
public:
void setNphi(const int nphi__);
int nphi() const;
virtual double vpot(const double* phi) const {
std::cerr << "!!! vpot is not overrode !!!" << std::endl;
return 0.;
}
virtual void calcDvdphi(const double* phi, double* dvdphi) const {
std::cerr << "!!! calcDvdphi is not overrode !!!" << std::endl;
}
};
////////////////////////////////////////////////////////////////////////////////
class BounceCalculator : public Scalarfield {
private:
double lambda;
double* phiTV;
double* phiFV;
GenericModel* model;
bool setModelDone;
bool setVacuumDone;
double VFV;
bool verbose;
// parameters for numerical calculation
double safetyfactor;
double maximumvariation;
double xTV0;
double width0;
double derivMax;
double tend0;
double tend1;
int maxN;
public:
BounceCalculator();
~BounceCalculator();
void setModel(GenericModel* const);
double t() const;
double v() const;
double evolve(const double ds);
double residual(const int i, const int iphi) const;
double residualBounce(const int i, const int iphi) const;
double tBounce() const;
double vBounce() const;
double action() const;
double oneIfBounce() const;
double rBounce(const int i) const;
int setVacuum(const double *phiTV_, const double *phiFV_);
void setInitial(const double frac, const double width);
double fieldExcursion() const;
double derivativeAtBoundary() const;
int evolveUntil(const double tend);
int solve();
double getlambda() const;
int printBounce() const;
int printBounceDetails() const;
void setSafetyfactor(double x);
void setMaximumvariation(double x);
void setXTV0(double x);
void setWidth0(double x);
void setDerivMax(double x);
void setTend0(double x);
void setTend1(double x);
void setMaxN(int x);
void verboseOn();
void verboseOff();
};
}
#endif /* SIMPLEBOUNCE_H */