autoemulate.simulations.reaction_diffusion#
- class ReactionDiffusion(parameters_range=None, output_names=None, return_timeseries=False, log_level='progress_bar', n=32, L=20, T=10.0, dt=0.1)[source]#
Bases:
Simulator
Simulate the reaction-diffusion PDE for a given set of parameters.
- reaction_diffusion(t, uvt, K22, d1, d2, beta, n, N)[source]#
Define the reaction-diffusion PDE in the Fourier (kx, ky) space.
- Parameters:
t (float) – The current time step (not used).
uvt (NumpyLike) – Fourier transformed solution vector at current time step.
K22 (NumpyLike) – The squared magnitudes of the Fourier wavevectors (kx, ky).
d1 (float) – The diffusion coefficient for species 1.
d2 (float) – The diffusion coefficient for species 2.
beta (float) – The reaction coefficient controlling reaction between the two species.
n (int) – Number of spatial points in each direction.
N (int) – Total number of spatial grid points (n*n).
- simulate_reaction_diffusion(x, return_timeseries=False, n=32, L=20, T=10.0, dt=0.1)[source]#
Simulate the reaction-diffusion PDE for a given set of parameters.
- Parameters:
x (NumpyLike) – The parameters of the reaction-diffusion model. The first element is the reaction coefficient (beta) and the second element is the diffusion coefficient (d).
return_timeseries (bool) – Whether to return the full timeseries or just the spatial solution at the final time step. Defaults to False.
n (int) – Number of spatial points in each direction. Defaults to 32.
L (int) – Domain size in X and Y directions. Defaults to 20.
T (float) – Total time to simulate. Defaults to 10.0.
dt (float) – Time step size. Defaults to 0.1.
- Returns:
[u_sol, v_sol], the spatial solution of the reaction-diffusion PDE, either as a timeseries or at the final time point of return_timeseries is False.
- Return type:
tuple[NumpyLike, NumpyLike]