https://mooseframework.inl.gov
Loading...
Searching...
No Matches
LevelSetCFLCondition.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
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
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
31void
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 {
38 RealVectorValue vel = MetaPhysicL::raw_value(_velocity[qp]);
39 _max_velocity = std::max(_max_velocity, std::abs(vel.norm()));
40 }
42}
43
44void
49
50void
52{
53 const auto & cfl = static_cast<const LevelSetCFLCondition &>(user_object);
54 _cfl_timestep = std::min(_cfl_timestep, cfl._cfl_timestep);
55}
56
registerMooseObject("LevelSetApp", LevelSetCFLCondition)
Real PostprocessorValue
static InputParameters validParams()
const Elem *const & _current_elem
const MooseArray< Point > & _q_point
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
Computes the maximum timestep based on the CFL condition.
virtual PostprocessorValue getValue() const override
const ADVectorVariableValue & _velocity
Velocity vector variable.
void threadJoin(const UserObject &user_object) override
LevelSetCFLCondition(const InputParameters &parameters)
static InputParameters validParams()
Real _max_velocity
The max velocity on an element, this is done simply to avoid creating temporary calls to execute.
Real _cfl_timestep
The minimum timestep computed using CFL condition.
unsigned int size() const
void gatherMin(T &value)
auto raw_value(const Eigen::Map< T > &in)