This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% -------- | |
% 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
program gdns2s_strat_new | |
use omp_lib | |
parameter (ni=998) | |
parameter (nj=1250) | |
!implicit double precision (a-h,o-z) | |
real (kind=8), allocatable, dimension(:) :: x, y, ylt, roaxe, paxe | |
real (kind=8), allocatable, dimension(:,:) :: ro, u, v, es, rox, ux, vx, esx, roy, uy, vy, esy, dksi | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upFt[t_, n_] := Product[Sinc[t 2^-k], {k, 1, n}] | |
Plot[{Sinc[2 \[Pi] t], upFt[2 \[Pi] t, 1], upFt[2 \[Pi] t, 2], | |
Cos[2 \[Pi] t]}, {t, -3.05, 3.05}, PlotRange -> All, | |
PlotStyle -> Thick, | |
PlotLegends -> {"sinc(2\[Pi]t)", "sinc(\[Pi]t)", | |
"sinc(\[Pi]t)sinc(\[Pi]t/2)", "cos(x)"}, | |
ImageSize -> Large] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sympy import * | |
#from sympy import Symbol, solve | |
from sympy.solvers.solveset import linsolve | |
# Set symbolic parameters | |
x, a, b, c, d, h, ui, ui1, gi, gi1 = symbols('x, a, b, c, d, h, ui, ui1, gi, gi1') | |
# Set interpolation polynomials | |
f = a + b*x + c*x**2 + d*x**3 | |
df = f.diff(x) | |
# Set constrains |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
B3[x_] := BSplineBasis[3, 0.25 (x + 2)] | |
FTfupn[x_, n_, elemProd_] := | |
Sinc[x/2]^(n + 1) Product[Sinc[x 2^-i], {i, 2, elemProd}] | |
fupn[x_, n_, elemProd_, elemSum_] := | |
If[-((n + 2)/2) <= x && x <= (n + 2)/2, | |
2/(n + 2) (0.5 + | |
Sum[FTfupn[ (2 k \[Pi])/(n + 2), n, | |
elemProd] Cos[(2 k \[Pi])/(n + 2) x], {k, 1, elemSum}]), 0] | |
Plot[{B3[x], fupn[x, 2, 4, 15]}, {x, -2, 2}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f[x_] := 1/2 - (4/\[Pi]) Arg[QPochhammer[I (2 x - 1)]] | |
upFT[t_] := Product[Sinc[t 2^-k], {k, 1, 5}] | |
up[x_] := 1/2 + Sum[Cos[\[Pi] k x] upFT[\[Pi] k], {k, 1, 25}] | |
Column@{ | |
Plot[{up[x - 1], f[x]}, {x, 0, 1}, PlotStyle -> Thick, | |
ImageSize -> 450], | |
Plot[Abs@{up[x - 1] - f[x]}, {x, 0, 1}, PlotStyle -> Thick, | |
ImageSize -> 450] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
Author: Oleg Kravchenko; | |
Date: 18/6/16; | |
*) | |
ClearAll["Global`*"] | |
(*eup(x) function via convolution*) | |
eUP[k_, x_] := 2^k UnitBox[2^k x] Exp[x] | |
c1eUP[x_] := Convolve[eUP[0, s], eUP[1, s], s, x] // Evaluate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(*Exponential atomic function*) | |
(*Fourier Transform*) | |
Sinch[x_] := If[x == 0, 0, Sinh[x]/x]; | |
FTeup[a_, t_] := | |
Product[(Sinch[Log[a]/2])^-1 Sinch[Log[a]/2 - I t /2^j], {j, 1, 4}]; | |
(*Eup AF via Fourier Series*) | |
eup[a_, x_] := | |
If[-1 <= x <= 1, |
NewerOlder