Skip to content

Commit

Permalink
Integrated Green's Function Poisson Solver (ECP-WarpX#4937)
Browse files Browse the repository at this point in the history
* [WIP]Integrated Green Function Poisson Solver

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* updated inputs

* Modified IGF.cpp file

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Latest IGF.cpp

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fixed the IGF file

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* IGF final

* IGF file final

* Added BL_PROFILE in IGF file

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Updated IntegratedGreenFunctionSolver

* Check Compilation Flags

* Added Multiplication

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* removed inputs

* Update Source/ablastr/fields/IntegratedGreenFunctionSolver.cpp

Co-authored-by: Remi Lehe <[email protected]>

* change import orders

* fix macros and add timers

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* update checksums and changed ifdefs

* mod GNUmake

* fix GNUmakefile for real

* heffte ctest

* fix test input name

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Apply suggestions from code review

* Update Source/ablastr/fields/IntegratedGreenFunctionSolver.cpp

* Start refactoring

* Continue refactoring

* Continue refactoring

* Finish refactoring

* Fix unused variable

* Fix compilation without heFFTe

* Fix bugs without heFFTe

* Remove unneeded ifdef

* Update checksum

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Alfred Haavaan Mishi <[email protected]>
Co-authored-by: Alfred Haavaan Mishi <[email protected]>
Co-authored-by: Alfred Haavaan Mishi <[email protected]>
Co-authored-by: Arianna Formenti <[email protected]>
Co-authored-by: Remi Lehe <[email protected]>
  • Loading branch information
7 people committed Sep 18, 2024
1 parent f8f4e57 commit cb5d0c8
Show file tree
Hide file tree
Showing 6 changed files with 232 additions and 91 deletions.
12 changes: 12 additions & 0 deletions Examples/Tests/open_bc_poisson_solver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,15 @@ if(WarpX_FFT)
OFF # dependency
)
endif()

if(WarpX_HEFFTE)
add_warpx_test(
test_3d_open_bc_poisson_solver_heffte # name
3 # dims
2 # nprocs
inputs_test_3d_open_bc_poisson_solver_heffte # inputs
analysis.py # analysis
diags/diag1000001 # output
OFF # dependency
)
endif()
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FILE = inputs_test_3d_open_bc_poisson_solver
1 change: 1 addition & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ USE_OPENPMD = FALSE
WarpxBinDir = Bin

USE_FFT = FALSE
USE_HEFFTE = FALSE
USE_RZ = FALSE

USE_EB = FALSE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
{
"lev=0": {
"Bx": 100915975.15792876,
"By": 157610677.31483692,
"Bz": 2.404060922276648e-13,
"Ex": 4.725066923361703e+16,
"Ey": 3.0253961494347724e+16,
"Ez": 3276584.4383433666,
"Bx": 100915975.15403552,
"By": 157610677.3147734,
"Bz": 1.2276713711194638e-13,
"Ex": 4.725066923359797e+16,
"Ey": 3.025396149317578e+16,
"Ez": 3276584.4383433824,
"rho": 10994013582437.197
},
"electron": {
"particle_momentum_x": 5.701279599504008e-19,
"particle_momentum_y": 3.650453172860547e-19,
"particle_momentum_x": 5.701279599509506e-19,
"particle_momentum_y": 3.650453172383178e-19,
"particle_momentum_z": 1.145432768297242e-10,
"particle_position_x": 17.31408691249785,
"particle_position_y": 0.2583691267187801,
"particle_position_y": 0.25836912671878015,
"particle_position_z": 10066.329600000008,
"particle_weight": 19969036501.910976
}
}
}
31 changes: 31 additions & 0 deletions Source/ablastr/fields/IntegratedGreenFunctionSolver.H
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#ifndef ABLASTR_IGF_SOLVER_H
#define ABLASTR_IGF_SOLVER_H

#include <ablastr/constant.H>

#include <AMReX_BoxArray.H>
#include <AMReX_GpuQualifiers.H>
#include <AMReX_MultiFab.H>
Expand Down Expand Up @@ -47,6 +49,35 @@ namespace ablastr::fields
return G;
}

/** @brief add
*
* @param[in] x x-coordinate of given location
* @param[in] y y-coordinate of given location
* @param[in] z z-coordinate of given location
*
* @return the sum of integrated Green function G
*/
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
amrex::Real
SumOfIntegratedPotential (amrex::Real x, amrex::Real y, amrex::Real z, amrex::Real dx, amrex::Real dy, amrex::Real dz)
{
using namespace amrex::literals;


amrex::Real const G_value = 1._rt/(4._rt*ablastr::constant::math::pi*ablastr::constant::SI::ep0) * (
IntegratedPotential( x+0.5_rt*dx, y+0.5_rt*dy, z+0.5_rt*dz )
- IntegratedPotential( x-0.5_rt*dx, y+0.5_rt*dy, z+0.5_rt*dz )
- IntegratedPotential( x+0.5_rt*dx, y-0.5_rt*dy, z+0.5_rt*dz )
+ IntegratedPotential( x-0.5_rt*dx, y-0.5_rt*dy, z+0.5_rt*dz )
- IntegratedPotential( x+0.5_rt*dx, y+0.5_rt*dy, z-0.5_rt*dz )
+ IntegratedPotential( x-0.5_rt*dx, y+0.5_rt*dy, z-0.5_rt*dz )
+ IntegratedPotential( x+0.5_rt*dx, y-0.5_rt*dy, z-0.5_rt*dz )
- IntegratedPotential( x-0.5_rt*dx, y-0.5_rt*dy, z-0.5_rt*dz )
);

return G_value;
}

/** @brief Compute the electrostatic potential using the Integrated Green Function method
* as in http://dx.doi.org/10.1103/PhysRevSTAB.9.044204
*
Expand Down
Loading

0 comments on commit cb5d0c8

Please sign in to comment.