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
cbf98d27
Commit
cbf98d27
authored
3 years ago
by
Laura Christine Kühle
Browse files
Options
Downloads
Patches
Plain Diff
Moved basis initialization for plots into 'plot_approximation_results()'.
parent
1aa90002
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Plotting.py
+4
-7
4 additions, 7 deletions
Plotting.py
Troubled_Cell_Detector.py
+1
-1
1 addition, 1 deletion
Troubled_Cell_Detector.py
workflows/approximation.smk
+1
-4
1 addition, 4 deletions
workflows/approximation.smk
with
6 additions
and
12 deletions
Plotting.py
+
4
−
7
View file @
cbf98d27
...
...
@@ -18,7 +18,7 @@ from sympy import Symbol
from
Quadrature
import
Quadrature
from
Initial_Condition
import
InitialCondition
from
Basis_Function
import
Basis
from
Basis_Function
import
Basis
,
OrthonormalLegendre
from
projection_utils
import
calculate_exact_solution
,
\
calculate_approximate_solution
,
Mesh
from
encoding_utils
import
decode_ndarray
...
...
@@ -318,7 +318,7 @@ def plot_evaluation_results(evaluation_file: str, directory: str,
def
plot_approximation_results
(
data_file
:
str
,
directory
:
str
,
plot_name
:
str
,
basis
:
Basis
,
quadrature
:
Quadrature
,
quadrature
:
Quadrature
,
init_cond
:
InitialCondition
)
->
None
:
"""
Plots given approximation results.
...
...
@@ -333,8 +333,6 @@ def plot_approximation_results(data_file: str, directory: str, plot_name: str,
Path to directory in which plots will be saved.
plot_name : str
Name of plot.
basis: Basis object
Basis used for calculation.
quadrature: Quadrature object
Quadrature used for evaluation.
init_cond : InitialCondition object
...
...
@@ -348,13 +346,12 @@ def plot_approximation_results(data_file: str, directory: str, plot_name: str,
# Decode all ndarrays by converting lists
approx_stats
=
{
key
:
decode_ndarray
(
approx_stats
[
key
])
for
key
in
approx_stats
.
keys
()}
approx_stats
.
pop
(
'
polynomial_degree
'
)
approx_stats
[
'
basis
'
]
=
OrthonormalLegendre
(
**
approx_stats
[
'
basis
'
]
)
approx_stats
[
'
mesh
'
]
=
Mesh
(
**
approx_stats
[
'
mesh
'
])
# Plot exact/approximate results, errors, shock tubes,
# and any detector-dependant plots
plot_results
(
quadrature
=
quadrature
,
basis
=
basis
,
init_cond
=
init_cond
,
**
approx_stats
)
plot_results
(
quadrature
=
quadrature
,
init_cond
=
init_cond
,
**
approx_stats
)
# Set paths for plot files if not existing already
if
not
os
.
path
.
exists
(
directory
):
...
...
This diff is collapsed.
Click to expand it.
Troubled_Cell_Detector.py
+
1
−
1
View file @
cbf98d27
...
...
@@ -112,7 +112,7 @@ class TroubledCellDetector(ABC):
'
final_time
'
:
self
.
_final_time
,
'
left_bound
'
:
self
.
_left_bound
,
'
right_bound
'
:
self
.
_right_bound
,
'
polynomial_degree
'
:
self
.
_basis
.
polynomial_degree
,
'
basis
'
:
{
'
polynomial_degree
'
:
self
.
_basis
.
polynomial_degree
}
,
'
mesh
'
:
{
'
num_grid_cells
'
:
self
.
_num_grid_cells
,
'
left_bound
'
:
self
.
_left_bound
,
'
right_bound
'
:
self
.
_right_bound
,
...
...
This diff is collapsed.
Click to expand it.
workflows/approximation.smk
+
1
−
4
View file @
cbf98d27
...
...
@@ -6,7 +6,6 @@ import Initial_Condition
import Quadrature
from DG_Approximation import DGScheme
from Plotting import plot_approximation_results
from Basis_Function import OrthonormalLegendre
configfile: 'config.yaml'
...
...
@@ -92,12 +91,10 @@ rule plot_approximation_results:
quadrature = getattr(Quadrature, detector_dict.pop(
'quadrature', 'Gauss'))(detector_dict.pop(
'quadrature_config', {}))
basis = OrthonormalLegendre(detector_dict.pop(
'polynomial_degree', 2))
plot_approximation_results(directory=params.plot_dir,
plot_name=wildcards.scheme,
data_file=params.plot_dir+'/'+wildcards.scheme,
basis=basis,
data_file=params.plot_dir+'/'+wildcards.scheme,
quadrature=quadrature, init_cond=init_cond)
toc = time.perf_counter()
...
...
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