17 std::shared_ptr<neml2::Model>
18 getModel(neml2::Factory & factory,
const std::string & name, neml2::Dtype dtype)
20 const auto prev_dtype = neml2::get_default_dtype();
21 neml2::set_default_dtype(dtype);
22 auto model = factory.get_model(
name);
24 neml2::set_default_dtype(prev_dtype);
34 if (!v.is_force() && !v.is_state())
35 mooseError(
"The NEML2 variable '", v,
"' is on the wrong subaxis.");
44 if (!v.is_old_force() && !v.is_old_state())
45 mooseError(
"The NEML2 variable '", v,
"' is on the wrong subaxis.");
51 return neml2::utils::parse<neml2::VariableName>(s);
53 #endif // NEML2_ENABLED 55 static const std::string
missing_neml2 =
"The `NEML2` library is required but not enabled. Refer " 56 "to the documentation for guidance on how to enable it.";
80 return missing_neml2 +
" (Original description: " + desc +
")";
std::string name(const ElemQuality q)
virtual bool computingScalingJacobian() const =0
Getter for whether we're computing the scaling jacobian.
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
bool shouldCompute(const SubProblem &)
Determine whether the NEML2 material model should be evaluated.
void assertOldVariable(const neml2::VariableName &)
Assert that the NEML2 variable name sits on either the old_forces or the old_state subaxis...
const bool & currentlyComputingResidualAndJacobian() const
Returns true if the problem is in the process of computing the residual and the Jacobian.
std::string docstring(const std::string &desc)
Augment docstring if NEML2 is not enabled.
void assertNEML2Enabled()
Assert that NEML2 is enabled.
std::shared_ptr< neml2::Model > getModel(neml2::Factory &factory, const std::string &name, neml2::Dtype dtype=neml2::kFloat64)
Get the NEML2 Model.
Generic class for solving transient nonlinear problems.
void assertVariable(const neml2::VariableName &)
Assert that the NEML2 variable name sits on either the forces or the state subaxis.
const bool & currentlyComputingJacobian() const
Returns true if the problem is in the process of computing the Jacobian.
static const std::string missing_neml2
neml2::VariableName parseVariableName(const std::string &)
Parse a raw string into NEML2 variable name.