BubbleProfiler  0.3.0
by Peter Athron, Csaba Balazs, Michael Bardsley, Andrew Fowlie, Dylan Harries & Graham White
run_cmd_line_potential.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of BubbleProfiler.
3  *
4  * BubbleProfiler is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * BubbleProfiler is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with BubbleProfiler. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
28 #include "error.hpp"
29 #include "gsl_root_finder.hpp"
31 #include "kink_profile_guesser.hpp"
32 #include "logging_manager.hpp"
33 #include "nlopt_optimizer.hpp"
34 #include "observers.hpp"
36 #include "potential.hpp"
38 #include "shooting.hpp"
40 #include "algebraic_potential.hpp"
41 
42 #include <boost/program_options.hpp>
43 #include <boost/filesystem.hpp>
44 
45 #include <fstream>
46 #include <iomanip>
47 #include <iostream>
48 #include <memory>
49 #include <string>
50 #include <vector>
51 
52 namespace fs = boost::filesystem;
53 namespace po = boost::program_options;
54 
55 namespace BubbleProfiler {
56 
58 
59 const std::string default_ansatz_file = "";
60 const double default_domain_start = -1.;
61 const double default_domain_end = -1.;
62 const double default_initial_step_size = 1.e-2;
63 const int default_interp_fraction = 1.0;
66 const double default_rtol_action = 1.e-3;
67 const double default_rtol_fields = 1.e-3;
68 const std::string default_output_file = "-";
69 const bool default_write_perturbations = true;
70 const bool default_force_output = false;
71 const double default_opt_timeout = 10.;
72 const int default_max_iterations = -1;
74 const bool default_use_perturbative = false;
75 const bool default_write_profiles = false;
76 const bool default_shooting_ansatz = false;
77 const bool default_verbose = false;
78 
79 // Options pertaining only to 1D shooting method
81 const double default_action_arrived_rel = 1.e-3;
82 const double default_shoot_ode_abs = 1.e-4;
83 const double default_shoot_ode_rel = 1.e-4;
84 const double default_action_ode_abs = 1.e-6;
85 const double default_action_ode_rel = 1.e-6;
86 const double default_drho_frac = 1.e-3;
87 const double default_evolve_change_rel = 1.e-2;
88 const double default_bisect_lambda_max = 5.0;
89 const int default_iter_max = 100000;
90 const double default_periods_max = 1.e2;
91 const double default_f_y_max = 1.e6;
92 const double default_f_y_min = 1.e-3;
93 const double default_y_max = 1.e1;
94 
95 
96 
98  std::vector<std::string> fields;
99  std::string potential;
100  int n_dims;
101  double domain_start;
102  double domain_end;
106  double rtol_action;
107  double rtol_fields;
110  std::string output_file;
111  std::string output_path;
112  std::vector<double> global_min;
113  std::vector<double> local_min;
114  std::vector<double> barrier;
115  double opt_timeout;
117  std::string ansatz_file;
122  bool verbose;
123 
124  // Options pertaining only to 1D shooting method
131  double drho_frac;
134  int iter_max;
135  double periods_max;
136  double f_y_max;
137  double f_y_min;
138  double y_max;
139 };
140 
141 void validate(boost::any& v,
142  const std::vector<std::string>& values,
143  Integration_algorithm*, int)
144 {
145  using namespace po;
146 
147  validators::check_first_occurrence(v);
148 
149  const std::string& val = validators::get_single_string(values);
150 
151  if (val == "runge-kutta-4") {
152  v = boost::any(Integration_algorithm::Runge_kutta_4);
153  } else if (val == "euler") {
154  v = boost::any(Integration_algorithm::Euler);
155  } else {
156  throw validation_error(validation_error::invalid_option_value);
157  }
158 }
159 
160 Bubble_profiler_inputs parse_cmd_line_args(int argc, const char* argv[])
161 {
163 
164  po::options_description desc("run_cmd_line_potential options");
165  desc.add_options()
166  ("ansatz-file", po::value<std::string>(&input.ansatz_file)->default_value(default_ansatz_file),
167  "Text file containing a predefined ansatz")
168  ("false-vacuum-at-origin",
169  po::bool_switch(&input.assume_origin_false_vacuum)->default_value(default_assume_origin_false_vacuum),
170  "If given, assume the false location is at the origin of field space unless specified otherwise")
171  ("barrier", po::value<std::vector<double> >()->multitoken(),
172  "Location of barrier. Applies only when using the shooting method for 1-field problems."
173  " If not supplied, barrier will be found numerically.")
174  ("domain-start", po::value<double>(&input.domain_start)->default_value(default_domain_start),
175  "Domain of integration start. If negative, the profiler will attempt to guess a suitable value.")
176  ("domain-end", po::value<double>(&input.domain_end)->default_value(default_domain_end),
177  "Domain of integration end. If negative, the profiler will attempt to guess a suitable value.")
178  ("field", po::value<std::vector<std::string> >(&input.fields)->required(),
179  "Specify a field name")
180  ("force-output", po::bool_switch(&input.force_output)->default_value(default_force_output),
181  "If given, overwrite existing output files")
182  ("global-minimum", po::value<std::vector<double> >()->multitoken(),
183  "Location of global minimum")
184  ("initial-step-size", po::value<double>(&input.initial_step_size)->default_value(default_initial_step_size),
185  "Approximate initial step size to use in solving ODE")
186  ("help", "print help message")
187  ("integration-method", po::value<Integration_algorithm>(&input.algorithm)->default_value(default_algorithm, "runge-kutta-4"),
188  "Algorithm to use for integrating ODEs (valid options: runge-kutta-4, euler)")
189  ("interpolation-fraction", po::value<double>(&input.interpolation_fraction)->default_value(default_interp_fraction),
190  "Approximate fraction of grid points to use for interpolation")
191  ("local-minimum", po::value<std::vector<double> >()->multitoken(),
192  "Location of local minimum")
193  ("max-iterations", po::value<int>(),
194  "Perform at most this many iterations")
195  ("opt-timeout", po::value<double>(&input.opt_timeout)->default_value(default_opt_timeout),
196  "Timeout if using the optimizer to locate global minimum (0 for no timeout)")
197  ("output-file", po::value<std::string>(&input.output_file)->default_value(default_output_file),
198  "Name of output file. If '-' is given, write to standard output")
199  ("output-path", po::value<std::string>(&input.output_path)->default_value(""),
200  "Output path for additional generated data files")
201  ("perturbative", po::bool_switch(&input.use_perturbative)->default_value(default_use_perturbative),
202  "If given, use perturbative method for one-dimensional potentials")
203  ("potential", po::value<std::string>(&input.potential)->required(),
204  "Specify a potential as GiNaCs string")
205  ("n-dims", po::value<int>(&input.n_dims)->default_value(3),
206  "number of spacetime dimensions")
207  ("rtol-action", po::value<double>(&input.rtol_action)->default_value(default_rtol_action),
208  "Relative tolerance in bounce action")
209  ("rtol-fields", po::value<double>(&input.rtol_fields)->default_value(default_rtol_fields),
210  "Relative tolerance in fields at r = 0")
211  ("write-profiles", po::bool_switch(&input.write_profiles)->default_value(default_write_profiles),
212  "If given, write the field profiles to disk as well as the action")
213  ("shooting-ansatz", po::bool_switch(&input.shooting_ansatz)->default_value(default_shooting_ansatz),
214  "If given, use the shooting method to calculate an ansatz")
215  ("verbose", po::bool_switch(&input.verbose)->default_value(default_verbose),
216  "If given, produce verbose logging output")
217  ("shoot-bisect-bits", po::value<int>(&input.shoot_bisect_bits)->default_value(default_shoot_bisect_bits),
218  "1D shooting: target relative precision in significant bits when bisecting")
219  ("action-arrived-rel", po::value<double>(&input.action_arrived_rel)->default_value(default_action_arrived_rel),
220  "1D shooting: relative tolerance for arriving at false vacuum when calculating action")
221  ("shoot-ode-abs", po::value<double>(&input.shoot_ode_abs)->default_value(default_shoot_ode_abs),
222  "1D shooting: absolute error tolerance for ODE integrator (bubble profile)")
223  ("shoot-ode-rel", po::value<double>(&input.shoot_ode_rel)->default_value(default_shoot_ode_rel),
224  "1D shooting: relative error tolerance for ODE integrator (bubble profile)")
225  ("action-ode-abs", po::value<double>(&input.action_ode_abs)->default_value(default_action_ode_abs),
226  "1D shooting: absolute error tolerance for ODE integrator (action integral)")
227  ("action-ode-rel", po::value<double>(&input.action_ode_rel)->default_value(default_action_ode_rel),
228  "1D shooting: relative error tolerance for ODE integrator (action integral)")
229  ("drho-frac", po::value<double>(&input.drho_frac)->default_value(default_drho_frac),
230  "1D shooting: initial step size relative to characteristic bubble scale")
231  ("evolve-change-rel", po::value<double>(&input.evolve_change_rel)->default_value(default_evolve_change_rel),
232  "1D shooting: evolve using approximate solution until field has changed by this much, relative to false vacuum")
233  ("bisect-lambda-max", po::value<double>(&input.bisect_lambda_max)->default_value(default_bisect_lambda_max),
234  "1D shooting: maximum value of bisection parameter lambda")
235  ("iter-max", po::value<int>(&input.iter_max)->default_value(default_iter_max),
236  "1D shooting: set maximum number of shooting iterations")
237  ("periods-max", po::value<double>(&input.periods_max)->default_value(default_periods_max),
238  "1D shooting: domain size in terms of characteristic oscillation periods")
239  ("f-y-max", po::value<double>(&input.f_y_max)->default_value(default_f_y_max),
240  "1D shooting: threshold for asymptotic approximation in analytic evolution")
241  ("f-y-min", po::value<double>(&input.f_y_min)->default_value(default_f_y_min),
242  "1D shooting: threshold for asymptotic approximation in analytic evolution")
243  ("y-max", po::value<double>(&input.y_max)->default_value(default_y_max),
244  "1D shooting: threshold for asymptotic approximation in analytic evolution")
245  ;
246 
247  po::variables_map vm;
248  po::store(
249  po::parse_command_line(
250  argc, argv, desc,
251  po::command_line_style::unix_style ^ po::command_line_style::allow_short),
252  vm);
253 
254  if (vm.count("help")) {
255  std::cout << desc << std::endl;
256  exit(EXIT_SUCCESS);
257  }
258 
259  po::notify(vm);
260 
261  if (vm.count("max-iterations")) {
262  const int max_iterations = vm["max-iterations"].as<int>();
263  if (max_iterations < 0) {
264  std::cerr << "Error: number of iterations must be non-negative"
265  << std::endl;
266  exit(EXIT_FAILURE);
267  }
268  input.max_iterations = max_iterations;
269  } else {
271  }
272 
273  if (vm.count("global-minimum")) {
274  input.global_min = vm["global-minimum"].as<std::vector<double> >();
275  }
276  if (vm.count("local-minimum")) {
277  input.local_min = vm["local-minimum"].as<std::vector<double> >();
278  }
279  if (vm.count("barrier")) {
280  input.barrier = vm["barrier"].as<std::vector<double> >();
281  }
282 
283  return input;
284 }
285 
292 void write_action(double action, std::ostream& ostr)
293 {
294  ostr << "# Action: " << action << std::endl;
295 }
296 
304 void write_profiles(const std::vector<std::string>& fields,
305  const Field_profiles& profiles, std::ostream& ostr)
306 {
307  ostr << "#" << ' '
308  << std::left << std::setw(16) << "rho";
309 
310  for (const auto& name: fields) {
311  ostr << ' ' << std::left << std::setw(16) << name;
312  }
313  ostr << std::endl;
314 
315  const auto coord_values = profiles.get_spatial_grid();
316  const auto field_values = profiles.get_field_profiles();
317 
318  const int n_grid_points = coord_values.size();
319  const int n_fields = fields.size();
320 
321  for (int i = 0; i < n_grid_points; ++i) {
322  ostr << " " << std::left
323  << std::setw(16) << std::setprecision(8)
324  << std::scientific << coord_values(i);
325  for (int j = 0; j < n_fields; ++j) {
326  ostr << ' ' << std::left
327  << std::setw(16) << std::setprecision(8)
328  << std::scientific << field_values(i, j);
329  }
330  ostr << std::endl;
331  }
332 }
333 
340 Eigen::VectorXd find_global_min(const Potential& potential, double opt_timeout)
341 {
342  const int n_fields = potential.get_number_of_fields();
343  const auto v = [&potential](const Eigen::VectorXd& x) -> double {
344  return potential(x);
345  };
346  NLopt_optimizer optimizer(v, n_fields);
348  optimizer.set_lower_bounds(-1.e6);
349  optimizer.set_upper_bounds(1.e6);
350  optimizer.set_max_time(opt_timeout);
351 
352  const Eigen::VectorXd initial_guess(Eigen::VectorXd::Zero(n_fields));
353  const auto status = optimizer.optimize(initial_guess);
354 
355  if (!optimization_succeeded(status)) {
356  std::cerr << "Error: unable to locate global minimum." << std::endl;
357  exit(EXIT_FAILURE);
358  }
359 
360  return optimizer.get_extremum_location();
361 }
362 
378  const Potential& potential,
379  const Eigen::VectorXd& true_vacuum_loc,
380  const Eigen::VectorXd& false_vacuum_loc,
381  double opt_timeout)
382 {
383  const int n_fields = potential.get_number_of_fields();
384  if (n_fields != 1) {
385  throw Setup_error("automatically locating potential barrier only "
386  "supported for single field case");
387  }
388 
389  const auto v = [&potential](const Eigen::VectorXd& x) {
390  return potential(x);
391  };
392 
393  NLopt_optimizer optimizer(v, n_fields);
394 
395  // Don't need much precision for location of barrier
396  optimizer.set_xtol_rel(1.e-2);
397  optimizer.set_ftol_rel(1.e-2);
398 
400  optimizer.set_lower_bounds(std::min(true_vacuum_loc(0),
401  false_vacuum_loc(0)));
402  optimizer.set_upper_bounds(std::max(true_vacuum_loc(0),
403  false_vacuum_loc(0)));
404  optimizer.set_max_time(opt_timeout);
405 
406  Eigen::VectorXd initial_guess(0.5 * (true_vacuum_loc + false_vacuum_loc));
407  const auto status = optimizer.optimize(initial_guess);
408 
409  if (!optimization_succeeded(status)) {
410  std::cerr << "Error: unable to locate barrier. NLOPT status = "
411  << status << std::endl;
412  exit(EXIT_FAILURE);
413  }
414 
415  return optimizer.get_extremum_location();
416 }
417 
440 void initialize_extrema(const Potential& potential,
441  const Bubble_profiler_inputs& input,
442  Eigen::VectorXd& true_vacuum_loc,
443  Eigen::VectorXd& false_vacuum_loc)
444 {
445  const std::size_t n_fields = potential.get_number_of_fields();
446 
447  if (input.local_min.empty()) {
448  if (input.assume_origin_false_vacuum) {
449  false_vacuum_loc = Eigen::VectorXd::Zero(n_fields);
450  } else {
451  throw Setup_error("location of false vacuum not specified");
452  }
453  } else {
454  if (input.local_min.size() != n_fields) {
455  throw Setup_error("number of fields does not match dimensions "
456  "of local minimum");
457  }
458 
459  false_vacuum_loc = Eigen::VectorXd::Map(input.local_min.data(),
460  input.local_min.size());
461  }
462 
463  if (input.global_min.empty()) {
464  true_vacuum_loc = find_global_min(potential, input.opt_timeout);
465  } else {
466  if (input.global_min.size() != n_fields) {
467  throw Setup_error("number of fields does not match dimensions "
468  "of global minimum");
469  }
470 
471  true_vacuum_loc = Eigen::VectorXd::Map(input.global_min.data(),
472  input.global_min.size());
473  }
474 }
475 
505 void initialize_extrema(const Potential& potential,
506  const Bubble_profiler_inputs& input,
507  Eigen::VectorXd& true_vacuum_loc,
508  Eigen::VectorXd& false_vacuum_loc,
509  Eigen::VectorXd& barrier_loc)
510 {
511  const std::size_t n_fields = potential.get_number_of_fields();
512 
513  if (n_fields != 1) {
514  throw Setup_error("automatically locating potential barrier only "
515  "supported for single field case");
516  }
517 
518  initialize_extrema(potential, input, true_vacuum_loc, false_vacuum_loc);
519 
520  if (input.barrier.empty()) {
521  barrier_loc = find_one_dimensional_barrier(potential,
522  false_vacuum_loc,
523  true_vacuum_loc,
524  input.opt_timeout);
525  } else {
526  if (input.barrier.size() != n_fields) {
527  throw Setup_error("number of fields does not match dimensions "
528  "of barrier location");
529  }
530  barrier_loc = Eigen::VectorXd::Map(input.barrier.data(),
531  input.barrier.size());
532  }
533 }
534 
542 std::tuple<double, Field_profiles> run_shooting_profiler(
543  const Bubble_profiler_inputs& input)
544 {
545  Algebraic_potential potential(input.fields, input.potential);
546  const int n_fields = potential.get_number_of_fields();
547 
548  Eigen::VectorXd true_vacuum_loc(n_fields);
549  Eigen::VectorXd false_vacuum_loc(n_fields);
550  Eigen::VectorXd barrier(n_fields);
551 
552  initialize_extrema(potential, input, true_vacuum_loc, false_vacuum_loc,
553  barrier);
554 
555  unsigned int options = Shooting::Solver_options::Compute_action;
556  if (input.write_profiles) {
557  options = options | Shooting::Solver_options::Compute_profile;
558  }
559  Shooting solver;
560 
563  solver.set_shooting_abs_tol(input.shoot_ode_abs);
564  solver.set_shooting_rel_tol(input.shoot_ode_rel);
565  solver.set_action_abs_tol(input.action_ode_abs);
566  solver.set_action_rel_tol(input.action_ode_rel);
567  solver.set_drho_frac(input.drho_frac);
570  solver.set_max_iterations(input.iter_max);
571  solver.set_max_periods(input.periods_max);
572  solver.set_f_y_max(input.f_y_max);
573  solver.set_f_y_min(input.f_y_min);
574  solver.set_y_max(input.y_max);
575 
576  solver.solve(potential, false_vacuum_loc(0),
577  true_vacuum_loc(0), barrier(0), input.n_dims, options);
578 
579  Field_profiles profile;
580  if (input.write_profiles) {
581  profile = solver.get_bubble_profile();
582  }
583 
584  return std::make_tuple(solver.get_euclidean_action(), profile);
585 }
586 
598 template <class Profiler>
599 std::tuple<double, Field_profiles> run_perturbative_profiler(
600  const Bubble_profiler_inputs& input, Profiler& profiler)
601 {
602  Algebraic_potential potential(input.fields, input.potential);
603 
604  const int n_fields = potential.get_number_of_fields();
605 
606  Eigen::VectorXd false_vacuum_loc(n_fields);
607  Eigen::VectorXd true_vacuum_loc(n_fields);
608 
609  initialize_extrema(potential, input, true_vacuum_loc, false_vacuum_loc);
610 
611  if (input.domain_start >= 0.) {
612  profiler.set_domain_start(input.domain_start);
613  }
614  if (input.domain_end >= 0.) {
615  profiler.set_domain_end(input.domain_end);
616  }
617  profiler.set_initial_step_size(input.initial_step_size);
618  profiler.set_interpolation_points_fraction(input.interpolation_fraction);
619  profiler.set_false_vacuum_loc(false_vacuum_loc);
620  profiler.set_true_vacuum_loc(true_vacuum_loc);
621  profiler.set_number_of_dimensions(input.n_dims);
622 
623  auto root_finder = std::make_shared<GSL_root_finder<Eigen::Dynamic> >();
624  profiler.set_root_finder(root_finder);
625 
626  std::shared_ptr<Profile_guesser> guesser;
627  if (input.shooting_ansatz) {
628  guesser = std::make_shared<Shooting_profile_guesser>();
629  } else if (!input.ansatz_file.empty()) {
630  std::ifstream ansatz_input(input.ansatz_file);
631  guesser = std::make_shared<Instream_profile_guesser>(ansatz_input);
632  } else {
633  guesser = std::make_shared<Kink_profile_guesser>();
634  }
635  profiler.set_initial_guesser(guesser);
636 
637  auto convergence_tester = std::make_shared<Relative_convergence_tester>(
638  input.rtol_action, input.rtol_fields);
639  if (input.max_iterations >= 0) {
640  convergence_tester->set_max_iterations(input.max_iterations);
641  }
642  profiler.set_convergence_tester(convergence_tester);
643 
644  if (!input.output_path.empty()) {
645  Profile_observer observer(input.fields, input.output_path, potential);
646  profiler.calculate_bubble_profile(potential, observer);
647  } else {
648  profiler.calculate_bubble_profile(potential);
649  }
650 
651  Field_profiles profiles;
652  if (input.write_profiles) {
653  profiles = profiler.get_bubble_profile();
654  }
655 
656  return std::make_tuple(profiler.get_euclidean_action(), profiles);
657 }
658 
670 std::tuple<double, Field_profiles> run_perturbative_profiler(
671  const Bubble_profiler_inputs& input)
672 {
673  switch (input.algorithm) {
675  RK4_perturbative_profiler profiler;
676  return run_perturbative_profiler(input, profiler);
677  }
680  return run_perturbative_profiler(input, profiler);
681  }
682  default: {
683  throw Setup_error("unrecognized integration method");
684  }
685  }
686 }
687 
694 {
695  const auto n_fields = input.fields.size();
696 
697  std::tuple<double, Field_profiles> result;
698  if (n_fields == 1 && !input.use_perturbative) {
699  result = run_shooting_profiler(input);
700  } else {
701  result = run_perturbative_profiler(input);
702  }
703 
704  if (!input.output_file.empty()) {
705  if (input.output_file == "-") {
706  write_action(std::get<0>(result), std::cout);
707  if (input.write_profiles) {
708  write_profiles(input.fields, std::get<1>(result), std::cout);
709  }
710  } else {
711  std::ofstream ostr(input.output_file);
712  write_action(std::get<0>(result), ostr);
713  if (input.write_profiles) {
714  write_profiles(input.fields, std::get<1>(result), ostr);
715  }
716  }
717  }
718 }
719 
721 {
722  auto& logging_manager = logging::Logging_manager::get_manager();
723 
724  if (input.verbose) {
725  logging_manager.set_minimum_log_level(logging::Log_level::Trace);
726  } else {
727  logging_manager.set_minimum_log_level(logging::Log_level::Warning);
728  }
729 }
730 
731 } // namespace BubbleProfiler
732 
733 int main(int argc, const char* argv[])
734 {
735  using namespace BubbleProfiler;
736 
737  try {
738 
739  Bubble_profiler_inputs input = parse_cmd_line_args(argc, argv);
740 
741  configure_logging(input);
742 
743  std::cout << "Potential: " << input.potential << std::endl;
744  for (const auto& f: input.fields) {
745  std::cout << "Field: " << f << std::endl;
746  }
747 
748  if (!input.output_file.empty()) {
749  // check for existence of output file if not allowing overwriting
750  if (!input.force_output && input.output_file != "-") {
751  fs::path output_file(input.output_file);
752  if (fs::exists(output_file)) {
753  std::cerr << "Error: output file already exists.\n";
754  std::cerr << "Please specify a different output file, or use\n";
755  std::cerr << "the --force-output option.\n";
756  return EXIT_FAILURE;
757  }
758  }
759  }
760 
761  if (!input.output_path.empty()) {
762  fs::path output_path(input.output_path);
763  if (!fs::exists(output_path) || input.force_output) {
764  fs::create_directory(output_path);
765  } else if (fs::is_regular_file(output_path)) {
766  throw Setup_error("Error: output path is a regular file");
767  } else {
768  std::cerr << "Error: output directory already exists.\n";
769  std::cerr << "Please specify a different output path, or use\n";
770  std::cerr << "the --force-output option.\n";
771  return EXIT_FAILURE;
772  }
773  }
774 
775  run_profiler(input);
776 
777  } catch (const Setup_error& e) {
778  std::cerr << "Error: " << e.what() << std::endl;
779  return EXIT_FAILURE;
780  } catch (const Error& e) {
781  std::cerr << "Error: " << e.what() << std::endl;
782  return EXIT_FAILURE;
783  } catch (const std::runtime_error& e) {
784  std::cerr << "runtime error: " << e.what() << std::endl;
785  return EXIT_FAILURE;
786  } catch (const std::exception& e) {
787  std::cerr << "Exception: " << e.what() << std::endl;
788  return EXIT_FAILURE;
789  } catch (const std::string& a) {
790  std::cerr << a;
791  return EXIT_FAILURE;
792  } catch (...) {
793  std::cerr << "Unknown type of exception caught.\n";
794  return EXIT_FAILURE;
795  }
796 
797  return 0;
798 }
void run_profiler(const Bubble_profiler_inputs &input)
Calculates the action and bubble profile for the given potential.
void set_shooting_rel_tol(double tol)
Definition: shooting.hpp:58
const int default_shoot_bisect_bits
const bool default_shooting_ansatz
const Eigen::VectorXd & get_spatial_grid() const
Get a vector of the grid point coordinates.
void initialize_extrema(const Potential &potential, const Bubble_profiler_inputs &input, Eigen::VectorXd &true_vacuum_loc, Eigen::VectorXd &false_vacuum_loc)
Locate the requested critical points if not already provided.
const double default_evolve_change_rel
void set_max_iterations(int i)
Definition: shooting.hpp:76
nlopt::result optimize(const Eigen::VectorXd &guess)
const std::string default_output_file
const double default_bisect_lambda_max
std::tuple< double, Field_profiles > run_shooting_profiler(const Bubble_profiler_inputs &input)
Calculates the action and bubble profile using the shooting method.
Bubble_profiler_inputs parse_cmd_line_args(int argc, const char *argv[])
void solve(const std::function< double(double)> &potential_, const std::function< double(double)> &potential_first_, const std::function< double(double)> &potential_second_, double false_min_, double true_min_, double barrier_, int dim_=3, unsigned int options=(Solver_options::Compute_action|Solver_options::Compute_profile))
Definition: shooting.cpp:81
const double default_initial_step_size
bool optimization_succeeded(nlopt::result)
int main(int argc, const char *argv[])
contains the definition of the Instream_profile_guesser class
void set_bisect_lambda_max(double l)
Definition: shooting.hpp:74
virtual std::size_t get_number_of_fields() const override
Eigen::VectorXd find_one_dimensional_barrier(const Potential &potential, const Eigen::VectorXd &true_vacuum_loc, const Eigen::VectorXd &false_vacuum_loc, double opt_timeout)
Find barrier directly between two minima of a 1D potential.
const double default_action_ode_abs
void write_profiles(const std::vector< std::string > &fields, const Field_profiles &profiles, std::ostream &ostr)
Write the given field profiles to requested output stream.
static Logging_manager & get_manager()
const Field_profiles & get_bubble_profile() const
Definition: shooting.cpp:48
double get_euclidean_action() const
Definition: shooting.cpp:40
const double default_periods_max
const std::string default_ansatz_file
const double default_f_y_min
const double default_drho_frac
void configure_logging(const Bubble_profiler_inputs &input)
void set_f_y_max(double f)
Definition: shooting.hpp:80
const bool default_assume_origin_false_vacuum
const bool default_write_profiles
const double default_rtol_fields
const double default_f_y_max
void set_action_rel_tol(double tol)
Definition: shooting.hpp:62
const double default_shoot_ode_abs
const double default_domain_start
const double default_domain_end
void set_f_y_min(double f)
Definition: shooting.hpp:82
const double default_opt_timeout
void write_action(double action, std::ostream &ostr)
Write the value of the action to requested output stream.
void set_evolve_change_rel(double frac)
Definition: shooting.hpp:72
Observes the profile during iteration and writes out profile, perturbations and action for each step ...
Definition: observers.hpp:50
void set_action_arrived_rel(double tol)
Definition: shooting.hpp:54
void set_action_abs_tol(double tol)
Definition: shooting.hpp:60
void set_max_periods(double p)
Definition: shooting.hpp:78
const bool default_write_perturbations
void set_drho_frac(double frac)
Definition: shooting.hpp:64
std::tuple< double, Field_profiles > run_perturbative_profiler(const Bubble_profiler_inputs &input, Profiler &profiler)
Calculates the action and bubble profile using the perturbative method.
void set_y_max(double y)
Definition: shooting.hpp:84
Solve the one-dimensional problem using the shooting method.
Definition: shooting.hpp:44
void set_extremum_type(Extremum_type e)
Eigen::VectorXd get_extremum_location() const
virtual std::size_t get_number_of_fields() const =0
Exception indicating general setup error.
Definition: error.hpp:32
const Integration_algorithm default_algorithm
void set_ftol_rel(double ftol_rel_)
One-dimensional shooting method.
const bool default_use_perturbative
const double default_action_arrived_rel
Implements a multi dimensional scalar field potential, which may be expressed as almost any algerbrai...
Abstract base class for a generic potential.
Definition: potential.hpp:36
const double default_rtol_action
Eigen::VectorXd find_global_min(const Potential &potential, double opt_timeout)
Find the global minimum of the given potential.
void set_shooting_abs_tol(double tol)
Definition: shooting.hpp:56
void validate(boost::any &v, const std::vector< std::string > &values, Integration_algorithm *, int)
void set_xtol_rel(double xtol_rel_)
void set_bisection_precision_bits(int b)
Definition: shooting.hpp:52
Discretized set of field profiles.
Bounce solver using perturbative method.
const Eigen::MatrixXd & get_field_profiles() const
Get the field profile data in matrix form.
const double default_action_ode_rel
const double default_shoot_ode_rel