HyperHDG
parabolic.hxx
Go to the documentation of this file.
1 #pragma once // Ensure that file is included only once in a single compilation.
2 
6 #include <HyperHDG/hy_assert.hxx>
7 #include <HyperHDG/plot.hxx>
8 #include <algorithm>
9 #include <array>
10 #include <cmath>
11 
12 namespace GlobalLoop
13 {
14 /*!*************************************************************************************************
15  * \brief Combine local solver and global information for parabolic problems.
16  *
17  * \tparam TopologyT Class type containing topological information.
18  * \tparam GeometryT Class type containing geometrical information.
19  * \tparam NodeDescriptorT Class type containing the information of nodes of hyperedges.
20  * \tparam LocalSolverT Class type of the local solver.
21  * \tparam LargeVecT Clas type of large, global vector.
22  * \tparam dof_index_t Index type of hyperedges. Default is \c unsigned \c int.
23  *
24  * \authors Guido Kanschat, Heidelberg University, 2019--2020.
25  * \authors Andreas Rupp, Heidelberg University, 2019--2020.
26  **************************************************************************************************/
27 template <class TopologyT,
28  class GeometryT,
29  class NodeDescriptorT,
30  class LocalSolverT,
31  typename LargeVecT = std::vector<double>,
32  typename dof_index_t = unsigned int>
33 class Parabolic
34 {
35  /*!***********************************************************************************************
36  * \brief Prepare struct to check for function to exist (cf. compile_time_tricks.hxx).
37  ************************************************************************************************/
38  HAS_MEMBER_FUNCTION(trace_to_flux, has_trace_to_flux);
39  /*!***********************************************************************************************
40  * \brief Prepare struct to check for function to exist (cf. compile_time_tricks.hxx).
41  ************************************************************************************************/
42  HAS_MEMBER_FUNCTION(residual_flux, has_residual_flux);
43  /*!***********************************************************************************************
44  * \brief Prepare struct to check for function to exist (cf. compile_time_tricks.hxx).
45  ************************************************************************************************/
46  HAS_MEMBER_FUNCTION(make_initial, has_make_initial);
47  /*!***********************************************************************************************
48  * \brief Prepare struct to check for function to exist (cf. compile_time_tricks.hxx).
49  ************************************************************************************************/
50  HAS_MEMBER_FUNCTION(errors, has_errors);
51  /*!***********************************************************************************************
52  * \brief Prepare struct to check for function to exist (cf. compile_time_tricks.hxx).
53  ************************************************************************************************/
54  HAS_MEMBER_FUNCTION(set_data, has_set_data);
55  /*!***********************************************************************************************
56  * \brief Some constant variable that might be helpful.
57  ************************************************************************************************/
58  static constexpr unsigned int hyEdge_dim = TopologyT::hyEdge_dim();
59  /*!***********************************************************************************************
60  * \brief Some constant variable that might be helpful.
61  ************************************************************************************************/
62  static constexpr unsigned int n_dofs_per_node = LocalSolverT::n_glob_dofs_per_node();
63 
64  /*!***********************************************************************************************
65  * \brief Floating type is determined by floating type of large vector's entries.
66  ************************************************************************************************/
67  using dof_value_t = typename LargeVecT::value_type;
68 
69  private:
70  /*!***********************************************************************************************
71  * \brief Instantiation of a hypergraph.
72  ************************************************************************************************/
73  HDGHyperGraph<LocalSolverT::n_glob_dofs_per_node(),
74  TopologyT,
75  GeometryT,
76  NodeDescriptorT,
77  typename LocalSolverT::data_type>
79  /*!***********************************************************************************************
80  * \brief Instantiation of a local solver.
81  ************************************************************************************************/
82  const LocalSolverT local_solver_;
83  /*!***********************************************************************************************
84  * \brief Struct encoding the options for plotting.
85  ************************************************************************************************/
87 
88  public:
89  /*!***********************************************************************************************
90  * \brief Abstract problem constructor.
91  *
92  * Constructor for class containing a HyperGraph and a local solver that solve a PDE on a
93  * hyperedge.
94  *
95  * \param construct_topo Information to construct a topology.
96  * \param construct_geom Information to construct a geometry.
97  * \param construct_loc_sol Information to construct a local solver.
98  ************************************************************************************************/
99  Parabolic(const typename TopologyT::constructor_value_type& construct_topo,
100  const typename GeometryT::constructor_value_type& construct_geom,
101  const typename LocalSolverT::constructor_value_type& construct_loc_sol)
102  : hyper_graph_(construct_topo, construct_geom), local_solver_(construct_loc_sol)
103  {
104  static_assert(TopologyT::hyEdge_dim() == GeometryT::hyEdge_dim(),
105  "Hyperedge dimension of topology and geometry must be equal!");
106  static_assert(TopologyT::space_dim() == GeometryT::space_dim(),
107  "Space dimension of topology and geometry must be equal!");
108  static_assert(TopologyT::hyEdge_dim() == LocalSolverT::hyEdge_dim(),
109  "Hyperedge dimension of hypergraph and local solver must be equal!");
110  }
111  /*!***********************************************************************************************
112  * \brief Abstract problem constructor.
113  *
114  * Constructor for class containing a HyperGraph and a local solver that solve a PDE on a
115  * hyperedge.
116  *
117  * \param construct_topo Information to construct a topology.
118  * \param construct_loc_sol Information to construct a local solver.
119  ************************************************************************************************/
120  Parabolic(const typename TopologyT::constructor_value_type& construct_topo,
121  const typename LocalSolverT::constructor_value_type& construct_loc_sol)
122  : hyper_graph_(construct_topo), local_solver_(construct_loc_sol)
123  {
124  static_assert(TopologyT::hyEdge_dim() == GeometryT::hyEdge_dim(),
125  "Hyperedge dimension of topology and geometry must be equal!");
126  static_assert(TopologyT::space_dim() == GeometryT::space_dim(),
127  "Space dimension of topology and geometry must be equal!");
128  static_assert(TopologyT::hyEdge_dim() == LocalSolverT::hyEdge_dim(),
129  "Hyperedge dimension of hypergraph and local solver must be equal!");
130  }
131  /*!***********************************************************************************************
132  * \brief Abstract problem constructor.
133  *
134  * Constructor for class containing a HyperGraph and a local solver that solve a PDE on a
135  * hyperedge.
136  *
137  * \param construct_topo Information to construct a topology.
138  ************************************************************************************************/
139  Parabolic(const typename TopologyT::constructor_value_type& construct_topo)
140  : hyper_graph_(construct_topo)
141  {
142  static_assert(TopologyT::hyEdge_dim() == GeometryT::hyEdge_dim(),
143  "Hyperedge dimension of topology and geometry must be equal!");
144  static_assert(TopologyT::space_dim() == GeometryT::space_dim(),
145  "Space dimension of topology and geometry must be equal!");
146  static_assert(TopologyT::hyEdge_dim() == LocalSolverT::hyEdge_dim(),
147  "Hyperedge dimension of hypergraph and local solver must be equal!");
148  }
149  /*!***********************************************************************************************
150  * \brief Returns vector of appropriate size for the predefined problem.
151  *
152  * Returns a vector containing only the value zero, but of the size \f$n\f$ which is also the
153  * number which is returned if \c size_of_system() is evaluated.
154  *
155  * \retval zero A vector of the correct size for the unknowns of the given problem.
156  ************************************************************************************************/
157  LargeVecT zero_vector() const { return LargeVecT(hyper_graph_.n_global_dofs(), 0.); }
158  /*!***********************************************************************************************
159  * \brief Evaluate condensed matrix-vector product.
160  *
161  * Function that evaluates the condensed, matrix-free version of the matrix-vector product
162  * \f$A x = y\f$, where \f$A\f$ is the condensed matrix of the LDG-H method that needs to be
163  * inverted for a time step, \f$x\f$ is the vector of parameters to define the skeletal variable
164  * \f$\lambda\f$, and \f$y\f$ is the resulting vector, which has the same size as the input vector
165  * \f$x\f$.
166  *
167  * \param x_vec A vector containing the input vector \f$x\f$.
168  * \param time Time at which the new time step will end.
169  * \retval y_vec A vector containing the product \f$y = Ax\f$.
170  ************************************************************************************************/
171  template <typename hyNode_index_t = dof_index_t>
172  LargeVecT trace_to_flux(const LargeVecT& x_vec, const dof_value_t time = 0.)
173  {
174  constexpr unsigned int hyEdge_dim = TopologyT::hyEdge_dim();
175  constexpr unsigned int n_dofs_per_node = LocalSolverT::n_glob_dofs_per_node();
176 
177  LargeVecT vec_Ax(x_vec.size(), 0.);
179  std::array<std::array<dof_value_t, n_dofs_per_node>, 2 * hyEdge_dim> hyEdge_dofs_old,
180  hyEdge_dofs_new;
181 
182  // Do matrix--vector multiplication by iterating over all hyperedges.
183  std::for_each(hyper_graph_.begin(), hyper_graph_.end(), [&](auto hyper_edge) {
184  // Fill x_vec's degrees of freedom of a hyperedge into hyEdge_dofs array.
185  hyEdge_hyNodes = hyper_edge.topology.get_hyNode_indices();
186  for (unsigned int hyNode = 0; hyNode < hyEdge_hyNodes.size(); ++hyNode)
187  {
188  hyper_graph_.hyNode_factory().get_dof_values(hyEdge_hyNodes[hyNode], x_vec,
189  hyEdge_dofs_old[hyNode]);
190  hyEdge_dofs_new[hyNode].fill(0.);
191  }
192 
193  // Turn degrees of freedom of x_vec that have been stored locally into those of vec_Ax.
194  if constexpr (
195  has_trace_to_flux<
196  LocalSolverT,
197  std::array<std::array<dof_value_t, n_dofs_per_node>, 2 * TopologyT::hyEdge_dim()>&(
198  std::array<std::array<dof_value_t, n_dofs_per_node>, 2 * TopologyT::hyEdge_dim()>&,
199  std::array<std::array<dof_value_t, n_dofs_per_node>, 2 * TopologyT::hyEdge_dim()>&,
200  dof_value_t)>::value)
201  local_solver_.trace_to_flux(hyEdge_dofs_old, hyEdge_dofs_new, time);
202  else if constexpr (
203  has_trace_to_flux<
204  LocalSolverT,
205  std::array<std::array<dof_value_t, n_dofs_per_node>, 2 * TopologyT::hyEdge_dim()>&(
206  std::array<std::array<dof_value_t, n_dofs_per_node>, 2 * TopologyT::hyEdge_dim()>&,
207  std::array<std::array<dof_value_t, n_dofs_per_node>, 2 * TopologyT::hyEdge_dim()>&,
208  decltype(hyper_edge)&, dof_value_t)>::value)
209  local_solver_.trace_to_flux(hyEdge_dofs_old, hyEdge_dofs_new, hyper_edge, time);
210  else
211  hy_assert(false, "Function seems not to be implemented!");
212 
213  // Fill hyEdge_dofs array degrees of freedom into vec_Ax.
214  for (unsigned int hyNode = 0; hyNode < hyEdge_hyNodes.size(); ++hyNode)
215  hyper_graph_.hyNode_factory().add_to_dof_values(hyEdge_hyNodes[hyNode], vec_Ax,
216  hyEdge_dofs_new[hyNode]);
217  });
218 
219  return vec_Ax;
220  }
221  /*!***********************************************************************************************
222  * \brief Evaluate condensed matrix-vector product.
223  *
224  * Function that evaluates the condensed, matrix-free version of the matrix-vector product
225  * \f$A x = y\f$, where \f$A\f$ is the condensed matrix of the LDG-H method that needs to be
226  * inverted to do a time step, \f$x\f$ is the vector of parameters to define the skeletal variable
227  * \f$\lambda\f$, and \f$y\f$ is the resulting vector, which has the same size as the input vector
228  * \f$x\f$.
229  *
230  * \param x_vec A vector containing the input vector \f$x\f$.
231  * \param time Time at which the time step ends.
232  * \retval y_vec A vector containing the product \f$y = Ax\f$.
233  ************************************************************************************************/
234  template <typename hyNode_index_t = dof_index_t>
235  std::vector<dof_value_t> residual_flux(const std::vector<dof_value_t>& x_vec,
236  const dof_value_t time = 0.)
237  {
238  constexpr unsigned int hyEdge_dim = TopologyT::hyEdge_dim();
239  constexpr unsigned int n_dofs_per_node = LocalSolverT::n_glob_dofs_per_node();
240 
241  LargeVecT vec_Ax(x_vec.size(), 0.);
243  std::array<std::array<dof_value_t, n_dofs_per_node>, 2 * hyEdge_dim> hyEdge_dofs_old,
244  hyEdge_dofs_new;
245 
246  // Do matrix--vector multiplication by iterating over all hyperedges.
247  std::for_each(hyper_graph_.begin(), hyper_graph_.end(), [&](auto hyper_edge) {
248  // Fill x_vec's degrees of freedom of a hyperedge into hyEdge_dofs array.
249  hyEdge_hyNodes = hyper_edge.topology.get_hyNode_indices();
250  for (unsigned int hyNode = 0; hyNode < hyEdge_hyNodes.size(); ++hyNode)
251  {
252  hyper_graph_.hyNode_factory().get_dof_values(hyEdge_hyNodes[hyNode], x_vec,
253  hyEdge_dofs_old[hyNode]);
254  hyEdge_dofs_new[hyNode].fill(0.);
255  }
256 
257  // Turn degrees of freedom of x_vec that have been stored locally into those of vec_Ax.
258  if constexpr (
259  has_residual_flux<
260  LocalSolverT,
261  std::array<std::array<dof_value_t, n_dofs_per_node>, 2 * TopologyT::hyEdge_dim()>&(
262  std::array<std::array<dof_value_t, n_dofs_per_node>, 2 * TopologyT::hyEdge_dim()>&,
263  std::array<std::array<dof_value_t, n_dofs_per_node>, 2 * TopologyT::hyEdge_dim()>&,
264  dof_value_t)>::value)
265  {
266  local_solver_.residual_flux(hyEdge_dofs_old, hyEdge_dofs_new, time);
267  }
268  else if constexpr (
269  has_residual_flux<
270  LocalSolverT,
271  std::array<std::array<dof_value_t, n_dofs_per_node>, 2 * TopologyT::hyEdge_dim()>&(
272  std::array<std::array<dof_value_t, n_dofs_per_node>, 2 * TopologyT::hyEdge_dim()>&,
273  std::array<std::array<dof_value_t, n_dofs_per_node>, 2 * TopologyT::hyEdge_dim()>&,
274  decltype(hyper_edge)&, dof_value_t)>::value)
275  {
276  local_solver_.residual_flux(hyEdge_dofs_old, hyEdge_dofs_new, hyper_edge, time);
277  }
278  else
279  hy_assert(false, "Function seems not to be implemented!");
280 
281  // Fill hyEdge_dofs array degrees of freedom into vec_Ax.
282  for (unsigned int hyNode = 0; hyNode < hyEdge_hyNodes.size(); ++hyNode)
283  hyper_graph_.hyNode_factory().add_to_dof_values(hyEdge_hyNodes[hyNode], vec_Ax,
284  hyEdge_dofs_new[hyNode]);
285  });
286 
287  return vec_Ax;
288  }
289  /*!***********************************************************************************************
290  * \brief Set data using the result of the old time step.
291  *
292  * \param x_vec A \c std::vector containing the input vector \f$x\f$.
293  * \param time Time at which the old time step ended.
294  ************************************************************************************************/
295  template <typename hyNode_index_t = dof_index_t>
296  void set_data(const LargeVecT& x_vec, const dof_value_t time = 0.)
297  {
298  constexpr unsigned int hyEdge_dim = TopologyT::hyEdge_dim();
299  constexpr unsigned int n_dofs_per_node = LocalSolverT::n_glob_dofs_per_node();
300 
302  std::array<std::array<dof_value_t, n_dofs_per_node>, 2 * hyEdge_dim> hyEdge_dofs;
303 
304  // Do matrix--vector multiplication by iterating over all hyperedges.
305  std::for_each(hyper_graph_.begin(), hyper_graph_.end(), [&](auto hyper_edge) {
306  // Fill x_vec's degrees of freedom of a hyperedge into hyEdge_dofs array.
307  hyEdge_hyNodes = hyper_edge.topology.get_hyNode_indices();
308  for (unsigned int hyNode = 0; hyNode < hyEdge_hyNodes.size(); ++hyNode)
309  hyper_graph_.hyNode_factory().get_dof_values(hyEdge_hyNodes[hyNode], x_vec,
310  hyEdge_dofs[hyNode]);
311 
312  // Turn degrees of freedom of x_vec that have been stored locally into those of vec_Ax.
313  if constexpr (has_set_data<LocalSolverT,
314  void(std::array<std::array<dof_value_t, n_dofs_per_node>,
315  2 * TopologyT::hyEdge_dim()>&,
316  dof_value_t)>::value)
317  {
318  local_solver_.set_data(hyEdge_dofs, time);
319  }
320  else if constexpr (has_set_data<LocalSolverT,
321  void(std::array<std::array<dof_value_t, n_dofs_per_node>,
322  2 * TopologyT::hyEdge_dim()>&,
323  decltype(hyper_edge)&, dof_value_t)>::value)
324  {
325  local_solver_.set_data(hyEdge_dofs, hyper_edge, time);
326  }
327  else
328  hy_assert(false, "Function seems not to be implemented!");
329  });
330  }
331  /*!***********************************************************************************************
332  * \brief Evaluate the initial flux of the problem.
333  *
334  * \param x_vec A vector containing the input vector \f$x\f$.
335  * \param time Time for initial data.
336  * \retval y_vec A vector containing the initial fluxes.
337  ************************************************************************************************/
338  template <typename hyNode_index_t = dof_index_t>
339  LargeVecT make_initial(const LargeVecT& x_vec, const dof_index_t time = 0.)
340  {
341  constexpr unsigned int hyEdge_dim = TopologyT::hyEdge_dim();
342  constexpr unsigned int n_dofs_per_node = LocalSolverT::n_glob_dofs_per_node();
343 
344  std::vector<dof_value_t> vec_Ax(x_vec.size(), 0.);
346  std::array<std::array<dof_value_t, n_dofs_per_node>, 2 * hyEdge_dim> hyEdge_dofs;
347 
348  // Do matrix--vector multiplication by iterating over all hyperedges.
349  std::for_each(hyper_graph_.begin(), hyper_graph_.end(), [&](auto hyper_edge) {
350  // Fill x_vec's degrees of freedom of a hyperedge into hyEdge_dofs array.
351  hyEdge_hyNodes = hyper_edge.topology.get_hyNode_indices();
352  for (unsigned int hyNode = 0; hyNode < hyEdge_hyNodes.size(); ++hyNode)
353  hyEdge_dofs[hyNode].fill(0.);
354 
355  // Turn degrees of freedom of x_vec that have been stored locally into those of vec_Ax.
356  if constexpr (has_make_initial<LocalSolverT,
357  std::array<std::array<dof_value_t, n_dofs_per_node>,
358  2 * TopologyT::hyEdge_dim()>&(
359  std::array<std::array<dof_value_t, n_dofs_per_node>,
360  2 * TopologyT::hyEdge_dim()>&,
361  dof_value_t)>::value)
362  {
363  local_solver_.make_initial(hyEdge_dofs, time);
364  }
365  else if constexpr (has_make_initial<LocalSolverT,
366  std::array<std::array<dof_value_t, n_dofs_per_node>,
367  2 * TopologyT::hyEdge_dim()>&(
368  std::array<std::array<dof_value_t, n_dofs_per_node>,
369  2 * TopologyT::hyEdge_dim()>&,
370  decltype(hyper_edge)&, dof_value_t)>::value)
371  {
372  local_solver_.make_initial(hyEdge_dofs, hyper_edge, time);
373  }
374  else
375  hy_assert(false, "Function seems not to be implemented!");
376 
377  // Fill hyEdge_dofs array degrees of freedom into vec_Ax.
378  for (unsigned int hyNode = 0; hyNode < hyEdge_hyNodes.size(); ++hyNode)
379  hyper_graph_.hyNode_factory().set_dof_values(hyEdge_hyNodes[hyNode], vec_Ax,
380  hyEdge_dofs[hyNode]);
381  });
382 
383  return vec_Ax;
384  }
385  /*!***********************************************************************************************
386  * \brief Calculate L2 error.
387  *
388  * \param x_vec A vector containing the input vector \f$x\f$.
389  * \param time Time at which error is evaluated.
390  * \retval error L2 error.
391  ************************************************************************************************/
392  template <typename hyNode_index_t = dof_index_t>
393  std::vector<dof_value_t> errors(const LargeVecT& x_vec, const dof_value_t time = 0.)
394  {
395  auto result = prototype_errors(errors, has_errors);
396  return std::vector<dof_value_t>(result.begin(), result.end());
397  }
398  /*!***********************************************************************************************
399  * \brief Determine size of condensed system for the skeletal unknowns.
400  *
401  * Function that returns the size \f$n\f$ of the \f$n \times n\f$ linear, sparse system
402  * \f$Ax = b\f$ that is solved by the program in a matrix-free fashion.
403  *
404  * This function is needed to define a \c LinearOperator from Python's \c scipy.sparse.linalg
405  * package which can be used to define iterative solvers for sparse systems.
406  *
407  * \retval n Size of condensed system of equations.
408  ************************************************************************************************/
409  dof_index_t size_of_system() const { return hyper_graph_.n_global_dofs(); }
410  /*!***********************************************************************************************
411  * \brief Set plot option and return old plot option.
412  *
413  * Function to set and / or read the current plot option.
414  *
415  * \param option A \c std::string containing the plot option to be considered.
416  * \param value A \c std::string containing the new value of the considered option.
417  * If empty, the old value is kept.
418  * \retval opt_value A \c std::string containing the value of the plot option.
419  ************************************************************************************************/
420  std::string plot_option(const std::string& option, std::string value = "")
421  {
422  return set_plot_option(plot_options, option, value);
423  }
424  /*!***********************************************************************************************
425  * \brief Plot solution in vtu format.
426  *
427  * Function that plots the solution of the problem to a predefined file.
428  *
429  * \param lambda A vector of unknowns containing the data vector.
430  * \param time Time at which analytic functions are evaluated.
431  * \retval file A file in the output directory.
432  ************************************************************************************************/
433  void plot_solution(const std::vector<dof_value_t>& lambda, const dof_value_t time = 0.)
434  {
435  plot(hyper_graph_, local_solver_, lambda, plot_options, time);
436  }
437  /*!***********************************************************************************************
438  * \brief Return refinement level.
439  ************************************************************************************************/
440  unsigned int get_refinement() { return hyper_graph_.get_refinement(); }
441  /*!***********************************************************************************************
442  * \brief Set refinement level.
443  ************************************************************************************************/
444  void set_refinement(unsigned int level) { hyper_graph_.set_refinement(level); }
445 }; // end of class Parabolic
446 
447 } // end of namespace GlobalLoop
GlobalLoop::Parabolic::dof_value_t
typename LargeVecT::value_type dof_value_t
Floating type is determined by floating type of large vector's entries.
Definition: parabolic.hxx:67
compile_time_tricks.hxx
GlobalLoop::Parabolic::plot_option
std::string plot_option(const std::string &option, std::string value="")
Set plot option and return old plot option.
Definition: parabolic.hxx:420
hy_assert.hxx
This file provides the function hy_assert.
HDGHyperGraph::n_global_dofs
const dof_index_t n_global_dofs() const
Returns the total amount of degrees of freedom in the considered hypergraph.
Definition: hdg_hypergraph.hxx:514
GlobalLoop::Parabolic::size_of_system
dof_index_t size_of_system() const
Determine size of condensed system for the skeletal unknowns.
Definition: parabolic.hxx:409
plot.hxx
prototype_errors
#define prototype_errors(fun_name, has_fun_name)
Macro that allows to use an implemented error evaluation.
Definition: prototype.hxx:71
PlotOptions
A class storing options for plotting.
Definition: plot.hxx:20
GlobalLoop::Parabolic::make_initial
LargeVecT make_initial(const LargeVecT &x_vec, const dof_index_t time=0.)
Evaluate the initial flux of the problem.
Definition: parabolic.hxx:339
HDGHyperGraph::end
HDGHyperGraph< n_dofs_per_nodeT, TopoT, GeomT, NodeT, DataT, hyEdge_index_t >::iterator end()
Return iterator to the end of hyEdge list.
Definition: hdg_hypergraph.hxx:433
HDGHyperGraph
The class template uniting topology and geometry of a hypergraph with the topology of the skeleton sp...
Definition: hdg_hypergraph.hxx:51
GlobalLoop::Parabolic::plot_solution
void plot_solution(const std::vector< dof_value_t > &lambda, const dof_value_t time=0.)
Plot solution in vtu format.
Definition: parabolic.hxx:433
GlobalLoop::Parabolic::hyper_graph_
HDGHyperGraph< LocalSolverT::n_glob_dofs_per_node(), TopologyT, GeometryT, NodeDescriptorT, typename LocalSolverT::data_type > hyper_graph_
Instantiation of a hypergraph.
Definition: parabolic.hxx:78
SmallMat::size
static constexpr unsigned int size()
Return size a SmallMat.
Definition: dense_la.hxx:54
GlobalLoop::Parabolic::Parabolic
Parabolic(const typename TopologyT::constructor_value_type &construct_topo)
Abstract problem constructor.
Definition: parabolic.hxx:139
GlobalLoop::Parabolic::get_refinement
unsigned int get_refinement()
Return refinement level.
Definition: parabolic.hxx:440
GlobalLoop::Parabolic::errors
std::vector< dof_value_t > errors(const LargeVecT &x_vec, const dof_value_t time=0.)
Calculate L2 error.
Definition: parabolic.hxx:393
GlobalLoop::Parabolic::local_solver_
const LocalSolverT local_solver_
Instantiation of a local solver.
Definition: parabolic.hxx:82
GlobalLoop::Parabolic
Combine local solver and global information for parabolic problems.
Definition: parabolic.hxx:33
GlobalLoop::Parabolic::zero_vector
LargeVecT zero_vector() const
Returns vector of appropriate size for the predefined problem.
Definition: parabolic.hxx:157
GlobalLoop::Parabolic::set_refinement
void set_refinement(unsigned int level)
Set refinement level.
Definition: parabolic.hxx:444
HyperNodeFactory::add_to_dof_values
LargeVecT & add_to_dof_values(const hyNode_index_t hyNode_index, LargeVecT &global_dof_vector, const SmallVecT &local_dof_vector) const
Add different values to values of degrees of freedom related to a hypernode.
Definition: hypernodefactory.hxx:187
GlobalLoop::Parabolic::hyEdge_dim
static constexpr unsigned int hyEdge_dim
Some constant variable that might be helpful.
Definition: parabolic.hxx:58
GlobalLoop::Parabolic::Parabolic
Parabolic(const typename TopologyT::constructor_value_type &construct_topo, const typename GeometryT::constructor_value_type &construct_geom, const typename LocalSolverT::constructor_value_type &construct_loc_sol)
Abstract problem constructor.
Definition: parabolic.hxx:99
prototype.hxx
plot
void plot(HyperGraphT &hyper_graph, const LocalSolverT &local_solver, const LargeVecT &lambda, PlotOptions &plot_options, const floatT time=0.)
Function plotting the solution of an equation on a hypergraph in vtu format.
Definition: plot.hxx:778
GlobalLoop::Parabolic::residual_flux
std::vector< dof_value_t > residual_flux(const std::vector< dof_value_t > &x_vec, const dof_value_t time=0.)
Evaluate condensed matrix-vector product.
Definition: parabolic.hxx:235
hy_assert
#define hy_assert(Expr, Msg)
The assertion to be used within HyperHDG — deactivate using -DNDEBUG compile flag.
Definition: hy_assert.hxx:38
GlobalLoop::Parabolic::plot_options
PlotOptions plot_options
Struct encoding the options for plotting.
Definition: parabolic.hxx:86
GlobalLoop::Parabolic::Parabolic
Parabolic(const typename TopologyT::constructor_value_type &construct_topo, const typename LocalSolverT::constructor_value_type &construct_loc_sol)
Abstract problem constructor.
Definition: parabolic.hxx:120
HDGHyperGraph::begin
HDGHyperGraph< n_dofs_per_nodeT, TopoT, GeomT, NodeT, DataT, hyEdge_index_t >::iterator begin()
Return iterator to first hyEdge of HDGHyperGraph.
Definition: hdg_hypergraph.hxx:417
HDGHyperGraph::hyNode_factory
const HyperNodeFactory< n_dofs_per_nodeT, hyEdge_index_t > & hyNode_factory() const
Return const reference to HyperNodeFactory.
Definition: hdg_hypergraph.hxx:446
set_plot_option
std::string set_plot_option(PlotOptions &plot_options, const std::string &option, std::string value="")
Set a plot option and return the new value of this option as std::string.
Definition: plot.hxx:122
hdg_hypergraph.hxx
GlobalLoop::Parabolic::set_data
void set_data(const LargeVecT &x_vec, const dof_value_t time=0.)
Set data using the result of the old time step.
Definition: parabolic.hxx:296
GlobalLoop::Parabolic::trace_to_flux
LargeVecT trace_to_flux(const LargeVecT &x_vec, const dof_value_t time=0.)
Evaluate condensed matrix-vector product.
Definition: parabolic.hxx:172
GlobalLoop::Parabolic::n_dofs_per_node
static constexpr unsigned int n_dofs_per_node
Some constant variable that might be helpful.
Definition: parabolic.hxx:62
GlobalLoop
A namespace for global loops.
Definition: elliptic.hxx:14
SmallMat
This class implements a small/dense matrix.
Definition: dense_la.hxx:34
GlobalLoop::Parabolic::HAS_MEMBER_FUNCTION
HAS_MEMBER_FUNCTION(trace_to_flux, has_trace_to_flux)
Prepare struct to check for function to exist (cf. compile_time_tricks.hxx).