Debian Codegraph @

School05/Thursday/monopole_functions.C

raw
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 double rlim = mp.val_r (0,1,0,0) ;
10
11 big_W.allocate_all() ;
12 //for (int i=0 ; i<nz-1 ; i++)
13 big_W.set_domain(0) = (1-0.5*radius*radius/rlim/rlim).domain(0) ;
14 for (int i=1 ; i<nz ; i++) big_W.set_domain(i) = (0.5*exp(-(radius-rlim)/rlim)).domain(i) ;
15
16 big_W.std_spectral_base() ;
17 }
18
19 void Monopole::init_big_H() {
20 cout << "Monopole::init_big_H is not implemented" << endl ;
21 }
22
23 void Monopole::do_small_w () {
24 small_w = big_W ;
25
26 Scalar auxi ((big_W-1)/radius) ;
27 auxi.set_inner_boundary(0,0) ;
28 small_w.set_domain(0) = auxi.domain(0) ;
29
30 // Basis :
31 small_w.std_spectral_base_odd() ;
32 }
33
34 void Monopole::do_big_W () {
35 cout << "Monopole::do_big_W is not implemented" << endl ;
36 }
37
38 void Monopole::do_small_h() {
39 cout << "Monopole::do_small_h is not implemented" << endl ;
40 }
41
42 void Monopole::do_big_H() {
43 cout << "Monopole::do_big_H is not implemented" << endl ;
44 }
45
46 Scalar Monopole::compute_source_W() const {
47 cout << "Monopole::compute_source_w is not implemented" << endl ;
48 return Scalar(mp) ; /// To avoid compilation error
49 }
50
51 Scalar Monopole::compute_source_H() const {
52
53 Scalar source (mp) ;
54 source.allocate_all() ;
55
56 // near r = 0 ;
57 Scalar source_noyau (mp) ;
58 source_noyau = 2*big_H*
59 (small_w*small_w+2*small_w/radius) + beta*beta/2.*big_H*(big_H*big_H-1) ;
60 source_noyau.set_inner_boundary(0,0) ;
61 source.set_domain(0) = source_noyau.domain(0) ;
62
63 // CED :
64 Scalar source_zec (mp) ;
65 source_zec = 2*big_W*big_W*(small_h+1) ;
66 source_zec.set_dzpuis(2) ;
67 Scalar auxi (mp) ;
68 auxi = beta*beta/2.*small_h*small_h*(3.+small_h) ;
69 auxi.std_spectral_base() ;
70 auxi.inc_dzpuis(2) ;
71 source_zec += auxi ;
72 source.set_domain(nz-1) = source_zec.domain(nz-1) ;
73 source.set_dzpuis(source_zec.get_dzpuis()) ;
74
75 // Coquilles :
76 Scalar source_H (mp) ;
77 source_H = 2*big_W*big_W*big_H/radius/radius + beta*beta/2.*big_H*(big_H*big_H-3) ;
78 for (int i=1 ; i<nz-1 ; i++)
79 source.set_domain(i) = source_H.domain(i) ;
80
81 source.std_spectral_base_odd() ;
82 return source ;
83 }
84
85 double Monopole::give_a() const {
86 cout << "Monopole::give_a is not implemented" << endl ;
87 return 1 ; // To avoid compilation errors
88 }
89
90 double Monopole::give_b() const {
91 cout << "Monopole::give_b is not implemented" << endl ;
92 return 1 ; /// To avoid compilatin error
93 }
94