Skip to content

Instantly share code, notes, and snippets.

@olekravchenko
olekravchenko / HWENO5_residual
Created April 21, 2020 07:38
HWENO5 residual
% --------
% RESIDUAL
% --------
% Along x
[axp,axm]=fluxsplitting_scalar(ax,'LF');
axm = circshift(axm,[0 1]);
[dqL,dpL] = HWENO5_reconstruction(axm,dx,q,p,[0 -1]);
[dqR,dpR] = HWENO5_reconstruction(axp,dx,q,p,[0 +1]);
dq = dqL + dqR;
@olekravchenko
olekravchenko / HWENO5_reconstruction
Created April 21, 2020 07:39
HWENO5 reconstruction
%% Set Variables
qm = circshift(qo,+ind);
pm = circshift(po,+ind);
qp = circshift(qo,-ind);
pp = circshift(po,-ind);
%% Step 1: Reconstruction of flux \hat{f}_{i+1/2} value
% Reconstruction Polynomials
up0 = [-7 13 -4*h] * [qm; qo; pm] / 6;
up1 = [-1 5 2 ] * [qm; qo; qp] / 6;
@olekravchenko
olekravchenko / IVP_BC_mol.nb
Created April 24, 2020 05:50
IVP with boundary condition (incorrect statement) impelentation
Clear[n, e, Ne, Ef, lines, ns, es]
L = 6; nx = 201; dx = L/(nx - 1);
xTbl = Range[0, L, dx]; tEnd = 10;
Ne[t_] = Subscript[n, #][t] & /@ Range[1, nx];
Ef[t_] = Subscript[e, #][t] & /@ Range[1, nx];
eTbl = {Subscript[e, 1][t] == 10^-4,
Table[\[Kappa] D[Subscript[e, i][t],
t] + {1, -1}.{Subscript[e, i][t],
Subscript[e, i - 1][t]}/(h) == 1 - Subscript[n, i][t], {i, 2,
nx - 1}], Subscript[e, nx][t] == Subscript[e, nx - 1][t]};