Skip to content

Commit

Permalink
Fix issue causing parallel transient problems to output a zero solution
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderianblair committed Dec 19, 2024
1 parent 0babdbd commit 9290d3f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/problem_operators/problem_operator_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class ProblemOperatorInterface
virtual ~ProblemOperatorInterface() = default;

virtual void SetGridFunctions();
virtual void SetTestVariablesFromTrueVectors();
virtual void SetTrialVariablesFromTrueVectors();
virtual void Init(mfem::BlockVector & X);

mfem::Array<int> _block_true_offsets;
Expand Down
3 changes: 3 additions & 0 deletions src/executioners/MFEMTransient.C
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ MFEMTransient::step(double dt, int it) const
// Advance time step.
_problem_data._ode_solver->Step(_problem_data._f, _t, dt);

// Synchonise time dependent GridFunctions with updated DoF data.
_problem_operator->SetTestVariablesFromTrueVectors();

// Sync Host/Device
_problem_data._f.HostRead();

Expand Down
18 changes: 18 additions & 0 deletions src/problem_operators/problem_operator_interface.C
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,22 @@ ProblemOperatorInterface::Init(mfem::BlockVector & X)
}
}

void
ProblemOperatorInterface::SetTestVariablesFromTrueVectors()
{
for (unsigned int ind = 0; ind < _test_variables.size(); ++ind)
{
_test_variables.at(ind)->SetFromTrueVector();
}
}

void
ProblemOperatorInterface::SetTrialVariablesFromTrueVectors()
{
for (unsigned int ind = 0; ind < _trial_variables.size(); ++ind)
{
_trial_variables.at(ind)->SetFromTrueVector();
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ TimeDomainEquationSystemProblemOperator::ImplicitSolve(const double dt,
mfem::Vector & dX_dt)
{
dX_dt = 0.0;
SetTestVariablesFromTrueVectors();
for (unsigned int ind = 0; ind < _trial_variables.size(); ++ind)
{
_trial_variables.at(ind)->MakeTRef(
Expand All @@ -50,6 +51,7 @@ TimeDomainEquationSystemProblemOperator::ImplicitSolve(const double dt,
_problem._nonlinear_solver->SetSolver(*_problem._jacobian_solver);
_problem._nonlinear_solver->SetOperator(*GetEquationSystem());
_problem._nonlinear_solver->Mult(_true_rhs, dX_dt);
SetTrialVariablesFromTrueVectors();
}

void
Expand Down

0 comments on commit 9290d3f

Please sign in to comment.