Skip to content

Commit

Permalink
Allen-Cahn work-precision and resilience plots (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
brownbaerchen authored Dec 8, 2023
1 parent 465ac8c commit ca48726
Show file tree
Hide file tree
Showing 12 changed files with 540 additions and 94 deletions.
10 changes: 6 additions & 4 deletions pySDC/core/Problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,13 @@ def generate_scipy_reference_solution(self, eval_rhs, t, u_init=None, t_init=Non
import numpy as np
from scipy.integrate import solve_ivp

tol = 100 * np.finfo(float).eps
kwargs = {
'atol': 100 * np.finfo(float).eps,
'rtol': 100 * np.finfo(float).eps,
**kwargs,
}
u_init = self.u_exact(t=0) if u_init is None else u_init * 1.0
t_init = 0 if t_init is None else t_init

u_shape = u_init.shape
return (
solve_ivp(eval_rhs, (t_init, t), u_init.flatten(), rtol=tol, atol=tol, **kwargs).y[:, -1].reshape(u_shape)
)
return solve_ivp(eval_rhs, (t_init, t), u_init.flatten(), **kwargs).y[:, -1].reshape(u_shape)
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ def dependencies(self, controller, description, **kwargs):
step_limiter_params = {key: self.params.__dict__[key] for key in available_keys}
controller.add_convergence_controller(StepSizeLimiter, params=step_limiter_params, description=description)

if self.params.useMPI:
self.prepare_MPI_logical_operations()

return None

def get_new_step_size(self, controller, S, **kwargs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def prepare_next_block(self, controller, S, *args, **kwargs):
for u in lvl.u:
if u is None:
break
isfinite = all(np.isfinite(u.flatten()))
isfinite = np.all(np.isfinite(u))

below_limit = abs(u) < self.params.thresh

Expand Down
12 changes: 10 additions & 2 deletions pySDC/implementations/problem_classes/AllenCahn_2D_FFT.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,19 @@ class allencahn2d_imex(ptype):
dtype_u = mesh
dtype_f = imex_mesh

def __init__(self, nvars=None, nu=2, eps=0.04, radius=0.25, L=1.0, init_type='circle'):
def __init__(
self,
nvars=None,
nu=2,
eps=0.04,
radius=0.25,
L=1.0,
init_type='circle',
):
"""Initialization routine"""

if nvars is None:
nvars = [(256, 256), (64, 64)]
nvars = (128, 128)

# we assert that nvars looks very particular here.. this will be necessary for coarsening in space later on
if len(nvars) != 2:
Expand Down
Loading

0 comments on commit ca48726

Please sign in to comment.