Ejemplo n.º 1
0
void
TagTestProblem::computeResidual(const NumericVector<Number> & soln,
                                NumericVector<Number> & residual)
{
  _fe_vector_tags.clear();

  for (auto & vtag : vtags)
    if (vectorTagExists(vtag))
    {
      auto tag = getVectorTagID(vtag);
      _fe_vector_tags.insert(tag);
    }
    else
      mooseError("Tag ", vtag, " does not exist");

  _nl->setSolution(soln);

  if (_fe_vector_tags.find(_nl->residualVectorTag()) != _fe_vector_tags.end())
    _nl->associateVectorToTag(residual, _nl->residualVectorTag());

  computeResidualTags(_fe_vector_tags);

  if (_fe_vector_tags.find(_nl->residualVectorTag()) != _fe_vector_tags.end())
    _nl->disassociateVectorFromTag(residual, _nl->residualVectorTag());
}
Ejemplo n.º 2
0
TagID
SubProblem::getVectorTagID(const TagName & tag_name)
{
  auto tag_name_upper = MooseUtils::toUpper(tag_name);

  if (!vectorTagExists(tag_name))
    mooseError("Vector 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 _vector_tag_name_to_tag_id.at(tag_name_upper);
}