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
978b1594
Commit
978b1594
authored
3 years ago
by
Laura Christine Kühle
Browse files
Options
Downloads
Patches
Plain Diff
Improved 'calculate_cell_average()'.
parent
0cbaa977
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
DG_Approximation.py
+3
-3
3 additions, 3 deletions
DG_Approximation.py
Troubled_Cell_Detector.py
+2
-2
2 additions, 2 deletions
Troubled_Cell_Detector.py
projection_utils.py
+16
-19
16 additions, 19 deletions
projection_utils.py
with
21 additions
and
24 deletions
DG_Approximation.py
+
3
−
3
View file @
978b1594
...
@@ -11,7 +11,7 @@ Urgent:
...
@@ -11,7 +11,7 @@ Urgent:
TODO: Extract do_initial_projection() from DGScheme -> Done
TODO: Extract do_initial_projection() from DGScheme -> Done
TODO: Move inverse mass matrix to basis -> Done
TODO: Move inverse mass matrix to basis -> Done
TODO: Extract calculate_cell_average() from TCD -> Done
TODO: Extract calculate_cell_average() from TCD -> Done
TODO: Improve calculate_cell_average()
TODO: Improve calculate_cell_average()
-> Done
TODO: Extract calculate_[...]_solution() from Plotting
TODO: Extract calculate_[...]_solution() from Plotting
TODO: Extract plotting from TCD completely
TODO: Extract plotting from TCD completely
(maybe give indicator which plots are required instead?)
(maybe give indicator which plots are required instead?)
...
@@ -334,8 +334,8 @@ class DGScheme:
...
@@ -334,8 +334,8 @@ class DGScheme:
return
calculate_cell_average
(
return
calculate_cell_average
(
projection
=
projection
[:,
1
:
-
1
],
stencil_length
=
stencil_length
,
projection
=
projection
[:,
1
:
-
1
],
stencil_length
=
stencil_length
,
polynomial_degree
=
self
.
_polynomial_degree
,
basis
=
self
.
_basis
,
polynomial_degree
=
self
.
_polynomial_degree
if
add_reconstructions
add_reconstructions
=
add_reconstruction
s
)
else
-
1
,
basis
=
self
.
_basi
s
)
def
do_initial_projection
(
initial_condition
,
basis
,
quadrature
,
def
do_initial_projection
(
initial_condition
,
basis
,
quadrature
,
...
...
This diff is collapsed.
Click to expand it.
Troubled_Cell_Detector.py
+
2
−
2
View file @
978b1594
...
@@ -292,8 +292,8 @@ class ArtificialNeuralNetwork(TroubledCellDetector):
...
@@ -292,8 +292,8 @@ class ArtificialNeuralNetwork(TroubledCellDetector):
projection
=
projection
[
projection
=
projection
[
:,
cell
-
num_ghost_cells
:
cell
+
num_ghost_cells
+
1
],
:,
cell
-
num_ghost_cells
:
cell
+
num_ghost_cells
+
1
],
stencil_length
=
self
.
_stencil_len
,
basis
=
self
.
_basis
,
stencil_length
=
self
.
_stencil_len
,
basis
=
self
.
_basis
,
polynomial_degree
=
self
.
_polynomial_degree
,
polynomial_degree
=
self
.
_polynomial_degree
if
add_reconstructions
=
self
.
_add_reconstructions
)
self
.
_add_reconstructions
else
-
1
)
for
cell
in
range
(
num_ghost_cells
,
for
cell
in
range
(
num_ghost_cells
,
len
(
projection
[
0
])
-
num_ghost_cells
)]))
len
(
projection
[
0
])
-
num_ghost_cells
)]))
...
...
This diff is collapsed.
Click to expand it.
projection_utils.py
+
16
−
19
View file @
978b1594
...
@@ -9,8 +9,8 @@ from Plotting import calculate_approximate_solution
...
@@ -9,8 +9,8 @@ from Plotting import calculate_approximate_solution
def
calculate_cell_average
(
projection
,
basis
,
stencil_length
,
def
calculate_cell_average
(
projection
,
basis
,
stencil_length
,
polynomial_degree
,
add_reconstructions
=
True
):
polynomial_degree
=-
1
):
"""
Calculate
s
cell averages for a given projection.
"""
Calculate cell averages for a given projection.
Calculate the cell averages of all cells in a projection.
Calculate the cell averages of all cells in a projection.
If desired, reconstructions are calculated for the middle cell
If desired, reconstructions are calculated for the middle cell
...
@@ -24,11 +24,9 @@ def calculate_cell_average(projection, basis, stencil_length,
...
@@ -24,11 +24,9 @@ def calculate_cell_average(projection, basis, stencil_length,
Basis for calculation.
Basis for calculation.
stencil_length : int
stencil_length : int
Size of data array.
Size of data array.
polynomial_degree : int
polynomial_degree : int, optional
Polynomial degree.
Polynomial degree for reconstructions of the middle cell. If -1 no
add_reconstructions: bool, optional
reconstructions will be included. Default: -1.
Flag whether reconstructions of the middle cell are included.
Default: True.
Returns
Returns
-------
-------
...
@@ -37,19 +35,18 @@ def calculate_cell_average(projection, basis, stencil_length,
...
@@ -37,19 +35,18 @@ def calculate_cell_average(projection, basis, stencil_length,
projection.
projection.
"""
"""
basis_vector
=
basis
.
get_basis_vector
()
cell_averages
=
calculate_approximate_solution
(
cell_averages
=
calculate_approximate_solution
(
projection
,
[
0
],
0
,
basis
.
get_
basis_vector
()
)
projection
,
np
.
array
(
[
0
]
)
,
0
,
basis_vector
)
if
add_reconstructions
:
if
polynomial_degree
!=
-
1
:
left_reconstructions
=
calculate_approximate_solution
(
left_reconstructions
=
calculate_approximate_solution
(
projection
,
[
-
1
],
polynomial_degree
,
projection
,
np
.
array
([
-
1
]),
polynomial_degree
,
basis_vector
)
basis
.
get_basis_vector
())
right_reconstructions
=
calculate_approximate_solution
(
right_reconstructions
=
calculate_approximate_solution
(
projection
,
[
1
],
polynomial_degree
,
projection
,
np
.
array
([
1
]),
polynomial_degree
,
basis_vector
)
basis
.
get_basis_vector
())
middle_idx
=
stencil_length
//
2
middle_idx
=
stencil_length
//
2
return
np
.
array
(
return
np
.
array
(
list
(
map
(
list
(
map
(
np
.
float64
,
zip
(
cell_averages
[:,
:
middle_idx
],
np
.
float64
,
zip
(
cell_averages
[:,
:
middle_idx
],
left_reconstructions
[:,
middle_idx
],
left_reconstructions
[:,
middle_idx
],
cell_averages
[:,
middle_idx
],
cell_averages
[:,
middle_idx
],
right_reconstructions
[:,
middle_idx
],
right_reconstructions
[:,
middle_idx
],
...
...
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