Skip to content
Snippets Groups Projects
Commit 9325ca8d authored by Laura Christine Kühle's avatar Laura Christine Kühle
Browse files

Reworked ModifiedMinMod limiter for efficiency.

parent 204ea3d3
No related branches found
No related tags found
No related merge requests found
...@@ -218,11 +218,8 @@ class ModifiedMinMod(MinMod): ...@@ -218,11 +218,8 @@ class ModifiedMinMod(MinMod):
Attributes Attributes
---------- ----------
cell_len : float threshold : float
Length of a cell in mesh. Threshold up to which a cell slope does not require limiting.
mod_factor : float
Factor determining whether cell slope is significantly high enough for
modification.
Methods Methods
------- -------
...@@ -247,11 +244,9 @@ class ModifiedMinMod(MinMod): ...@@ -247,11 +244,9 @@ class ModifiedMinMod(MinMod):
super()._reset(config) super()._reset(config)
# Unpack necessary configurations # Unpack necessary configurations
# cell_len = config.pop('cell_len') cell_len = config.pop('cell_len')
# mod_factor = config.pop('mod_factor', 0) mod_factor = config.pop('mod_factor', 0)
# self._threshold = mod_factor * cell_len**2 self._threshold = mod_factor * cell_len**2
self._cell_len = config.pop('cell_len')
self._mod_factor = config.pop('mod_factor', 0)
def get_name(self): def get_name(self):
"""Returns string of class name concatenated with the erase-degree.""" """Returns string of class name concatenated with the erase-degree."""
...@@ -275,8 +270,7 @@ class ModifiedMinMod(MinMod): ...@@ -275,8 +270,7 @@ class ModifiedMinMod(MinMod):
Flag whether cell should be adjusted. Flag whether cell should be adjusted.
""" """
# if abs(cell_slope) <= self._threshold: if abs(cell_slope) <= self._threshold:
if abs(cell_slope) <= self._mod_factor*self._cell_len**2:
return True return True
return super()._determine_modification(projection, cell, cell_slope) return super()._determine_modification(projection, cell, cell_slope)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment