From f418ee4d2757364d2b666aad26bac94548f30f83 Mon Sep 17 00:00:00 2001 From: Remi Lehe Date: Mon, 27 Jan 2020 12:11:44 -0800 Subject: Implement cylindrical Yee algorithm --- .../FieldSolver/FiniteDifferenceSolver/EvolveB.cpp | 33 ++++++++++++++-------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp') diff --git a/Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp b/Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp index a1f35f903..c08dee04f 100644 --- a/Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp +++ b/Source/FieldSolver/FiniteDifferenceSolver/EvolveB.cpp @@ -110,10 +110,9 @@ void FiniteDifferenceSolver::EvolveBCylindrical ( VectorField& Bfield, auto const& Ez = Efield[2]->array(mfi); // Extract stencil coefficients - Real const* AMREX_RESTRICT coefs_x = stencil_coefs_x.dataPtr(); - int const n_coefs_x = stencil_coefs_x.size(); - Real const* AMREX_RESTRICT coefs_y = stencil_coefs_y.dataPtr(); - int const n_coefs_y = stencil_coefs_y.size(); + Real const dr = m_dr; + Real const* AMREX_RESTRICT coefs_r = stencil_coefs_r.dataPtr(); + int const n_coefs_r = stencil_coefs_r.size(); Real const* AMREX_RESTRICT coefs_z = stencil_coefs_z.dataPtr(); int const n_coefs_z = stencil_coefs_z.size(); @@ -126,12 +125,13 @@ void FiniteDifferenceSolver::EvolveBCylindrical ( VectorField& Bfield, amrex::ParallelFor(tbr, tbt, tbz, [=] AMREX_GPU_DEVICE (int i, int j, int k){ - Br(i, j, 0, 0) += dt * T_Algo::UpwardDz(Et, inv_dz, i, j, 0, 0); // Mode m = 0; + Real const r = rmin + i*dr; // r on nodal point (Br is nodal in r) + Br(i, j, 0, 0) += dt * T_Algo::UpwardDz(Et, coefs_z, n_coefs_z, i, j, 0, 0); // Mode m=0 for (int m=1; m