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
83a45cda
Commit
83a45cda
authored
4 years ago
by
Laura Christine Kühle
Browse files
Options
Downloads
Patches
Plain Diff
Started replacing transposing with vectorized access. Removed completed TODOs.
parent
fde3fa8c
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
DG_Approximation.py
+3
-6
3 additions, 6 deletions
DG_Approximation.py
Initial_Condition.py
+0
-2
0 additions, 2 deletions
Initial_Condition.py
Limiter.py
+19
-3
19 additions, 3 deletions
Limiter.py
Main.py
+5
-0
5 additions, 0 deletions
Main.py
with
27 additions
and
11 deletions
DG_Approximation.py
+
3
−
6
View file @
83a45cda
...
...
@@ -25,11 +25,8 @@ TODO: Write documentation for all methods
TODO: Add a verbose option
TODO: Check whether consistency is given/possible for each class instance
TODO: Make projection local variable -> Done
TODO: Check whether current and original projection in Update_Scheme are identical -> Done (No)
TODO: Adjust line breaks to standard -> Done
TODO: Remove redundant passes -> Done
TODO: Shorten returns for True/False and redundant variables -> Done
TODO: Make projection local variable -> Done (not for Limiter and Troubled_Cell_Detector)
TODO: Vector faster than Trans for longer processes, therefore replace ->
"""
import
numpy
as
np
...
...
@@ -336,7 +333,7 @@ class DGScheme(object):
toc
=
timeit
.
default_timer
()
print
(
'
Vecto:
'
,
toc
-
tic
)
print
(
coarse_projection
==
coarse_projection1
)
#
print(coarse_projection == coarse_projection1)
# Plot exact and approximate solutions for coarse mesh
grid
,
exact
=
self
.
_calculate_exact_solution
(
coarse_mesh
[
1
:
-
1
],
coarse_cell_len
)
...
...
This diff is collapsed.
Click to expand it.
Initial_Condition.py
+
0
−
2
View file @
83a45cda
...
...
@@ -2,8 +2,6 @@
"""
@author: Laura C. Kühle
TODO: Rename initial conditions -> Done
"""
import
numpy
as
np
...
...
This diff is collapsed.
Click to expand it.
Limiter.py
+
19
−
3
View file @
83a45cda
...
...
@@ -4,6 +4,7 @@
"""
import
numpy
as
np
import
timeit
class
Limiter
(
object
):
...
...
@@ -23,7 +24,7 @@ class NoLimiter(Limiter):
self
.
function_name
=
'
NoLimiter
'
def
apply
(
self
,
projection
,
cell
):
return
np
.
transpose
(
projection
)
[
cell
]
return
projection
[
:,
cell
]
class
MinMod
(
Limiter
):
...
...
@@ -47,21 +48,36 @@ class MinMod(Limiter):
is_good_cell
=
self
.
_determine_modification
()
if
is_good_cell
:
return
np
.
transpose
(
self
.
projection
)
[
self
.
cell
]
return
self
.
projection
[
:,
self
.
cell
]
adapted_projection
=
np
.
transpose
(
self
.
projection
)
[
self
.
cell
].
copy
()
adapted_projection
=
self
.
projection
[
:,
self
.
cell
].
copy
()
for
i
in
range
(
len
(
adapted_projection
)):
if
i
>
self
.
erase_degree
:
adapted_projection
[
i
]
=
0
return
adapted_projection
def
_set_cell_slope
(
self
):
tic
=
timeit
.
default_timer
()
slope
=
[]
transposed_projection
=
np
.
transpose
(
self
.
projection
)
for
cell
in
range
(
len
(
transposed_projection
)):
new_entry
=
sum
(
transposed_projection
[
cell
][
degree
]
*
(
degree
+
0.5
)
**
0.5
for
degree
in
range
(
1
,
len
(
self
.
projection
)))
slope
.
append
(
new_entry
)
toc
=
timeit
.
default_timer
()
print
(
'
Trans:
'
,
toc
-
tic
)
tic
=
timeit
.
default_timer
()
slope1
=
[]
transposed_projection
=
self
.
projection
for
cell
in
range
(
len
(
transposed_projection
[
0
])):
new_entry
=
sum
(
transposed_projection
[
degree
][
cell
]
*
(
degree
+
0.5
)
**
0.5
for
degree
in
range
(
1
,
len
(
self
.
projection
)))
slope1
.
append
(
new_entry
)
toc
=
timeit
.
default_timer
()
print
(
'
Vecto:
'
,
toc
-
tic
)
print
(
slope
==
slope1
)
self
.
cell_slope
=
slope
[
self
.
cell
]
def
_determine_modification
(
self
):
...
...
This diff is collapsed.
Click to expand it.
Main.py
+
5
−
0
View file @
83a45cda
...
...
@@ -7,7 +7,9 @@ Docstring-Style: D200, D400
"""
from
DG_Approximation
import
DGScheme
import
timeit
tic
=
timeit
.
default_timer
()
alpha
=
1
p
=
2
...
...
@@ -49,6 +51,9 @@ dg_scheme = DGScheme(detector, detector_config=detector_config, init_cond=init_c
# __, __, troubled_cells, __ =
dg_scheme
.
approximate
()
dg_scheme
.
save_plots
()
toc
=
timeit
.
default_timer
()
print
(
"
Time:
"
,
toc
-
tic
)
# =============================================================================
#
# print(troubled_cells)
...
...
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