From 0122f2b120bb65405d649ae2c4d38721760247d7 Mon Sep 17 00:00:00 2001 From: magomedovs Date: Fri, 12 Jul 2024 00:15:30 +0300 Subject: [PATCH] Indentations fixed. Identifiers fixed in .h files. --- TravelingWaves/IntegrateSystem.h | 1 - TravelingWaves/Parameters.cc | 24 +++++++++--------- TravelingWaves/Parameters.h | 18 +++++++------- TravelingWaves/Solution.cc | 12 ++++----- TravelingWaves/Solution.h | 18 +++++++------- TravelingWaves/TravelingWaveSolver.cc | 2 +- TravelingWaves/TravelingWaveSolver.h | 36 +++++++++++++-------------- TravelingWaves/calculate_profile.cc | 6 ++--- TravelingWaves/calculate_profile.h | 10 ++++---- 9 files changed, 63 insertions(+), 64 deletions(-) diff --git a/TravelingWaves/IntegrateSystem.h b/TravelingWaves/IntegrateSystem.h index 1078293f..ec714940 100644 --- a/TravelingWaves/IntegrateSystem.h +++ b/TravelingWaves/IntegrateSystem.h @@ -1,4 +1,3 @@ - #ifndef INTEGRATE_SYSTEM #define INTEGRATE_SYSTEM diff --git a/TravelingWaves/Parameters.cc b/TravelingWaves/Parameters.cc index ed55a0a7..4222601c 100644 --- a/TravelingWaves/Parameters.cc +++ b/TravelingWaves/Parameters.cc @@ -7,13 +7,13 @@ namespace TravelingWave Problem::Problem() : ParameterAcceptor("Problem") { - add_parameter("delta", delta = 0.01); - add_parameter("epsilon", epsilon = 0.1); - add_parameter("Prandtl number", Pr = 0.75); - add_parameter("Lewis number", Le = 1.0); - add_parameter("Constant of reaction rate", k = 1.0); - add_parameter("Activation energy", theta = 1.65); - add_parameter("Heat release", q = 1.7); + add_parameter("delta", delta = 0.01); + add_parameter("epsilon", epsilon = 0.1); + add_parameter("Prandtl number", Pr = 0.75); + add_parameter("Lewis number", Le = 1.0); + add_parameter("Constant of reaction rate", k = 1.0); + add_parameter("Activation energy", theta = 1.65); + add_parameter("Heat release", q = 1.7); add_parameter("Ignition Temperature", T_ign = 1.0); add_parameter("Type of the wave (deflagration / detonation)", wave_type = 1); // 0 for "deflagration"; 1 for "detonation". @@ -35,12 +35,12 @@ namespace TravelingWave } Mesh::Mesh() - : ParameterAcceptor("Mesh") + : ParameterAcceptor("Mesh") { - add_parameter("Interval left boundary", interval_left = -50.0); - add_parameter("Interval right boundary", interval_right = 20.0); - add_parameter("Refinements number", refinements_number = 10); - add_parameter("Adaptive mesh refinement", adaptive = 1); // 1 for adaptive; 0 for global. + add_parameter("Interval left boundary", interval_left = -50.0); + add_parameter("Interval right boundary", interval_right = 20.0); + add_parameter("Refinements number", refinements_number = 10); + add_parameter("Adaptive mesh refinement", adaptive = 1); // 1 for adaptive; 0 for global. } Solver::Solver() diff --git a/TravelingWaves/Parameters.h b/TravelingWaves/Parameters.h index 2dd02c65..554a5109 100644 --- a/TravelingWaves/Parameters.h +++ b/TravelingWaves/Parameters.h @@ -25,7 +25,7 @@ namespace TravelingWave struct FiniteElements : ParameterAcceptor { - FiniteElements(); + FiniteElements(); unsigned int poly_degree; unsigned int quadrature_points_number; @@ -35,25 +35,25 @@ namespace TravelingWave { Mesh(); - double interval_left; - double interval_right; - unsigned int refinements_number; - int adaptive; + double interval_left; + double interval_right; + unsigned int refinements_number; + int adaptive; }; struct Solver : ParameterAcceptor { Solver(); - double tol; + double tol; }; struct Parameters { Problem problem; - FiniteElements fe; - Mesh mesh; - Solver solver; + FiniteElements fe; + Mesh mesh; + Solver solver; }; } // namespace TravelingWave diff --git a/TravelingWaves/Solution.cc b/TravelingWaves/Solution.cc index 8087337f..962334b5 100644 --- a/TravelingWaves/Solution.cc +++ b/TravelingWaves/Solution.cc @@ -7,7 +7,7 @@ namespace TravelingWave SolutionStruct::SolutionStruct() {} SolutionStruct::SolutionStruct(const std::vector &ix, const std::vector &iu, - const std::vector &iT, const std::vector &ilambda, double iwave_speed) + const std::vector &iT, const std::vector &ilambda, double iwave_speed) : x(ix) , u(iu) , T(iT) @@ -15,7 +15,7 @@ namespace TravelingWave , wave_speed(iwave_speed) {} SolutionStruct::SolutionStruct(const std::vector &ix, const std::vector &iu, - const std::vector &iT, const std::vector &ilambda) + const std::vector &iT, const std::vector &ilambda) : SolutionStruct(ix, iu, iT, ilambda, 0.) {} @@ -59,7 +59,7 @@ namespace TravelingWave double Interpolant::value(const Point<1> &p, const unsigned int component) const { - double x = p[0]; + double x = p[0]; double res = interpolant.value(x); return res; @@ -78,9 +78,9 @@ namespace TravelingWave double SolutionVectorFunction::value(const Point<1> &p, const unsigned int component) const { double res = 0.; - if (component == 0) { res = u_interpolant.value(p); } - else if (component == 1) { res = T_interpolant.value(p); } - else if (component == 2) { res = lambda_interpolant.value(p); } + if (component == 0) { res = u_interpolant.value(p); } + else if (component == 1) { res = T_interpolant.value(p); } + else if (component == 2) { res = lambda_interpolant.value(p); } return res; } diff --git a/TravelingWaves/Solution.h b/TravelingWaves/Solution.h index 2de6619a..4bddad22 100644 --- a/TravelingWaves/Solution.h +++ b/TravelingWaves/Solution.h @@ -1,5 +1,5 @@ -#ifndef SOLUTION_STRUCT -#define SOLUTION_STRUCT +#ifndef SOLUTION +#define SOLUTION #include @@ -21,20 +21,20 @@ namespace TravelingWave { SolutionStruct(); SolutionStruct(const std::vector &ix, const std::vector &iu, - const std::vector &iT, const std::vector &ilambda, const double iwave_speed); + const std::vector &iT, const std::vector &ilambda, const double iwave_speed); SolutionStruct(const std::vector &ix, const std::vector &iu, - const std::vector &iT, const std::vector &ilambda); + const std::vector &iT, const std::vector &ilambda); void reinit(const unsigned int number_of_elements); void save_to_file(std::string filename) const; - std::vector x; // mesh coordinates (must be an increasing sequence) - std::vector u; // array of u components - std::vector T; // array of T components - std::vector lambda; // array of lambda components + std::vector x; // mesh coordinates (must be an increasing sequence) + std::vector u; // array of u components + std::vector T; // array of T components + std::vector lambda; // array of lambda components - double wave_speed; // speed of the wave + double wave_speed; // speed of the wave }; // Interpolation class diff --git a/TravelingWaves/TravelingWaveSolver.cc b/TravelingWaves/TravelingWaveSolver.cc index 09b67eaa..cb5fd1d4 100644 --- a/TravelingWaves/TravelingWaveSolver.cc +++ b/TravelingWaves/TravelingWaveSolver.cc @@ -12,7 +12,7 @@ namespace TravelingWave , triangulation_uploaded(false) , fe(FE_Q<1>(params.fe.poly_degree), 1, FE_Q<1>(params.fe.poly_degree), 1, - FE_Q<1>(params.fe.poly_degree), 1) // 3 fe basis sets, corresponding to du, dT, dlambda + FE_Q<1>(params.fe.poly_degree), 1) // 3 fe basis sets, corresponding to du, dT, dlambda , dof_handler(triangulation) , current_wave_speed(0.) , initial_guess(initial_guess_input) diff --git a/TravelingWaves/TravelingWaveSolver.h b/TravelingWaves/TravelingWaveSolver.h index b0315679..56b0187c 100644 --- a/TravelingWaves/TravelingWaveSolver.h +++ b/TravelingWaves/TravelingWaveSolver.h @@ -1,5 +1,5 @@ -#ifndef WAVE_CONSTRUCTOR -#define WAVE_CONSTRUCTOR +#ifndef TRAVELING_WAVE_SOLVER +#define TRAVELING_WAVE_SOLVER #include #include @@ -46,9 +46,9 @@ namespace TravelingWave { public: TravelingWaveSolver(const Parameters ¶meters, const SolutionStruct &initial_guess_input); - + void set_triangulation(const Triangulation<1> &itriangulation); - + void run(const std::string filename="solution", const bool save_solution_to_file=true); void get_solution(SolutionStruct &solution) const; void get_triangulation(Triangulation<1> &otriangulation) const; @@ -61,7 +61,7 @@ namespace TravelingWave void set_initial_guess(); double Heaviside_func(double x) const; - + void compute_and_factorize_jacobian(const Vector &evaluation_point_extended); double compute_residual(const Vector &evaluation_point_extended, Vector &residual); void split_extended_solution_vector(); @@ -77,37 +77,37 @@ namespace TravelingWave std::map boundary_and_centering_dof_numbers; // Parameters of the problem, taken from a .prm file. - const Parameters ¶ms; - const Problem &problem; // Reference variable, just for convenience. + const Parameters ¶ms; + const Problem &problem; // Reference variable, just for convenience. unsigned int number_of_quadrature_points; Triangulation<1> triangulation; // The flag indicating whether the triangulation was uploaded externally or created within the run member function. - bool triangulation_uploaded; - FESystem<1> fe; - DoFHandler<1> dof_handler; + bool triangulation_uploaded; + FESystem<1> fe; + DoFHandler<1> dof_handler; // Constraints for Dirichlet boundary conditions. AffineConstraints zero_boundary_constraints; - SparsityPattern sparsity_pattern_extended; - SparseMatrix jacobian_matrix_extended; - std::unique_ptr jacobian_matrix_extended_factorization; + SparsityPattern sparsity_pattern_extended; + SparseMatrix jacobian_matrix_extended; + std::unique_ptr jacobian_matrix_extended_factorization; // Finite element solution of the problem. - Vector current_solution; + Vector current_solution; // Value of the wave speed $c$. - double current_wave_speed; + double current_wave_speed; // Solution with an additional term, corresponding to the variable wave_speed. - Vector current_solution_extended; + Vector current_solution_extended; // Initial guess for Newton's iterations. - SolutionStruct initial_guess; + SolutionStruct initial_guess; - TimerOutput computing_timer; + TimerOutput computing_timer; }; } // namespace TravelingWave diff --git a/TravelingWaves/calculate_profile.cc b/TravelingWaves/calculate_profile.cc index a6a9e2ea..21be5431 100644 --- a/TravelingWaves/calculate_profile.cc +++ b/TravelingWaves/calculate_profile.cc @@ -254,10 +254,10 @@ namespace TravelingWave // Error estimation. { unsigned int sol_length = sol.x.size(); - double u_r = sol.u[sol_length-1]; // Dirichlet boundary condition - double T_r = sol.T[sol_length-1]; // Dirichlet condition only for detonation case + double u_r = sol.u[sol_length-1]; // Dirichlet boundary condition + double T_r = sol.T[sol_length-1]; // Dirichlet condition only for detonation case double u_l = sol.u[0]; - double T_l = sol.T[0]; // Dirichlet boundary condition + double T_l = sol.T[0]; // Dirichlet boundary condition double wave_speed = sol.wave_speed; std::cout << "Error estimates:" << std::endl; diff --git a/TravelingWaves/calculate_profile.h b/TravelingWaves/calculate_profile.h index ff5761d6..8194f993 100644 --- a/TravelingWaves/calculate_profile.h +++ b/TravelingWaves/calculate_profile.h @@ -1,5 +1,5 @@ -#ifndef INITIAL_GUESS -#define INITIAL_GUESS +#ifndef CALCULATE_PROFILE +#define CALCULATE_PROFILE #include "Parameters.h" #include "Solution.h" @@ -21,9 +21,9 @@ namespace TravelingWave void compute_initial_guess_deflagration(const Parameters ¶ms, SolutionStruct &initial_guess); void calculate_profile(Parameters& parameters, - const bool continuation_for_delta=false /* Compute with the continuation. */, - const double delta_start=0.01 /* The starting value of delta for the continuation method. */, - const unsigned int number_of_continuation_points=10); + const bool continuation_for_delta=false /* Compute with the continuation. */, + const double delta_start=0.01 /* The starting value of delta for the continuation method. */, + const unsigned int number_of_continuation_points=10); } // namespace TravelingWave