/* Copyright 2020 * * This file is part of WarpX. * * License: BSD-3-Clause-LBNL */ #include "FiniteDifferenceSolver.H" #ifndef WARPX_DIM_RZ # include "FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CartesianYeeAlgorithm.H" # include "FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CartesianCKCAlgorithm.H" # include "FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CartesianNodalAlgorithm.H" #else # include "FieldSolver/FiniteDifferenceSolver/FiniteDifferenceAlgorithms/CylindricalYeeAlgorithm.H" #endif #include "Utils/TextMsg.H" #include "Utils/WarpXAlgorithmSelection.H" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace amrex; void FiniteDifferenceSolver::EvolveG ( std::unique_ptr& Gfield, std::array,3> const& Bfield, amrex::Real const dt) { #ifdef WARPX_DIM_RZ // TODO Implement G update equation in RZ geometry amrex::ignore_unused(Gfield, Bfield, dt); #else // Select algorithm if (m_do_nodal) { EvolveGCartesian(Gfield, Bfield, dt); } else if (m_fdtd_algo == ElectromagneticSolverAlgo::Yee) { EvolveGCartesian(Gfield, Bfield, dt); } else if (m_fdtd_algo == ElectromagneticSolverAlgo::CKC) { EvolveGCartesian(Gfield, Bfield, dt); } else { amrex::Abort(Utils::TextMsg::Err("EvolveG: unknown FDTD algorithm")); } #endif } #ifndef WARPX_DIM_RZ template void FiniteDifferenceSolver::EvolveGCartesian ( std::unique_ptr& Gfield, std::array,3> const& Bfield, amrex::Real const dt) { amrex::Real constexpr c2 = PhysConst::c * PhysConst::c; #ifdef AMREX_USE_OMP #pragma omp parallel if (amrex::Gpu::notInLaunchRegion()) #endif // Loop over grids and over tiles within each grid for (amrex::MFIter mfi(*Gfield, TilingIfNotGPU()); mfi.isValid(); ++mfi) { // Extract field data for this grid/tile amrex::Array4 const& G = Gfield->array(mfi); amrex::Array4 const& Bx = Bfield[0]->array(mfi); amrex::Array4 const& By = Bfield[1]->array(mfi); amrex::Array4 const& Bz = Bfield[2]->array(mfi); // Extract stencil coefficients amrex::Real const* const AMREX_RESTRICT coefs_x = m_stencil_coefs_x.dataPtr(); amrex::Real const* const AMREX_RESTRICT coefs_y = m_stencil_coefs_y.dataPtr(); amrex::Real const* const AMREX_RESTRICT coefs_z = m_stencil_coefs_z.dataPtr(); const int n_coefs_x = m_stencil_coefs_x.size(); const int n_coefs_y = m_stencil_coefs_y.size(); const int n_coefs_z = m_stencil_coefs_z.size(); // Extract tilebox to loop over amrex::Box const& tf = mfi.tilebox(Gfield->ixType().toIntVect()); // Loop over cells and update G amrex::ParallelFor(tf, [=] AMREX_GPU_DEVICE (int i, int j, int k) { G(i,j,k) += c2 * dt * (T_Algo::UpwardDx(Bx, coefs_x, n_coefs_x, i, j, k) + T_Algo::UpwardDy(By, coefs_y, n_coefs_y, i, j, k) + T_Algo::UpwardDz(Bz, coefs_z, n_coefs_z, i, j, k)); }); } } #endif led-after-rejection'>dylan/callback-fulfilled-after-rejection Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
path: root/src (unfollow)
AgeCommit message (Expand)AuthorFilesLines
2022-03-24clang-formatGravatar Jarred Sumner 7-278/+363
2022-03-24Update response.zigGravatar Jarred Sumner 1-6/+6
2022-03-24[bun.js] Enable SharedArrayBuffer and expose internal LoaderGravatar Jarred Sumner 1-7/+16
2022-03-23handle bodies of 0 length betterGravatar Jarred Sumner 6-42/+86
2022-03-23Update server.zigGravatar Jarred Sumner 1-1/+2
2022-03-23Implement Request body support!Gravatar Jarred Sumner 3-30/+132
2022-03-23Support `Request.headers` and `Request.url` in http serverGravatar Jarred Sumner 5-30/+134
2022-03-23Update MakefileGravatar Jarred Sumner 1-1/+1
2022-03-23:scissors: testGravatar Jarred Sumner 1-14/+2
2022-03-23[bun.js] Bun.write for macOSGravatar Jarred Sumner 14-76/+232
2022-03-23[bun.js] Implement Bun.write()Gravatar Jarred SUmner 11-63/+959
2022-03-22Handle integer sizes greater than i32Gravatar Jarred SUmner 14-74/+142
2022-03-22Linux-specific tweaksGravatar Jarred SUmner 6-43/+52
2022-03-22`Response.file` -> `Bun.file`Gravatar Jarred Sumner 3-72/+65
2022-03-21sendfile worksGravatar Jarred Sumner 7-62/+174
2022-03-21[bun.js] 2/? Implement `Response.file`, sendfile editionGravatar Jarred Sumner 8-161/+506
2022-03-21[bun.js] 1/? Implement `Response.file`Gravatar Jarred Sumner 13-103/+1103