www.mooseframework.org
LevelSetCFLCondition.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "LevelSetCFLCondition.h"
11 
13 
16 {
18  params.addClassDescription("Compute the minimum timestep from the Courant-Friedrichs-Lewy (CFL) "
19  "condition for the level-set equation.");
20  params.addRequiredCoupledVar("velocity", "Velocity vector variable.");
21  return params;
22 }
23 
25  : ElementPostprocessor(parameters),
26  _cfl_timestep(std::numeric_limits<Real>::max()),
27  _velocity(adCoupledVectorValue("velocity"))
28 {
29 }
30 
31 void
33 {
34  // Compute maximum velocity
35  _max_velocity = std::numeric_limits<Real>::min();
36  for (unsigned int qp = 0; qp < _q_point.size(); ++qp)
37  {
39  _max_velocity = std::max(_max_velocity, std::abs(vel.norm()));
40  }
42 }
43 
44 void
46 {
48 }
49 
50 void
52 {
53  const auto & cfl = static_cast<const LevelSetCFLCondition &>(user_object);
54  _cfl_timestep = std::min(_cfl_timestep, cfl._cfl_timestep);
55 }
56 
59 {
60  return _cfl_timestep;
61 }
auto norm() const -> decltype(std::norm(Real()))
registerMooseObject("LevelSetApp", LevelSetCFLCondition)
const MooseArray< Point > & _q_point
static InputParameters validParams()
auto raw_value(const Eigen::Map< T > &in)
Real _cfl_timestep
The minimum timestep computed using CFL condition.
Computes the maximum timestep based on the CFL condition.
void gatherMin(T &value)
const ADVectorVariableValue & _velocity
Velocity vector variable.
auto max(const L &left, const R &right)
ADRealEigenVector< T, D, asd > abs(const ADRealEigenVector< T, D, asd > &)
unsigned int size() const
Real PostprocessorValue
static InputParameters validParams()
void threadJoin(const UserObject &user_object) override
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
LevelSetCFLCondition(const InputParameters &parameters)
const Elem *const & _current_elem
void addClassDescription(const std::string &doc_string)
Real _max_velocity
The max velocity on an element, this is done simply to avoid creating temporary calls to execute...
virtual PostprocessorValue getValue() const override