@@ -164,17 +164,22 @@ void mytest_set_fluxeb (
164164 amrex::Real theta = std::atan2 (x,y) + 0.5 *pi;
165165 amrex::Real r2 = x*x+y*y;
166166
167- // Compute grad phi Cartesian components
167+ // Derivation of grad phi Cartesian components:
168+ // th = atan2(y,x) is the polar angle
168169 // theta = atan2(x,y) + pi/2
169170 // = pi/2 - atan2(y,x) + pi/2
170171 // = pi - th
171172 // phi = r^4 cos(3 theta)
172173 // = r^4 cos(3*(pi - th))
173- // grad phi = 4 r^3 cos(3 theta) rhat + 3 r^3 sin(3 theta) thhat
174- // rhat = (x/r) xhat + (y/r) yhat
175- // thhat = (-y/r) xhat + (x/r) yhat
176- amrex::Real gradphi_x = r2 * (x * 4.0 * std::cos (3 .*theta) - y * 3.0 * std::sin (3 .*theta));
177- amrex::Real gradphi_y = r2 * (y * 4.0 * std::cos (3 .*theta) + x * 3.0 * std::sin (3 .*theta));
174+ // grad phi = rhat(+4 r^3 cos(3 theta)) + thhat(+3 r^3 sin(3 theta))
175+ // rhat = (+x/r) xhat + (+y/r) yhat
176+ // thhat = (-y/r) xhat + (+x/r) yhat
177+ // grad_x phi = (+x/r)(+4 r^3 cos(3 theta)) + (-y/r)(+3 r^3 sin(3 theta))
178+ // grad_y phi = (-y/r)(+4 r^3 cos(3 theta)) + (+x/r)(+3 r^3 sin(3 theta))
179+ amrex::Real gradphi_r_over_r = 4.0 * r2 * std::cos (3 .*theta);
180+ amrex::Real gradphi_t_over_r = 3.0 * r2 * std::sin (3 .*theta);
181+ amrex::Real gradphi_x = x * gradphi_r_over_r - y * gradphi_t_over_r;
182+ amrex::Real gradphi_y = y * gradphi_r_over_r + x * gradphi_t_over_r;
178183
179184 amrex::Real bx = 1.0 ;
180185 amrex::Real by = 1.0 ;
@@ -191,6 +196,10 @@ void mytest_set_fluxeb (
191196 }
192197}
193198
199+ AMREX_GPU_DEVICE AMREX_FORCE_INLINE
200+ void compute_bnorm (int i, int j, int k, )
201+
202+
194203AMREX_GPU_DEVICE AMREX_FORCE_INLINE
195204void mytest_set_phi_boundary (int i, int j, int k, amrex::Array4<amrex::Real> const & phi,
196205 amrex::GpuArray<amrex::Real, AMREX_SPACEDIM > const & dx,
0 commit comments