Skip to content

Commit

Permalink
a fix for time integrator: associate vectors with tags early because …
Browse files Browse the repository at this point in the history
…kernels may be using the tags idaholab#17586
  • Loading branch information
YaqiWang authored and aeslaughter committed Jun 2, 2021
1 parent 9e361da commit d6ea207
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion framework/include/timeintegrators/TimeIntegrator.h
Expand Up @@ -67,7 +67,7 @@ class TimeIntegrator : public MooseObject, public Restartable
*/
virtual void init() {}
virtual void preSolve() {}
virtual void preStep();
virtual void preStep() {}

/**
* Solves the time step and sets the number of nonlinear and linear iterations.
Expand Down
7 changes: 7 additions & 0 deletions framework/src/problems/FEProblemBase.C
Expand Up @@ -5337,6 +5337,13 @@ FEProblemBase::addTimeIntegrator(const std::string & type,
// integrator
_aux->addDotVectors();
_nl->addDotVectors();

auto tag_udot = _nl->getTimeIntegrator()->uDotFactorTag();
if (!_nl->hasVector(tag_udot))
_nl->associateVectorToTag(*_nl->solutionUDot(), tag_udot);
auto tag_udotdot = _nl->getTimeIntegrator()->uDotDotFactorTag();
if (!_nl->hasVector(tag_udotdot) && uDotDotRequested())
_nl->associateVectorToTag(*_nl->solutionUDotDot(), tag_udotdot);
}

void
Expand Down
2 changes: 2 additions & 0 deletions framework/src/timeintegrators/CentralDifference.C
Expand Up @@ -60,7 +60,9 @@ CentralDifference::initialSetup()
ActuallyExplicitEuler::initialSetup();

// _nl here so that we don't create this vector in the aux system time integrator
_nl.disassociateVectorFromTag(*_nl.solutionUDot(), _u_dot_factor_tag);
_nl.addVector(_u_dot_factor_tag, true, GHOSTED);
_nl.disassociateVectorFromTag(*_nl.solutionUDotDot(), _u_dotdot_factor_tag);
_nl.addVector(_u_dotdot_factor_tag, true, GHOSTED);
}

Expand Down
10 changes: 0 additions & 10 deletions framework/src/timeintegrators/TimeIntegrator.C
Expand Up @@ -50,16 +50,6 @@ TimeIntegrator::TimeIntegrator(const InputParameters & parameters)
_fe_problem.setUDotRequested(true);
}

void
TimeIntegrator::preStep()
{
// If nothing else (children TimeIntegrators) associated these tags, associate them now
if (!_nl.hasVector(_u_dot_factor_tag))
_nl.associateVectorToTag(*_nl.solutionUDot(), _u_dot_factor_tag);
if (!_nl.hasVector(_u_dotdot_factor_tag) && _fe_problem.uDotDotRequested())
_nl.associateVectorToTag(*_nl.solutionUDotDot(), _u_dotdot_factor_tag);
}

void
TimeIntegrator::solve()
{
Expand Down

0 comments on commit d6ea207

Please sign in to comment.