733 * <a name=
"codeDiffusionoutput_resultscode"></a>
815 *
data_out.attach_dof_handler(dof_handler);
816 *
data_out.add_data_vector(solution,
"solution");
818 *
data_out.build_patches();
826 *
data_out.write_vtu(output);
847 * <a name=
"codeDiffusionexplicit_methodcode"></a>
873 *
every 10 time steps.
878 *
const double initial_time,
879 *
const double final_time)
882 *
(final_time - initial_time) /
static_cast<double>(
n_time_steps);
891 *
while (time.is_at_end() ==
false)
897 *
time.get_current_time(),
898 *
time.get_next_step_size(),
900 *
time.advance_time();
904 *
if (time.get_step_number() % 10 == 0)
906 *
time.get_step_number(),
916 * <a name=
"codeDiffusionimplicit_methodcode"></a>
927 *
const double initial_time,
928 *
const double final_time)
931 *
(final_time - initial_time) /
static_cast<double>(
n_time_steps);
940 *
while (time.is_at_end() ==
false)
949 *
time.get_current_time(),
950 *
time.get_next_step_size(),
952 *
time.advance_time();
956 *
if (time.get_step_number() % 10 == 0)
958 *
time.get_step_number(),
968 * <a name=
"codeDiffusionembedded_explicit_methodcode"></a>
1000 *
const double initial_time,
1001 *
const double final_time)
1004 *
(final_time - initial_time) /
static_cast<double>(
n_time_steps);
1005 *
const double coarsen_param = 1.2;
1006 *
const double refine_param = 0.8;
1009 *
const double refine_tol = 1
e-1;
1010 *
const double coarsen_tol = 1
e-5;
1025 *
while (time.is_at_end() ==
false)
1032 *
time.get_current_time(),
1033 *
time.get_next_step_size(),
1035 *
time.set_next_step_size(new_time - time.get_current_time());
1036 *
time.advance_time();
1040 *
if (time.get_step_number() % 10 == 0)
1042 *
time.get_step_number(),
1045 *
time.set_desired_next_step_size(
1049 *
return time.get_step_number();
1057 * <a name=
"codeDiffusionruncode"></a>
1068 *
void Diffusion::run()
1073 *
for (
const auto &cell :
triangulation.active_cell_iterators())
1075 *
if (face->at_boundary())
1078 *
face->set_boundary_id(1);
1080 *
face->set_boundary_id(0);
1105 *
const double initial_time = 0.;
1106 *
const double final_time = 10.;
1108 *
std::cout <<
"Explicit methods:" << std::endl;
1113 *
std::cout <<
" Forward Euler: error=" << solution.l2_norm()
1120 *
std::cout <<
" Third order Runge-Kutta: error=" << solution.l2_norm()
1127 *
std::cout <<
" Fourth order Runge-Kutta: error=" << solution.l2_norm()
1129 *
std::cout << std::endl;
1132 *
std::cout <<
"Implicit methods:" << std::endl;
1137 *
std::cout <<
" Backward Euler: error=" << solution.l2_norm()
1144 *
std::cout <<
" Implicit Midpoint: error=" << solution.l2_norm()
1151 *
std::cout <<
" Crank-Nicolson: error=" << solution.l2_norm()
1158 *
std::cout <<
" SDIRK: error=" << solution.l2_norm()
1160 *
std::cout << std::endl;
1163 *
std::cout <<
"Embedded explicit methods:" << std::endl;
1168 *
std::cout <<
" Heun-Euler: error=" << solution.l2_norm()
1170 *
std::cout <<
" steps performed=" <<
n_steps << std::endl;
1176 *
std::cout <<
" Bogacki-Shampine: error=" << solution.l2_norm()
1178 *
std::cout <<
" steps performed=" <<
n_steps << std::endl;
1184 *
std::cout <<
" Dopri: error=" << solution.l2_norm()
1186 *
std::cout <<
" steps performed=" <<
n_steps << std::endl;
1192 *
std::cout <<
" Fehlberg: error=" << solution.l2_norm()
1194 *
std::cout <<
" steps performed=" <<
n_steps << std::endl;
1200 *
std::cout <<
" Cash-Karp: error=" << solution.l2_norm()
1202 *
std::cout <<
" steps performed=" <<
n_steps << std::endl;
1211 * <a name=
"Thecodemaincodefunction"></a>
1227 *
catch (std::exception &exc)
1229 *
std::cerr << std::endl
1231 *
<<
"----------------------------------------------------"
1233 *
std::cerr <<
"Exception on processing: " << std::endl
1234 *
<< exc.what() << std::endl
1235 *
<<
"Aborting!" << std::endl
1236 *
<<
"----------------------------------------------------"
1242 *
std::cerr << std::endl
1244 *
<<
"----------------------------------------------------"
1246 *
std::cerr <<
"Unknown exception!" << std::endl
1247 *
<<
"Aborting!" << std::endl
1248 *
<<
"----------------------------------------------------"
1298<a name=
"PlainProg"></a>
double evolve_one_time_step(const std::function< VectorType(const double, const VectorType &)> &f, const std::function< VectorType(const double, const double, const VectorType &)> &id_minus_tau_J_inverse, double t, double delta_t, VectorType &y) override
__global__ void set(Number *val, const Number s, const size_type N)
void write_pvd_record(std::ostream &out, const std::vector< std::pair< double, std::string > > ×_and_names)
void hyper_cube(Triangulation< dim, spacedim > &tria, const double left=0., const double right=1., const bool colorize=false)
void refine(Triangulation< dim, spacedim > &tria, const Vector< Number > &criteria, const double threshold, const unsigned int max_to_mark=numbers::invalid_unsigned_int)
void coarsen(Triangulation< dim, spacedim > &tria, const Vector< Number > &criteria, const double threshold)
double norm(const FEValuesBase< dim > &fe, const ArrayView< const std::vector< Tensor< 1, dim > > > &Du)
void mass_matrix(FullMatrix< double > &M, const FEValuesBase< dim > &fe, const double factor=1.)
Point< spacedim > point(const gp_Pnt &p, const double tolerance=1e-10)
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
@ RK_CLASSIC_FOURTH_ORDER
VectorType::value_type * end(VectorType &V)
std::string int_to_string(const unsigned int value, const unsigned int digits=numbers::invalid_unsigned_int)
int(&) functions(const void *v1, const void *v2)
const ::parallel::distributed::Triangulation< dim, spacedim > * triangulation