9#include <dirac_operator_experiment.h>
11using lf::uscalfe::operator-;
12using complex = std::complex<double>;
18int main(
int argc,
char *argv[]) {
19 if (argc != 4 && argc != 5) {
20 std::cerr <<
"Usage: " << argv[0]
21 <<
" max_refinement_level min_k max_k step=0.1 " << std::endl;
28 const unsigned refinement_level = atoi(argv[1]);
29 sscanf(argv[2],
"%lf", &min_k);
30 sscanf(argv[3],
"%lf", &max_k);
31 if (argc == 5) sscanf(argv[4],
"%lf", &step);
32 std::cout <<
"max_refinement_level : " << refinement_level << std::endl;
33 std::cout <<
"min_k : " << min_k <<
", max_k = " << max_k
34 <<
" step = " << step << std::endl;
39 std::vector<unsigned> refinement_levels(refinement_level + 1);
40 for (
int i = 0; i < refinement_level + 1; i++) {
41 refinement_levels[i] = i;
44 std::vector<double> ks;
45 for (
double i = min_k; i <= max_k; i += step) {
50 auto Power = [](complex a, complex b) -> complex {
return std::pow(a, b); };
51 auto Complex = [](
double a,
double b) -> complex {
return complex(a, b); };
52 auto Sin = [](complex a) -> complex {
return std::sin(a); };
53 auto Cos = [](complex a) -> complex {
return std::cos(a); };
54 auto Sqrt = [](complex a) -> complex {
return std::sqrt(a); };
57 auto f_zero = [&](
const Eigen::Vector3d &x_vec) -> complex {
59 Eigen::Vector3d x_ = x_vec;
65 complex ret = Complex(0, 1) * k * (Cos(y) + Sin(x) + Sin(z));
70 auto f_one = [&](
const Eigen::Vector3d &x_vec) -> Eigen::VectorXcd {
72 Eigen::Vector3d x_ = x_vec;
78 Eigen::VectorXcd ret(3);
79 ret << ((Power(y, 2) + Power(z, 2)) * Cos(x) - x * z * Cos(z) +
81 (Power(x, 2) + Power(y, 2) + Power(z, 2)),
82 -((x * y * Cos(x) + y * z * Cos(z) +
83 (Power(x, 2) + Power(z, 2)) * Sin(y)) /
84 (Power(x, 2) + Power(y, 2) + Power(z, 2))),
85 (-(x * z * Cos(x)) + (Power(x, 2) + Power(y, 2)) * Cos(z) +
87 (Power(x, 2) + Power(y, 2) + Power(z, 2));
92 auto f_two = [&](
const Eigen::Vector3d &x_vec) -> complex {
94 Eigen::Vector3d x_ = x_vec;
105 auto u_zero = [&](
const Eigen::Vector3d x_vec) -> complex {
107 Eigen::Vector3d x_ = x_vec;
112 return Cos(y) + Sin(x) + Sin(z);
116 auto u_one = [&](
const Eigen::Vector3d x_vec) -> Eigen::Vector3cd {
118 Eigen::Vector3d x_ = x_vec;
123 Eigen::VectorXcd ret(3);
130 auto u_two = [&](
const Eigen::Vector3d x_vec) -> complex {
132 Eigen::Vector3d x_ = x_vec;
141 u_zero, u_one, u_two, f_zero, f_one, f_two, k,
"debug_only_zero");
143 experiment.Compute(refinement_levels, ks);
Creates and solves the discretised Dirac Operator source problems for a given list of levels and valu...