21 *moose_object->parameters().getCheckedPointerParam<
FEProblemBase *>(
"_fe_problem_base")),
22 _sc_tid(moose_object->parameters().isParamValid(
"_tid")
23 ? moose_object->parameters().get<
THREAD_ID>(
"_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.getObjectName()),
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)
69#ifdef MOOSE_KOKKOS_ENABLED
72 : _sc_fe_problem(object._sc_fe_problem),
73 _sc_tid(object._sc_tid),
74 _real_zero(object._real_zero),
75 _scalar_zero(object._scalar_zero),
76 _point_zero(object._point_zero),
77 _sc_parameters(object._sc_parameters),
78 _sc_name(object._sc_name),
79 _sc_is_implicit(object._sc_is_implicit)
91 return (i < it->second.size());
97 ": The coupled scalar variable \"",
99 "\" was never added to this object's "
100 "InputParameters, please double-check "
132 default_value_it =
_default_value.insert(std::make_pair(var_name, std::move(value))).first;
135 return default_value_it->second.get();
161 mooseError(
"adCoupledValue for non-implicit calculations is not currently supported. Use "
162 "coupledValue instead for non-implicit");
167ScalarCoupleable::coupledGenericScalarValue<false>(
const std::string & var_name,
168 const unsigned int comp)
const
175ScalarCoupleable::coupledGenericScalarValue<true>(
const std::string & var_name,
176 const unsigned int comp)
const
189 default_value_it =
_dual_default_value.insert(std::make_pair(var_name, std::move(value))).first;
192 return default_value_it->second.get();
198 const unsigned int comp)
const
205 mooseError(
"Attempting to couple to vector tag scalar with ID ",
209 ", but a vector tag with that ID does not exist");
219 const unsigned int comp)
const
244 const unsigned int comp)
const
253 return var->slnOlder();
255 mooseError(
"Older values not available for explicit schemes");
292 const unsigned int comp)
const
323 for (
auto jt : it->second)
324 cvars +=
" " + jt->name();
326 ": Trying to couple a field variable where scalar variable is expected, '",
343 const auto & entry = it->second;
344 if (comp < entry.size())
347 mooseError(
_sc_name,
": Trying to get a non-existent component of variable '", var_name,
"'");
355 const std::string & fn_name)
const
363 "\" when using a \"Steady\" executioner is not allowed. This value is available "
364 "only in transient simulations.");
374 return it->second.size();
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Moose::GenericType< VariableValue, is_ad > GenericVariableValue
OutputTools< Real >::VariableValue VariableValue
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
libMesh::Order getMaxScalarOrder() const
virtual bool isTransient() const override
Every object that can be built by the factory should be derived from this class.
libMesh::Order order() const
Get the order of this variable Note: Order enum can be implicitly converted to unsigned int.
unsigned int number() const
Get variable number coming from libMesh.
This class provides an interface for common operations on field variables of both FE and FV types wit...
Class for scalar variables (they are different).
const VariableValue & uDotOld() const
const VariableValue & uDot() const
const VariableValue & duDotDotDu() const
const VariableValue & uDotDotOld() const
const ADVariableValue & adUDot() const
Return the first derivative of the solution with derivative information.
const VariableValue & duDotDu() const
const VariableValue & uDotDot() const
const VariableValue & matrixTagSln(TagID tag) const
const VariableValue & vectorTagSln(TagID tag) const
Interface for objects that needs scalar coupling capabilities.
const VariableValue & coupledScalarValue(const std::string &var_name, unsigned int comp=0) const
Returns value of a scalar coupled variable.
const std::string & _sc_name
The name of the object this interface is part of.
std::unordered_map< std::string, std::unique_ptr< VariableValue > > _default_value
Will hold the default value for optional coupled scalar variables.
const VariableValue & coupledMatrixTagScalarValue(const std::string &var_name, TagID tag, unsigned int comp=0) const
Returns 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.
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.
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...
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_vector_tags
The scalar coupleable vector tags.
const InputParameters & _sc_parameters
std::set< TagID > _sc_coupleable_matrix_tags
The scalar coupleable matrix 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.
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.
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 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 & coupledScalarDotOld(const std::string &var_name, unsigned int comp=0) const
Returns the old time derivative 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.
const VariableValue * getDefaultValue(const std::string &var_name) const
Helper method to return (and insert if necessary) the default value for an uncoupled variable.
const VariableValue & coupledVectorTagScalarValue(const std::string &var_name, TagID tag, unsigned int comp=0) const
Returns value of a scalar coupled variable.
std::unordered_map< std::string, std::unique_ptr< ADVariableValue > > _dual_default_value
Will hold the default AD value for optional coupled scalar variables.
bool isCoupledScalar(const std::string &var_name, unsigned int i=0) const
Returns true if a variables has been coupled_as name.
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.
FEProblemBase & _sc_fe_problem
libMesh::Order coupledScalarOrder(const std::string &var_name, unsigned int comp=0) const
Returns the order for a scalar coupled variable by name.
const MooseVariableScalar * getScalarVar(const std::string &var_name, unsigned int comp) const
Extract pointer to a scalar coupled variable.
const ADVariableValue & adCoupledScalarValue(const std::string &var_name, unsigned int comp=0) const
Returns AD value of a scalar coupled variable.
const VariableValue & coupledScalarDot(const std::string &var_name, unsigned int comp=0) const
Returns the time derivative of a scalar coupled variable.
ScalarCoupleable(const MooseObject *moose_object)
Constructing the object.
const THREAD_ID _sc_tid
Thread ID of the thread using this object.
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 bool _sc_is_implicit
True if implicit value is required.
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.
Generic class for solving transient nonlinear problems.
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 hasScalarVariable(const std::string &var_name) const =0
Returns a Boolean indicating whether any system contains a variable with the name provided.
virtual bool hasVariable(const std::string &var_name) const =0
Whether or not this problem has the variable.
virtual bool vectorTagExists(const TagID tag_id) const
Check to see if a particular Tag exists.
virtual MooseVariableScalar & getScalarVariable(const THREAD_ID tid, const std::string &var_name)=0
Returns the scalar variable reference from whichever system contains it.