Пример #1
0
TagID
SubProblem::getMatrixTagID(const TagName & tag_name)
{
  auto tag_name_upper = MooseUtils::toUpper(tag_name);

  if (!matrixTagExists(tag_name))
    mooseError("Matrix tag: ",
               tag_name,
               " does not exist. ",
               "If this is a TimeKernel then this may have happened because you didn't "
               "specify a Transient Executioner.");

  return _matrix_tag_name_to_tag_id.at(tag_name_upper);
}
Пример #2
0
void
TagTestProblem::computeJacobian(const NumericVector<Number> & soln, SparseMatrix<Number> & jacobian)
{
  _fe_matrix_tags.clear();

  for (auto & mtag : mtags)
    if (matrixTagExists(mtag))
    {
      auto tag = getMatrixTagID(mtag);
      _fe_matrix_tags.insert(tag);
    }
    else
      mooseError("Tag ", mtag, " does not exist");

  _nl->setSolution(soln);

  if (_fe_matrix_tags.size() > 0)
    _nl->associateMatrixToTag(jacobian, *_fe_matrix_tags.begin());

  computeJacobianTags(_fe_matrix_tags);

  if (_fe_matrix_tags.size() > 0)
    _nl->disassociateMatrixFromTag(jacobian, *_fe_matrix_tags.begin());
}