Reference documentation for deal.II version 9.2.0
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
flow_function.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2007 - 2018 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_flow_function_h
17 #define dealii_flow_function_h
18 
19 
20 #include <deal.II/base/config.h>
21 
22 #include <deal.II/base/function.h>
23 #include <deal.II/base/point.h>
25 
27 
28 namespace Functions
29 {
48  template <int dim>
49  class FlowFunction : public Function<dim>
50  {
51  public:
55  FlowFunction();
56 
60  virtual ~FlowFunction() override = default;
61 
66  void
67  pressure_adjustment(double p);
68 
74  virtual void
75  vector_values(const std::vector<Point<dim>> & points,
76  std::vector<std::vector<double>> &values) const override = 0;
82  virtual void
84  const std::vector<Point<dim>> & points,
85  std::vector<std::vector<Tensor<1, dim>>> &gradients) const override = 0;
94  virtual void
95  vector_laplacians(const std::vector<Point<dim>> & points,
96  std::vector<std::vector<double>> &values) const = 0;
97 
98  virtual void
99  vector_value(const Point<dim> &points,
100  Vector<double> & value) const override;
101  virtual double
102  value(const Point<dim> & points,
103  const unsigned int component) const override;
104  virtual void
105  vector_value_list(const std::vector<Point<dim>> &points,
106  std::vector<Vector<double>> & values) const override;
107  virtual void
109  const std::vector<Point<dim>> & points,
110  std::vector<std::vector<Tensor<1, dim>>> &gradients) const override;
114  virtual void
115  vector_laplacian_list(const std::vector<Point<dim>> &points,
116  std::vector<Vector<double>> & values) const override;
117 
118  std::size_t
119  memory_consumption() const;
120 
121  protected:
126 
127  private:
132 
136  mutable std::vector<std::vector<double>> aux_values;
137 
141  mutable std::vector<std::vector<Tensor<1, dim>>> aux_gradients;
142  };
143 
152  template <int dim>
153  class PoisseuilleFlow : public FlowFunction<dim>
154  {
155  public:
160  PoisseuilleFlow<dim>(const double r, const double Re);
161 
162  virtual ~PoisseuilleFlow() override = default;
163 
164  virtual void
165  vector_values(const std::vector<Point<dim>> & points,
166  std::vector<std::vector<double>> &values) const override;
167  virtual void
169  const std::vector<Point<dim>> & points,
170  std::vector<std::vector<Tensor<1, dim>>> &gradients) const override;
171  virtual void
172  vector_laplacians(const std::vector<Point<dim>> & points,
173  std::vector<std::vector<double>> &values) const override;
174 
175  private:
176  const double radius;
177  const double Reynolds;
178  };
179 
180 
194  template <int dim>
195  class StokesCosine : public FlowFunction<dim>
196  {
197  public:
202  StokesCosine(const double viscosity = 1., const double reaction = 0.);
206  void
207  set_parameters(const double viscosity, const double reaction);
208 
209  virtual ~StokesCosine() override = default;
210 
211  virtual void
212  vector_values(const std::vector<Point<dim>> & points,
213  std::vector<std::vector<double>> &values) const override;
214  virtual void
216  const std::vector<Point<dim>> & points,
217  std::vector<std::vector<Tensor<1, dim>>> &gradients) const override;
218  virtual void
219  vector_laplacians(const std::vector<Point<dim>> & points,
220  std::vector<std::vector<double>> &values) const override;
221 
222  private:
224  double viscosity;
226  double reaction;
227  };
228 
229 
248  {
249  public:
252 
253  virtual void
254  vector_values(const std::vector<Point<2>> & points,
255  std::vector<std::vector<double>> &values) const override;
256  virtual void
258  const std::vector<Point<2>> & points,
259  std::vector<std::vector<Tensor<1, 2>>> &gradients) const override;
260  virtual void
261  vector_laplacians(const std::vector<Point<2>> & points,
262  std::vector<std::vector<double>> &values) const override;
263 
264  private:
266  double
267  Psi(double phi) const;
269  double
270  Psi_1(double phi) const;
272  double
273  Psi_2(double phi) const;
275  double
276  Psi_3(double phi) const;
278  double
279  Psi_4(double phi) const;
281  const double omega;
284  static const double lambda;
286  const double coslo;
288  const double lp;
290  const double lm;
291  };
292 
301  class Kovasznay : public FlowFunction<2>
302  {
303  public:
311  Kovasznay(const double Re, bool Stokes = false);
312 
313  virtual ~Kovasznay() override = default;
314 
315  virtual void
316  vector_values(const std::vector<Point<2>> & points,
317  std::vector<std::vector<double>> &values) const override;
318  virtual void
320  const std::vector<Point<2>> & points,
321  std::vector<std::vector<Tensor<1, 2>>> &gradients) const override;
322  virtual void
323  vector_laplacians(const std::vector<Point<2>> & points,
324  std::vector<std::vector<double>> &values) const override;
325 
327  double
328  lambda() const;
329 
330  private:
331  const double Reynolds;
332  double lbda;
333  double p_average;
334  const bool stokes;
335  };
336 
337 } // namespace Functions
338 
340 
341 #endif
Functions::FlowFunction::vector_gradients
virtual void vector_gradients(const std::vector< Point< dim >> &points, std::vector< std::vector< Tensor< 1, dim >>> &gradients) const override=0
Functions::FlowFunction::mean_pressure
double mean_pressure
Definition: flow_function.h:125
Functions
Definition: flow_function.h:28
Functions::FlowFunction::aux_gradients
std::vector< std::vector< Tensor< 1, dim > > > aux_gradients
Definition: flow_function.h:141
Functions::FlowFunction
Definition: flow_function.h:49
Functions::FlowFunction::vector_value_list
virtual void vector_value_list(const std::vector< Point< dim >> &points, std::vector< Vector< double >> &values) const override
Definition: flow_function.cc:50
Functions::StokesCosine::vector_gradients
virtual void vector_gradients(const std::vector< Point< dim >> &points, std::vector< std::vector< Tensor< 1, dim >>> &gradients) const override
Definition: flow_function.cc:358
Threads::Mutex
Definition: thread_management.h:91
Functions::Kovasznay::~Kovasznay
virtual ~Kovasznay() override=default
Functions::FlowFunction::vector_values
virtual void vector_values(const std::vector< Point< dim >> &points, std::vector< std::vector< double >> &values) const override=0
Functions::PoisseuilleFlow::~PoisseuilleFlow
virtual ~PoisseuilleFlow() override=default
Functions::FlowFunction::~FlowFunction
virtual ~FlowFunction() override=default
Functions::StokesLSingularity::Psi_4
double Psi_4(double phi) const
The 4th derivative of Psi()
Definition: flow_function.cc:539
Functions::StokesCosine
Definition: flow_function.h:195
Functions::FlowFunction::memory_consumption
std::size_t memory_consumption() const
Definition: flow_function.cc:181
Functions::StokesLSingularity::lambda
static const double lambda
Definition: flow_function.h:284
Functions::Kovasznay::lbda
double lbda
Definition: flow_function.h:332
Functions::StokesLSingularity::Psi
double Psi(double phi) const
The auxiliary function Psi.
Definition: flow_function.cc:505
Functions::Kovasznay::lambda
double lambda() const
The value of lambda.
Definition: flow_function.cc:777
Functions::FlowFunction::FlowFunction
FlowFunction()
Definition: flow_function.cc:31
Functions::PoisseuilleFlow::Reynolds
const double Reynolds
Definition: flow_function.h:177
Functions::StokesLSingularity::Psi_3
double Psi_3(double phi) const
The 3rd derivative of Psi()
Definition: flow_function.cc:529
Functions::Kovasznay::vector_values
virtual void vector_values(const std::vector< Point< 2 >> &points, std::vector< std::vector< double >> &values) const override
Definition: flow_function.cc:683
Functions::StokesCosine::~StokesCosine
virtual ~StokesCosine() override=default
Functions::FlowFunction::aux_values
std::vector< std::vector< double > > aux_values
Definition: flow_function.h:136
thread_management.h
Functions::StokesCosine::vector_values
virtual void vector_values(const std::vector< Point< dim >> &points, std::vector< std::vector< double >> &values) const override
Definition: flow_function.cc:309
Functions::FlowFunction::pressure_adjustment
void pressure_adjustment(double p)
Definition: flow_function.cc:42
Functions::FlowFunction::vector_gradient_list
virtual void vector_gradient_list(const std::vector< Point< dim >> &points, std::vector< std::vector< Tensor< 1, dim >>> &gradients) const override
Definition: flow_function.cc:125
Functions::StokesLSingularity::Psi_1
double Psi_1(double phi) const
The derivative of Psi()
Definition: flow_function.cc:513
Functions::PoisseuilleFlow::vector_values
virtual void vector_values(const std::vector< Point< dim >> &points, std::vector< std::vector< double >> &values) const override
Definition: flow_function.cc:202
Functions::StokesCosine::viscosity
double viscosity
The viscosity.
Definition: flow_function.h:224
Functions::Kovasznay
Definition: flow_function.h:301
Functions::FlowFunction::vector_laplacians
virtual void vector_laplacians(const std::vector< Point< dim >> &points, std::vector< std::vector< double >> &values) const =0
Functions::StokesLSingularity::vector_gradients
virtual void vector_gradients(const std::vector< Point< 2 >> &points, std::vector< std::vector< Tensor< 1, 2 >>> &gradients) const override
Definition: flow_function.cc:589
Tensor< 1, dim >
DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:358
Functions::StokesLSingularity::omega
const double omega
The angle of the reentrant corner, set to 3*pi/2.
Definition: flow_function.h:281
Functions::PoisseuilleFlow::vector_laplacians
virtual void vector_laplacians(const std::vector< Point< dim >> &points, std::vector< std::vector< double >> &values) const override
Definition: flow_function.cc:273
Functions::FlowFunction::mutex
Threads::Mutex mutex
Definition: flow_function.h:131
Functions::Kovasznay::vector_laplacians
virtual void vector_laplacians(const std::vector< Point< 2 >> &points, std::vector< std::vector< double >> &values) const override
Definition: flow_function.cc:740
Functions::StokesCosine::reaction
double reaction
The reaction parameter.
Definition: flow_function.h:226
Functions::StokesLSingularity
Definition: flow_function.h:247
Functions::StokesLSingularity::coslo
const double coslo
Cosine of lambda times omega.
Definition: flow_function.h:286
Functions::PoisseuilleFlow
Definition: flow_function.h:153
function.h
Functions::PoisseuilleFlow::vector_gradients
virtual void vector_gradients(const std::vector< Point< dim >> &points, std::vector< std::vector< Tensor< 1, dim >>> &gradients) const override
Definition: flow_function.cc:240
Functions::StokesLSingularity::lp
const double lp
Auxiliary variable 1+lambda.
Definition: flow_function.h:288
Functions::Kovasznay::Kovasznay
Kovasznay(const double Re, bool Stokes=false)
Definition: flow_function.cc:666
Functions::Kovasznay::stokes
const bool stokes
Definition: flow_function.h:334
Functions::StokesCosine::set_parameters
void set_parameters(const double viscosity, const double reaction)
Definition: flow_function.cc:300
Functions::StokesLSingularity::StokesLSingularity
StokesLSingularity()
Constructor setting up some data.
Definition: flow_function.cc:496
Functions::Kovasznay::Reynolds
const double Reynolds
Definition: flow_function.h:331
Functions::FlowFunction::value
virtual double value(const Point< dim > &points, const unsigned int component) const override
Definition: flow_function.cc:103
Functions::StokesCosine::StokesCosine
StokesCosine(const double viscosity=1., const double reaction=0.)
Definition: flow_function.cc:291
Functions::StokesCosine::vector_laplacians
virtual void vector_laplacians(const std::vector< Point< dim >> &points, std::vector< std::vector< double >> &values) const override
Definition: flow_function.cc:424
Point< dim >
config.h
Function
Definition: function.h:151
Functions::StokesLSingularity::Psi_2
double Psi_2(double phi) const
The 2nd derivative of Psi()
Definition: flow_function.cc:521
Functions::Kovasznay::p_average
double p_average
Definition: flow_function.h:333
DEAL_II_NAMESPACE_CLOSE
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:359
Functions::FlowFunction::vector_laplacian_list
virtual void vector_laplacian_list(const std::vector< Point< dim >> &points, std::vector< Vector< double >> &values) const override
Definition: flow_function.cc:153
Functions::StokesLSingularity::lm
const double lm
Auxiliary variable 1-lambda.
Definition: flow_function.h:290
Functions::Kovasznay::vector_gradients
virtual void vector_gradients(const std::vector< Point< 2 >> &points, std::vector< std::vector< Tensor< 1, 2 >>> &gradients) const override
Definition: flow_function.cc:707
Vector< double >
Functions::FlowFunction::vector_value
virtual void vector_value(const Point< dim > &points, Vector< double > &value) const override
Definition: flow_function.cc:78
Functions::StokesLSingularity::vector_values
virtual void vector_values(const std::vector< Point< 2 >> &points, std::vector< std::vector< double >> &values) const override
Definition: flow_function.cc:549
Functions::StokesLSingularity::vector_laplacians
virtual void vector_laplacians(const std::vector< Point< 2 >> &points, std::vector< std::vector< double >> &values) const override
Definition: flow_function.cc:649
Functions::PoisseuilleFlow::radius
const double radius
Definition: flow_function.h:176
point.h