www.mooseframework.org
INSCourant.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 #include "INSCourant.h"
8 #include "MooseMesh.h"
9 
10 template <>
11 InputParameters
13 {
14  InputParameters params = validParams<AuxKernel>();
15 
16  params.addClassDescription("Computes h_min / |u|.");
17  // Coupled variables
18  params.addRequiredCoupledVar("u", "x-velocity");
19  params.addCoupledVar("v", "y-velocity"); // only required in 2D and 3D
20  params.addCoupledVar("w", "z-velocity"); // only required in 3D
21 
22  return params;
23 }
24 
25 INSCourant::INSCourant(const InputParameters & parameters)
26  : AuxKernel(parameters),
27  _u_vel(coupledValue("u")),
28  _v_vel(_mesh.dimension() >= 2 ? coupledValue("v") : _zero),
29  _w_vel(_mesh.dimension() == 3 ? coupledValue("w") : _zero)
30 {
31 }
32 
33 Real
35 {
36  const RealVectorValue U(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
37  Real vel_mag = U.norm();
38 
39  // Don't divide by zero...
40  vel_mag = std::max(vel_mag, std::numeric_limits<Real>::epsilon());
41 
42  return _current_elem->hmin() / vel_mag;
43 }
INSCourant(const InputParameters &parameters)
Definition: INSCourant.C:25
InputParameters validParams< INSCourant >()
Definition: INSCourant.C:12
const VariableValue & _w_vel
Definition: INSCourant.h:32
const VariableValue & _u_vel
Definition: INSCourant.h:30
virtual Real computeValue()
Definition: INSCourant.C:34
const VariableValue & _v_vel
Definition: INSCourant.h:31