/usr/include/deal.II/base/flow_function.h is in libdeal.ii-dev 8.1.0-6ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | // ---------------------------------------------------------------------
// $Id: flow_function.h 30036 2013-07-18 16:55:32Z maier $
//
// Copyright (C) 2007 - 2013 by the deal.II authors
//
// This file is part of the deal.II library.
//
// The deal.II library is free software; you can use it, redistribute
// it, and/or modify it under the terms of the GNU Lesser General
// Public License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// The full text of the license can be found in the file LICENSE at
// the top level of the deal.II distribution.
//
// ---------------------------------------------------------------------
#ifndef __deal2__flow_function_h
#define __deal2__flow_function_h
#include <deal.II/base/config.h>
#include <deal.II/base/function.h>
#include <deal.II/base/point.h>
#include <deal.II/base/thread_management.h>
DEAL_II_NAMESPACE_OPEN
namespace Functions
{
/**
* Base class for analytic solutions to incompressible flow problems.
*
* Additional to the Function interface, this function provides for an
* offset of the pressure: if the pressure of the computed solution
* has an integral mean value different from zero, this value can be
* given to pressure_adjustment() in order to compute correct pressure
* errors.
*
* @note Derived classes should implement pressures with integral mean
* value zero always.
*
* @note Thread safety: Some of the functions make use of internal data to compute
* values. Therefore, every thread should obtain its own object of
* derived classes.
*
* @ingroup functions
* @author Guido Kanschat, 2007
*/
template <int dim>
class FlowFunction : public Function<dim>
{
public:
/**
* Constructor, setting up some
* internal data structures.
*/
FlowFunction();
/**
* Virtual destructor.
*/
virtual ~FlowFunction();
/**
* Store an adjustment for the
* pressure function, such that
* its mean value is
* <tt>p</tt>.
*/
void pressure_adjustment(double p);
/**
* Values in a structure more
* suitable for vector valued
* functions. The outer vector
* is indexed by solution
* component, the inner by
* quadrature point.
*/
virtual void vector_values (const std::vector<Point<dim> > &points,
std::vector<std::vector<double> > &values) const = 0;
/**
* Gradients in a structure more
* suitable for vector valued
* functions. The outer vector
* is indexed by solution
* component, the inner by
* quadrature point.
*/
virtual void vector_gradients (const std::vector<Point<dim> > &points,
std::vector<std::vector<Tensor<1,dim> > > &gradients) const = 0;
/**
* Force terms in a structure more
* suitable for vector valued
* functions. The outer vector
* is indexed by solution
* component, the inner by
* quadrature point.
*
* @warning This is not the
* true Laplacian, but the
* force term to be used as
* right hand side in Stokes'
* equations
*/
virtual void vector_laplacians (const std::vector<Point<dim> > &points,
std::vector<std::vector<double> > &values) const = 0;
virtual void vector_value (const Point<dim> &points, Vector<double> &value) const;
virtual double value (const Point<dim> &points, const unsigned int component) const;
virtual void vector_value_list (const std::vector<Point<dim> > &points,
std::vector<Vector<double> > &values) const;
virtual void vector_gradient_list (const std::vector<Point<dim> > &points,
std::vector<std::vector<Tensor<1,dim> > > &gradients) const;
/**
* The force term in the
* momentum equation.
*/
virtual void vector_laplacian_list (const std::vector<Point<dim> > &points,
std::vector<Vector<double> > &values) const;
std::size_t memory_consumption () const;
protected:
/**
* Mean value of the pressure
* to be added by derived
* classes.
*/
double mean_pressure;
private:
/**
* A mutex that guards the
* following scratch arrays.
*/
mutable Threads::Mutex mutex;
/**
* Auxiliary values for the usual
* Function interface.
*/
mutable std::vector<std::vector<double> > aux_values;
/**
* Auxiliary values for the usual
* Function interface.
*/
mutable std::vector<std::vector<Tensor<1,dim> > > aux_gradients;
};
/**
* Laminar pipe flow in two and three dimensions. The channel
* stretches along the <i>x</i>-axis and has radius @p radius. The
* @p Reynolds number is used to scale the pressure properly for a
* Navier-Stokes problem.
*
* @ingroup functions
* @author Guido Kanschat, 2007
*/
template <int dim>
class PoisseuilleFlow : public FlowFunction<dim>
{
public:
/**
* Construct an object for the
* given channel radius
* <tt>r</tt> and the Reynolds
* number <tt>Re</tt>.
*/
PoisseuilleFlow<dim> (const double r,
const double Re);
virtual ~PoisseuilleFlow();
virtual void vector_values (const std::vector<Point<dim> > &points,
std::vector<std::vector<double> > &values) const;
virtual void vector_gradients (const std::vector<Point<dim> > &points,
std::vector<std::vector<Tensor<1,dim> > > &gradients) const;
virtual void vector_laplacians (const std::vector<Point<dim> > &points,
std::vector<std::vector<double> > &values) const;
private:
const double radius;
const double Reynolds;
};
/**
* Artificial divergence free function with homogeneous boundary
* conditions on the cube [-1,1]<sup>dim</sup>.
*
* The function in 2D is
* @f[
* \left(\begin{array}{c}u\\v\\p\end{array}\right)
* \left(\begin{array}{c}\cos^2x \sin y\cos y\\-\sin x\cos x\cos^2y\\
* \sin x\cos x\sin y\cos y\end{array}\right)
* @f]
* @ingroup functions
* @author Guido Kanschat, 2007
*/
template <int dim>
class StokesCosine :
public FlowFunction<dim>
{
public:
/**
* Constructor setting the
* Reynolds number required for
* pressure computation and
* scaling of the right hand side.
*/
StokesCosine (const double viscosity = 1., const double reaction = 0.);
/**
* Change the viscosity and the
* reaction parameter.
*/
void set_parameters (const double viscosity, const double reaction);
virtual ~StokesCosine();
virtual void vector_values (const std::vector<Point<dim> > &points,
std::vector<std::vector<double> > &values) const;
virtual void vector_gradients (const std::vector<Point<dim> > &points,
std::vector<std::vector<Tensor<1,dim> > > &gradients) const;
virtual void vector_laplacians (const std::vector<Point<dim> > &points,
std::vector<std::vector<double> > &values) const;
private:
/// The viscosity
double viscosity;
/// The reaction parameter
double reaction;
};
/**
* The solution to Stokes' equations on an L-shaped domain.
*
* Taken from Houston, Schötzau, Wihler, proceeding ENUMATH 2003.
*
* @ingroup functions
* @author Guido Kanschat, 2007
*/
class StokesLSingularity : public FlowFunction<2>
{
public:
/// Constructor setting upsome data.
StokesLSingularity();
virtual void vector_values (const std::vector<Point<2> > &points,
std::vector<std::vector<double> > &values) const;
virtual void vector_gradients (const std::vector<Point<2> > &points,
std::vector<std::vector<Tensor<1,2> > > &gradients) const;
virtual void vector_laplacians (const std::vector<Point<2> > &points,
std::vector<std::vector<double> > &values) const;
private:
/// The auxiliary function Psi.
double Psi(double phi) const;
/// The derivative of Psi()
double Psi_1(double phi) const;
/// The 2nd derivative of Psi()
double Psi_2(double phi) const;
/// The 3rd derivative of Psi()
double Psi_3(double phi) const;
/// The 4th derivative of Psi()
double Psi_4(double phi) const;
/// The angle of the reentrant corner
const double omega;
/// The exponent of the radius
static const double lambda;
/// Cosine of lambda times omega
const double coslo;
/// Auxiliary variable 1+lambda
const double lp;
/// Auxiliary variable 1-lambda
const double lm;
};
/**
* Flow solution in 2D by Kovasznay (1947).
*
* This function is valid on the half plane right of the line
* <i>x=1/2</i>.
*
* @ingroup functions
* @author Guido Kanschat, 2007
*/
class Kovasznay : public FlowFunction<2>
{
public:
/**
* Construct an object for the
* give Reynolds number
* <tt>Re</tt>. If the
* parameter <tt>Stokes</tt> is
* true, the right hand side of
* the momentum equation
* returned by
* vector_laplacians() contains
* the nonlinearity, such that
* the Kovasznay solution can
* be obtained as the solution
* to a Stokes problem.
*/
Kovasznay (const double Re, bool Stokes = false);
virtual ~Kovasznay();
virtual void vector_values (const std::vector<Point<2> > &points,
std::vector<std::vector<double> > &values) const;
virtual void vector_gradients (const std::vector<Point<2> > &points,
std::vector<std::vector<Tensor<1,2> > > &gradients) const;
virtual void vector_laplacians (const std::vector<Point<2> > &points,
std::vector<std::vector<double> > &values) const;
/// The value of lambda.
double lambda () const;
private:
const double Reynolds;
double lbda;
double p_average;
const bool stokes;
};
}
DEAL_II_NAMESPACE_CLOSE
#endif
|