6#ifndef IPPL_POISSON_CG_H
7#define IPPL_POISSON_CG_H
17#define IPPL_SOLVER_OPERATOR_WRAPPER(fun, type) \
22 template <
typename FieldLHS,
typename FieldRHS = FieldLHS>
24 using Tlhs =
typename FieldLHS::value_type;
28 constexpr static unsigned Dim = FieldLHS::dim;
30 using OperatorRet = UnaryMinus<detail::meta_laplace<lhs_type>>;
31 using LowerRet = UnaryMinus<detail::meta_lower_laplace<lhs_type>>;
32 using UpperRet = UnaryMinus<detail::meta_upper_laplace<lhs_type>>;
40 static_assert(std::is_floating_point<Tlhs>::value,
"Not a floating point type");
47 static_assert(std::is_floating_point<Tlhs>::value,
"Not a floating point type");
52 std::string solver_type = this->
params_m.template get<std::string>(
"solver");
57 if (solver_type ==
"preconditioned") {
61 std::string preconditioner_type =
62 this->
params_m.template get<std::string>(
"preconditioner_type");
63 int level = this->
params_m.template get<int>(
"newton_level");
64 int degree = this->
params_m.template get<int>(
"chebyshev_degree");
65 int inner = this->
params_m.template get<int>(
"gauss_seidel_inner_iterations");
66 int outer = this->
params_m.template get<int>(
"gauss_seidel_outer_iterations");
67 double omega = this->
params_m.template get<double>(
"ssor_omega");
68 int richardson_iterations =
69 this->
params_m.template get<int>(
"richardson_iterations");
70 int communication = this->
params_m.template get<int>(
"communication");
77 for (
unsigned int d = 0; d <
Dim; ++d) {
78 n = mesh.getGridsize(d);
79 h = mesh.getMeshSpacing(d);
80 double local_min = 4 / std::pow(h, 2);
83 for (
unsigned int i = 1; i < n; ++i) {
84 test = 4. / std::pow(h, 2) * std::pow(std::sin(i * M_PI * h / 2.), 2);
85 if (test > local_max) {
88 if (test < local_min) {
103 preconditioner_type, level, degree, richardson_iterations, inner, outer,
106 algo_m->setPreconditioner(
113 preconditioner_type, level, degree, richardson_iterations, inner, outer,
128 int output = this->
params_m.template get<int>(
"output_type");
155 this->
params_m.
add(
"solver",
"non-preconditioned");
ippl::ParticleSpatialLayout< double, 3, Mesh_t > Layout_t
ippl::UniformCartesian< double, 3 > Mesh_t
#define IPPL_SOLVER_OPERATOR_WRAPPER(fun, type)
constexpr double alpha
The fine structure constant, no dimension.
constexpr double e
The value of.
Implementations for FFT constructor/destructor and transforms.
detail::meta_upper_laplace< Field > upper_laplace(Field &u)
detail::meta_upper_and_lower_laplace< Field > upper_and_lower_laplace_no_comm(Field &u)
detail::meta_lower_laplace< Field > lower_laplace(Field &u)
double negative_inverse_diagonal_laplace(Field &u)
detail::meta_upper_laplace< Field > upper_laplace_no_comm(Field &u)
double diagonal_laplace(Field &u)
detail::meta_grad< Field > grad(Field &u)
detail::meta_laplace< Field > laplace(Field &u)
detail::meta_lower_laplace< Field > lower_laplace_no_comm(Field &u)
detail::meta_upper_and_lower_laplace< Field > upper_and_lower_laplace(Field &u)
UnaryMinus< detail::meta_lower_laplace< lhs_type > > LowerRet
static constexpr unsigned Dim
typename FieldLHS::value_type Tlhs
UnaryMinus< detail::meta_upper_laplace< lhs_type > > UpperRet
double InverseDiagonalRet
void setDefaultParameters() override
std::unique_ptr< CG< OperatorRet, LowerRet, UpperRet, UpperAndLowerRet, InverseDiagonalRet, DiagRet, FieldLHS, FieldRHS > > algo_m
UnaryMinus< detail::meta_laplace< lhs_type > > OperatorRet
PoissonCG(lhs_type &lhs, rhs_type &rhs)
void setSolver(lhs_type lhs)
UnaryMinus< detail::meta_upper_and_lower_laplace< lhs_type > > UpperAndLowerRet
void add(const std::string &key, const T &value)