https://mooseframework.inl.gov
Loading...
Searching...
No Matches
level_set
src
postprocessors
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
10
#include "
LevelSetCFLCondition.h
"
11
12
registerMooseObject
(
"LevelSetApp"
,
LevelSetCFLCondition
);
13
14
InputParameters
15
LevelSetCFLCondition::validParams
()
16
{
17
InputParameters
params =
ElementPostprocessor::validParams
();
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
24
LevelSetCFLCondition::LevelSetCFLCondition
(
const
InputParameters
& parameters)
25
:
ElementPostprocessor
(parameters),
26
_cfl_timestep(
std
::numeric_limits<Real>::max()),
27
_velocity(adCoupledVectorValue(
"velocity"
))
28
{
29
}
30
31
void
32
LevelSetCFLCondition::execute
()
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
}
41
_cfl_timestep
= std::min(
_cfl_timestep
,
_current_elem
->hmin() /
_max_velocity
);
42
}
43
44
void
45
LevelSetCFLCondition::finalize
()
46
{
47
gatherMin
(
_cfl_timestep
);
48
}
49
50
void
51
LevelSetCFLCondition::threadJoin
(
const
UserObject
& user_object)
52
{
53
const
auto
& cfl =
static_cast<
const
LevelSetCFLCondition
&
>
(user_object);
54
_cfl_timestep
= std::min(
_cfl_timestep
, cfl._cfl_timestep);
55
}
56
57
PostprocessorValue
58
LevelSetCFLCondition::getValue
()
const
59
{
60
return
_cfl_timestep
;
61
}
registerMooseObject
registerMooseObject("LevelSetApp", LevelSetCFLCondition)
LevelSetCFLCondition.h
PostprocessorValue
Real PostprocessorValue
ElementPostprocessor
ElementPostprocessor::validParams
static InputParameters validParams()
ElementPostprocessor::_current_elem
const Elem *const & _current_elem
ElementPostprocessor::_q_point
const MooseArray< Point > & _q_point
InputParameters::addRequiredCoupledVar
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
InputParameters::addClassDescription
void addClassDescription(const std::string &doc_string)
LevelSetCFLCondition
Computes the maximum timestep based on the CFL condition.
Definition
LevelSetCFLCondition.h:18
LevelSetCFLCondition::execute
void execute() override
Definition
LevelSetCFLCondition.C:32
LevelSetCFLCondition::getValue
virtual PostprocessorValue getValue() const override
Definition
LevelSetCFLCondition.C:58
LevelSetCFLCondition::_velocity
const ADVectorVariableValue & _velocity
Velocity vector variable.
Definition
LevelSetCFLCondition.h:37
LevelSetCFLCondition::threadJoin
void threadJoin(const UserObject &user_object) override
Definition
LevelSetCFLCondition.C:51
LevelSetCFLCondition::LevelSetCFLCondition
LevelSetCFLCondition(const InputParameters ¶meters)
Definition
LevelSetCFLCondition.C:24
LevelSetCFLCondition::validParams
static InputParameters validParams()
Definition
LevelSetCFLCondition.C:15
LevelSetCFLCondition::finalize
void finalize() override
Definition
LevelSetCFLCondition.C:45
LevelSetCFLCondition::_max_velocity
Real _max_velocity
The max velocity on an element, this is done simply to avoid creating temporary calls to execute.
Definition
LevelSetCFLCondition.h:31
LevelSetCFLCondition::_cfl_timestep
Real _cfl_timestep
The minimum timestep computed using CFL condition.
Definition
LevelSetCFLCondition.h:34
MooseArray::size
unsigned int size() const
ElementPostprocessor::gatherMin
void gatherMin(T &value)
UserObject
MetaPhysicL::raw_value
auto raw_value(const Eigen::Map< T > &in)
std
InputParameters
Generated on Fri Aug 21 2026 13:41:05 for https://mooseframework.inl.gov by
1.9.8