From f8d2f53083d0395662114212f281d5bd37c910fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Sierro?= Date: Thu, 26 Aug 2021 15:00:49 +0200 Subject: [PATCH] fixed energy conservation --- src/scgenerator/physics/simulate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scgenerator/physics/simulate.py b/src/scgenerator/physics/simulate.py index a6107b3..28719eb 100644 --- a/src/scgenerator/physics/simulate.py +++ b/src/scgenerator/physics/simulate.py @@ -114,12 +114,12 @@ class RK4IP: elif self.alpha is not None: self.logger.debug("Conserved quantity : energy with loss") self.conserved_quantity_func = lambda spectrum, h: pulse.pulse_energy_with_loss( - spectrum, self.dw, self.alpha, h + self.C_to_A_factor * spectrum, self.dw, self.alpha, h ) else: self.logger.debug("Conserved quantity : energy without loss") self.conserved_quantity_func = lambda spectrum, h: pulse.pulse_energy( - spectrum, self.dw + self.C_to_A_factor * spectrum, self.dw ) else: self.conserved_quantity_func = lambda spectrum, h: 0.0