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
cc2d79ea
Commit
cc2d79ea
authored
4 years ago
by
Laura Christine Kühle
Browse files
Options
Downloads
Patches
Plain Diff
Changed 'xi' to 'z'. Removed unnecessary imports.
parent
c73b1f04
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
Basis_Function.py
+9
-9
9 additions, 9 deletions
Basis_Function.py
DG_Approximation.py
+2
-2
2 additions, 2 deletions
DG_Approximation.py
Main.py
+4
-3
4 additions, 3 deletions
Main.py
Troubled_Cell_Detector.py
+5
-5
5 additions, 5 deletions
Troubled_Cell_Detector.py
with
20 additions
and
19 deletions
Basis_Function.py
+
9
−
9
View file @
cc2d79ea
...
@@ -7,14 +7,14 @@ import numpy as np
...
@@ -7,14 +7,14 @@ import numpy as np
from
sympy
import
Symbol
,
integrate
from
sympy
import
Symbol
,
integrate
x
=
Symbol
(
'
x
'
)
x
=
Symbol
(
'
x
'
)
xi
=
Symbol
(
'
z
'
)
z
=
Symbol
(
'
z
'
)
class
Vector
(
object
):
class
Vector
(
object
):
def
__init__
(
self
,
polynomial_degree
):
def
__init__
(
self
,
polynomial_degree
):
self
.
_polynomial_degree
=
polynomial_degree
self
.
_polynomial_degree
=
polynomial_degree
self
.
_basis
=
self
.
_build_basis_vector
(
x
)
self
.
_basis
=
self
.
_build_basis_vector
(
x
)
self
.
_wavelet
=
self
.
_build_wavelet_vector
(
xi
)
self
.
_wavelet
=
self
.
_build_wavelet_vector
(
z
)
def
get_basis_vector
(
self
):
def
get_basis_vector
(
self
):
return
self
.
_basis
return
self
.
_basis
...
@@ -90,8 +90,8 @@ class OrthonormalLegendre(Legendre):
...
@@ -90,8 +90,8 @@ class OrthonormalLegendre(Legendre):
up to degree 4 for this application
'
)
up to degree 4 for this application
'
)
def
get_basis_projections
(
self
):
def
get_basis_projections
(
self
):
basis_projection_left
=
self
.
_build_basis_matrix
(
xi
,
0.5
*
(
xi
-
1
))
basis_projection_left
=
self
.
_build_basis_matrix
(
z
,
0.5
*
(
z
-
1
))
basis_projection_right
=
self
.
_build_basis_matrix
(
xi
,
0.5
*
(
xi
+
1
))
basis_projection_right
=
self
.
_build_basis_matrix
(
z
,
0.5
*
(
z
+
1
))
return
basis_projection_left
,
basis_projection_right
return
basis_projection_left
,
basis_projection_right
def
_build_basis_matrix
(
self
,
first_param
,
second_param
):
def
_build_basis_matrix
(
self
,
first_param
,
second_param
):
...
@@ -101,14 +101,14 @@ class OrthonormalLegendre(Legendre):
...
@@ -101,14 +101,14 @@ class OrthonormalLegendre(Legendre):
for
j
in
range
(
self
.
_polynomial_degree
+
1
):
for
j
in
range
(
self
.
_polynomial_degree
+
1
):
entry
=
integrate
(
self
.
_basis
[
i
].
subs
(
x
,
first_param
)
entry
=
integrate
(
self
.
_basis
[
i
].
subs
(
x
,
first_param
)
*
self
.
_basis
[
j
].
subs
(
x
,
second_param
),
*
self
.
_basis
[
j
].
subs
(
x
,
second_param
),
(
xi
,
-
1
,
1
))
(
z
,
-
1
,
1
))
row
.
append
(
np
.
float64
(
entry
))
row
.
append
(
np
.
float64
(
entry
))
matrix
.
append
(
row
)
matrix
.
append
(
row
)
return
matrix
return
matrix
def
get_multiwavelet_projections
(
self
):
def
get_multiwavelet_projections
(
self
):
wavelet_projection_left
=
self
.
_build_multiwavelet_matrix
(
xi
,
-
0.5
*
(
xi
-
1
),
True
)
wavelet_projection_left
=
self
.
_build_multiwavelet_matrix
(
z
,
-
0.5
*
(
z
-
1
),
True
)
wavelet_projection_right
=
self
.
_build_multiwavelet_matrix
(
xi
,
0.5
*
(
xi
+
1
),
False
)
wavelet_projection_right
=
self
.
_build_multiwavelet_matrix
(
z
,
0.5
*
(
z
+
1
),
False
)
return
wavelet_projection_left
,
wavelet_projection_right
return
wavelet_projection_left
,
wavelet_projection_right
def
_build_multiwavelet_matrix
(
self
,
first_param
,
second_param
,
is_left_matrix
):
def
_build_multiwavelet_matrix
(
self
,
first_param
,
second_param
,
is_left_matrix
):
...
@@ -116,8 +116,8 @@ class OrthonormalLegendre(Legendre):
...
@@ -116,8 +116,8 @@ class OrthonormalLegendre(Legendre):
for
i
in
range
(
self
.
_polynomial_degree
+
1
):
for
i
in
range
(
self
.
_polynomial_degree
+
1
):
row
=
[]
row
=
[]
for
j
in
range
(
self
.
_polynomial_degree
+
1
):
for
j
in
range
(
self
.
_polynomial_degree
+
1
):
entry
=
integrate
(
self
.
_basis
[
i
].
subs
(
x
,
first_param
)
*
self
.
_wavelet
[
j
].
subs
(
xi
,
second_param
),
entry
=
integrate
(
self
.
_basis
[
i
].
subs
(
x
,
first_param
)
*
self
.
_wavelet
[
j
].
subs
(
z
,
second_param
),
(
xi
,
-
1
,
1
))
(
z
,
-
1
,
1
))
if
is_left_matrix
:
if
is_left_matrix
:
entry
=
entry
*
(
-
1
)
**
(
j
+
self
.
_polynomial_degree
+
1
)
entry
=
entry
*
(
-
1
)
**
(
j
+
self
.
_polynomial_degree
+
1
)
row
.
append
(
np
.
float64
(
entry
))
row
.
append
(
np
.
float64
(
entry
))
...
...
This diff is collapsed.
Click to expand it.
DG_Approximation.py
+
2
−
2
View file @
cc2d79ea
...
@@ -14,10 +14,11 @@ TODO: Restructure Vectors_of_Polynomials -> Done
...
@@ -14,10 +14,11 @@ TODO: Restructure Vectors_of_Polynomials -> Done
TODO: Rename Vectors_of_Polynomials -> Done (Basis_Function)
TODO: Rename Vectors_of_Polynomials -> Done (Basis_Function)
TODO: Contemplate how to make shock tubes comparable
TODO: Contemplate how to make shock tubes comparable
TODO: Implement type check for all kwargs and configs -> Done (not recommended for Python)
TODO: Implement type check for all kwargs and configs -> Done (not recommended for Python)
TODO: Create a Conda environment with dependencies -> Done
"""
"""
import
numpy
as
np
import
numpy
as
np
from
sympy
import
Symbol
,
integrate
from
sympy
import
Symbol
import
math
import
math
import
matplotlib.pyplot
as
plt
import
matplotlib.pyplot
as
plt
...
@@ -29,7 +30,6 @@ import Update_Scheme
...
@@ -29,7 +30,6 @@ import Update_Scheme
from
Basis_Function
import
OrthonormalLegendre
from
Basis_Function
import
OrthonormalLegendre
x
=
Symbol
(
'
x
'
)
x
=
Symbol
(
'
x
'
)
xi
=
Symbol
(
'
z
'
)
class
DGScheme
(
object
):
class
DGScheme
(
object
):
...
...
This diff is collapsed.
Click to expand it.
Main.py
+
4
−
3
View file @
cc2d79ea
...
@@ -20,21 +20,22 @@ xL = -1
...
@@ -20,21 +20,22 @@ xL = -1
xR
=
1
xR
=
1
detector_config
=
{}
detector_config
=
{}
init_config
=
{}
limiter_config
=
{}
quadrature_config
=
{}
fold_len
=
16
fold_len
=
16
whisker_len
=
3
whisker_len
=
3
detector_config
[
'
fold_len
'
]
=
fold_len
detector_config
[
'
fold_len
'
]
=
fold_len
detector_config
[
'
whisker_len
'
]
=
whisker_len
detector_config
[
'
whisker_len
'
]
=
whisker_len
init_config
=
{}
init_config
[
'
factor
'
]
=
4
init_config
[
'
factor
'
]
=
4
init_config
[
'
left_factor
'
]
=
3
init_config
[
'
left_factor
'
]
=
3
limiter_config
=
{}
limiter_config
[
'
mod_factor
'
]
=
0
limiter_config
[
'
mod_factor
'
]
=
0
limiter_config
[
'
erase_degree
'
]
=
0
limiter_config
[
'
erase_degree
'
]
=
0
quadrature_config
=
{}
quadrature_config
[
'
num_eval_points
'
]
=
12
# 12
quadrature_config
[
'
num_eval_points
'
]
=
12
# 12
detector
=
'
Theoretical
'
detector
=
'
Theoretical
'
...
...
This diff is collapsed.
Click to expand it.
Troubled_Cell_Detector.py
+
5
−
5
View file @
cc2d79ea
...
@@ -7,10 +7,10 @@ import os
...
@@ -7,10 +7,10 @@ import os
import
numpy
as
np
import
numpy
as
np
import
matplotlib.pyplot
as
plt
import
matplotlib.pyplot
as
plt
import
seaborn
as
sns
import
seaborn
as
sns
from
sympy
import
Symbol
,
integrate
from
sympy
import
Symbol
x
=
Symbol
(
'
x
'
)
x
=
Symbol
(
'
x
'
)
xi
=
Symbol
(
'
z
'
)
z
=
Symbol
(
'
z
'
)
class
TroubledCellDetector
(
object
):
class
TroubledCellDetector
(
object
):
...
@@ -232,9 +232,9 @@ class WaveletDetector(TroubledCellDetector):
...
@@ -232,9 +232,9 @@ class WaveletDetector(TroubledCellDetector):
# for degree in range(self._polynomial_degree + 1):
# for degree in range(self._polynomial_degree + 1):
# leftMesh = coarse_projection[degree] * basis[degree].subs(x, -1 / 2)
# leftMesh = coarse_projection[degree] * basis[degree].subs(x, -1 / 2)
# rightMesh = coarse_projection[degree] * basis[degree].subs(x, 1 / 2)
# rightMesh = coarse_projection[degree] * basis[degree].subs(x, 1 / 2)
# leftTest = multiwavelet_coeffs[degree] * wavelet[degree].subs(
xi
, 1 / 2) \
# leftTest = multiwavelet_coeffs[degree] * wavelet[degree].subs(
z
, 1 / 2) \
# * (-1)**(self._polynomial_degree + 1 + degree)
# * (-1)**(self._polynomial_degree + 1 + degree)
# rightTest = multiwavelet_coeffs[degree] * wavelet[degree].subs(
xi
, 1 / 2)
# rightTest = multiwavelet_coeffs[degree] * wavelet[degree].subs(
z
, 1 / 2)
# newRowMesh = []
# newRowMesh = []
# newRowTest = []
# newRowTest = []
# for i in range(len(coarse_projection[0])):
# for i in range(len(coarse_projection[0])):
...
@@ -254,7 +254,7 @@ class WaveletDetector(TroubledCellDetector):
...
@@ -254,7 +254,7 @@ class WaveletDetector(TroubledCellDetector):
for
value
in
[
-
0.5
,
0.5
]]
for
value
in
[
-
0.5
,
0.5
]]
for
degree
in
range
(
self
.
_polynomial_degree
+
1
)]
for
degree
in
range
(
self
.
_polynomial_degree
+
1
)]
wavelet_projection
=
[[
multiwavelet_coeffs
[
degree
][
cell
]
*
wavelet
[
degree
].
subs
(
xi
,
0.5
)
*
value
wavelet_projection
=
[[
multiwavelet_coeffs
[
degree
][
cell
]
*
wavelet
[
degree
].
subs
(
z
,
0.5
)
*
value
for
cell
in
range
(
self
.
_num_coarse_grid_cells
)
for
cell
in
range
(
self
.
_num_coarse_grid_cells
)
for
value
in
[(
-
1
)
**
(
self
.
_polynomial_degree
+
degree
+
1
),
1
]]
for
value
in
[(
-
1
)
**
(
self
.
_polynomial_degree
+
degree
+
1
),
1
]]
for
degree
in
range
(
self
.
_polynomial_degree
+
1
)]
for
degree
in
range
(
self
.
_polynomial_degree
+
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