diff options
-rw-r--r-- | src/driver/Newton.cc | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/driver/Newton.cc b/src/driver/Newton.cc index f3efb56..47bfd64 100644 --- a/src/driver/Newton.cc +++ b/src/driver/Newton.cc @@ -68,8 +68,9 @@ bool Newton_solve(patch_system& ps, int hn, const struct verbose_info& verbose_info) { const int max_Newton_iterations - = initial_find_flag ? solver_info.max_Newton_iterations__initial - : solver_info.max_Newton_iterations__subsequent; + = initial_find_flag ? solver_info.max_Newton_iterations__initial + : solver_info.max_Newton_iterations__subsequent; + for (int iteration = 1 ; iteration <= max_Newton_iterations ; ++iteration) @@ -78,13 +79,15 @@ const int max_Newton_iterations then CCTK_VInfo(CCTK_THORNSTRING, "Newton iteration %d of %d", iteration, max_Newton_iterations); - if (solver_info.debugging_output_at_each_Newton_iteration) then output_gridfn(ps, gfns::gfn__h, IO_info, IO_info.h_base_file_name, hn, verbose_info.print_algorithm_details, iteration); + // + // evaluate H(h) + // jtutil::norm<fp> H_norms; if (! horizon_function(ps, cgi, gi, @@ -97,13 +100,15 @@ const int max_Newton_iterations " iteration %d: H ||rms||=%.1e, ||infinity||=%.1e", iteration, H_norms.rms_norm(), H_norms.infinity_norm()); - if (solver_info.debugging_output_at_each_Newton_iteration) then output_gridfn(ps, gfns::gfn__H, IO_info, IO_info.H_base_file_name, hn, verbose_info.print_algorithm_details, iteration); + // + // convergence test on ||H|| + // if (H_norms.infinity_norm() <= solver_info.H_norm_for_convergence) then { if (verbose_info.print_algorithm_details) @@ -113,7 +118,9 @@ const int max_Newton_iterations return true; // *** NORMAL RETURN *** } + // // compute the Newton step + // if (! horizon_Jacobian(ps, Jac, cgi, gi, Jacobian_info, verbose_info.print_algorithm_details)) @@ -146,7 +153,9 @@ const int max_Newton_iterations hn, verbose_info.print_algorithm_details, iteration); + // // if the Newton step is too large, scale it down + // jtutil::norm<fp> h_norms; ps.ghosted_gridfn_norms(gfns::gfn__h, h_norms); const fp max_allowable_Delta_h @@ -158,7 +167,9 @@ const int max_Newton_iterations ? max_allowable_Delta_h / max_Delta_h : 1.0; + // // take the Newton step (scaled if need be) + // for (int pn = 0 ; pn < ps.N_patches() ; ++pn) { patch& p = ps.ith_patch(pn); @@ -189,6 +200,9 @@ const int max_Newton_iterations scale * Delta_h_norms.infinity_norm()); } + // + // convergence test on ||Delta_h|| + // if ( scale * Delta_h_norms.infinity_norm() <= solver_info.Delta_h_norm_for_convergence ) then { |