OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
P3MPoissonSolver.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 /***************************************************************************
3  *
4  *
5  * P3MPoissonSolver.hh
6  *
7  * Open BC in x,y and z.
8  *
9  *
10  *
11  *
12  *
13  *
14  ***************************************************************************/
15 
17 // This class contains methods for solving Poisson's equation for the
18 // space charge portion of the calculation.
20 
21 #ifndef P3M_POISSON_SOLVER_H_
22 #define P3M_POISSON_SOLVER_H_
23 const unsigned Dim = 3;
24 
25 #ifdef dontOPTIMIZE_FIELD_ASSIGNMENT
26 #define FIELDASSIGNOPTIMIZATION __attribute__((optimize(0)))
27 #else
28 #define FIELDASSIGNOPTIMIZATION
29 #endif
30 
31 #include <memory>
33 #include "PoissonSolver.h"
35 
36 template <class T, unsigned Dim>
37 class PartBunchBase;
38 
40 
42 public:
43  // constructor and destructor
44  P3MPoissonSolver(Mesh_t *mesh, FieldLayout_t *fl, double interaction_radius, double alpha, double eps);
45 
47 
48  void initFields();
49 
50  void calculateGridForces(PartBunchBase<double, 3> *bunch, double interaction_radius, double alpha, double eps);
51 
52  void calculatePairForces(PartBunchBase<double, 3> *bunch, double interaction_radius, double alpha, double eps);
53 
54  // given a charge-density field rho and a set of mesh spacings hr,
55  // compute the scalar potential with image charges at -z
56  void computePotential(Field_t &rho, Vector_t hr, double zshift);
57 
58  // given a charge-density field rho and a set of mesh spacings hr,
59  // compute the scalar potential in open space
60  void computePotential(Field_t &rho, Vector_t hr);
61 
62  void applyConstantFocusing(PartBunchBase<double, 3> *bunch, double f, double r);
63  void test(PartBunchBase<double, 3> *bunch);
64 
65  double getXRangeMin(unsigned short level) {return 1.0;}
66  double getXRangeMax(unsigned short level) {return 1.0;}
67  double getYRangeMin(unsigned short level) {return 1.0;}
68  double getYRangeMax(unsigned short level) {return 1.0;}
69  double getZRangeMin(unsigned short level) {return 1.0;}
70  double getZRangeMax(unsigned short level) {return 1.0;}
71 
74  Inform &print(Inform &os) const;
75 private:
76 
80 
81  // rho_m is the charge-density field with mesh doubled in each dimension
84 
86 
87  // real field with layout of complex field: domain3_m
89 
92 
93  // grntr_m is the Fourier transformed Green's function
94  // domain3_m and mesh3_ are used
96 
97  // the FFT object
98  std::unique_ptr<FFTC_t> fft_m;
99 
100 
101  // Fields used to eliminate excess calculation in greensFunction()
102  // mesh2_m and layout2_m are used
104 
105 
106  // mesh and layout objects for rho_m
109 
110 
111  // tmp
113 
114  // domains for the various fields
115  NDIndex<3> domain_m; // original domain, gridsize
116  // mesh and gridsize defined outside of P3M class, given as
117 
118 
120 
121 
123  double alpha_m;
124  double eps_m;
125 
128 
129  // for tests
131  double globSumEf_m[Dim];
132 
133 
134 public:
137 
138 
139 };
140 
142  return fs.print(os);
143 }
144 
145 
146 
147 #endif
148 
149 /***************************************************************************
150  * $RCSfile: P3MPoissonSolver.hh,v $ $Author: adelmann $
151  * $Revision: 1.1.1.1 $ $Date: 2001/08/08 11:21:48 $
152  ***************************************************************************/
std::ostream & operator<<(std::ostream &os, const Attribute &attr)
Definition: Attribute.cpp:167
NDIndex< 3 > domain_m
double getXRangeMax(unsigned short level)
Definition: TSVMeta.h:24
void applyConstantFocusing(PartBunchBase< double, 3 > *bunch, double f, double r)
double getYRangeMax(unsigned short level)
FRONT * fs
Definition: hypervolume.cpp:59
P3MPoissonSolver(Mesh_t *mesh, FieldLayout_t *fl, double interaction_radius, double alpha, double eps)
double getZRangeMin(unsigned short level)
void test(PartBunchBase< double, 3 > *bunch)
BConds< Vector_t, Dim, Mesh_t, Center_t > vbc_m
double getXRangeMin(unsigned short level)
Definition: BCond.h:34
double getZRangeMax(unsigned short level)
constexpr double alpha
The fine structure constant, no dimension.
Definition: Physics.h:79
double getYRangeMin(unsigned short level)
void compute_temperature(PartBunchBase< double, 3 > *bunch)
Class: DataSink.
Definition: OpalData.h:29
double globSumEf_m[Dim]
FieldLayout_t * layout_m
Vektor< int, 3 > nr_m
void computeAvgSpaceChargeForces(PartBunchBase< double, 3 > *bunch)
std::unique_ptr< FFTC_t > fft_m
void computePotential(Field_t &rho, Vector_t hr, double zshift)
BConds< double, Dim, Mesh_t, Center_t > bcp_m
IField_t grnIField_m[3]
Vektor< double, 3 > extend_l
Inform & print(Inform &os) const
BConds< double, Dim, Mesh_t, Center_t > bc_m
void calculatePairForces(PartBunchBase< double, 3 > *bunch, double interaction_radius, double alpha, double eps)
void calculateGridForces(PartBunchBase< double, 3 > *bunch, double interaction_radius, double alpha, double eps)
NDIndex< 3 > domainP3MConstruct_m
const unsigned Dim
Vektor< double, Dim > avgEF_m
Vektor< double, 3 > extend_r
Definition: Inform.h:41