Reference documentation for deal.II version 9.0.0
flow_function.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2007 - 2017 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 at
12 // the top level of the deal.II distribution.
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 #include <deal.II/base/function.h>
22 #include <deal.II/base/point.h>
23 #include <deal.II/base/thread_management.h>
24 
25 DEAL_II_NAMESPACE_OPEN
26 
27 namespace Functions
28 {
47  template <int dim>
48  class FlowFunction : public Function<dim>
49  {
50  public:
54  FlowFunction();
55 
59  virtual ~FlowFunction() = default;
60 
65  void pressure_adjustment(double p);
66 
72  virtual void vector_values (const std::vector<Point<dim> > &points,
73  std::vector<std::vector<double> > &values) const = 0;
79  virtual void vector_gradients (const std::vector<Point<dim> > &points,
80  std::vector<std::vector<Tensor<1,dim> > > &gradients) const = 0;
89  virtual void vector_laplacians (const std::vector<Point<dim> > &points,
90  std::vector<std::vector<double> > &values) const = 0;
91 
92  virtual void vector_value (const Point<dim> &points, Vector<double> &value) const;
93  virtual double value (const Point<dim> &points, const unsigned int component) const;
94  virtual void vector_value_list (const std::vector<Point<dim> > &points,
95  std::vector<Vector<double> > &values) const;
96  virtual void vector_gradient_list (const std::vector<Point<dim> > &points,
97  std::vector<std::vector<Tensor<1,dim> > > &gradients) const;
101  virtual void vector_laplacian_list (const std::vector<Point<dim> > &points,
102  std::vector<Vector<double> > &values) const;
103 
104  std::size_t memory_consumption () const;
105 
106  protected:
111 
112  private:
113 
118 
122  mutable std::vector<std::vector<double> > aux_values;
123 
127  mutable std::vector<std::vector<Tensor<1,dim> > > aux_gradients;
128  };
129 
138  template <int dim>
139  class PoisseuilleFlow : public FlowFunction<dim>
140  {
141  public:
146  PoisseuilleFlow<dim> (const double r,
147  const double Re);
148 
149  virtual ~PoisseuilleFlow() = default;
150 
151  virtual void vector_values (const std::vector<Point<dim> > &points,
152  std::vector<std::vector<double> > &values) const;
153  virtual void vector_gradients (const std::vector<Point<dim> > &points,
154  std::vector<std::vector<Tensor<1,dim> > > &gradients) const;
155  virtual void vector_laplacians (const std::vector<Point<dim> > &points,
156  std::vector<std::vector<double> > &values) const;
157 
158  private:
159  const double radius;
160  const double Reynolds;
161  };
162 
163 
177  template <int dim>
178  class StokesCosine :
179  public FlowFunction<dim>
180  {
181  public:
186  StokesCosine (const double viscosity = 1., const double reaction = 0.);
190  void set_parameters (const double viscosity, const double reaction);
191 
192  virtual ~StokesCosine() = default;
193 
194  virtual void vector_values (const std::vector<Point<dim> > &points,
195  std::vector<std::vector<double> > &values) const;
196  virtual void vector_gradients (const std::vector<Point<dim> > &points,
197  std::vector<std::vector<Tensor<1,dim> > > &gradients) const;
198  virtual void vector_laplacians (const std::vector<Point<dim> > &points,
199  std::vector<std::vector<double> > &values) const;
200 
201  private:
203  double viscosity;
205  double reaction;
206  };
207 
208 
227  {
228  public:
231 
232  virtual void vector_values (const std::vector<Point<2> > &points,
233  std::vector<std::vector<double> > &values) const;
234  virtual void vector_gradients (const std::vector<Point<2> > &points,
235  std::vector<std::vector<Tensor<1,2> > > &gradients) const;
236  virtual void vector_laplacians (const std::vector<Point<2> > &points,
237  std::vector<std::vector<double> > &values) const;
238  private:
240  double Psi(double phi) const;
242  double Psi_1(double phi) const;
244  double Psi_2(double phi) const;
246  double Psi_3(double phi) const;
248  double Psi_4(double phi) const;
250  const double omega;
253  static const double lambda;
255  const double coslo;
257  const double lp;
259  const double lm;
260  };
261 
270  class Kovasznay : public FlowFunction<2>
271  {
272  public:
280  Kovasznay (const double Re, bool Stokes = false);
281 
282  virtual ~Kovasznay() = default;
283 
284  virtual void vector_values (const std::vector<Point<2> > &points,
285  std::vector<std::vector<double> > &values) const;
286  virtual void vector_gradients (const std::vector<Point<2> > &points,
287  std::vector<std::vector<Tensor<1,2> > > &gradients) const;
288  virtual void vector_laplacians (const std::vector<Point<2> > &points,
289  std::vector<std::vector<double> > &values) const;
290 
292  double lambda () const;
293  private:
294  const double Reynolds;
295  double lbda;
296  double p_average;
297  const bool stokes;
298  };
299 
300 }
301 
302 DEAL_II_NAMESPACE_CLOSE
303 
304 #endif
std::vector< std::vector< double > > aux_values
const double lm
Auxiliary variable 1-lambda.
virtual double value(const Point< dim > &points, const unsigned int component) const
const double lp
Auxiliary variable 1+lambda.
virtual void vector_values(const std::vector< Point< dim > > &points, std::vector< std::vector< double > > &values) const
static const double lambda
StokesCosine(const double viscosity=1., const double reaction=0.)
virtual void vector_gradients(const std::vector< Point< dim > > &points, std::vector< std::vector< Tensor< 1, dim > > > &gradients) const =0
void set_parameters(const double viscosity, const double reaction)
double viscosity
The viscosity.
double Psi(double phi) const
The auxiliary function Psi.
virtual void vector_gradients(const std::vector< Point< dim > > &points, std::vector< std::vector< Tensor< 1, dim > > > &gradients) const
virtual void vector_gradients(const std::vector< Point< dim > > &points, std::vector< std::vector< Tensor< 1, dim > > > &gradients) const
double lambda() const
The value of lambda.
virtual void vector_values(const std::vector< Point< dim > > &points, std::vector< std::vector< double > > &values) const
std::vector< std::vector< Tensor< 1, dim > > > aux_gradients
double reaction
The reaction parameter.
virtual void vector_value(const Point< dim > &points, Vector< double > &value) const
virtual void vector_laplacians(const std::vector< Point< dim > > &points, std::vector< std::vector< double > > &values) const
virtual ~FlowFunction()=default
const double omega
The angle of the reentrant corner, set to 3*pi/2.
virtual void vector_value_list(const std::vector< Point< dim > > &points, std::vector< Vector< double > > &values) const
double Psi_1(double phi) const
The derivative of Psi()
const double coslo
Cosine of lambda times omega.
double Psi_4(double phi) const
The 4th derivative of Psi()
virtual void vector_laplacians(const std::vector< Point< dim > > &points, std::vector< std::vector< double > > &values) const =0
double Psi_3(double phi) const
The 3rd derivative of Psi()
StokesLSingularity()
Constructor setting up some data.
virtual void vector_values(const std::vector< Point< dim > > &points, std::vector< std::vector< double > > &values) const =0
virtual void vector_laplacian_list(const std::vector< Point< dim > > &points, std::vector< Vector< double > > &values) const
virtual void vector_laplacians(const std::vector< Point< dim > > &points, std::vector< std::vector< double > > &values) const
Kovasznay(const double Re, bool Stokes=false)
double Psi_2(double phi) const
The 2nd derivative of Psi()
void pressure_adjustment(double p)