Skip to content

Commit d1999bc

Browse files
committed
Add a bit more information
1 parent 14894d7 commit d1999bc

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

pySDC/playgrounds/time_dep_BCs/heat_eq_time_dep_BCs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ def put_time_dep_BCs_in_rhs(self, rhs_hat, t):
195195
"""
196196
Put the time dependent BCs in the right hand side.
197197
198+
See Section 2.5.10 in https://doi.org/10.15480/882.16360 for details on the implementation of the boundary conditions.
199+
198200
In this simple 1D case the BCs are simply in the last two lines of the problem, so we can put there whatever we want.
199201
Note that in 2D you essentially do the same, but you need to unflatten the RHS, put the BCs in the last lines, and then reflatten.
200202
"""

pySDC/playgrounds/time_dep_BCs/run_time_dep_heat.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from pySDC.implementations.hooks.plotting import PlotPostStep
99

1010

11-
def run_heat(dt=1e-1, Tend=4):
11+
def run_heat(dt=1e-1, Tend=4, plotting=False):
1212
level_params = {}
1313
level_params['dt'] = dt
1414

@@ -24,7 +24,8 @@ def run_heat(dt=1e-1, Tend=4):
2424

2525
controller_params = {}
2626
controller_params['logger_level'] = 15
27-
controller_params['hook_class'] = PlotPostStep
27+
if plotting:
28+
controller_params['hook_class'] = PlotPostStep
2829

2930
description = {}
3031
description['problem_class'] = Heat1DTimeDependentBCs
@@ -47,5 +48,5 @@ def run_heat(dt=1e-1, Tend=4):
4748

4849

4950
if __name__ == '__main__':
50-
run_heat()
51+
run_heat(plotting=True)
5152
plt.show()

pySDC/playgrounds/time_dep_BCs/tests.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ def test_time_dep_heat_eq(a, b, t):
1919
expect_boundary = np.empty((2, 2))
2020
expect_boundary = problem.put_time_dep_BCs_in_rhs(expect_boundary, t)
2121

22+
# we use T_n(1) = 1 and T_n(-1) = (1)^n, to compute the values at the boundaries from the spectral representation
23+
# see Wikipedia for more details: https://en.wikipedia.org/wiki/Chebyshev_polynomials#Roots_and_extrema
2224
right_boundary = u.sum()
2325
expect_right_boundary = expect_boundary[0, -2]
2426
assert np.isclose(

0 commit comments

Comments
 (0)