68 "Usage: thin [OPTION] <lambda> <a> <delta>\n\n" 69 "Calculate action and field profile for one-dimensional perturbed\n" 70 "quartic potential characterized by the parameters lambda, a,\n" 72 "Example: thin -c -o 'output.txt' 1 1 0.01\n\n" 74 " -c, --calculate-profile calculate field profile as well\n" 75 " -f, --finite-temperature calculate using d = 3 dimensions\n" 76 " -h, --help print this help message\n" 77 " -o, --output-file=FILE write results to FILE\n" 78 " -P, --perturbations-file=FILE write perturbations to FILE\n" 79 " -p, --perturbative use the perturbative algorithm\n" 80 " -v, --verbose produce verbose output" 84 bool starts_with(
const std::string& option,
const std::string& prefix)
86 return !option.compare(0, prefix.size(), prefix);
90 const std::string& sep =
"=")
92 std::string value{
""};
93 const auto prefix_end = option.find(sep);
95 if (prefix_end != std::string::npos) {
96 value = option.substr(prefix_end + 1);
105 const auto n_positional_args = args.size();
107 if (n_positional_args == 0) {
109 "value of lambda must be provided");
110 }
else if (n_positional_args == 1) {
112 "value of a must be provided");
113 }
else if (n_positional_args == 2) {
115 "value of delta must be provided");
116 }
else if (n_positional_args > 3) {
118 "unrecognized command line argument '" 123 options.
lambda = std::stod(args[0]);
124 }
catch (
const std::invalid_argument& e) {
126 "invalid value of lambda, '" + args[0] +
"'");
130 options.
a = std::stod(args[1]);
131 }
catch (
const std::invalid_argument& e) {
133 "invalid value for a, '" + args[1] +
"'");
137 options.
delta = std::stod(args[2]);
138 }
catch (
const std::invalid_argument& e) {
140 "invalid value for delta, '" + args[2] +
"'");
148 std::vector<std::string> positional_args;
151 const std::string opt(argv[i++]);
154 positional_args.push_back(opt);
158 if (opt ==
"-c" || opt ==
"--calculate-profile") {
163 if (opt ==
"-f" || opt ==
"--finite-temperature") {
168 if (opt ==
"-h" || opt ==
"--help") {
176 "'-o' given but no output file name provided");
178 const std::string filename(argv[i++]);
179 if (
starts_with(filename,
"-") && filename !=
"-") {
181 "'-o' given but no output file name provided");
189 if (filename.empty()) {
191 "'--output-file=' given but no output file name provided");
200 "'-P' given but no file name provided");
202 const std::string filename(argv[i++]);
203 if (
starts_with(filename,
"-") && filename !=
"-") {
205 "'-P' given but no file name provided");
213 if (filename.empty()) {
215 "'--perturbations-file=' given but no file name provided");
221 if (opt ==
"-p" || opt ==
"--perturbative") {
226 if (opt ==
"-v" || opt ==
"--verbose") {
232 "unrecognized command line argument '" + opt +
"'");
248 = calculate_profile ?
249 (Shooting::Solver_options::Compute_action |
250 Shooting::Solver_options::Compute_profile)
251 : Shooting::Solver_options::Compute_action;
256 profiler.set_shooting_abs_tol(1.e-15);
257 profiler.set_shooting_rel_tol(1.e-15);
258 profiler.set_action_abs_tol(1.e-15);
259 profiler.set_action_rel_tol(1.e-15);
260 profiler.set_evolve_change_rel(1.e-4);
265 profiler.solve(potential, false_min, true_min, barrier, dim,
268 if ((options & Shooting::Solver_options::Compute_action) != 0) {
269 action = profiler.get_euclidean_action();
272 if ((options & Shooting::Solver_options::Compute_profile) != 0) {
273 profile = profiler.get_bubble_profile();
276 return std::make_tuple(action, profile);
281 const std::string& observer_file)
291 const double action_tol = 1.e-3;
292 const double fields_tol = 1.e-3;
294 std::make_shared<Relative_convergence_tester>(
295 action_tol, fields_tol));
297 auto root_finder = std::make_shared<Root_finder>();
300 Eigen::VectorXd true_vacuum(1);
303 Eigen::VectorXd false_vacuum(1);
313 if (observer_file.empty()) {
322 return std::make_tuple(action, profile);
328 << std::setw(16) <<
"rho" <<
' ' 329 << std::setw(16) <<
"numeric" << std::endl;
336 for (
int i = 0; i < n_grid_points; ++i) {
338 << std::setw(16) << std::setprecision(8)
339 << std::scientific << rho_values(i) <<
' ' 340 << std::setw(16) << std::setprecision(8)
341 << std::scientific << numerical_values(i, 0) << std::endl;
345 void write_action(std::ostream& ostr,
double numerical_action,
346 double thin_wall_action)
348 const double rel_diff = (numerical_action - thin_wall_action)
349 / (0.5 * (numerical_action + thin_wall_action));
351 ostr <<
"# Numerical action = " 352 << std::setprecision(8) << std::scientific << numerical_action
354 ostr <<
"# Thin wall action = " 355 << std::setprecision(8) << std::scientific << thin_wall_action
357 ostr <<
"# Relative error = " 358 << std::setprecision(8) << std::scientific << rel_diff
364 int main(
int argc,
const char* argv[])
369 std::cerr <<
"Usage: thin [OPTION] <lambda> <a> <delta>\n" 370 <<
"Try 'thin --help' for more information." 386 std::tuple<double, Field_profiles> result;
397 output_file.open(options.
output_file, std::ios::out);
400 std::ostream& output_stream
408 write_action(output_stream, std::get<0>(result), thin_wall_action);
410 std::cerr <<
"Error: " << e.what() << std::endl;
411 exit_code = EXIT_FAILURE;
413 std::cerr <<
"Error: " << e.what() << std::endl;
414 exit_code = EXIT_FAILURE;
416 std::cerr <<
"Error: " << e.what() << std::endl;
417 exit_code = EXIT_FAILURE;
418 }
catch (
const Error& e) {
419 std::cerr <<
"Error: " << e.what() << std::endl;
420 exit_code = EXIT_FAILURE;
422 std::cerr <<
"Error: unrecognized error occurred." 424 exit_code = EXIT_FAILURE;
contains the definition of the Field_profiles clas
double get_local_minimum_location() const
returns the location of the local minimum
Exception indicating failure to integrate BVP.
void parse_positional_args(const std::vector< std::string > &args, Fubini_options &options)
void calculate_bubble_profile(Potential &, Observer &)
std::tuple< double, Field_profiles > solve_perturbative(Generalized_fubini_potential &potential, double true_min, const std::string &observer_file)
void set_initial_guesser(std::shared_ptr< Profile_guesser > g)
const Eigen::VectorXd & get_spatial_grid() const
Get a vector of the grid point coordinates.
void set_false_vacuum_loc(const Eigen::VectorXd &fv)
void set_true_vacuum_loc(const Eigen::VectorXd &tv)
Bubble_profiler_inputs parse_cmd_line_args(int argc, const char *argv[])
void set_root_finder(std::shared_ptr< Root_finder< Eigen::VectorXd > > rf)
double get_euclidean_action() const
Retrieve the action after running calculate_bubble_profile.
std::string get_option_value(const std::string &option, const std::string &sep="=")
std::string perturbations_file
void write_profile(std::ostream &ostr, const Field_profiles &numerical_profile, const Field_profiles &exact_profile)
void set_convergence_tester(std::shared_ptr< Profile_convergence_tester > ct)
static Logging_manager & get_manager()
int get_number_of_grid_points() const
std::tuple< double, Field_profiles > solve_shooting(const Generalized_fubini_potential &potential, double true_min, bool calculate_profile)
void set_minimum_log_level(Log_level level)
Example thin wall potential as given by Coleman.
void write_action(double action, std::ostream &ostr)
Write the value of the action to requested output stream.
double get_thin_wall_action() const
returns the approximate action in the thin-wall approximation
Solve the one-dimensional problem using the shooting method.
Exception indicating general setup error.
One-dimensional shooting method.
void set_number_of_dimensions(int d)
bool starts_with(const std::string &option, const std::string &prefix)
void set_initial_step_size(double h)
int main(int argc, const char *argv[])
Exception indicating generic numerical error.
double get_local_maximum_location() const
returns the location of the local maximum
const Field_profiles & get_bubble_profile() const
Retrieve the field profiles after running calculate_bubble_profile.
void set_bisection_precision_bits(int b)
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.
double get_global_minimum_location() const
returns the location of the global minimum