% PDEONE - Solve one dimensional PDE's using ALGORITHM 494 PDEONE % % Written by: % -- % John L. Weatherwax 2005-12-17 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- %xGrid = linspace( -50, +50, 101 ); xGrid = linspace( -400, +400, 801 ); %tGrid = 0:0.1:0.1; %tGrid = [ 0 0.1 0.3 ]; tGrid = [ 0 0.1 0.3 0.5 1.0 1.2 1.4 1.6 1.83 ]; [ U, opts ] = pdeone("F","D","BNDRY_ALPHA","BNDRY_BETA","BNDRY_GAMMA","shallow_init", ... "xGrid", xGrid, "tGrid", tGrid, "eps", 10^(-4), "dt", 10^(-5) ); tGrid = opts.tGrid; xGrid = opts.xGrid; %close all; ntouts = length(tGrid); for nti=1:ntouts, figure; title( [ "U/Phi at t=", num2str(tGrid(nti)) ] ); subplot(2,1,1); plot( xGrid/100, U(1,:,nti)/10, 'b-' ); grid; %axis( [ -4, +4, 0.0, 20.0 ] ); xlabel( "--x--" ); ylabel( "Velocity of Water" ); subplot(2,1,2); plot( xGrid/100, (U(2,:,nti)+bottom_H(xGrid))/10, 'r-' ); grid; %axis( [ -4, +4, 0.0, 4.0 ] ); hold on; plot( xGrid/100, bottom_H( xGrid )/10, 'g-' ); hold off; xlabel( "--x--" ); ylabel( "Depth of Water" ); %pause; end save -v6 "EGB_sol.mat" U xGrid tGrid;