528 *
double return_value = 0.0;
532 *
return_value = 24.0 *
std::pow(p(1) * (1.0 - p(1)), 2) +
533 *
+24.0 *
std::pow(p(0) * (1.0 - p(0)), 2) +
534 *
2.0 * (2.0 - 12.0 * p(0) + 12.0 * p(0) * p(0)) *
535 *
(2.0 - 12.0 * p(1) + 12.0 * p(1) * p(1));
540 *
24.0 *
std::pow(p(1) * (1.0 - p(1)) * p(2) * (1.0 - p(2)), 2) +
541 *
24.0 *
std::pow(p(0) * (1.0 - p(0)) * p(2) * (1.0 - p(2)), 2) +
542 *
24.0 *
std::pow(p(0) * (1.0 - p(0)) * p(1) * (1.0 - p(1)), 2) +
543 *
2.0 * (2.0 - 12.0 * p(0) + 12.0 * p(0) * p(0)) *
544 *
(2.0 - 12.0 * p(1) + 12.0 * p(1) * p(1)) *
545 *
std::pow(p(2) * (1.0 - p(2)), 2) +
546 *
2.0 * (2.0 - 12.0 * p(0) + 12.0 * p(0) * p(0)) *
547 *
(2.0 - 12.0 * p(2) + 12.0 * p(2) * p(2)) *
548 *
std::pow(p(1) * (1.0 - p(1)), 2) +
549 *
2.0 * (2.0 - 12.0 * p(1) + 12.0 * p(1) * p(1)) *
550 *
(2.0 - 12.0 * p(2) + 12.0 * p(2) * p(2)) *
554 *
Assert(
false, ExcNotImplemented());
556 *
return return_value;
576 *
const unsigned int component = 0)
const override;
580 *
const unsigned int component = 0)
const override;
584 *
const unsigned int component = 0)
const override;
591 *
const unsigned int )
const
593 *
double return_value = 0.0;
597 *
return_value =
std::pow(p(0) * (1.0 - p(0)) * p(1) * (1.0 - p(1)), 2);
601 *
return_value =
std::pow(p(0) * (1.0 - p(0)) * p(1) * (1.0 - p(1)) *
602 *
p(2) * (1.0 - p(2)),
606 *
Assert(
false, ExcNotImplemented());
608 *
return return_value;
616 *
const unsigned int )
const
633 *
std::pow(p(1) * (1.0 - p(1)) * p(2) * (1.0 - p(2)), 2);
636 *
std::pow(p(0) * (1.0 - p(0)) * p(2) * (1.0 - p(2)), 2);
639 *
std::pow(p(0) * (1.0 - p(0)) * p(1) * (1.0 - p(1)), 2);
642 *
Assert(
false, ExcNotImplemented());
652 *
const unsigned int )
const
658 *
return_hessian[0][0] = (2.0 - 12.0 * p(0) + 12.0 * p(0) * p(0)) *
663 *
return_hessian[1][1] = (2.0 - 12.0 * p(1) + 12.0 * p(1) * p(1)) *
669 *
(2.0 - 12.0 * p(0) + 12.0 * p(0) * p(0)) *
670 *
std::pow(p(1) * (1.0 - p(1)) * p(2) * (1.0 - p(2)), 2);
680 *
(2.0 - 12.0 * p(1) + 12.0 * p(1) * p(1)) *
681 *
std::pow(p(0) * (1.0 - p(0)) * p(2) * (1.0 - p(2)), 2);
687 *
(2.0 - 12.0 * p(2) + 12.0 * p(2) * p(2)) *
688 *
std::pow(p(0) * (1.0 - p(0)) * p(1) * (1.0 - p(1)), 2);
691 *
Assert(
false, ExcNotImplemented());
701 * <a name=
"ImplementationofthecodeBiLaplacianLDGLiftcodeclass"></a>
707 * <a name=
"BiLaplacianLDGLiftBiLaplacianLDGLift"></a>
719 *
const unsigned int fe_degree,
735 * <a name=
"BiLaplacianLDGLiftmake_grid"></a>
741 * <
code>GridGenerator::hyper_cube</code>
and then refine
it using
749 *
std::cout <<
"Building the mesh............." << std::endl;
755 *
std::cout <<
"Number of active cells: " <<
triangulation.n_active_cells()
764 * <a name=
"BiLaplacianLDGLiftsetup_system"></a>
771 * right-
hand side vectors
786 *
dof_handler.distribute_dofs(fe);
788 *
std::cout <<
"Number of degrees of freedom: " << dof_handler.n_dofs()
793 *
const auto dofs_per_cell = fe.dofs_per_cell;
795 *
for (
const auto &cell : dof_handler.active_cell_iterators())
798 *
cell->get_dof_indices(dofs);
800 *
for (
unsigned int f = 0; f < cell->n_faces(); ++f)
801 *
if (!cell->face(f)->at_boundary())
805 *
std::vector<types::global_dof_index> tmp(dofs_per_cell);
808 *
dofs.insert(std::end(dofs), std::begin(tmp), std::end(tmp));
811 *
for (
const auto i : dofs)
819 *
sparsity_pattern.copy_from(
dsp);
822 *
matrix.reinit(sparsity_pattern);
825 *
solution.
reinit(dof_handler.n_dofs());
834 *
std::ofstream out(
"sparsity-pattern.svg");
835 *
sparsity_pattern.print_svg(out);
843 * <a name=
"BiLaplacianLDGLiftassemble_system"></a>
855 *
std::cout <<
"Assembling the system............." << std::endl;
860 *
std::cout <<
"Done. " << std::endl;
868 * <a name=
"BiLaplacianLDGLiftassemble_matrix"></a>
886 *
const unsigned int n_q_points = quad.
size();
897 *
const unsigned int n_dofs = fe_values.dofs_per_cell;
899 *
std::vector<types::global_dof_index> local_dof_indices(n_dofs);
938 *
std::vector<std::vector<std::vector<Tensor<2, dim>>>>
942 *
for (
const auto &cell : dof_handler.active_cell_iterators())
945 *
cell->get_dof_indices(local_dof_indices);
966 *
for (
unsigned int q = 0;
q < n_q_points; ++
q)
968 *
const double dx = fe_values.JxW(
q);
970 *
for (
unsigned int i = 0; i < n_dofs; ++i)
971 *
for (
unsigned int j = 0;
j < n_dofs; ++
j)
980 *
for (
unsigned int i = 0; i < n_dofs; ++i)
981 *
for (
unsigned int j = 0;
j < n_dofs; ++
j)
983 *
matrix(local_dof_indices[i], local_dof_indices[
j]) +=
1000 *
const bool at_boundary = face->at_boundary();
1021 *
for (
unsigned int q = 0;
q < n_q_points; ++
q)
1023 *
const double dx = fe_values.JxW(
q);
1025 *
for (
unsigned int i = 0; i < n_dofs; ++i)
1027 *
for (
unsigned int j = 0;
j < n_dofs; ++
j)
1047 *
for (
unsigned int i = 0; i < n_dofs; ++i)
1049 *
for (
unsigned int j = 0;
j < n_dofs; ++
j)
1051 *
matrix(local_dof_indices[i],
1055 *
local_dof_indices[
j]) +=
1078 *
const bool at_boundary = face->at_boundary();
1116 *
for (
unsigned int q = 0;
q < n_q_points; ++
q)
1118 *
const double dx = fe_values.JxW(
q);
1120 *
for (
unsigned int i = 0; i < n_dofs; ++i)
1121 *
for (
unsigned int j = 0;
j < n_dofs; ++
j)
1140 *
for (
unsigned int i = 0; i < n_dofs; ++i)
1141 *
for (
unsigned int j = 0;
j < n_dofs; ++
j)
1166 *
const double mesh_inv = 1.0 / face->diameter();
1168 *
1.0 /
std::pow(face->diameter(), 3);
1174 *
const bool at_boundary = face->at_boundary();
1177 *
for (
unsigned int q = 0;
q < n_q_points_face; ++
q)
1181 *
for (
unsigned int i = 0; i < n_dofs; ++i)
1182 *
for (
unsigned int j = 0;
j < n_dofs; ++
j)
1199 *
cell->neighbor_of_neighbor(
face_no);
1218 *
for (
unsigned int q = 0;
q < n_q_points_face; ++
q)
1222 *
for (
unsigned int i = 0; i < n_dofs; ++i)
1224 *
for (
unsigned int j = 0;
j < n_dofs; ++
j)
1268 *
for (
unsigned int i = 0; i < n_dofs; ++i)
1270 *
for (
unsigned int j = 0;
j < n_dofs; ++
j)
1272 *
matrix(local_dof_indices[i], local_dof_indices[
j]) +=
1279 *
for (
unsigned int i = 0; i < n_dofs; ++i)
1281 *
for (
unsigned int j = 0;
j < n_dofs; ++
j)
1283 *
matrix(local_dof_indices[i],
1304 * <a name=
"BiLaplacianLDGLiftassemble_rhs"></a>
1315 *
template <
int dim>
1324 *
const unsigned int n_dofs = fe_values.dofs_per_cell;
1330 *
std::vector<types::global_dof_index> local_dof_indices(n_dofs);
1332 *
for (
const auto &cell : dof_handler.active_cell_iterators())
1334 *
fe_values.
reinit(cell);
1335 *
cell->get_dof_indices(local_dof_indices);
1340 *
const double dx = fe_values.JxW(
q);
1342 *
for (
unsigned int i = 0; i < n_dofs; ++i)
1346 *
fe_values.shape_value(i,
q) *
dx;
1350 *
for (
unsigned int i = 0; i < n_dofs; ++i)
1360 * <a name=
"BiLaplacianLDGLiftsolve"></a>
1361 * <
h4>BiLaplacianLDGLift::solve</
h4>
1371 *
template <
int dim>
1384 * <a name=
"BiLaplacianLDGLiftcompute_errors"></a>
1395 *
template <
int dim>
1419 *
const unsigned int n_q_points = quad.
size();
1438 *
std::vector<double> solution_values(n_q_points_face);
1440 *
std::vector<Tensor<1, dim>> solution_gradients(n_q_points_face);
1443 *
for (
const auto &cell : dof_handler.active_cell_iterators())
1445 *
fe_values.
reinit(cell);
1456 *
for (
unsigned int q = 0;
q < n_q_points; ++
q)
1458 *
const double dx = fe_values.JxW(
q);
1484 *
const double mesh_inv = 1.0 / face->diameter();
1486 *
1.0 /
std::pow(face->diameter(), 3);
1490 *
fe_face.get_function_values(solution, solution_values);
1491 *
fe_face.get_function_gradients(solution, solution_gradients);
1493 *
const bool at_boundary = face->at_boundary();
1496 *
for (
unsigned int q = 0;
q < n_q_points_face; ++
q)
1522 *
cell->neighbor_of_neighbor(
face_no);
1536 *
fe_face.get_function_values(solution, solution_values);
1539 *
fe_face.get_function_gradients(solution,
1540 *
solution_gradients);
1544 *
for (
unsigned int q = 0;
q < n_q_points_face; ++
q)
1563 *
solution_values[
q],
1568 *
solution_values[
q],
1584 *
std::cout <<
"DG H2 norm of the error: " <<
error_H2 << std::endl;
1585 *
std::cout <<
"DG H1 norm of the error: " <<
error_H1 << std::endl;
1586 *
std::cout <<
" L2 norm of the error: " <<
error_L2 << std::endl;
1594 * <a name=
"BiLaplacianLDGLiftoutput_results"></a>
1603 *
template <
int dim>
1607 *
data_out.attach_dof_handler(dof_handler);
1608 *
data_out.add_data_vector(solution,
"solution");
1609 *
data_out.build_patches();
1611 *
std::ofstream output(
"solution.vtk");
1612 *
data_out.write_vtk(output);
1620 * <a name=
"BiLaplacianLDGLiftassemble_local_matrix"></a>
1631 *
template <
int dim>
1634 *
const unsigned int n_q_points,
1642 *
for (
unsigned int q = 0;
q < n_q_points; ++
q)
1646 *
for (
unsigned int m = 0; m < n_dofs; ++m)
1647 *
for (
unsigned int n = 0; n < n_dofs; ++n)
1662 * <a name=
"BiLaplacianLDGLiftcompute_discrete_hessians"></a>
1713 *
const unsigned int n_q_points = quad.
size();
1734 *
const unsigned int n_dofs = fe_values.dofs_per_cell;
1766 *
fe_values.
reinit(cell);
1777 *
for (
unsigned int i = 0; i < n_dofs; ++i)
1778 *
for (
unsigned int q = 0;
q < n_q_points; ++
q)
1782 *
for (
unsigned int face_no = 0;
1799 *
for (
unsigned int i = 0; i < n_dofs; ++i)
1809 *
const bool at_boundary = face->at_boundary();
1831 *
for (
unsigned int q = 0;
q < n_q_points_face; ++
q)
1855 *
for (
unsigned int q = 0;
q < n_q_points_face; ++
q)
1885 *
for (
unsigned int q = 0;
q < n_q_points; ++
q)
1920 *
const bool at_boundary = face->at_boundary();
1937 *
cell->neighbor_of_neighbor(
face_no);
1940 *
for (
unsigned int i = 0; i < n_dofs; ++i)
1948 *
for (
unsigned int q = 0;
q < n_q_points_face; ++
q)
1971 *
for (
unsigned int q = 0;
q < n_q_points_face; ++
q)
1994 *
for (
unsigned int q = 0;
q < n_q_points; ++
q)
2019 * <a name=
"BiLaplacianLDGLiftrun"></a>
2020 * <
h4>BiLaplacianLDGLift::run</
h4>
2023 *
template <
int dim>
2044 * <a name=
"Thecodemaincodefunction"></a>
2059 *
const unsigned int n_ref = 3;
2061 *
const unsigned int degree =
2076 *
catch (std::exception &exc)
2078 *
std::cerr << std::endl
2080 *
<<
"----------------------------------------------------"
2082 *
std::cerr <<
"Exception on processing: " << std::endl
2083 *
<< exc.what() << std::endl
2084 *
<<
"Aborting!" << std::endl
2085 *
<<
"----------------------------------------------------"
2091 *
std::cerr << std::endl
2093 *
<<
"----------------------------------------------------"
2095 *
std::cerr <<
"Unknown exception!" << std::endl
2096 *
<<
"Aborting!" << std::endl
2097 *
<<
"----------------------------------------------------"
2125<table
align=
"center" class=
"doxtable">
2214<table
align=
"center" class=
"doxtable">
2263<a name=
"PlainProg"></a>
void reinit(value_type *starting_element, const std::size_t n_elements)
const SmartPointer< const FiniteElement< dim, spacedim >, FEValuesBase< dim, spacedim > > fe
const Quadrature< dim > quadrature
void reinit(const TriaIterator< DoFCellAccessor< dim, spacedim, level_dof_access > > &cell)
__global__ void set(Number *val, const Number s, const size_type N)
#define Assert(cond, exc)
typename ActiveSelector::face_iterator face_iterator
typename ActiveSelector::active_cell_iterator active_cell_iterator
void loop(ITERATOR begin, std_cxx20::type_identity_t< ITERATOR > end, DOFINFO &dinfo, INFOBOX &info, const std::function< void(DOFINFO &, typename INFOBOX::CellInfo &)> &cell_worker, const std::function< void(DOFINFO &, typename INFOBOX::CellInfo &)> &boundary_worker, const std::function< void(DOFINFO &, DOFINFO &, typename INFOBOX::CellInfo &, typename INFOBOX::CellInfo &)> &face_worker, ASSEMBLER &assembler, const LoopControl &lctrl=LoopControl())
void make_flux_sparsity_pattern(const DoFHandler< dim, spacedim > &dof_handler, SparsityPatternBase &sparsity_pattern)
@ update_hessians
Second derivatives of shape functions.
@ update_values
Shape function values.
@ update_normal_vectors
Normal vectors.
@ update_JxW_values
Transformed quadrature weights.
@ update_gradients
Shape function gradients.
@ update_quadrature_points
Transformed quadrature points.
CGAL::Exact_predicates_exact_constructions_kernel_with_sqrt K
void approximate(SynchronousIterators< std::tuple< typename DoFHandler< dim, spacedim >::active_cell_iterator, Vector< float >::iterator > > const &cell, const Mapping< dim, spacedim > &mapping, const DoFHandler< dim, spacedim > &dof_handler, const InputVector &solution, const unsigned int component)
void hyper_cube(Triangulation< dim, spacedim > &tria, const double left=0., const double right=1., const bool colorize=false)
@ matrix
Contents is actually a matrix.
double norm(const FEValuesBase< dim > &fe, const ArrayView< const std::vector< Tensor< 1, dim > > > &Du)
void L2(Vector< number > &result, const FEValuesBase< dim > &fe, const std::vector< double > &input, 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)
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
Tensor< 2, dim, Number > F(const Tensor< 2, dim, Number > &Grad_u)
void call(const std::function< RT()> &function, internal::return_value< RT > &ret_val)
VectorType::value_type * end(VectorType &V)
unsigned int n_cells(const internal::TriangulationImplementation::NumberCache< 1 > &c)
int(&) functions(const void *v1, const void *v2)
void assemble(const MeshWorker::DoFInfoBox< dim, DOFINFO > &dinfo, A *assembler)
void reinit(MatrixBlock< MatrixType > &v, const BlockSparsityPattern &p)
::VectorizedArray< Number, width > sqrt(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > pow(const ::VectorizedArray< Number, width > &, const Number p)
unsigned int global_dof_index
const ::parallel::distributed::Triangulation< dim, spacedim > * triangulation
DEAL_II_HOST constexpr Number trace(const SymmetricTensor< 2, dim2, Number > &)