allen_cahn_1D module#

Created on Fri Sep 1 19:12:28 2023

@author: Pavan Pranjivan Mehta

allen_cahn_1D.eval_A(epi, M, K, dt)#

Computes A = M + dt * episilon * episilon * K

Parameters#

Nint

max degree of the polynomial

Knumpy araray

Stiffness matrix of dim = (N x N)

Mnumpy araray

Mass matrix of dim = (N x N)

dtfloat

time step

epifloat

diffusion constant, episilon

Returns#

A = M + dt * episilon * episilon * K

A: numpy array float, dim = (N x N)

A = M + dt * episilon * episilon * K

allen_cahn_1D.eval_b(coeff_old, N, M, dt)#

Computes b = M [ eta_coeff - f_prime (eta_coeff) ]

Parameters#

Nint

max degree of the polynomial

coeff_oldnumpy araray

coeffecients of eta at time-step k obtained as reuslt of L2 Projection

Mnumpy araray

Mass matrix of dim = (N x N)

dtfloat

time step

Returns#

b = M [ eta_coeff - f_prime (eta_coeff) ]

b: numpy array float, dim = (N)

b = M [ eta_coeff - f_prime (eta_coeff) ]

Notes#

f = eta**2 ( eta - 1 )**2 f_prime = 4 eta**3 - 6 eta**2 + 2 eta

allen_cahn_1D.initial_value(x)#

Computes Initial value

Parameters#

xfloat or numpy array

spatial points in [0, 1]

Returns#

Initial value: numpy array

Notes#

Available functions: random, sin (x * pi) and runge in [0, 1]

allen_cahn_1D.function_projection(N, M)#

Computes Coeffcients from L2 of Initial value

Parameters#

Nint

max degree of the polynomial

Mnumpy araray

Mass matrix of dim = (N x N)

Returns#

Coeffcients: numpy array

Coeffcients from L2 projection of initial value basis = homogenous basis using shifted legendre polynomials

allen_cahn_1D.construct_sol(coeff, x, N)#

Constructs function value, f(x) as;

f(x) = coeff_0 * P_0 + coeff_1 * P_1 + coeff_3 * P_2 + …

where, P_n is basis function of n-th degree

Parameters#

Nint

max degreo of the polynomial

coeffnumpy araray

coeffecients of eta obtained as reuslt of L2 Projection

xfloat or numpy array

spatial points in [0, 1]

Returns#

f(x): numpy array

function value upon expansion over basis basis = homogenous basis using shifted legendre polynomials

allen_cahn_1D.solver(N)#

Solve Allen-Cahn eqaution in 1D

Parameters#

Nint

max degree of the polynomial

Returns#

None

place holder, see 2D for example