#ifndef WARPX_FINITE_DIFFERENCE_ALGORITHM_CYLINDRICAL_YEE_H_ #define WARPX_FINITE_DIFFERENCE_ALGORITHM_CYLINDRICAL_YEE_H_ #include #include #include struct CylindricalYeeAlgorithm { static void InitializeStencilCoefficients( std::array& cell_size, amrex::Gpu::ManagedVector& stencil_coefs_r, amrex::Gpu::ManagedVector& stencil_coefs_z ) { // Store the inverse cell size along each direction in the coefficients stencil_coefs_r.resize(1); stencil_coefs_r[0] = 1./cell_size[0]; // 1./dr stencil_coefs_z.resize(1); stencil_coefs_z[0] = 1./cell_size[2]; // 1./dz } /** Applies the differential operator `1/r * d(rF)/dr`, * where `F` is on a *nodal* grid in `r` * and the differential operator is evaluated on *cell-centered* grid. * The input parameter `r` is given at the cell-centered position */ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE static amrex::Real UpwardDrr_over_r( amrex::Array4 const& F, amrex::Real const r, amrex::Real const dr, amrex::Real const* coefs_r, int const n_coefs_r, int const i, int const j, int const k, int const comp ) { amrex::Real inv_dr = coefs_r[0]; return 1./r * inv_dr*( (r+0.5*dr)*F(i+1,j,k,comp) - (r-0.5*dr)*F(i,j,k,comp) ); }; /** /* Perform derivative along r on a cell-centered grid, from a nodal field `F`*/ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE static amrex::Real UpwardDr( amrex::Array4 const& F, amrex::Real const* coefs_r, int const n_coefs_r, int const i, int const j, int const k, int const comp ) { amrex::Real inv_dr = coefs_r[0]; return inv_dr*( F(i+1,j,k,comp) - F(i,j,k,comp) ); }; /** /* Perform derivative along r on a nodal grid, from a cell-centered field `F`*/ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE static amrex::Real DownwardDr( amrex::Array4 const& F, amrex::Real const* coefs_r, int const n_coefs_r, int const i, int const j, int const k, int const comp ) { amrex::Real inv_dr = coefs_r[0]; return inv_dr*( F(i,j,k,comp) - F(i-1,j,k,comp) ); }; /** /* Perform derivative along z on a cell-centered grid, from a nodal field `F`*/ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE static amrex::Real UpwardDz( amrex::Array4 const& F, amrex::Real const* coefs_z, int const n_coefs_z, int const i, int const j, int const k, int const comp ) { amrex::Real inv_dz = coefs_z[0]; return inv_dz*( F(i,j+1,k,comp) - F(i,j,k,comp) ); }; /** /* Perform derivative along z on a nodal grid, from a cell-centered field `F`*/ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE static amrex::Real DownwardDz( amrex::Array4 const& F, amrex::Real const* coefs_z, int const n_coefs_z, int const i, int const j, int const k, int const comp ) { amrex::Real inv_dz = coefs_z[0]; return inv_dz*( F(i,j,k,comp) - F(i,j-1,k,comp) ); }; /** Divide by the radius `r` and avoid potential singularities */ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE static amrex::Real DivideByR( amrex::Array4 const& F, amrex::Real const r, amrex::Real const dr, int const m, int const i, int const j, int const k, int const comp) { if (r != 0) { return F(i,j,k,comp)/r; } else { // r==0 ; singularity when dividing by r if (m==1) { // For m==1, F is linear in r, for small r // Therefore, the formula below regularizes the singularity return F(i+1,j,k,comp)/dr; } else { return 0; } } }; }; #endif // WARPX_FINITE_DIFFERENCE_ALGORITHM_CYLINDRICAL_YEE_H_ lue='examples/framework-solid'>examples/framework-solid Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Expand)AuthorFilesLines
2023-11-27Remove support for simple objects in endpoints (#9181)Gravatar Bjorn Lu 56-529/+206
2023-11-28Remove shiki lang path property support (#9196)Gravatar Bjorn Lu 7-427/+22
2023-11-28Remove deprecated features from Astro 3.0 (#9168)Gravatar Bjorn Lu 47-398/+95
2023-11-28Remove deprecated markdown-remark APIs (#9182)Gravatar Bjorn Lu 4-59/+7
2023-11-27[ci] release (#9180)astro@3.6.1Gravatar Houston (Bot) 32-65/+63
2023-11-24Remove vercel deprecated analytics option (#9184)Gravatar Bjorn Lu 3-30/+12
2023-11-24[ci] formatGravatar Guspan Tanadi 1-2/+1
2023-11-24style: highlight markdown Tip Note section CONTRIBUTING (#9123)Gravatar Guspan Tanadi 1-5/+7
2023-11-23fix scroll restoration issue on webKit browsers (#9186)Gravatar Martin Trapp 2-1/+7
2023-11-23fix(middleware): rename internal middleware id (#9173)Gravatar Arsh 2-1/+6
2023-11-23fix: Changelog formatting for 3.6.0 View Transition events (#9176)Gravatar Martin Trapp 1-3/+3
2023-11-22[ci] formatGravatar Eva Decker 1-3/+3
2023-11-22Fix View Transitions code block formatting (#9174)Gravatar Eva Decker 1-3/+3
2023-11-22Rename entryPoint to entrypoint (#9161)Gravatar Bjorn Lu 14-26/+38
2023-11-22Fix esbuild warning for local dev (#9160)Gravatar Bjorn Lu 1-1/+1
2023-11-22[ci] release (#9165)astro@3.6.0Gravatar Houston (Bot) 34-90/+83