21 *moose_object->parameters().getCheckedPointerParam<
FEProblemBase *>(
"_fe_problem_base")),
22 _sc_tid(moose_object->parameters().isParamValid(
"_tid")
25 _real_zero(_sc_fe_problem._real_zero[_sc_tid]),
26 _scalar_zero(_sc_fe_problem._scalar_zero[_sc_tid]),
27 _point_zero(_sc_fe_problem._point_zero[_sc_tid]),
28 _sc_parameters(moose_object->parameters()),
29 _sc_name(_sc_parameters.
get<
std::string>(
"_object_name")),
30 _sc_is_implicit(_sc_parameters.have_parameter<bool>(
"implicit")
31 ? _sc_parameters.
get<bool>(
"implicit")
41 std::string
name = *iter;
45 for (
const auto & coupled_var_name : vars)
76 return (i < it->second.size());
82 ": The coupled scalar variable \"",
84 "\" was never added to this object's " 85 "InputParameters, please double-check " 117 default_value_it =
_default_value.insert(std::make_pair(var_name, std::move(
value))).first;
120 return default_value_it->second.get();
146 mooseError(
"adCoupledValue for non-implicit calculations is not currently supported. Use " 147 "coupledValue instead for non-implicit");
152 ScalarCoupleable::coupledGenericScalarValue<false>(
const std::string & var_name,
153 const unsigned int comp)
const 155 return coupledScalarValue(var_name, comp);
160 ScalarCoupleable::coupledGenericScalarValue<true>(
const std::string & var_name,
161 const unsigned int comp)
const 163 return adCoupledScalarValue(var_name, comp);
177 return default_value_it->second.get();
183 const unsigned int comp)
const 190 mooseError(
"Attempting to couple to vector tag scalar with ID ",
194 ", but a vector tag with that ID does not exist");
204 const unsigned int comp)
const 229 const unsigned int comp)
const 238 return var->slnOlder();
240 mooseError(
"Older values not available for explicit schemes");
277 const unsigned int comp)
const 308 for (
auto jt : it->second)
309 cvars +=
" " + jt->name();
311 ": Trying to couple a field variable where scalar variable is expected, '",
328 const auto & entry = it->second;
329 if (comp < entry.size())
332 mooseError(
_sc_name,
": Trying to get a non-existent component of variable '", var_name,
"'");
340 const std::string & fn_name)
const 348 "\" when using a \"Steady\" executioner is not allowed. This value is available " 349 "only in transient simulations.");
359 return it->second.size();
std::string name(const ElemQuality q)
virtual MooseVariableScalar & getScalarVariable(const THREAD_ID tid, const std::string &var_name)=0
Returns the scalar variable reference from whichever system contains it.
const VariableValue & uDotOld() const
const VariableValue & uDotDot() const
const ADVariableValue & adUDot() const
Return the first derivative of the solution with derivative information.
std::unordered_map< std::string, std::vector< MooseVariableFieldBase * > > _sc_coupled_vars
Field variables coupled into this object (for error checking)
std::set< TagID > _sc_coupleable_matrix_tags
The scalar coupleable matrix tags.
typename Moose::GenericType< VariableValue, is_ad > GenericVariableValue
const THREAD_ID _sc_tid
Thread ID of the thread using this object.
const VariableValue & coupledScalarDotDotDu(const std::string &var_name, unsigned int comp=0) const
Second time derivative of a scalar coupled variable with respect to the coefficients.
std::set< TagID > _sc_coupleable_vector_tags
The scalar coupleable vector tags.
const VariableValue & coupledScalarValueOld(const std::string &var_name, unsigned int comp=0) const
Returns the old (previous time step) value of a scalar coupled variable.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
unsigned int number() const
Get variable number coming from libMesh.
T * get(const std::unique_ptr< T > &u)
The MooseUtils::get() specializations are used to support making forwards-compatible code changes fro...
const VariableValue & coupledScalarDot(const std::string &var_name, unsigned int comp=0) const
Returns the time derivative of a scalar coupled variable.
const bool _sc_is_implicit
True if implicit value is required.
const VariableValue & coupledScalarDotOld(const std::string &var_name, unsigned int comp=0) const
Returns the old time derivative of a scalar coupled variable.
const std::string & _sc_name
The name of the object this interface is part of.
const VariableValue & duDotDotDu() const
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...
This class provides an interface for common operations on field variables of both FE and FV types wit...
const VariableValue & coupledScalarDotDu(const std::string &var_name, unsigned int comp=0) const
Time derivative of a scalar coupled variable with respect to the coefficients.
const VariableValue & uDotDotOld() const
bool isCoupledScalar(const std::string &var_name, unsigned int i=0) const
Returns true if a variables has been coupled_as name.
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
const ADVariableValue & adCoupledScalarDot(const std::string &var_name, unsigned int comp=0) const
Returns the time derivative of a scalar coupled variable, including its dependence on the nonlinear d...
const VariableValue & coupledVectorTagScalarValue(const std::string &var_name, TagID tag, unsigned int comp=0) const
Returns value of a scalar coupled variable.
const VariableValue & uDot() const
const VariableValue & vectorTagSln(TagID tag) const
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
Every object that can be built by the factory should be derived from this class.
const VariableValue & coupledScalarValueOlder(const std::string &var_name, unsigned int comp=0) const
Returns the older (two time steps previous) value of a scalar coupled variable.
const VariableValue & coupledScalarDotDot(const std::string &var_name, unsigned int comp=0) const
Returns the second time derivative of a scalar coupled variable.
void checkVar(const std::string &var_name) const
Check that the right kind of variable is being coupled in.
const VariableValue & coupledScalarValue(const std::string &var_name, unsigned int comp=0) const
Returns value of a scalar coupled variable.
virtual bool hasScalarVariable(const std::string &var_name) const =0
Returns a Boolean indicating whether any system contains a variable with the name provided...
const MooseVariableScalar * getScalarVar(const std::string &var_name, unsigned int comp) const
Extract pointer to a scalar coupled variable.
virtual bool vectorTagExists(const TagID tag_id) const
Check to see if a particular Tag exists.
std::unordered_map< std::string, std::vector< MooseVariableScalar * > > _coupled_scalar_vars
Coupled vars whose values we provide.
unsigned int coupledScalar(const std::string &var_name, unsigned int comp=0) const
Returns the index for a scalar coupled variable by name.
virtual const MooseVariableFieldBase & getVariable(const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type=Moose::VarKindType::VAR_ANY, Moose::VarFieldType expected_var_field_type=Moose::VarFieldType::VAR_FIELD_ANY) const =0
Returns the variable reference for requested variable which must be of the expected_var_type (Nonline...
virtual bool hasVariable(const std::string &var_name) const =0
Whether or not this problem has the variable.
const VariableValue & matrixTagSln(TagID tag) const
const InputParameters & _sc_parameters
OutputTools< Real >::VariableValue VariableValue
Order order() const
Get the order of this variable Note: Order enum can be implicitly converted to unsigned int...
const ADVariableValue * getADDefaultValue(const std::string &var_name) const
Helper method to return (and insert if necessary) the AD default value for an uncoupled variable...
const ADVariableValue & adCoupledScalarValue(const std::string &var_name, unsigned int comp=0) const
Returns AD value of a scalar coupled variable.
Generic class for solving transient nonlinear problems.
const VariableValue * getDefaultValue(const std::string &var_name) const
Helper method to return (and insert if necessary) the default value for an uncoupled variable...
ScalarCoupleable(const MooseObject *moose_object)
Constructing the object.
const VariableValue & duDotDu() const
std::vector< MooseVariableScalar * > _coupled_moose_scalar_vars
Vector of coupled variables.
unsigned int coupledScalarComponents(const std::string &var_name) const
Return the number of components to the coupled scalar variable.
Class for scalar variables (they are different).
std::unordered_map< std::string, std::unique_ptr< VariableValue > > _default_value
Will hold the default value for optional coupled scalar variables.
std::unordered_map< std::string, std::unique_ptr< ADVariableValue > > _dual_default_value
Will hold the default AD value for optional coupled scalar variables.
virtual bool isTransient() const override
const VariableValue & coupledMatrixTagScalarValue(const std::string &var_name, TagID tag, unsigned int comp=0) const
Returns value of a scalar coupled variable.
const VariableValue & coupledScalarDotDotOld(const std::string &var_name, unsigned int comp=0) const
Returns the old second time derivative of a scalar coupled variable.
Order coupledScalarOrder(const std::string &var_name, unsigned int comp=0) const
Returns the order for a scalar coupled variable by name.
Order getMaxScalarOrder() const