Add modification to NewtonMethod to solve nonlinear periodic or hanging-node problems
Currently, there is no functionality to solve nonlinear periodic/hanging-node problems, like StationaryLinearProblemSolver._hanging_node_modifications
for linear problems. As far as I can tell, it should suffice to include something like
if (_hanging_node_modifications) {
auto dirichletValues = solution;
// keep only Dirichlet values
Dune::PDELab::set_shifted_dofs(_gridOperator.localAssembler().trialConstraints(),0.0, dirichletValues);
// set all constrained Dofs to zero in solution
Dune::PDELab::set_constrained_dofs(_gridOperator.localAssembler().trialConstraints(), 0.0, solution);
// copy correct Dirichlet values back into solution vector
Dune::PDELab::copy_constrained_dofs(_gridOperator.localAssembler().trialConstraints(), dirichletValues, solution);
// interpolate periodic constraints / hanging nodes
_gridOperator.localAssembler().backtransform(solution);
}
at the start of the prepareStep()
and updateDefect()
methods of the NewtonMethod
, so that the constrained Dofs are updated accordingly in each Newton iteration, while preserving the correct Dirichlet values.