pymgrit.allen_cahn package

Submodules

pymgrit.allen_cahn.allen_cahn module

Vector and application class for the 2D Allen-Cahn equation

Based on https://epubs.siam.org/doi/abs/10.1137/080738398?mobileUi=0 and https://dl.acm.org/doi/10.1145/3310410

class pymgrit.allen_cahn.allen_cahn.AllenCahn(*args, **kwargs)

Bases: pymgrit.core.application.Application

Application class for the Allen-Cahn in 2D space,

u_t = (u_xx + u_yy) + 1/ eps^2 u(1-u), a > 0, on [-0.5, 0.5] x [-0.5, 0.5] x (t_start, t_end],

with periodic boundary conditions, eps > 0, and subject to the initial condition

u(x,0) = tanh((R0-|x|)/sqrt(2eps).

compute_matrix()

Define spatial discretization matrix

Returns

space discretizaton

compute_radius(u)

Compute radius of u

Returns

Radius

exact_radius(t)

Compute exact radius

Returns

Exact radius

initial_guess()

Set initial condition

Returns

Initial guess

step(u_start: pymgrit.allen_cahn.allen_cahn.VectorAllenCahn2D, t_start: float, t_stop: float) pymgrit.allen_cahn.allen_cahn.VectorAllenCahn2D

Time integration routine for 2D Allen-Cahn problem:

Parameters
  • u_start – approximate solution for the input time t_start

  • t_start – time associated with the input approximate solution u_start

  • t_stop – time to evolve the input approximate solution to

Returns

approximate solution at input time t_stop

class pymgrit.allen_cahn.allen_cahn.VectorAllenCahn2D(nx, ny)

Bases: pymgrit.core.vector.Vector

Vector class for the 2D Allen-Cahn equation

clone()

Clone vector object

Return type

vector object with zero values

clone_rand()

Initialize vector object with random values

Return type

vector object with random values

clone_zero()

Initialize vector object with zeros

Return type

vector object with zero values

get_values()

Get vector data

Returns

values of vector object

norm()

Norm of a vector object

Returns

2-norm of vector object

pack()

Pack data

Returns

values of vector object

set_values(values)

Set vector data

Parameters

values – values for vector object

unpack(values)

Unpack and set data

Parameters

values – values for vector object

Module contents