view +sbp/+implementations/intOpMC_orders_2to2_ratio2to1.m @ 1012:1e437c9e5132 feature/advectionRV

Create residual viscosity package +rv and generalize the ResidualViscosity class - Generalize residual viscosity, by passing user-defined flux and calculating the time derivative outside of the update. - Create separate RungekuttaRV specifically using interior RV updates - Separate the artifical dissipation operator from the scheme AdvectionRV1D so that the same scheme can be reused for creating the diff op used by the ResidualViscosity class
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Wed, 05 Dec 2018 13:44:10 +0100
parents c923fe6197ff
children
line wrap: on
line source

function [IC2F,IF2C] = intOpMC_orders_2to2_ratio2to1(mc)

mf = 2*(mc-1) + 1;

stencil_F2C = [1.0./4.0,1.0./2.0,1.0./4.0];
stencil_width = length(stencil_F2C);
stencil_halfwidth = (stencil_width-1)/2;

BC_F2C = [1.0./2.0,1.0./2.0];

Hc = speye(mc,mc);
Hc(1,1) = 1/2;
Hc(end,end) = 1/2;

Hf = 1/2*speye(mf,mf);
Hf(1,1) = 1/4;
Hf(end,end) = 1/4; 

IF2C = sparse(mc,mf);
[BCrows, BCcols] = size(BC_F2C);
IF2C(1:BCrows, 1:BCcols) = BC_F2C;
IF2C(mc-BCrows+1:mc, mf-BCcols+1:mf) = rot90(BC_F2C,2);

for i = BCrows+1 : mc-BCrows
	IF2C(i,(2*i-stencil_halfwidth-1) :(2*i+stencil_halfwidth-1))...
		 = stencil_F2C;
end

IC2F = Hf\(IF2C'*Hc);