Peano
Loading...
Searching...
No Matches
spectral-solver.h
Go to the documentation of this file.
1#ifndef APPARENT_HORIZON_FINDER_SPECTRAL_SOLVER_H_
2#define APPARENT_HORIZON_FINDER_SPECTRAL_SOLVER_H_
3
4#include <functional>
5#include <string>
6#include <vector>
7
8#include "harmonics.h"
9
10namespace exahype2::ccz4::ahf {
11
18using SpectralResidual = std::function<std::vector<double>(const std::vector<double>&)>;
19
24 double tolerance = 1.0e-10;
25 double massScale = 1.0;
26 int maxIterations = 40;
27 double finiteDifferenceStep = 1.0e-6;
29 double maxRadiusFactor = 6.0;
42};
43
55 int iteration = 0;
57 double residualNormTwo = 0.0;
58 double damping = 1.0;
59 std::vector<double> coefficients;
60 std::vector<double> h;
61};
62
67 std::vector<double> coefficients;
68 bool converged = false;
69 int iterations = 0;
70 std::vector<double> residualHistory;
71 std::string message;
74 std::vector<SpectralNewtonIterate> iterationHistory;
75};
76
92 const SpectralResidual& residual,
93 const std::vector<double>& initialCoefficients,
94 const SpectralNewtonOptions& options = {});
95
96} // namespace exahype2::ccz4::ahf
97
98#endif // APPARENT_HORIZON_FINDER_SPECTRAL_SOLVER_H_
SpectralNewtonResult SolveSpectralNewton(const SpectralBasis &basis, const SpectralResidual &residual, const std::vector< double > &initialCoefficients, const SpectralNewtonOptions &options={})
Damped Newton-Raphson solve of the spectral apparent-horizon equations R(a) = 0.
std::function< std::vector< double >(const std::vector< double > &)> SpectralResidual
Residual R(a): the spherical-harmonic coefficients of the expansion Theta for a given coefficient vec...
Spectral basis plus collocation grid and precomputed design matrices.
Definition harmonics.h:100
One state of the Newton solver, recorded only when SpectralNewtonOptions::recordIterationHistory is s...
double damping
line-search lambda; 1.0 for the initial guess
std::vector< double > h
synthesised radius at the basis collocation points
Parameters for the damped Newton solve.
bool recordIterationHistory
populate SpectralNewtonResult::iterationHistory
double massScale
effective tolerance = tolerance / massScale
double maxRadiusFactor
runaway cap on max(h) as a multiple of the initial mean radius
double finiteDifferenceStep
relative step for the Jacobian
double tolerance
convergence threshold on ||R||_inf
double maxRelativeExpansionError
Not used by the Newton iteration: the horizon searches (AHSearch) reject a converged surface whose AH...
std::vector< SpectralNewtonIterate > iterationHistory
Per-iteration record; empty unless SpectralNewtonOptions::recordIterationHistory.
std::vector< double > residualHistory
||R||_inf per iteration