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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Laura Christine Kühle
Troubled Cell Detection
Commits
75c2b724
Commit
75c2b724
authored
2 years ago
by
Laura Christine Kühle
Browse files
Options
Downloads
Patches
Plain Diff
Vectorized 'rarefaction_wave' for Burgers.
parent
87f1987b
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
Snakefile
+1
-1
1 addition, 1 deletion
Snakefile
scripts/tcd/Equation.py
+26
-13
26 additions, 13 deletions
scripts/tcd/Equation.py
with
27 additions
and
14 deletions
Snakefile
+
1
−
1
View file @
75c2b724
...
...
@@ -34,7 +34,7 @@ TODO: Move height adjustment and stretch factor into implicit solver
TODO: Enable choice of equation -> Done
TODO: Ensure termination of Burgers with DiscontinuousConstant function -> Done
TODO: Ensure termination of Burgers with Sine function -> Done
TODO: Vectorize 'rarefaction_wave()'
TODO: Vectorize 'rarefaction_wave()'
-> Done
TODO: Vectorize 'burgers_volume_integral()'
TODO: Vectorize 'burgers_local_Lax_Friedrich()'
TODO: Vectorize 'burgers_boundary_matrix()'
...
...
This diff is collapsed.
Click to expand it.
scripts/tcd/Equation.py
+
26
−
13
View file @
75c2b724
...
...
@@ -495,19 +495,32 @@ class Burgers(Equation):
return
grid
,
exact
def
rarefaction_wave
(
self
,
grid_values
):
uexact
=
0
*
grid_values
N
=
np
.
size
(
grid_values
)
for
i
in
range
(
N
):
if
grid_values
[
0
,
i
]
<=
-
self
.
_final_time
:
uexact
[
0
,
i
]
=
-
1
elif
-
self
.
_final_time
<
grid_values
[
0
,
i
]
<
self
.
_final_time
:
uexact
[
0
,
i
]
=
grid_values
[
0
,
i
]
/
self
.
_final_time
else
:
uexact
[
0
,
i
]
=
1
def
rarefaction_wave
(
self
,
grid
):
"""
Calculate the exact solution for the rarefaction wave.
Parameters
----------
grid : ndarray
Array containing evaluation grid for a function.
Returns
-------
exact : ndarray
Array containing exact evaluation of a function.
"""
exact
=
np
.
ones_like
(
grid
)
# Set all values for the left boundary
mask
=
grid
[
0
]
<=
-
self
.
_final_time
exact
[
0
,
mask
]
=
-
1
# Set all values between the boundaries
mask
=
np
.
logical_and
(
-
self
.
_final_time
<
grid
[
0
],
grid
[
0
]
<
self
.
_final_time
)
exact
[
0
,
mask
]
=
grid
[
0
,
mask
]
/
self
.
final_time
return
u
exact
return
exact
def
implicit_burgers_solver
(
self
,
grid_values
,
mesh
):
"""
...
...
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