This source file includes following definitions.
- linHeat_algo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 #ifndef LINHEAT_ALGO_H
24 #define LINHEAT_ALGO_H
25
26 #include <config.h>
27
28
29
30
31 #include "esfem.h"
32
33 void linHeat_algo(int argc, char** argv){
34 using namespace Esfem;
35
36 Dune::Fem::MPIManager::initialize(argc, argv);
37
38 const auto parameter_file =
39 "/Users/christianpower/cpp/DISS_surfaces/data/tumor_parameter.txt";
40 Io::Parameter data {argc, argv, parameter_file};
41 #ifdef DEBUG
42 std::clog << data << std::endl;
43 #endif
44
45 Grid::Grid_and_time grid {data};
46 Grid::Scal_FEfun exact_solution {"exact_solution", grid};
47 Grid::Scal_FEfun numerical_solution {"numerical_solution", grid};
48 Grid::Scal_FEfun tmp_fef {"tmp", grid};
49
50 SecOrd_op::Init_data init_data {grid};
51 SecOrd_op::Rhs rhs {grid};
52 SecOrd_op::Linear_heat solver {data, grid};
53
54 const Io::L2H1_calculator err_cal {grid, exact_solution, numerical_solution};
55 Io::Error_stream err_log {data};
56 err_log << std::scientific;
57 Io::Paraview paraview_plot {data, grid, exact_solution, numerical_solution};
58
59 init_data.interpolate(numerical_solution);
60 init_data.interpolate(exact_solution);
61 solver.mass_matrix(numerical_solution, tmp_fef);
62
63 err_log << data.global_timeStep() << ' '
64 << err_cal.l2_err() << ' ' << err_cal.h1_err() << std::endl;
65
66
67 grid.next_timeStep(data.global_timeStep());
68 for(long it =0; it < data.max_timeSteps(); ++it){
69
70
71 rhs.assemble_and_addScaled_to(tmp_fef);
72 solver.solve(tmp_fef, numerical_solution);
73 solver.mass_matrix(numerical_solution, tmp_fef);
74
75 init_data.interpolate(exact_solution);
76 err_log << data.global_timeStep() << ' '
77 << err_cal.l2_err() << ' ' << err_cal.h1_err() << std::endl;
78
79
80 grid.next_timeStep(data.global_timeStep());
81 }
82 }
83
84 #endif
85
86
87