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
2f5f5fcc
Commit
2f5f5fcc
authored
Mar 10, 2023
by
Laura Christine Kühle
Browse files
Options
Downloads
Patches
Plain Diff
Enforced that number of ghost cells is positive for calculations and non-negative for training.
parent
c7d51a28
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
Snakefile
+2
-2
2 additions, 2 deletions
Snakefile
scripts/tcd/Equation.py
+9
-0
9 additions, 0 deletions
scripts/tcd/Equation.py
scripts/tcd/Mesh.py
+7
-2
7 additions, 2 deletions
scripts/tcd/Mesh.py
with
18 additions
and
4 deletions
Snakefile
+
2
−
2
View file @
2f5f5fcc
...
...
@@ -30,8 +30,7 @@ TODO: Enforce Boxplot folds with decorator -> Done
TODO: Enforce boundary for initial condition in exact solution only -> Done
TODO: Adapt number of ghost cells based on ANN stencil -> Done
TODO: Ensure exact solution is calculated in Equation class -> Done
TODO: Extract objects from UpdateScheme
TODO: Enforce num_ghost_cells to be positive integer for DG (not training)
TODO: Enforce num_ghost_cells to be positive integer for DG -> Done
TODO: Add Burger class
TODO: Use cfl_number for updating, not just time (equation-related?)
...
...
@@ -56,6 +55,7 @@ TODO: Add verbose output
TODO: Add tests for all functions
Not feasible yet or doc-related:
TODO: Extract objects from UpdateScheme
TODO: Clean up result plotting (remove object properties of Equation)
TODO: Add functions to create each object from dict
TODO: Move plot_approximation_results() into plotting script
...
...
This diff is collapsed.
Click to expand it.
scripts/tcd/Equation.py
+
9
−
0
View file @
2f5f5fcc
...
...
@@ -53,6 +53,11 @@ class Equation(ABC):
cfl_number : float
CFL number to ensure stability.
Raises
------
ValueError
If number of ghost cells in mesh in not positive.
"""
self
.
_quadrature
=
quadrature
self
.
_init_cond
=
init_cond
...
...
@@ -62,6 +67,10 @@ class Equation(ABC):
self
.
_wave_speed
=
wave_speed
self
.
_cfl_number
=
cfl_number
if
self
.
_mesh
.
num_ghost_cells
<=
0
:
raise
ValueError
(
'
Number of ghost cells for calculations has to
'
'
be positive.
'
)
self
.
_reset
()
@property
...
...
This diff is collapsed.
Click to expand it.
scripts/tcd/Mesh.py
+
7
−
2
View file @
2f5f5fcc
...
...
@@ -59,17 +59,22 @@ class Mesh:
Right boundary of the mesh interval.
num_ghost_cells : int, optional
Number of ghost cells on each side of the mesh, respectively.
Default:
False
.
Default:
1
.
Raises
------
ValueError
If number of cells is not exponential of 2.
If number of ghost cells is negative.
ValueError
If number of cells is not exponential of 2 (and ghost cells exist).
"""
self
.
_num_cells
=
num_cells
self
.
_num_ghost_cells
=
num_ghost_cells
if
self
.
_num_ghost_cells
!=
0
:
if
self
.
_num_ghost_cells
<
0
:
raise
ValueError
(
'
The number of ghost cells has to be a
'
'
non-negative integer
'
)
if
not
math
.
log
(
self
.
_num_cells
,
2
).
is_integer
():
raise
ValueError
(
'
The number of cells in the mesh has to be
'
'
an exponential of 2
'
)
...
...
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