WarpX
Loading...
Searching...
No Matches
IntegratedGreenFunctionSolver.H
Go to the documentation of this file.
1/* Copyright 2019-2024 Arianna Formenti, Remi Lehe
2 *
3 * This file is part of ABLASTR.
4 *
5 * License: BSD-3-Clause-LBNL
6 */
7#ifndef ABLASTR_IGF_SOLVER_H
8#define ABLASTR_IGF_SOLVER_H
9
10#include <ablastr/constant.H>
11
12#include <AMReX_BoxArray.H>
13#include <AMReX_GpuQualifiers.H>
14#include <AMReX_MultiFab.H>
15#include <AMReX_REAL.H>
16#include <AMReX_Vector.H>
17
18#include <array>
19#include <cmath>
20
21
22namespace ablastr::fields
23{
24 using namespace amrex::literals;
25
26
37 amrex::Real
38 IntegratedPotential3D (amrex::Real x, amrex::Real y, amrex::Real z)
39 {
40 amrex::Real const r = std::sqrt( x*x + y*y + z*z );
41 amrex::Real const G = - 0.5_rt * z*z * std::atan( x*y/(z*r) )
42 - 0.5_rt * y*y * std::atan( x*z/(y*r) )
43 - 0.5_rt * x*x * std::atan( y*z/(x*r) )
44 + y*z*std::asinh( x/std::sqrt(y*y + z*z) )
45 + x*z*std::asinh( y/std::sqrt(x*x + z*z) )
46 + x*y*std::asinh( z/std::sqrt(x*x + y*y) );
47 return G;
48 }
49
50
59 amrex::Real
60 IntegratedPotential2D (amrex::Real x, amrex::Real y)
61 {
62 amrex::Real const G = 3_rt*x*y
63 - x*x * std::atan(y/x)
64 - y*y * std::atan(x/y)
65 - x*y * std::log(x*x + y*y);
66 return G;
67 }
68
69
82 amrex::Real
83 SumOfIntegratedPotential3D (amrex::Real x, amrex::Real y, amrex::Real z, amrex::Real dx, amrex::Real dy, amrex::Real dz)
84 {
86 IntegratedPotential3D( x+0.5_rt*dx, y+0.5_rt*dy, z+0.5_rt*dz )
87 - IntegratedPotential3D( x-0.5_rt*dx, y+0.5_rt*dy, z+0.5_rt*dz )
88 - IntegratedPotential3D( x+0.5_rt*dx, y-0.5_rt*dy, z+0.5_rt*dz )
89 + IntegratedPotential3D( x-0.5_rt*dx, y-0.5_rt*dy, z+0.5_rt*dz )
90 - IntegratedPotential3D( x+0.5_rt*dx, y+0.5_rt*dy, z-0.5_rt*dz )
91 + IntegratedPotential3D( x-0.5_rt*dx, y+0.5_rt*dy, z-0.5_rt*dz )
92 + IntegratedPotential3D( x+0.5_rt*dx, y-0.5_rt*dy, z-0.5_rt*dz )
93 - IntegratedPotential3D( x-0.5_rt*dx, y-0.5_rt*dy, z-0.5_rt*dz )
94 );
95 }
96
97
108 amrex::Real
109 SumOfIntegratedPotential2D (amrex::Real x, amrex::Real y, amrex::Real dx, amrex::Real dy)
110 {
112 IntegratedPotential2D( x+0.5_rt*dx, y+0.5_rt*dy )
113 - IntegratedPotential2D( x+0.5_rt*dx, y-0.5_rt*dy )
114 - IntegratedPotential2D( x-0.5_rt*dx, y+0.5_rt*dy )
115 + IntegratedPotential2D( x-0.5_rt*dx, y-0.5_rt*dy )
116 );
117 }
118
119
128 void
129 computePhiIGF (amrex::MultiFab const & rho,
130 amrex::MultiFab & phi,
131 std::array<amrex::Real, 3> const & cell_size,
132 bool is_igf_2d_slices);
133
134} // namespace ablastr::fields
135
136#endif // ABLASTR_IGF_SOLVER_H
#define AMREX_FORCE_INLINE
#define AMREX_GPU_HOST_DEVICE
constexpr auto epsilon_0
vacuum permittivity: dielectric permittivity of vacuum [F/m]
Definition constant.H:152
constexpr auto pi
ratio of a circle's circumference to its diameter
Definition constant.H:29
Definition EffectivePotentialPoissonSolver.H:63
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real SumOfIntegratedPotential3D(amrex::Real x, amrex::Real y, amrex::Real z, amrex::Real dx, amrex::Real dy, amrex::Real dz)
add
Definition IntegratedGreenFunctionSolver.H:83
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real IntegratedPotential2D(amrex::Real x, amrex::Real y)
Implements equation 58 in https://doi.org/10.1016/j.jcp.2004.01.008.
Definition IntegratedGreenFunctionSolver.H:60
void computePhiIGF(amrex::MultiFab const &rho, amrex::MultiFab &phi, std::array< amrex::Real, 3 > const &cell_size, bool const is_igf_2d_slices)
Compute the electrostatic potential using the Integrated Green Function method as in http://dx....
Definition IntegratedGreenFunctionSolver.cpp:34
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real IntegratedPotential3D(amrex::Real x, amrex::Real y, amrex::Real z)
Implements equation 2 in https://doi.org/10.1103/PhysRevSTAB.10.129901 with some modification to symm...
Definition IntegratedGreenFunctionSolver.H:38
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real SumOfIntegratedPotential2D(amrex::Real x, amrex::Real y, amrex::Real dx, amrex::Real dy)
add
Definition IntegratedGreenFunctionSolver.H:109