From 9f524b52f67be4ce552be2b409d4797a81076445 Mon Sep 17 00:00:00 2001
From: Carl-Martin Pfeiler <carl-martin.pfeiler@asc.tuwien.ac.at>
Date: Wed, 8 Jan 2020 10:50:22 +0100
Subject: [PATCH] BugFix: Buggy recording of AppliedEnergy.

  + Appeared if .Integrate(..., relax=True) used after an external field was applied earlier.
  + Computation was already correct before.
---
 integrators/_details/physicalToMathematical.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/integrators/_details/physicalToMathematical.py b/integrators/_details/physicalToMathematical.py
index 15b0fa7..5f1b9e0 100644
--- a/integrators/_details/physicalToMathematical.py
+++ b/integrators/_details/physicalToMathematical.py
@@ -108,7 +108,11 @@ def Compute_Cst(self):
 def ConvertAppliedField(self):
   import types
   from ngsolve import CoefficientFunction, x, y, z
+
   if(self.parameters.H_ext == None):
+    self._hext_cf = CoefficientFunction((0, 0, 0))
+    self._hext_impl_cf = CoefficientFunction((0, 0, 0))
+    self._hext_mp_cf = CoefficientFunction((0, 0, 0))
     return
   
   tScale = self.parameters.gamma0 * self.parameters.Ms
-- 
GitLab