Logbook  (07-04-2025)
Static problems
static_scalar_input.cpp
1 /******************************************************************************
2  * Copyright (C) Siarhei Uzunbajakau, 2023.
3  *
4  * This program is free software. You can use, modify, and redistribute it under
5  * the terms of the GNU Lesser General Public License as published by the Free
6  * Software Foundation, either version 3 or (at your option) any later version.
7  * This program is distributed without any warranty.
8  *
9  * Refer to COPYING.LESSER for more details.
10  ******************************************************************************/
11 
12 #include <deal.II/base/types.h>
13 #define BOOST_ALLOW_DEPRECATED_HEADERS
14 
15 #include "static_scalar_input.hpp"
16 #include <math.h>
17 
18 #pragma GCC diagnostic push
19 #pragma GCC diagnostic ignored "-Wunused-parameter"
20 #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
21 
22 template<>
23 void
25  const std::vector<Point<2>>& r,
26  types::material_id mid,
27  unsigned int cuid,
28  std::vector<double>& values) const
29 {
30  Assert(r.size() == values.size(),
31  ExcDimensionMismatch(r.size(), values.size()));
32 
33  for (unsigned int i = 0; i < values.size(); i++)
34  values[i] = 1.0;
35 }
36 
37 template<>
38 void
39 StaticScalarSolver::PdeRhs<2>::value_list(const std::vector<Point<2>>& r,
40  types::material_id mid,
41  unsigned int cuid,
42  std::vector<double>& values) const
43 {
44  Assert(r.size() == values.size(),
45  ExcDimensionMismatch(r.size(), values.size()));
46 
47  for (unsigned int i = 0; i < values.size(); i++)
48  values[i] = 0.0;
49 }
50 
51 template<>
52 void
54  const std::vector<Point<2>>& r,
55  types::material_id mid,
56  unsigned int cuid,
57  std::vector<Tensor<1, 2>>& values) const
58 {
59  Assert(r.size() == values.size(),
60  ExcDimensionMismatch(r.size(), values.size()));
61 
62  auto v = values.begin();
63  for (auto p : r) {
64  if (mid == mid_2) {
65  (*v)[0] = -p[1];
66  (*v)[1] = p[0];
67  } else {
68  (*v)[0] = 0.0;
69  (*v)[1] = 0.0;
70  }
71  v++;
72  }
73 }
74 
75 template<>
76 void
77 StaticScalarSolver::Gamma<2>::value_list(const std::vector<Point<2>>& r,
78  const std::vector<Tensor<1, 2>>& n,
79  types::boundary_id bid,
80  types::material_id mid,
81  unsigned int cuid,
82  unsigned int fuid,
83  std::vector<double>& values) const
84 {
85  Assert(r.size() == values.size(),
86  ExcDimensionMismatch(r.size(), values.size()));
87 
88  for (unsigned int i = 0; i < values.size(); i++)
89  values[i] = 0.0;
90 }
91 
92 template<>
93 void
94 StaticScalarSolver::RobinRhs<2>::value_list(const std::vector<Point<2>>& r,
95  const std::vector<Tensor<1, 2>>& n,
96  types::boundary_id bid,
97  types::material_id mid,
98  unsigned int cuid,
99  unsigned int fuid,
100  std::vector<double>& values) const
101 {
102  Assert(r.size() == values.size(),
103  ExcDimensionMismatch(r.size(), values.size()));
104 
105  for (unsigned int i = 0; i < values.size(); i++)
106  values[i] = 0.0;
107 }
108 
109 template<>
110 void
112  const std::vector<Point<2>>& r,
113  const std::vector<Tensor<1, 2>>& n,
114  types::material_id mid,
115  unsigned int cuid,
116  unsigned int fuid,
117  std::vector<double>& values) const
118 {
119  Assert(r.size() == values.size(),
120  ExcDimensionMismatch(r.size(), values.size()));
121 
122  for (unsigned int i = 0; i < values.size(); i++)
123  values[i] = 0.0;
124 }
125 
126 template<>
127 double
128 StaticScalarSolver::Weight<2>::value(const Point<2>& r,
129  const unsigned int component) const
130 {
131  return 1.0;
132 }
133 
134 #pragma GCC diagnostic pop
void value_list(const std::vector< Point< dim >> &r, const std::vector< Tensor< 1, dim >> &n, types::material_id mid, unsigned int cuid, unsigned int fuid, std::vector< double > &values) const
Computes the right-hand side of the second continuity condition ( , , , or ).
void value_list(const std::vector< Point< dim >> &r, const std::vector< Tensor< 1, dim >> &n, types::boundary_id bid, types::material_id mid, unsigned int cuid, unsigned int fuid, std::vector< double > &values) const
Computes the coefficient at quadrature points.
void value_list(const std::vector< Point< dim >> &r, types::material_id mid, unsigned int cuid, std::vector< Tensor< 1, dim >> &values) const
Computes the two-dimensional free-current density on the right-hand side of the partial differential...
void value_list(const std::vector< Point< dim >> &r, types::material_id mid, unsigned int cuid, std::vector< double > &values) const
Computes the right-hand side of the div-grad partial differential equation at quadrature points.
void value_list(const std::vector< Point< dim >> &r, const std::vector< Tensor< 1, dim >> &n, types::boundary_id bid, types::material_id mid, unsigned int cuid, unsigned int fuid, std::vector< double > &values) const
Computes the right-hand side of the Robin boundary condition ( or ).
void value_list(const std::vector< Point< dim >> &r, types::material_id mid, unsigned int cuid, std::vector< double > &values) const
Computes the values of the coefficient at quadrature points.
virtual double value(const Point< dim > &r, const unsigned int component=0) const override final
Returns the value of weight at point r. All error norms, , , and , at point r will be multiplied by t...