www.mooseframework.org
ScalarCoupleable.h
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 #pragma once
11 
12 #include "Moose.h"
13 
14 // MOOSE includes
15 #include "MooseVariableBase.h"
16 
17 // C++ includes
18 #include <map>
19 #include <string>
20 #include <vector>
21 
22 // Forward declarations
23 class FEProblemBase;
24 class InputParameters;
25 class MooseObject;
27 
33 {
34 public:
39  ScalarCoupleable(const MooseObject * moose_object);
40 
44  virtual ~ScalarCoupleable();
45 
50  const std::vector<MooseVariableScalar *> & getCoupledMooseScalarVars();
51 
53 
55 
57 
59 
60 protected:
61  // Reference to the interface's input parameters
63 
65  const std::string & _sc_name;
66 
72  virtual bool isCoupledScalar(const std::string & var_name, unsigned int i = 0);
73 
78  virtual unsigned int coupledScalarComponents(const std::string & var_name);
79 
86  virtual unsigned int coupledScalar(const std::string & var_name, unsigned int comp = 0);
87 
94  virtual Order coupledScalarOrder(const std::string & var_name, unsigned int comp = 0);
95 
102  virtual VariableValue & coupledScalarValue(const std::string & var_name, unsigned int comp = 0);
103 
111  virtual VariableValue &
112  coupledVectorTagScalarValue(const std::string & var_name, TagID tag, unsigned int comp = 0);
113 
121  virtual VariableValue &
122  coupledMatrixTagScalarValue(const std::string & var_name, TagID tag, unsigned int comp = 0);
123 
130  virtual VariableValue & coupledScalarValueOld(const std::string & var_name,
131  unsigned int comp = 0);
132 
139  virtual VariableValue & coupledScalarValueOlder(const std::string & var_name,
140  unsigned int comp = 0);
147  virtual VariableValue & coupledScalarDot(const std::string & var_name, unsigned int comp = 0);
148 
155  virtual VariableValue & coupledScalarDotDot(const std::string & var_name, unsigned int comp = 0);
156 
163  virtual VariableValue & coupledScalarDotOld(const std::string & var_name, unsigned int comp = 0);
164 
171  virtual VariableValue & coupledScalarDotDotOld(const std::string & var_name,
172  unsigned int comp = 0);
173 
181  virtual VariableValue & coupledScalarDotDu(const std::string & var_name, unsigned int comp = 0);
182 
190  virtual VariableValue & coupledScalarDotDotDu(const std::string & var_name,
191  unsigned int comp = 0);
192 
193 protected:
194  // Reference to FEProblemBase
196 
198  std::map<std::string, std::vector<MooseVariableScalar *>> _coupled_scalar_vars;
199 
201  std::map<std::string, VariableValue *> _default_value;
202 
204  std::vector<MooseVariableScalar *> _coupled_moose_scalar_vars;
205 
208 
211 
214 
216  const Real & _real_zero;
217 
220 
222  const Point & _point_zero;
223 
230  VariableValue * getDefaultValue(const std::string & var_name);
231 
237  void checkVar(const std::string & var_name);
238 
245  MooseVariableScalar * getScalarVar(const std::string & var_name, unsigned int comp);
246 
253  void validateExecutionerType(const std::string & name, const std::string & fn_name) const;
254 
255 private:
257  std::map<std::string, std::vector<MooseVariableFEBase *>> _sc_coupled_vars;
258 
259  std::set<TagID> _sc_coupleable_vector_tags;
260 
261  std::set<TagID> _sc_coupleable_matrix_tags;
262 };
263 
std::map< std::string, std::vector< MooseVariableFEBase * > > _sc_coupled_vars
Field variables coupled into this object (for error checking)
const Point & _point_zero
Zero point.
std::set< TagID > _sc_coupleable_matrix_tags
const std::vector< MooseVariableScalar * > & getCoupledMooseScalarVars()
Get the list of coupled scalar variables.
virtual unsigned int coupledScalarComponents(const std::string &var_name)
Return the number of components to the coupled scalar variable.
unsigned int TagID
Definition: MooseTypes.h:162
virtual bool isCoupledScalar(const std::string &var_name, unsigned int i=0)
Returns true if a variables has been coupled_as name.
std::set< TagID > _sc_coupleable_vector_tags
virtual VariableValue & coupledScalarDotDot(const std::string &var_name, unsigned int comp=0)
Returns the second time derivative of a scalar coupled variable.
virtual ~ScalarCoupleable()
Destructor for object.
virtual VariableValue & coupledScalarDotDotOld(const std::string &var_name, unsigned int comp=0)
Returns the old second time derivative of a scalar coupled variable.
virtual VariableValue & coupledScalarDotOld(const std::string &var_name, unsigned int comp=0)
Returns the old time derivative of a scalar coupled variable.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void checkVar(const std::string &var_name)
Check that the right kind of variable is being coupled in.
const std::string & _sc_name
The name of the object this interface is part of.
virtual VariableValue & coupledScalarDotDu(const std::string &var_name, unsigned int comp=0)
Time derivative of a scalar coupled variable with respect to the coefficients.
FEProblemBase & _sc_fe_problem
void validateExecutionerType(const std::string &name, const std::string &fn_name) const
Checks to make sure that the current Executioner has set "_is_transient" when old/older values are co...
VariableValue * getDefaultValue(const std::string &var_name)
Helper method to return (and insert if necessary) the default value for an uncoupled variable...
virtual unsigned int coupledScalar(const std::string &var_name, unsigned int comp=0)
Returns the index for a scalar coupled variable by name.
virtual VariableValue & coupledMatrixTagScalarValue(const std::string &var_name, TagID tag, unsigned int comp=0)
Returns value of a scalar coupled variable.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
const InputParameters & _coupleable_params
Local InputParameters.
THREAD_ID _sc_tid
Thread ID of the thread using this object.
std::set< TagID > & getScalarVariableCoupleableVectorTags()
MooseVariableScalar * getScalarVar(const std::string &var_name, unsigned int comp)
Extract pointer to a scalar coupled variable.
bool _sc_is_implicit
True if implicit value is required.
virtual VariableValue & coupledScalarValueOld(const std::string &var_name, unsigned int comp=0)
Returns the old (previous time step) value of a scalar coupled variable.
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:42
virtual VariableValue & coupledVectorTagScalarValue(const std::string &var_name, TagID tag, unsigned int comp=0)
Returns value of a scalar coupled variable.
virtual Order coupledScalarOrder(const std::string &var_name, unsigned int comp=0)
Returns the order for a scalar coupled variable by name.
void addScalarVariableCoupleableVectorTag(TagID tag)
std::map< std::string, std::vector< MooseVariableScalar * > > _coupled_scalar_vars
Coupled vars whose values we provide.
virtual VariableValue & coupledScalarValue(const std::string &var_name, unsigned int comp=0)
Returns value of a scalar coupled variable.
const InputParameters & _sc_parameters
std::map< std::string, VariableValue * > _default_value
Will hold the default value for optional coupled scalar variables.
OutputTools< Real >::VariableValue VariableValue
Definition: MooseTypes.h:197
ScalarCoupleable(const MooseObject *moose_object)
Constructing the object.
std::vector< MooseVariableScalar * > _coupled_moose_scalar_vars
Vector of coupled variables.
const Real & _real_zero
Scalar zero.
Class for scalar variables (they are different).
virtual VariableValue & coupledScalarDot(const std::string &var_name, unsigned int comp=0)
Returns the time derivative of a scalar coupled variable.
virtual VariableValue & coupledScalarDotDotDu(const std::string &var_name, unsigned int comp=0)
Second time derivative of a scalar coupled variable with respect to the coefficients.
Interface for objects that needs scalar coupling capabilities.
const VariableValue & _scalar_zero
Zero value of a scalar variable.
std::set< TagID > & getScalarVariableCoupleableMatrixTags()
void addScalarVariableCoupleableMatrixTag(TagID tag)
unsigned int THREAD_ID
Definition: MooseTypes.h:161
virtual VariableValue & coupledScalarValueOlder(const std::string &var_name, unsigned int comp=0)
Returns the older (two time steps previous) value of a scalar coupled variable.