Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allen-Cahn work-precision and resilience plots #385

Merged
merged 1 commit into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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)

Check warning on line 74 in pySDC/implementations/problem_classes/AllenCahn_2D_FFT.py

View check run for this annotation

Codecov / codecov/patch

pySDC/implementations/problem_classes/AllenCahn_2D_FFT.py#L74

Added line #L74 was not covered by tests

# 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