Skip to content

Commit 9b3403a

Browse files
committed
Fixed initial conditions
1 parent 42d04ed commit 9b3403a

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

pySDC/implementations/problem_classes/RayleighBenard.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def __init__(
6060
comm=None,
6161
Lx=4,
6262
Lz=1,
63+
z0=0,
6364
**kwargs,
6465
):
6566
"""
@@ -74,6 +75,8 @@ def __init__(
7475
dealiasing (float): Dealiasing for evaluating the non-linear part in real space
7576
comm (mpi4py.Intracomm): Space communicator
7677
Lx (float): Horizontal length of the domain
78+
Lz (float): Vertical length of the domain
79+
z0 (float): Position of lower boundary
7780
"""
7881
BCs = {} if BCs is None else BCs
7982
BCs = {
@@ -103,13 +106,14 @@ def __init__(
103106
'comm',
104107
'Lx',
105108
'Lz',
109+
'z0',
106110
localVars=locals(),
107111
readOnly=True,
108112
)
109113

110114
bases = [
111115
{'base': 'fft', 'N': nx, 'x0': 0, 'x1': self.Lx},
112-
{'base': 'ultraspherical', 'N': nz, 'x0': 0, 'x1': self.Lz},
116+
{'base': 'ultraspherical', 'N': nz, 'x0': self.z0, 'x1': self.Lz},
113117
]
114118
components = ['u', 'v', 'T', 'p']
115119
super().__init__(bases, components, comm=comm, **kwargs)
@@ -252,8 +256,8 @@ def u_exact(self, t=0, noise_level=1e-3, seed=99):
252256

253257
# linear temperature gradient
254258
for comp in ['T', 'v', 'u']:
255-
a = (self.BCs[f'{comp}_top'] - self.BCs[f'{comp}_bottom']) / 2
256-
b = (self.BCs[f'{comp}_top'] + self.BCs[f'{comp}_bottom']) / 2
259+
a = (self.BCs[f'{comp}_top'] - self.BCs[f'{comp}_bottom']) / self.Lz
260+
b = self.BCs[f'{comp}_bottom'] - a * self.z0
257261
me[self.index(comp)] = a * self.Z + b
258262

259263
# perturb slightly
@@ -262,7 +266,7 @@ def u_exact(self, t=0, noise_level=1e-3, seed=99):
262266
noise = self.spectral.u_init
263267
noise[iT] = rng.random(size=me[iT].shape)
264268

265-
me[iT] += noise[iT].real * noise_level * (self.Z - 1) * (self.Z + 1)
269+
me[iT] += noise[iT].real * noise_level * (self.Z - self.z0) * (self.Z - self.z0 + self.Lz)
266270

267271
if self.spectral_space:
268272
me_hat = self.spectral.u_init_forward

pySDC/projects/GPU/configs/base_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,10 @@ def post_step_processing(self, controller, S, **kwargs):
243243
self.counter = hook.counter
244244

245245
def post_run_processing(self, controller, S, **kwargs):
246-
stats = self.merge_all_stats(controller)
247-
248246
self.post_step_processing(controller, S, **kwargs)
249247

248+
stats = self.merge_all_stats(controller)
249+
250250
def return_stats():
251251
return stats
252252

pySDC/projects/Resilience/RBC.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import numpy as np
1616

17-
PROBLEM_PARAMS = {'Rayleigh': 3.2e5, 'nx': 256, 'nz': 128, 'max_cached_factorizations': 30}
17+
PROBLEM_PARAMS = {'Rayleigh': 3.2e5, 'nx': 256, 'nz': 128, 'max_cached_factorizations': 30, 'Lx': 8, 'Lz': 4, 'z0': 0}
1818

1919

2020
def u_exact(self, t, u_init=None, t_init=None, recompute=False, _t0=None):

0 commit comments

Comments
 (0)