@@ -15,67 +15,86 @@ namespace user {
1515
1616 template <Dimension D>
1717 struct InitFields {
18- InitFields (real_t b0, real_t angle, real_t Omega, real_t d0, real_t rho0)
18+ InitFields (real_t b0, real_t angle, real_t Omega, real_t d0, real_t rho0, real_t r, real_t bp )
1919 : b0 { b0 }
2020 , angle { angle }
2121 , Omega { Omega }
2222 , skindepth0 { d0 }
23- , larmor0 { rho0 } {}
23+ , larmor0 { rho0 }
24+ , R { r }
25+ , bp { bp } {}
2426
2527 Inline auto bx1 (const coord_t <D>& x_Ph) const -> real_t {
2628 return b0 * math::cos (angle);
2729 }
2830
2931 Inline auto bx2 (const coord_t <D>& x_Ph) const -> real_t {
32+ return bp;
33+ }
34+
35+ Inline auto bx3 (const coord_t <D>& x_Ph) const -> real_t {
3036 return b0 * math::sin (angle);
3137 }
3238
3339 Inline auto ex1 (const coord_t <D>& x_Ph) const -> real_t {
34- return Omega * b0 * (math::sin (angle) * R + TWO * SQR (skindepth0) * x_Ph[0 ] / larmor0);
40+ return Omega * b0 * (-math::sin (angle) * R + TWO * SQR (skindepth0) * x_Ph[0 ] / larmor0);
41+ }
42+
43+ Inline auto ex3 (const coord_t <D>& x_Ph) const -> real_t {
44+ return -Omega * bx1 (x_Ph) * R;
3545 }
3646
3747 private:
38- const real_t b0, angle, R, Omega, skindepth0, larmor0;
48+ const real_t b0, angle, R, Omega, skindepth0, larmor0, bp ;
3949 };
4050
4151 template <Dimension D>
4252 struct MFields {
43- MFields (real_t b0, real_t angle) : b0 { b0 }, angle { angle } {}
53+ MFields (real_t b0, real_t angle, real_t omega, real_t r, real_t bp)
54+ : b0 { b0 }
55+ , angle { angle }
56+ , Omega { omega }
57+ , R { r }
58+ , bp { bp } {}
4459
4560 Inline auto bx1 (const coord_t <D>& x_Ph) const -> real_t {
4661 return b0 * math::cos (angle);
4762 }
4863
4964 Inline auto bx2 (const coord_t <D>& x_Ph) const -> real_t {
65+ return bp;
66+ }
67+
68+ Inline auto bx3 (const coord_t <D>& x_Ph) const -> real_t {
5069 return b0 * math::sin (angle);
5170 }
5271
72+ Inline auto ex3 (const coord_t <D>& x_Ph) const -> real_t {
73+ return -Omega * bx1 (x_Ph) * R;
74+ }
75+
5376
5477 private:
55- const real_t b0, angle;
78+ const real_t b0, angle, Omega, R, bp ;
5679 };
5780
5881 template <Dimension D>
5982 struct DriveFields : public InitFields <D> {
60- DriveFields (real_t time, real_t b0, real_t angle, real_t omega, real_t r)
61- : InitFields<D> { b0, angle}
83+ DriveFields (real_t time, real_t b0, real_t angle, real_t omega, real_t r, real_t d0, real_t rho0, real_t bp )
84+ : InitFields<D> { b0, angle, omega, d0, rho0, r, bp }
6285 , time { time }
6386 , Omega { omega }
6487 , R { r }{}
6588
6689 using InitFields<D>::bx1;
67- using InitFields<D>::bx2;
68-
69- Inline auto bx3 (const coord_t <D>&) const -> real_t {
70- return ZERO;
71- }
90+ using InitFields<D>::bx3;
7291
7392 Inline auto ex1 (const coord_t <D>& x_Ph) const -> real_t {
74- return Omega * bx2 (x_Ph) * R;
93+ return - Omega * bx3 (x_Ph) * R;
7594 }
7695
7796 Inline auto ex2 (const coord_t <D>& x_Ph) const -> real_t {
78- return - Omega * bx1 (x_Ph) * R;
97+ return Omega * bx1 (x_Ph) * R;
7998 }
8099
81100 Inline auto ex3 (const coord_t <D>&) const -> real_t {
@@ -100,7 +119,7 @@ namespace user {
100119 using arch::ProblemGenerator<S, M>::C;
101120 using arch::ProblemGenerator<S, M>::params;
102121
103- const real_t B0, angle, R, Omega, skindepth0, larmor0;
122+ const real_t B0, angle, R, Omega, skindepth0, larmor0, bp ;
104123 InitFields<D> init_flds;
105124
106125 inline PGen (const SimulationParams& p, const Metadomain<S, M>& m)
@@ -112,16 +131,17 @@ namespace user {
112131 , angle { p.template get <real_t >(" setup.angle" , ZERO) }
113132 , skindepth0 { p.template get <real_t >(" scales.skindepth0" ) }
114133 , larmor0 { p.template get <real_t >(" scales.larmor0" ) }
115- , init_flds { B0, angle} {}
134+ , bp { p.template get <real_t >(" setup.Bp" ) }
135+ , init_flds { B0, angle, Omega, skindepth0, larmor0, R, bp } {}
116136
117137 inline PGen () {}
118138
119139 auto AtmFields (real_t time) const -> DriveFields<D> {
120- return DriveFields<D> { time, B0, angle, Omega, R, skindepth0, larmor0 };
140+ return DriveFields<D> { time, B0, angle, Omega, R, skindepth0, larmor0, bp };
121141 }
122142
123143 auto MatchFields (real_t ) const -> MFields<D> {
124- return MFields<D> { B0, angle };
144+ return MFields<D> { B0, angle, Omega, R, bp };
125145 }
126146 };
127147
0 commit comments