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
34ab215a
Commit
34ab215a
authored
Oct 4, 2022
by
Laura Christine Kühle
Browse files
Options
Downloads
Patches
Plain Diff
Added sign change in stiffness and boundary matrix to accommodate negative wave speed.
parent
10a99b3e
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
+3
-2
3 additions, 2 deletions
DG_Approximation.py
Update_Scheme.py
+25
-8
25 additions, 8 deletions
Update_Scheme.py
with
28 additions
and
10 deletions
DG_Approximation.py
+
3
−
2
View file @
34ab215a
...
...
@@ -22,7 +22,8 @@ TODO: Discuss referencing info on SSPRK3
TODO: Discuss name for quadrature mesh (now: grid)
Urgent:
TODO: Check sign change in stiffness matrix to accommodate negative wave speed
TODO: Added sign change in stiffness and boundary matrix to accommodate
negative wave speed -> Done
TODO: Force input_size for each ANN model to be stencil length
TODO: Induce shift in IC class
TODO: Unify print commands (f vs no f)
...
...
@@ -231,7 +232,7 @@ class DGScheme:
self
.
_update_scheme
=
getattr
(
Update_Scheme
,
self
.
_update_scheme
)(
polynomial_degree
=
self
.
_basis
.
polynomial_degree
,
num_cells
=
self
.
_mesh
.
num_cells
,
detector
=
self
.
_detector
,
limiter
=
self
.
_limiter
)
limiter
=
self
.
_limiter
,
wave_speed
=
self
.
_wave_speed
)
def
approximate
(
self
,
data_file
):
"""
Approximates projection.
...
...
This diff is collapsed.
Click to expand it.
Update_Scheme.py
+
25
−
8
View file @
34ab215a
...
...
@@ -26,7 +26,8 @@ class UpdateScheme(ABC):
Performs time step.
"""
def
__init__
(
self
,
polynomial_degree
,
num_cells
,
detector
,
limiter
):
def
__init__
(
self
,
polynomial_degree
,
num_cells
,
detector
,
limiter
,
wave_speed
):
"""
Initializes UpdateScheme.
Parameters
...
...
@@ -39,6 +40,8 @@ class UpdateScheme(ABC):
Troubled cell detector for evaluation.
limiter : Limiter object
Limiter for evaluation.
wave_speed : float
Speed of wave in rightward direction.
"""
# Unpack positional arguments
...
...
@@ -46,6 +49,7 @@ class UpdateScheme(ABC):
self
.
_num_cells
=
num_cells
self
.
_detector
=
detector
self
.
_limiter
=
limiter
self
.
_wave_speed
=
wave_speed
self
.
_reset
()
...
...
@@ -56,9 +60,14 @@ class UpdateScheme(ABC):
for
i
in
range
(
self
.
_polynomial_degree
+
1
):
new_row
=
[]
for
j
in
range
(
self
.
_polynomial_degree
+
1
):
if
self
.
_wave_speed
>
0
:
new_entry
=
-
1.0
if
(
j
<
i
)
&
((
i
+
j
)
%
2
==
1
):
new_entry
=
1.0
else
:
new_entry
=
1.0
if
(
j
>
i
)
&
((
i
+
j
)
%
2
==
1
):
new_entry
=
-
1.0
new_row
.
append
(
new_entry
*
np
.
sqrt
((
i
+
0.5
)
*
(
j
+
0.5
)))
matrix
.
append
(
new_row
)
self
.
_stiffness_matrix
=
np
.
array
(
matrix
)
...
...
@@ -69,7 +78,9 @@ class UpdateScheme(ABC):
for
i
in
range
(
self
.
_polynomial_degree
+
1
):
new_row
=
[]
for
j
in
range
(
self
.
_polynomial_degree
+
1
):
new_entry
=
np
.
sqrt
((
i
+
0.5
)
*
(
j
+
0.5
))
*
(
-
1.0
)
**
i
new_entry
=
np
.
sqrt
((
i
+
0.5
)
*
(
j
+
0.5
))
*
(
-
1.0
)
**
i
\
if
self
.
_wave_speed
>
0
\
else
np
.
sqrt
((
i
+
0.5
)
*
(
j
+
0.5
))
*
(
-
1.0
)
**
j
new_row
.
append
(
new_entry
)
matrix
.
append
(
new_row
)
self
.
_boundary_matrix
=
np
.
array
(
matrix
)
...
...
@@ -314,10 +325,16 @@ class SSPRK3(UpdateScheme):
right_hand_side
=
[
0
]
for
j
in
range
(
self
.
_num_cells
):
if
self
.
_wave_speed
>
0
:
right_hand_side
.
append
(
2
*
(
self
.
_stiffness_matrix
@
current_projection
[:,
j
+
1
]
+
self
.
_boundary_matrix
@
current_projection
[:,
j
]))
else
:
right_hand_side
.
append
(
2
*
(
self
.
_stiffness_matrix
@
current_projection
[:,
j
+
1
]
+
self
.
_boundary_matrix
@
current_projection
[:,
j
+
2
]))
# Set ghost cells to respective value
right_hand_side
[
0
]
=
right_hand_side
[
self
.
_num_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
sign in
to comment