From 08536853054f2aa9e165b6b6bfb0862b71e54834 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Wed, 2 Apr 2025 22:42:56 -0300 Subject: Some changes --- fourier_integrator.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/fourier_integrator.cpp b/fourier_integrator.cpp index e2446fd..7fc8ab4 100644 --- a/fourier_integrator.cpp +++ b/fourier_integrator.cpp @@ -160,27 +160,33 @@ int main(int argc, char* argv[]) { Rtnew[i] = (1.0 + pow(y, 2) * RddfCt[i] * Rt[i]) / (z + 1i * ω); } - for (unsigned i = 0; i < Rt.size(); i++) { - Rt[i] += γ * (Rtnew[i] - Rt[i]); - } - for (unsigned i = 0; i < Rt.size(); i++) { Real ω = i * Δω; Ctnew[i] = (Γ₀ * std::conj(Rt[i]) / (1 + pow(τ₀ * ω, 2)) + pow(y, 2) * (RddfCt[i] * Ct[i] + dfCt[i] * std::conj(Rt[i]))) / (z + 1i * ω); } - for (unsigned i = 0; i < Ct.size(); i++) { - Ct[i] += γ * (Ctnew[i] - Ct[i]); - } - std::vector Cnew = fft.inverse(Ctnew); std::vector Rnew = fft.inverse(Rtnew); ΔC = 0; for (unsigned i = 0; i < Cnew.size(); i++) { ΔC += pow(Cnew[i] - C[i], 2); + ΔC += pow(Rnew[i] - R[i], 2); + } + + /* + for (unsigned i = 0; i < Cnew.size(); i++) { + C[i] += γ * (Cnew[i] - C[i]); } + for (unsigned i = 0; i < Rnew.size(); i++) { + R[i] += γ * (Rnew[i] - R[i]); + } + */ + + C = Cnew; + R = Rnew; + z *= Cnew[0]; Real energy = 0; @@ -189,9 +195,6 @@ int main(int argc, char* argv[]) { energy += y * R[i] * df(p, C[i]) * M_PI * Δτ; } - C = Cnew; - R = Rnew; - std::cerr << "y " << y << " iteration " << it << ": " << sqrt(ΔC / C.size()) << " " << pow(y, 2) / z << " " << energy << std::endl; if (it > maxIterations) { -- cgit v1.2.3-70-g09d2