T = 16; % maximum time [s] L = 8; % length [m] D = 0.1; % diffusivity [m*m/s] v = 0.5; % real fluid velocity [m/s] theta = 0.2; % porosity rhob = 1200; % porous medium bulk density [kg/m*m*m] kappaf = 0.00; % transition rate fluid to solid [1/s] kappas =0.1; % transition rate solid to fluid [1/s] lambdaf = 0; % decay rate in fluid [1/s] lambdas = 0; % decay rate in solid [1/s] c0f = 1; % initial concentration in fluid [kg/m*m*m] c0s = 0.1; % initial concentration in solid [1] M = 100; % number of timesteps (>2) N = 40; % number of nodes %-------------------------- output parameters------------------------------ gplot = 1; % =1: breakthrough curves; =2: profiles 1 t = linspace (T/M,T,M); % time discretization x = linspace (0,L,N); % space discretization cin = 10; % inflow concentration [kg/m*m*m] bctimes=[0,5,5.1,T]; bcVals=[cin,cin,0,0]; %----------------------execution------------------------------------------- bcFunc=@(xl,ul,xr,ur,t) slowsorpbc(xl,ul,xr,ur,t,bctimes,bcVals); options = odeset; c = pdepe(0,@slowsorpde,@slowsorpic,bcFunc,x,t,options,D,v,theta,rhob,kappaf,kappas,lambdaf,lambdas,[c0f;c0s]); %---------------------- graphical output ---------------------------------- Y=c(:,N,1); switch gplot case 1 plot (t,c(:,N,1)) % breakthrough curves xlabel ('time'); ylabel ('concentration'); case 2 plot (x,c(:,:,2)','--') % profiles xlabel ('space'); ylabel ('concentration'); end % -------------------------------------------------------------------------- function [c,f,s] = slowsorpde(x,t,u,DuDx,D,v,theta,rhob,kappaf,kappas,lambdaf,lambdas,c0) c = [1;1]; f = [D;0].*DuDx; s = -[v;0].*DuDx - [lambdaf;lambdas].*u - ([kappaf,-kappas]*u)*[1/theta;-1/rhob]; end % -------------------------------------------------------------------------- function u0 = slowsorpic(x,D,v,theta,rhob,kappaf,kappas,lambdaf,lambdas,c0) u0 = c0; end % -------------------------------------------------------------------------- function [pl,ql,pr,qr] = slowsorpbc(xl,ul,xr,ur,t,bctimes,bcVals) pl = [ul(1)-interp1(bctimes,bcVals,t);0]; ql = [0;1]; pr = [0;0]; qr = [1;1]; end
bcFunc=@(xl,ul,xr,ur,t) slowsorpbc(xl,ul,xr,ur,t,bctimes,bcVals);
That is a generally a good design.
Matlabsolutions.com provides guaranteed satisfaction with a
commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain
experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support
to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been
empanelled after extensive research and quality check.
Matlabsolutions.com provides undivided attention to each Matlab
assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services
include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work
done at the best price in industry.