Skip to content

Commit

Permalink
Add initial reinit_func(1.) call in Euler2Solver
Browse files Browse the repository at this point in the history
We need the call to reinit_func to set the time, t, in the context
to the correct value. Also added clarifying comments in EulerSolver
and Euler2Solver that we're also setting the time in addition to
possibly resetting the mesh if there's mesh motion.

There is probably a way to make this more efficient such that we
only call reinit_func twice in Euler2Solver, but I didn't put any
thought into it.
  • Loading branch information
pbauman committed Aug 24, 2016
1 parent 3f3a757 commit eed32a9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/solvers/euler2_solver.C
Expand Up @@ -134,6 +134,9 @@ bool Euler2Solver::_general_residual (bool request_jacobian,
context.get_elem_solution_rate() *=
context.elem_solution_rate_derivative;

// Move the mesh into place first if necessary, set t = t_{n+1}
(context.*reinit_func)(1.);

// First, evaluate time derivative at the new timestep.
// The element should already be in the proper place
// even for a moving mesh problem.
Expand Down Expand Up @@ -167,7 +170,7 @@ bool Euler2Solver::_general_residual (bool request_jacobian,
context.get_elem_solution().swap(old_elem_solution);
context.elem_solution_derivative = 0.0;

// Move the mesh into place first if necessary
// Move the mesh into place if necessary, set t = t_{n}
(context.*reinit_func)(0.);

jacobian_computed =
Expand All @@ -194,7 +197,7 @@ bool Euler2Solver::_general_residual (bool request_jacobian,
context.get_elem_solution().swap(old_elem_solution);
context.elem_solution_derivative = 1;

// Restore the elem position if necessary
// Restore the elem position if necessary, set t = t_{n+1}
(context.*reinit_func)(1.);

// Add back (or restore) the old residual/jacobian
Expand Down
4 changes: 2 additions & 2 deletions src/solvers/euler_solver.C
Expand Up @@ -129,7 +129,7 @@ bool EulerSolver::_general_residual (bool request_jacobian,
// Move theta_->elem_, elem_->theta_
context.get_elem_solution().swap(theta_solution);

// Move the mesh into place first if necessary
// Move the mesh into place first if necessary, set t = t_{\theta}
(context.*reinit_func)(theta);

// Get the time derivative at t_theta
Expand All @@ -139,7 +139,7 @@ bool EulerSolver::_general_residual (bool request_jacobian,
jacobian_computed = (_system.*mass)(jacobian_computed, context) &&
jacobian_computed;

// Restore the elem position if necessary
// Restore the elem position if necessary, set t = t_{n+1}
(context.*reinit_func)(1);

// Move elem_->elem_, theta_->theta_
Expand Down

0 comments on commit eed32a9

Please sign in to comment.