diff --git a/include/problem_operators/problem_operator_interface.h b/include/problem_operators/problem_operator_interface.h index ec8e5313..38e59590 100644 --- a/include/problem_operators/problem_operator_interface.h +++ b/include/problem_operators/problem_operator_interface.h @@ -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 _block_true_offsets; diff --git a/src/executioners/MFEMTransient.C b/src/executioners/MFEMTransient.C index 4f67d7bf..f113939e 100644 --- a/src/executioners/MFEMTransient.C +++ b/src/executioners/MFEMTransient.C @@ -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(); diff --git a/src/problem_operators/problem_operator_interface.C b/src/problem_operators/problem_operator_interface.C index dcc23924..637b1017 100644 --- a/src/problem_operators/problem_operator_interface.C +++ b/src/problem_operators/problem_operator_interface.C @@ -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(); + } +} + } \ No newline at end of file diff --git a/src/problem_operators/time_domain_equation_system_problem_operator.C b/src/problem_operators/time_domain_equation_system_problem_operator.C index 09e290ef..17cdbb58 100644 --- a/src/problem_operators/time_domain_equation_system_problem_operator.C +++ b/src/problem_operators/time_domain_equation_system_problem_operator.C @@ -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( @@ -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