www.mooseframework.org
CNSFVTimeStepLimit.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 
8 #include "CNSFVTimeStepLimit.h"
9 #include "MooseMesh.h"
10 
11 #include "libmesh/quadrature.h"
12 
13 template <>
14 InputParameters
16 {
17  InputParameters params = validParams<ElementPostprocessor>();
18  params.addClassDescription(
19  "A PostProcessor object to calculate the allowable time step size for the CNS equations.");
20  params.addParam<Real>("cfl", 0.8, "CFL number");
21  return params;
22 }
23 
24 CNSFVTimeStepLimit::CNSFVTimeStepLimit(const InputParameters & parameters)
25  : ElementPostprocessor(parameters),
26  _dim(_mesh.dimension()),
27  _cfl(getParam<Real>("cfl")),
28  _vmag(getMaterialProperty<Real>("velocity_magnitude")),
29  _csou(getMaterialProperty<Real>("speed_of_sound"))
30 {
31 }
32 
34 
35 void
37 {
38  _value = std::numeric_limits<Real>::max();
39 }
40 
41 void
43 {
44  Real h_min = _current_elem->hmin();
45  for (unsigned qp = 0; qp < _qrule->n_points(); ++qp)
46  _value = std::min(_value, _cfl * h_min / (_vmag[qp] + _csou[qp]));
47 }
48 
49 Real
51 {
52  gatherMin(_value);
53  return _value;
54 }
55 
56 void
57 CNSFVTimeStepLimit::threadJoin(const UserObject & uo)
58 {
59  const CNSFVTimeStepLimit & pps = dynamic_cast<const CNSFVTimeStepLimit &>(uo);
60  _value = std::min(_value, pps._value);
61 }
const MaterialProperty< Real > & _vmag
velocity magnitude
virtual Real getValue()
virtual void threadJoin(const UserObject &uo)
const MaterialProperty< Real > & _csou
speed of sound
virtual void initialize()
InputParameters validParams< CNSFVTimeStepLimit >()
Real _value
the value of dt
virtual void execute()
Real _cfl
user-input coefficient
CNSFVTimeStepLimit(const InputParameters &parameters)
A PostProcessor object to calculate the allowable time step size for the CNS equations.