www.mooseframework.org
LevelSetCFLCondition.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 "LevelSetCFLCondition.h"
9 
10 template <>
11 InputParameters
13 {
14  InputParameters params = validParams<ElementPostprocessor>();
15  params.addClassDescription("Compute the minimum timestep from the Courant-Friedrichs-Lewy (CFL) "
16  "condition for the level-set equation.");
17  params += validParams<LevelSetVelocityInterface<>>();
18  return params;
19 }
20 
21 LevelSetCFLCondition::LevelSetCFLCondition(const InputParameters & parameters)
22  : LevelSetVelocityInterface<ElementPostprocessor>(parameters),
23  _cfl_timestep(std::numeric_limits<Real>::max())
24 {
25 }
26 
27 void
29 {
30  // Compute maximum velocity
31  _max_velocity = std::numeric_limits<Real>::min();
32  for (unsigned int qp = 0; qp < _q_point.size(); ++qp)
33  {
34  RealVectorValue vel(_velocity_x[qp], _velocity_y[qp], _velocity_z[qp]);
35  _max_velocity = std::max(_max_velocity, std::abs(vel.norm()));
36  }
37  _cfl_timestep = std::min(_cfl_timestep, _current_elem->hmin() / _max_velocity);
38 }
39 
40 void
42 {
43  gatherMin(_cfl_timestep);
44 }
45 
46 void
47 LevelSetCFLCondition::threadJoin(const UserObject & user_object)
48 {
49  const LevelSetCFLCondition & cfl = static_cast<const LevelSetCFLCondition &>(user_object);
50  _cfl_timestep = std::min(_cfl_timestep, cfl._cfl_timestep);
51 }
52 
53 PostprocessorValue
55 {
56  return _cfl_timestep;
57 }
virtual PostprocessorValue getValue() override
Real _cfl_timestep
The minimum timestep computed using CFL condition.
Computes the maximum timestep based on the CFL condition.
A helper class for defining the velocity as coupled variables for the levelset equation.
InputParameters validParams< LevelSetCFLCondition >()
void threadJoin(const UserObject &user_object) override
LevelSetCFLCondition(const InputParameters &parameters)
Real _max_velocity
The max velocity on an element, this is done simply to avoid creating temporary calls to execute...