https://mooseframework.inl.gov
MooseVariableScalar.h
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 #pragma once
11 
12 #include "MooseVariableBase.h"
13 #include "SystemBase.h"
14 
15 // libMesh forward declarations
16 namespace libMesh
17 {
18 template <typename T>
19 class NumericVector;
20 }
21 
22 class Assembly;
23 class TimeIntegrator;
24 
29 {
30 public:
32 
34  virtual ~MooseVariableScalar();
35 
41  void reinit(bool reinit_for_derivative_reordering = false);
42 
43  const VariableValue & sln() const { return _u; }
44 
48  const ADVariableValue & adSln() const;
49 
50  const VariableValue & slnOld() const;
51  const VariableValue & slnOlder() const;
52  const VariableValue & vectorTagSln(TagID tag) const;
53  const VariableValue & matrixTagSln(TagID tag) const;
54 
55  const VariableValue & uDot() const;
56  const VariableValue & uDotDot() const;
57  const VariableValue & uDotOld() const;
58  const VariableValue & uDotDotOld() const;
59  const VariableValue & duDotDu() const;
60  const VariableValue & duDotDotDu() const;
61 
65  const ADVariableValue & adUDot() const;
66 
70  void setValue(unsigned int i, Number value);
71 
75  void setValues(Number value);
76 
77  void insert(NumericVector<Number> & soln);
78 
83  unsigned int oldestSolutionStateRequested() const;
84 
85  void setActiveTags(const std::set<TagID> & vtags) override { _required_vector_tags = vtags; }
86 
87 protected:
95  std::vector<VariableValue> _vector_tag_u;
97  mutable std::vector<bool> _need_vector_tag_u;
99  std::vector<VariableValue> _matrix_tag_u;
101  mutable std::vector<bool> _need_matrix_tag_u;
102 
109 
110  mutable bool _need_u_dot;
111  mutable bool _need_u_dotdot;
112  mutable bool _need_u_dot_old;
113  mutable bool _need_u_dotdot_old;
114  mutable bool _need_du_dot_du;
115  mutable bool _need_du_dotdot_du;
116 
118  mutable bool _need_u_old;
120  mutable bool _need_u_older;
121 
123  mutable bool _need_ad;
125  mutable bool _need_ad_u;
127  mutable bool _need_ad_u_dot;
132 
133 private:
140  void computeAD(bool nodal_ordering);
141 
143  std::set<TagID> _required_vector_tags;
144 };
std::set< TagID > _required_vector_tags
The set of vector tags we need to evaluate.
const VariableValue & uDotOld() const
const VariableValue & uDotDot() const
const ADVariableValue & adUDot() const
Return the first derivative of the solution with derivative information.
void computeAD(bool nodal_ordering)
Adds derivative information to the scalar variable value arrays.
ADVariableValue _ad_u_dot
The first derivative of the scalar solution with derivative information.
Keeps track of stuff related to assembling.
Definition: Assembly.h:101
unsigned int TagID
Definition: MooseTypes.h:210
void reinit(bool reinit_for_derivative_reordering=false)
Fill out the VariableValue arrays from the system solution vector.
bool _need_u_older
Whether or not the older solution is needed.
VariableValue _u
The value of scalar variable.
MooseVariableScalar(const InputParameters &parameters)
const VariableValue & slnOlder() const
bool _need_ad_u
whether ad_u is needed
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
ADVariableValue _ad_u
The scalar solution with derivative information.
const VariableValue & duDotDotDu() const
VariableValue _u_older
The older value of scalar variable.
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
const VariableValue & uDotDotOld() const
void setActiveTags(const std::set< TagID > &vtags) override
Set the active vector tags.
std::vector< VariableValue > _vector_tag_u
Tagged vectors.
std::vector< bool > _need_vector_tag_u
Only cache data when need it.
const VariableValue & slnOld() const
const VariableValue & uDot() const
const VariableValue & vectorTagSln(TagID tag) const
bool _need_ad
Whether any AD calculations are needed.
unsigned int oldestSolutionStateRequested() const
The oldest solution state that is requested for this variable (0 = current, 1 = old, 2 = older, etc).
static InputParameters validParams()
void setValue(unsigned int i, Number value)
Set the nodal value for this variable (to keep everything up to date.
void setValues(Number value)
Set all of the values of this scalar variable to the same value.
std::vector< bool > _need_matrix_tag_u
Only cache data when need it.
const VariableValue & matrixTagSln(TagID tag) const
std::vector< VariableValue > _matrix_tag_u
Tagged matrices.
OutputTools< Real >::VariableValue VariableValue
Definition: MooseTypes.h:314
bool _need_ad_u_dot
whether ad_u_dot is needed
Base class for time integrators.
const VariableValue & duDotDu() const
bool _need_u_old
Whether or not the old solution is needed.
Class for scalar variables (they are different).
void insert(NumericVector< Number > &soln)
const InputParameters & parameters() const
Get the parameters of the object.
const ADVariableValue & adSln() const
Return the solution with derivative information.
Real Number
const VariableValue & sln() const
VariableValue _u_old
The old value of scalar variable.