Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Troubled Cell Detection
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Laura Christine Kühle
Troubled Cell Detection
Commits
742500c7
Commit
742500c7
authored
2 years ago
by
Laura Christine Kühle
Browse files
Options
Downloads
Patches
Plain Diff
Combined 'get_cells()' and '_get_cells()'.
parent
3e4d5284
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
DG_Approximation.py
+4
-0
4 additions, 0 deletions
DG_Approximation.py
Troubled_Cell_Detector.py
+13
-52
13 additions, 52 deletions
Troubled_Cell_Detector.py
with
17 additions
and
52 deletions
DG_Approximation.py
+
4
−
0
View file @
742500c7
...
@@ -16,6 +16,10 @@ TODO: Contemplate saving training data for each IC separately
...
@@ -16,6 +16,10 @@ TODO: Contemplate saving training data for each IC separately
TODO: Contemplate removing TrainingDataGenerator class
TODO: Contemplate removing TrainingDataGenerator class
TODO: Ask why no fine mesh is used for calculate_coarse_projection()
TODO: Ask why no fine mesh is used for calculate_coarse_projection()
TODO: Ask the meaning of the shifted bounds in Boxplot (Modified script)
TODO: Ask whether the indices for the wavelet calculation are i or i+1
TODO: Ask why wavelet matrix has unset ghost cells
Urgent:
Urgent:
TODO: Enforce mesh with 2^n cells
TODO: Enforce mesh with 2^n cells
TODO: Change heaviside random to uniform(-100, 100)
TODO: Change heaviside random to uniform(-100, 100)
...
...
This diff is collapsed.
Click to expand it.
Troubled_Cell_Detector.py
+
13
−
52
View file @
742500c7
...
@@ -8,12 +8,10 @@ TODO: Change method of calculating quartiles -> Done
...
@@ -8,12 +8,10 @@ TODO: Change method of calculating quartiles -> Done
TODO: Include overlapping cells in quartile calculation (if needed) -> Done
TODO: Include overlapping cells in quartile calculation (if needed) -> Done
TODO: Determine max_value for Theoretical only over highest degree
TODO: Determine max_value for Theoretical only over highest degree
-> Done (now optional)
-> Done (now optional)
TODO: Check if indexing in wavelets is correct
TODO: Check if indexing in wavelets is correct -> Done
TODO: Combine get_cells() and _get_cells()
TODO: Combine get_cells() and _get_cells() -> Done
TODO: Add TC condition to only flag cell if left-adjacent one is flagged as
TODO: Check coarse_projection calculation for indexing errors -> Done
well (remove this condition)
TODO: Adjust Boxplot approach (adjacent cells, outer fence, etc.) -> Done
TODO: Check coarse_projection calculation for indexing errors
TODO: Adjust Boxplot approach (adjacent cells, outer fence, etc.)
TODO: Give detailed description of wavelet detection
TODO: Give detailed description of wavelet detection
"""
"""
...
@@ -237,24 +235,6 @@ class WaveletDetector(TroubledCellDetector):
...
@@ -237,24 +235,6 @@ class WaveletDetector(TroubledCellDetector):
self
.
_wavelet_projection_left
,
self
.
_wavelet_projection_right
\
self
.
_wavelet_projection_left
,
self
.
_wavelet_projection_right
\
=
self
.
_basis
.
multiwavelet_projection
=
self
.
_basis
.
multiwavelet_projection
def
get_cells
(
self
,
projection
):
"""
Calculates troubled cells in a given projection.
Parameters
----------
projection : ndarray
Matrix of projection for each polynomial degree.
Returns
-------
list
List of indices for all detected troubled cells.
"""
multiwavelet_coeffs
=
self
.
_calculate_wavelet_coeffs
(
projection
)
multiwavelet_coeffs
=
self
.
_select_degree
(
multiwavelet_coeffs
)
return
self
.
_get_cells
(
multiwavelet_coeffs
,
projection
)
def
_calculate_wavelet_coeffs
(
self
,
projection
):
def
_calculate_wavelet_coeffs
(
self
,
projection
):
"""
Calculates wavelet coefficients used for projection to coarser grid.
"""
Calculates wavelet coefficients used for projection to coarser grid.
...
@@ -303,25 +283,6 @@ class WaveletDetector(TroubledCellDetector):
...
@@ -303,25 +283,6 @@ class WaveletDetector(TroubledCellDetector):
min_values
=
np
.
min
(
wavelet_matrix
,
axis
=
0
)
min_values
=
np
.
min
(
wavelet_matrix
,
axis
=
0
)
return
np
.
where
(
-
min_values
>
max_values
,
min_values
,
max_values
)
return
np
.
where
(
-
min_values
>
max_values
,
min_values
,
max_values
)
@abstractmethod
def
_get_cells
(
self
,
multiwavelet_coeffs
,
projection
):
"""
Calculates troubled cells using multiwavelet coefficients.
Parameters
----------
multiwavelet_coeffs : ndarray
Matrix of multiwavelet coefficients.
projection : ndarray
Matrix of projection for each polynomial degree.
Returns
-------
list
List of indices for all detected troubled cells.
"""
pass
def
_calculate_coarse_projection
(
self
,
projection
):
def
_calculate_coarse_projection
(
self
,
projection
):
"""
Calculates coarse projection.
"""
Calculates coarse projection.
...
@@ -419,23 +380,23 @@ class Boxplot(WaveletDetector):
...
@@ -419,23 +380,23 @@ class Boxplot(WaveletDetector):
fold
*
self
.
_fold_len
-
num_overlapping_cells
,
fold
*
self
.
_fold_len
-
num_overlapping_cells
,
(
fold
+
1
)
*
self
.
_fold_len
+
num_overlapping_cells
)])
(
fold
+
1
)
*
self
.
_fold_len
+
num_overlapping_cells
)])
def
_
get_cells
(
self
,
coeffs
,
projection
):
def
get_cells
(
self
,
projection
):
"""
Calculate troubled cells
using multiwavelet coefficients
.
"""
Calculate troubled cells
in a given projection
.
Parameters
Parameters
----------
----------
coeffs : ndarray
Matrix of multiwavelet coefficients.
projection : ndarray
projection : ndarray
Matrix of projection for each polynomial degree.
Matrix of projection for each polynomial degree.
Returns
Returns
-------
-------
list
list
List of indices
o
f all detected troubled cells.
List of indices f
or
all detected troubled cells.
"""
"""
# Determine quartiles of folds
# Determine quartiles of folds
coeffs
=
self
.
_select_degree
(
self
.
_calculate_wavelet_coeffs
(
projection
))
folds
=
coeffs
[
self
.
_fold_indices
]
folds
=
coeffs
[
self
.
_fold_indices
]
first_quartiles
=
np
.
quantile
(
folds
,
0.25
,
axis
=
1
,
first_quartiles
=
np
.
quantile
(
folds
,
0.25
,
axis
=
1
,
method
=
self
.
_quantile_method
)
method
=
self
.
_quantile_method
)
...
@@ -508,13 +469,11 @@ class Theoretical(WaveletDetector):
...
@@ -508,13 +469,11 @@ class Theoretical(WaveletDetector):
np
.
sqrt
(
2
)
*
self
.
_mesh
.
cell_len
)
np
.
sqrt
(
2
)
*
self
.
_mesh
.
cell_len
)
# comment to line above: or 2 or 3
# comment to line above: or 2 or 3
def
_
get_cells
(
self
,
coeffs
,
projection
):
def
get_cells
(
self
,
projection
):
"""
Calculate
s
troubled cells
using multiwavelet coefficients
.
"""
Calculate troubled cells
in a given projection
.
Parameters
Parameters
----------
----------
coeffs : ndarray
Matrix of multiwavelet coefficients.
projection : ndarray
projection : ndarray
Matrix of projection for each polynomial degree.
Matrix of projection for each polynomial degree.
...
@@ -524,6 +483,8 @@ class Theoretical(WaveletDetector):
...
@@ -524,6 +483,8 @@ class Theoretical(WaveletDetector):
List of indices for all detected troubled cells.
List of indices for all detected troubled cells.
"""
"""
coeffs
=
self
.
_select_degree
(
self
.
_calculate_wavelet_coeffs
(
projection
))
troubled_cells
=
[]
troubled_cells
=
[]
max_avg
=
np
.
sqrt
(
0.5
)
\
max_avg
=
np
.
sqrt
(
0.5
)
\
*
max
(
1
,
max
(
abs
(
projection
[
0
][
cell
+
1
])
*
max
(
1
,
max
(
abs
(
projection
[
0
][
cell
+
1
])
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment