555 *
const double m = 0.5;
556 *
const double c1 = 0.;
557 *
const double c2 = 0.;
558 *
const double factor =
561 *
for (
unsigned int d = 0;
d < dim; ++
d)
562 *
result *= -4. * std::atan(factor / std::cosh(m * p[d] +
c1));
572 * <a name=
"SineGordonProblemclass"></a>
616 *
const double final_time;
625 * <a name=
"SineGordonProblemSineGordonProblem"></a>
662 * <a name=
"SineGordonProblemmake_grid_and_dofs"></a>
688 *
if (cell->is_locally_owned())
689 *
if (cell->center().norm() < 11)
690 *
cell->set_refine_flag();
696 *
if (cell->is_locally_owned())
697 *
if (cell->center().norm() < 6)
698 *
cell->set_refine_flag();
702 *
pcout <<
" Number of global active cells: "
710 *
dof_handler.distribute_dofs(fe);
712 *
pcout <<
" Number of degrees of freedom: " << dof_handler.n_dofs()
740 *
constraints.clear();
743 *
constraints.close();
746 *
additional_data.tasks_parallel_scheme =
765 * <a name=
"SineGordonProblemoutput_results"></a>
799 *
constraints.distribute(solution);
802 *
solution.update_ghost_values();
815 *
pcout <<
" Time:" << std::setw(8) << std::setprecision(3) << time
816 *
<<
", solution norm: " << std::setprecision(5) << std::setw(7)
821 *
data_out.attach_dof_handler(dof_handler);
822 *
data_out.add_data_vector(solution,
"solution");
823 *
data_out.build_patches(mapping);
825 *
data_out.write_vtu_with_pvtu_record(
828 *
solution.zero_out_ghost_values();
835 * <a name=
"SineGordonProblemrun"></a>
836 * <
h4>SineGordonProblem::run</
h4>
862 *
pcout <<
"Number of MPI ranks: "
864 *
pcout <<
"Number of threads on each rank: "
949 *
for (time +=
time_step; time <= final_time;
956 *
wtime += timer.wall_time();
971 *
pcout <<
" Average wallclock time per time step: "
975 *
<<
"s on computations." << std::endl;
984 * <a name=
"Thecodemaincodefunction"></a>
1000 *
using namespace Step48;
1001 *
using namespace dealii;
1011 *
catch (std::exception &exc)
1013 *
std::cerr << std::endl
1015 *
<<
"----------------------------------------------------"
1017 *
std::cerr <<
"Exception on processing: " << std::endl
1018 *
<< exc.what() << std::endl
1019 *
<<
"Aborting!" << std::endl
1020 *
<<
"----------------------------------------------------"
1027 *
std::cerr << std::endl
1029 *
<<
"----------------------------------------------------"
1031 *
std::cerr <<
"Unknown exception!" << std::endl
1032 *
<<
"Aborting!" << std::endl
1033 *
<<
"----------------------------------------------------"
1056<table
align=
"center" class=
"doxtable">
1109<a name=
"Parallelrunin2Dand3D"></a><
h3>Parallel
run in 2
D and 3
D</
h3>
1121 Number
of global
active cells: 15412
1141 Time: -0.624, solution
norm: 20.488
1142 Time: -0.0381, solution
norm: 16.697
1174 Number
of global
active cells: 17592
1182 Time: -0.621, solution
norm: 123.52
1264 Intel's math kernel library (MKL). By using the function
1265 <code>vdSin</code> in MKL, the program uses half the computing time
1266 in 2D and 40 percent less time in 3D. On the other hand, the sine
1267 computation is structurally much more complicated than the simple
1268 arithmetic operations like additions and multiplications in the rest
1269 of the local operation.
1271 <li> <b>Higher order time stepping:</b> While the implementation allows for
1272 arbitrary order in the spatial part (by adjusting the degree of the finite
1273 element), the time stepping scheme is a standard second-order leap-frog
1274 scheme. Since solutions in wave propagation problems are usually very
1275 smooth, the error is likely dominated by the time stepping part. Of course,
1276 this could be cured by using smaller time steps (at a fixed spatial
1277 resolution), but it would be more efficient to use higher order time
1278 stepping as well. While it would be straight-forward to do so for a
1279 first-order system (use some Runge–Kutta scheme of higher order,
1280 probably combined with adaptive time step selection like the <a
1281 href="http://en.wikipedia.org/wiki/Dormand%E2%80%93Prince_method">Dormand–Prince
1282 method</a>), it is more challenging for the second-order formulation. At
1283 least in the finite difference community, people usually use the PDE to find
1284 spatial correction terms that improve the temporal error.
1289<a name="PlainProg"></a>
1290<h1> The plain program</h1>
1291@include "step-48.cc"
value_type * data() const noexcept
void reinit(value_type *starting_element, const std::size_t n_elements)
static unsigned int n_threads()
static constexpr std::size_t size()
#define DEAL_II_WITH_P4EST
__global__ void set(Number *val, const Number s, const size_type N)
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_hanging_node_constraints(const DoFHandler< dim, spacedim > &dof_handler, AffineConstraints< number > &constraints)
void apply(const Kokkos::TeamPolicy< MemorySpace::Default::kokkos_space::execution_space >::member_type &team_member, const Kokkos::View< Number *, MemorySpace::Default::kokkos_space > shape_data, const ViewTypeIn in, ViewTypeOut out)
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)
@ matrix
Contents is actually a matrix.
@ diagonal
Matrix is diagonal.
@ general
No special properties.
double norm(const FEValuesBase< dim > &fe, const ArrayView< const std::vector< Tensor< 1, dim > > > &Du)
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)
void call(const std::function< RT()> &function, internal::return_value< RT > &ret_val)
std::vector< unsigned int > serial(const std::vector< unsigned int > &targets, const std::function< RequestType(const unsigned int)> &create_request, const std::function< AnswerType(const unsigned int, const RequestType &)> &answer_request, const std::function< void(const unsigned int, const AnswerType &)> &process_answer, const MPI_Comm comm)
unsigned int n_mpi_processes(const MPI_Comm mpi_communicator)
T max(const T &t, const MPI_Comm mpi_communicator)
unsigned int this_mpi_process(const MPI_Comm mpi_communicator)
const std::string get_current_vectorization_level()
void run(const Iterator &begin, const std_cxx20::type_identity_t< Iterator > &end, Worker worker, Copier copier, const ScratchData &sample_scratch_data, const CopyData &sample_copy_data, const unsigned int queue_length, const unsigned int chunk_size)
void copy(const T *begin, const T *end, U *dest)
int(&) functions(const void *v1, const void *v2)
static const unsigned int invalid_unsigned_int
::VectorizedArray< Number, width > sin(const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > sqrt(const ::VectorizedArray< Number, width > &)
const ::parallel::distributed::Triangulation< dim, spacedim > * triangulation
void swap(SmartPointer< T, P > &t1, SmartPointer< T, Q > &t2)
const TriangulationDescription::Settings settings