From 9325ca8d7af64b9740cc77ef49151afa732e7847 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=BChle=2C=20Laura=20Christine=20=28lakue103=29?=
 <laura.kuehle@uni-duesseldorf.de>
Date: Thu, 27 Oct 2022 23:47:38 +0200
Subject: [PATCH] Reworked ModifiedMinMod limiter for efficiency.

---
 scripts/tcd/Limiter.py | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/scripts/tcd/Limiter.py b/scripts/tcd/Limiter.py
index bc3b6c0..ab2be32 100644
--- a/scripts/tcd/Limiter.py
+++ b/scripts/tcd/Limiter.py
@@ -218,11 +218,8 @@ class ModifiedMinMod(MinMod):
 
     Attributes
     ----------
-    cell_len : float
-        Length of a cell in mesh.
-    mod_factor : float
-        Factor determining whether cell slope is significantly high enough for
-        modification.
+    threshold : float
+        Threshold up to which a cell slope does not require limiting.
 
     Methods
     -------
@@ -247,11 +244,9 @@ class ModifiedMinMod(MinMod):
         super()._reset(config)
 
         # Unpack necessary configurations
-        # cell_len = config.pop('cell_len')
-        # mod_factor = config.pop('mod_factor', 0)
-        # self._threshold = mod_factor * cell_len**2
-        self._cell_len = config.pop('cell_len')
-        self._mod_factor = config.pop('mod_factor', 0)
+        cell_len = config.pop('cell_len')
+        mod_factor = config.pop('mod_factor', 0)
+        self._threshold = mod_factor * cell_len**2
 
     def get_name(self):
         """Returns string of class name concatenated with the erase-degree."""
@@ -275,8 +270,7 @@ class ModifiedMinMod(MinMod):
             Flag whether cell should be adjusted.
 
         """
-        # if abs(cell_slope) <= self._threshold:
-        if abs(cell_slope) <= self._mod_factor*self._cell_len**2:
+        if abs(cell_slope) <= self._threshold:
             return True
 
         return super()._determine_modification(projection, cell, cell_slope)
-- 
GitLab