| 1 |
#include <math.h> |
| 2 |
|
| 3 |
#include "scalar.h" |
| 4 |
#include "monopole.h" |
| 5 |
#include "proto.h" |
| 6 |
#include "graphique.h" |
| 7 |
|
| 8 |
void Monopole::init_big_W() { |
| 9 |
|
| 10 |
double rlim = mp.val_r (0,1,0,0) ; |
| 11 |
|
| 12 |
// Polynomial near r=0 |
| 13 |
Scalar auxi_un (mp) ; |
| 14 |
auxi_un = 1-0.5*radius*radius/rlim/rlim ; |
| 15 |
auxi_un.annule (1, nz-1) ; |
| 16 |
|
| 17 |
// Exponential at infinity : |
| 18 |
Scalar auxi_deux (mp) ; |
| 19 |
auxi_deux = 0.5*exp(-(radius-rlim)/rlim) ; |
| 20 |
auxi_deux.set_outer_boundary(nz-1,0) ; |
| 21 |
auxi_deux.annule_domain(0) ; |
| 22 |
|
| 23 |
big_W = auxi_un+auxi_deux ; |
| 24 |
big_W.std_spectral_base() ; |
| 25 |
} |
| 26 |
|
| 27 |
void Monopole::init_big_H() { |
| 28 |
|
| 29 |
double rlim = mp.val_r (0,1,0,0) ; |
| 30 |
Scalar auxi_un (radius/rlim) ; |
| 31 |
auxi_un.annule(1,nz-1) ; |
| 32 |
|
| 33 |
Scalar auxi_deux (mp) ; |
| 34 |
auxi_deux = 1 ; |
| 35 |
auxi_deux.annule_domain(0) ; |
| 36 |
|
| 37 |
big_H = auxi_un + auxi_deux ; |
| 38 |
big_H.std_spectral_base_odd() ; |
| 39 |
} |
| 40 |
|
| 41 |
void Monopole::do_small_w () { |
| 42 |
|
| 43 |
Scalar auxi_un (mp) ; |
| 44 |
auxi_un = (big_W-1)/radius ; |
| 45 |
// Put zero at the origin |
| 46 |
auxi_un.set_inner_boundary(0,0) ; |
| 47 |
auxi_un.annule(1, nz-1) ; |
| 48 |
|
| 49 |
Scalar auxi_deux (big_W) ; |
| 50 |
auxi_deux.annule_domain(0) ; |
| 51 |
small_w = auxi_un+auxi_deux ; |
| 52 |
|
| 53 |
// Basis : |
| 54 |
small_w.std_spectral_base_odd() ; |
| 55 |
} |
| 56 |
|
| 57 |
void Monopole::do_big_W () { |
| 58 |
|
| 59 |
Scalar auxi_un (mp) ; |
| 60 |
auxi_un = small_w*radius ; |
| 61 |
// Put zero at origin |
| 62 |
auxi_un.set_inner_boundary(0,0) ; |
| 63 |
auxi_un = auxi_un+1 ; |
| 64 |
auxi_un.annule(1, nz-1) ; |
| 65 |
|
| 66 |
Scalar auxi_deux (small_w) ; |
| 67 |
auxi_deux.annule_domain(0) ; |
| 68 |
|
| 69 |
big_W = auxi_un+auxi_deux ; |
| 70 |
|
| 71 |
// Basis : |
| 72 |
big_W.std_spectral_base() ; |
| 73 |
} |
| 74 |
|
| 75 |
void Monopole::do_small_h() { |
| 76 |
Scalar auxi (big_H-1) ; |
| 77 |
auxi.annule(0, nz-2) ; |
| 78 |
|
| 79 |
small_h = big_H ; |
| 80 |
small_h.annule_domain(nz-1) ; |
| 81 |
small_h += auxi ; |
| 82 |
small_h.std_spectral_base_odd() ; |
| 83 |
} |
| 84 |
|
| 85 |
void Monopole::do_big_H() { |
| 86 |
Scalar auxi (small_h+1) ; |
| 87 |
auxi.annule(0, nz-2) ; |
| 88 |
|
| 89 |
big_H = small_h; |
| 90 |
big_H.annule_domain(nz-1) ; |
| 91 |
big_H += auxi ; |
| 92 |
big_H.std_spectral_base_odd() ; |
| 93 |
} |
| 94 |
|
| 95 |
Scalar Monopole::compute_source_W() const { |
| 96 |
|
| 97 |
// Near r = 0 |
| 98 |
Scalar source_w (mp) ; |
| 99 |
source_w = small_w*small_w*small_w + 3*small_w*small_w/radius + |
| 100 |
(1+radius*small_w)*big_H*big_H/radius ; |
| 101 |
source_w.set_inner_boundary(0,0) ; |
| 102 |
source_w.annule(1, nz-1) ; |
| 103 |
|
| 104 |
// Near infinity |
| 105 |
Scalar source_zec (mp) ; |
| 106 |
source_zec = big_W*small_h*(small_h+2) ; |
| 107 |
source_zec.std_spectral_base() ; |
| 108 |
source_zec.inc_dzpuis(2) ; |
| 109 |
Scalar auxi(big_W*(big_W*big_W-1)) ; |
| 110 |
auxi.set_dzpuis(2) ; |
| 111 |
source_zec += auxi ; |
| 112 |
source_zec += 2*big_W.dsdr()/radius ; |
| 113 |
source_zec.set_outer_boundary(nz-1, 0) ; |
| 114 |
source_zec.annule(0, nz-2) ; |
| 115 |
|
| 116 |
// In the shells : |
| 117 |
Scalar source_W (mp) ; |
| 118 |
source_W = big_W*((big_W*big_W-1)/radius/radius + |
| 119 |
big_H*big_H-1.) ; |
| 120 |
source_W.annule_domain(nz-1) ; |
| 121 |
source_W += 2*big_W.dsdr()/radius ; |
| 122 |
source_W.annule_domain(nz-1) ; |
| 123 |
source_W.annule_domain(0) ; |
| 124 |
source_W.std_spectral_base() ; |
| 125 |
|
| 126 |
Scalar source (source_W+source_w+source_zec) ; |
| 127 |
source.set_spectral_base(small_w.get_spectral_va().base) ; |
| 128 |
|
| 129 |
return source ; |
| 130 |
} |
| 131 |
|
| 132 |
Scalar Monopole::compute_source_H() const { |
| 133 |
|
| 134 |
// near r = 0 ; |
| 135 |
Scalar source_noyau (mp) ; |
| 136 |
source_noyau = 2*big_H* |
| 137 |
(small_w*small_w+2*small_w/radius) + beta*beta/2.*big_H*(big_H*big_H-1) ; |
| 138 |
source_noyau.annule(1,nz-1) ; |
| 139 |
source_noyau.set_inner_boundary(0,0) ; |
| 140 |
|
| 141 |
// ZEC : |
| 142 |
Scalar source_zec (mp) ; |
| 143 |
source_zec = 2*big_W*big_W*(small_h+1) ; |
| 144 |
source_zec.set_dzpuis(2) ; |
| 145 |
Scalar auxi (mp) ; |
| 146 |
auxi = beta*beta/2.*small_h*small_h*(3.+small_h) ; |
| 147 |
auxi.std_spectral_base() ; |
| 148 |
auxi.inc_dzpuis(2) ; |
| 149 |
source_zec += auxi ; |
| 150 |
source_zec.std_spectral_base() ; |
| 151 |
source_zec.annule(0, nz-2) ; |
| 152 |
|
| 153 |
// Coquilles : |
| 154 |
Scalar source_H (mp) ; |
| 155 |
source_H = 2*big_W*big_W*big_H/radius/radius + beta*beta/2.*big_H*(big_H*big_H-3) ; |
| 156 |
source_H.annule_domain(0) ; |
| 157 |
source_H.annule_domain(nz-1) ; |
| 158 |
|
| 159 |
Scalar source (source_noyau+source_zec+source_H) ; |
| 160 |
source.set_spectral_base(big_H.get_spectral_va().base) ; |
| 161 |
return source ; |
| 162 |
} |
| 163 |
|
| 164 |
double Monopole::give_a() const { |
| 165 |
double res = big_H.dsdr().val_grid_point(0,0,0,0) ; |
| 166 |
return res ; |
| 167 |
} |
| 168 |
|
| 169 |
double Monopole::give_b() const { |
| 170 |
Scalar auxi (big_W.dsdr()) ; |
| 171 |
auxi.dec_dzpuis(2) ; |
| 172 |
double res = auxi.dsdr().val_grid_point(0,0,0,0)/2. ; |
| 173 |
return -res ; |
| 174 |
} |