summaryrefslogtreecommitdiff
path: root/log-fourier_integrator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'log-fourier_integrator.cpp')
-rw-r--r--log-fourier_integrator.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/log-fourier_integrator.cpp b/log-fourier_integrator.cpp
index ffbce1d..eb72b49 100644
--- a/log-fourier_integrator.cpp
+++ b/log-fourier_integrator.cpp
@@ -85,6 +85,8 @@ int main(int argc, char* argv[]) {
Real β = 0;
while (β < βₘₐₓ) {
Real ΔC = 100;
+ Real ΔC₀ = 100;
+ unsigned it = 0;
while (ΔC > ε) {
std::vector<Real> RddfC(N);
for (unsigned n = 0; n < N; n++) {
@@ -119,6 +121,20 @@ int main(int argc, char* argv[]) {
μ *= Cₜ[0];
+ if (ΔC < ΔC₀) {
+ ΔC₀ = ΔC;
+ it = 0;
+ γ = std::min(1.01 * γ, 1.0);
+ } else {
+ it++;
+ }
+
+ if (it > 1000) {
+ std::cerr << "Decreased!" << std::endl;
+ γ = std::max(0.5 * γ, 1e-6);
+ it = 0;
+ }
+
// std::cerr << ΔC << std::endl;
}
@@ -138,7 +154,7 @@ int main(int argc, char* argv[]) {
}
E *= β;
- std::cerr << β << " " << μ << " " << Ĉₜ[0].real() << " " << E << std::endl;
+ std::cerr << β << " " << μ << " " << Ĉₜ[0].real() << " " << E << " " << γ << std::endl;
β += Δβ;
}