https://mooseframework.inl.gov
FVBoundedValueConstraint.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 
12 #include "MooseVariableScalar.h"
13 #include "MooseVariableFV.h"
14 #include "Assembly.h"
15 
17 
20 {
22  params.addClassDescription(
23  "This class is used to enforce a min or max value for a finite volume variable");
24  params.setDocString("phi0", "The min or max bound");
25  // Define the min/max enumeration
26  MooseEnum type_options("lower_than=0 higher_than=1");
28  "bound_type", type_options, "Whether a minimum or a maximum bound");
29  return params;
30 }
31 
33  : FVScalarLagrangeMultiplierConstraint(parameters), _bound_type(getParam<MooseEnum>("bound_type"))
34 {
35 }
36 
37 ADReal
39 {
40  if (_bound_type == BoundType::LOWER_THAN && _u[_qp] > _phi0)
42  else if (_bound_type == BoundType::HIGHER_THAN && _u[_qp] < _phi0)
44  else
45  return 0;
46 }
const MooseEnum _bound_type
What type of bound (min or max) this kernel intends to apply.
static InputParameters validParams()
void setDocString(const std::string &name, const std::string &doc)
Set the doc string of a parameter.
Moose::StateArg determineState() const
Create a functor state argument that corresponds to the implicit state of this object.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
Base class for implementing constraints on finite volume variable elemental values using scalar Lagra...
DualNumber< Real, DNDerivativeType, true > ADReal
Definition: ADRealForward.h:46
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
Moose::ElemArg makeElemArg(const Elem *elem, bool correct_skewnewss=false) const
Helper method to create an elemental argument for a functor that includes whether to perform skewness...
registerMooseObject("MooseApp", FVBoundedValueConstraint)
const Elem *const & _current_elem
ADReal computeQpResidual() override final
This is the primary function that must be implemented for flux kernel terms.
FVBoundedValueConstraint(const InputParameters &parameters)
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:33
const ADVariableValue & _u
This Kernel implements the residuals that enforce the constraint.
const unsigned int _qp
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
const PostprocessorValue & _phi0
The value that we want the average of the primal variable to be equal to.
MooseVariableFV< Real > & _var