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
6bf3a1ca
Commit
6bf3a1ca
authored
2 years ago
by
Laura Christine Kühle
Browse files
Options
Downloads
Patches
Plain Diff
Enforced boundary condition for initial condition in exact solution only.
parent
f42c5cdc
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
Snakefile
+1
-1
1 addition, 1 deletion
Snakefile
scripts/tcd/Equation.py
+13
-4
13 additions, 4 deletions
scripts/tcd/Equation.py
scripts/tcd/Initial_Condition.py
+0
-9
0 additions, 9 deletions
scripts/tcd/Initial_Condition.py
scripts/tcd/projection_utils.py
+13
-3
13 additions, 3 deletions
scripts/tcd/projection_utils.py
with
27 additions
and
17 deletions
Snakefile
+
1
−
1
View file @
6bf3a1ca
...
...
@@ -27,7 +27,7 @@ TODO: Refactor Boxplot class -> Done
TODO: Enforce periodic boundary condition for projection with decorator -> Done
TODO: Enforce Boxplot bounds with decorator -> Done
TODO: Enforce Boxplot folds with decorator -> Done
TODO: Enforce boundary for initial condition in exact solution only
TODO: Enforce boundary for initial condition in exact solution only
-> Done
TODO: Adapt number of ghost cells based on ANN stencil
TODO: Ensure exact solution is calculated in Equation class
TODO: Extract objects from UpdateScheme
...
...
This diff is collapsed.
Click to expand it.
scripts/tcd/Equation.py
+
13
−
4
View file @
6bf3a1ca
...
...
@@ -254,10 +254,19 @@ class LinearAdvection(Equation):
grid
=
np
.
repeat
(
mesh
.
non_ghost_cells
,
self
.
_quadrature
.
num_nodes
)
+
\
mesh
.
cell_len
/
2
*
np
.
tile
(
self
.
_quadrature
.
nodes
,
mesh
.
num_cells
)
exact
=
np
.
array
([
self
.
_init_cond
.
calculate
(
mesh
=
mesh
,
x
=
point
-
self
.
wave_speed
*
self
.
final_time
+
num_periods
*
mesh
.
interval_len
)
# Project points into correct periodic interval
points
=
np
.
array
([
point
-
self
.
wave_speed
*
self
.
final_time
+
num_periods
*
mesh
.
interval_len
for
point
in
grid
])
left_bound
,
right_bound
=
self
.
_mesh
.
bounds
while
np
.
any
(
points
<
left_bound
):
points
[
points
<
left_bound
]
+=
self
.
_mesh
.
interval_len
while
np
.
any
(
points
)
>
right_bound
:
points
[
points
>
right_bound
]
-=
self
.
_mesh
.
interval_len
exact
=
np
.
array
([
self
.
_init_cond
.
calculate
(
mesh
=
mesh
,
x
=
point
)
for
point
in
points
])
grid
=
np
.
reshape
(
grid
,
(
1
,
grid
.
size
))
exact
=
np
.
reshape
(
exact
,
(
1
,
exact
.
size
))
...
...
This diff is collapsed.
Click to expand it.
scripts/tcd/Initial_Condition.py
+
0
−
9
View file @
6bf3a1ca
...
...
@@ -88,9 +88,6 @@ class InitialCondition(ABC):
def
calculate
(
self
,
x
,
mesh
):
"""
Evaluates function at given x-value.
In evaluation (not training) mode, the x-value is projected
into its periodic interval before evaluating the function.
Parameters
----------
x : float
...
...
@@ -104,12 +101,6 @@ class InitialCondition(ABC):
Value of function evaluates at x-value.
"""
if
mesh
.
mode
==
'
evaluation
'
:
left_bound
,
right_bound
=
mesh
.
bounds
while
x
<
left_bound
:
x
+=
mesh
.
interval_len
while
x
>
right_bound
:
x
-=
mesh
.
interval_len
return
self
.
_get_point
(
x
,
mesh
)
@abstractmethod
...
...
This diff is collapsed.
Click to expand it.
scripts/tcd/projection_utils.py
+
13
−
3
View file @
6bf3a1ca
...
...
@@ -83,9 +83,19 @@ def calculate_exact_solution(
grid
=
np
.
repeat
(
mesh
.
non_ghost_cells
,
quadrature
.
num_nodes
)
+
\
mesh
.
cell_len
/
2
*
np
.
tile
(
quadrature
.
nodes
,
mesh
.
num_cells
)
exact
=
np
.
array
([
init_cond
.
calculate
(
mesh
=
mesh
,
x
=
point
-
wave_speed
*
final_time
+
num_periods
*
mesh
.
interval_len
)
# Project points into correct periodic interval
points
=
np
.
array
([
point
-
wave_speed
*
final_time
+
num_periods
*
mesh
.
interval_len
for
point
in
grid
])
left_bound
,
right_bound
=
mesh
.
bounds
while
np
.
any
(
points
<
left_bound
):
points
[
points
<
left_bound
]
+=
mesh
.
interval_len
while
np
.
any
(
points
)
>
right_bound
:
points
[
points
>
right_bound
]
-=
mesh
.
interval_len
exact
=
np
.
array
([
init_cond
.
calculate
(
mesh
=
mesh
,
x
=
point
)
for
point
in
points
])
grid
=
np
.
reshape
(
grid
,
(
1
,
grid
.
size
))
exact
=
np
.
reshape
(
exact
,
(
1
,
exact
.
size
))
...
...
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