12 #ifndef SolverCBND_H__
13 #define SolverCBND_H__
15 #define BOOST_ALLOW_DEPRECATED_HEADERS
17 #include <deal.II/base/function.h>
18 #include <deal.II/grid/grid_generator.h>
19 #include <deal.II/grid/grid_in.h>
20 #include <deal.II/grid/manifold_lib.h>
22 #include <deal.II/numerics/fe_field_function.h>
24 #include "exact_solution.hpp"
25 #include "settings.hpp"
26 #include "static_scalar_solver.hpp"
28 #define TMR(__name) TimerOutput::Scope timer_section(timer, __name)
30 using namespace StaticScalarSolver;
60 unsigned int mapping_degree,
71 project_exact_solution)
74 , dirichlet_function_in(1.0)
77 TimerOutput::OutputFrequency tf =
78 (print_time_tables) ? TimerOutput::summary : TimerOutput::never;
80 TimerOutput timer(std::cout, tf, TimerOutput::cpu_and_wall_times_grouped);
98 const std::string fname;
100 const dealii::Functions::ZeroFunction<dim> dirichlet_function_out;
101 const dealii::Functions::ConstantFunction<dim> dirichlet_function_in;
106 const unsigned int nr_slice_global_refs = 10;
111 Triangulation<1, dim> triangulation_slice;
112 FE_Q<1, dim> fe_slice;
113 DoFHandler<1, dim> dof_handler_slice;
114 Vector<double> solution_slice;
118 virtual void make_mesh() override final;
119 virtual
void fill_dirichlet_stack() override final;
120 virtual
void solve() override final;
123 void data_slice(std::
string fname);
125 void attach_manifold_refine();
132 #if IS_BC_EXACT__ == 1
134 { bid_out, &exact_solution } };
136 #if IS_BC_EXACT__ == 0
138 { bid_out, &dirichlet_function_out } };
148 GridGenerator::hyper_cube(triangulation_slice, a + eps, b - eps);
150 GridGenerator::hyper_cube(triangulation_slice, a + eps, b - eps);
153 triangulation_slice.refine_global(nr_slice_global_refs);
155 dof_handler_slice.reinit(triangulation_slice);
156 dof_handler_slice.distribute_dofs(fe_slice);
157 solution_slice.reinit(dof_handler_slice.n_dofs());
162 VectorTools::interpolate(dof_handler_slice, potential, solution_slice);
164 DataOut<1, dim> data_out;
166 data_out.attach_dof_handler(dof_handler_slice);
167 data_out.add_data_vector(solution_slice,
"solution_slice");
168 data_out.build_patches();
170 std::ofstream out(fname +
"_slice" +
".gpi");
172 data_out.write_gnuplot(out);
204 if (log_cg_convergence)
205 control.enable_history_data();
207 GrowingVectorMemory<Vector<double>> memory;
208 SolverCG<Vector<double>> cg(control, memory);
210 PreconditionJacobi<SparseMatrix<double>> preconditioner;
220 if (log_cg_convergence) {
221 const std::vector<double> history_data = control.get_history_data();
223 std::ofstream ofs(fname +
"_cg_convergence.csv");
226 for (
auto item : history_data) {
227 ofs << i <<
", " << item <<
"\n";
Describes exact solution, , of the Effect of curved boundaries (cbnd/) numerical experiment.
Global settings for the Effect of curved boundaries (cbnd/) numerical experiment.
Implements the solver of the Effect of curved boundaries (cbnd/) numerical experiment.
SolverCBND(unsigned int p, unsigned int mapping_degree, unsigned int r, std::string fname)
Solves static scalar boundary value problem.
void run()
Runs the simulation.