File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -242,21 +242,21 @@ namespace pfasst
242242 {
243243 if (this ->abs_residual_tol > 0.0 || this ->rel_residual_tol > 0.0 ) {
244244 if (this ->residuals .size () == 0 ) {
245- for (auto x: this ->get_nodes ()) {
246- UNUSED (x);
245+ for (size_t m = 0 ; m < this ->get_nodes ().size (); m++) {
247246 this ->residuals .push_back (this ->get_factory ()->create (pfasst::encap::solution));
248247 }
249248 }
250249 this ->residual (this ->get_controller ()->get_time_step (), this ->residuals );
251- vector<time> rnorms;
252- for (auto r: this ->residuals ) {
253- rnorms.push_back (r->norm0 ());
250+ vector<time> anorms, rnorms;
251+ for (size_t m = 0 ; m < this ->get_nodes ().size (); m++) {
252+ anorms.push_back (this ->residuals [m]->norm0 ());
253+ rnorms.push_back (anorms.back () / this ->get_state (m)->norm0 ());
254254 }
255+ auto amax = *std::max_element (anorms.begin (), anorms.end ());
255256 auto rmax = *std::max_element (rnorms.begin (), rnorms.end ());
256- if (rmax < this ->abs_residual_tol ) {
257+ if (amax < this ->abs_residual_tol || rmax < this -> rel_residual_tol ) {
257258 return true ;
258259 }
259- // XXX: check rel norms too
260260 }
261261 return false ;
262262 }
You can’t perform that action at this time.
0 commit comments