Matlab

  • Here I'll collect some of the scripts I wrote during the past years to make life easier.
  • #matlab
    -->
    
    Some Scilab scripts and functions I transformed to Matlab code to include them in other Matlab codes. The differences are minimal, but still there are some differences.

Single Collector Efficiency

  • Matlab script version of the scilab code to calculate the single collector efficiency as defined by Tufenkji and Elimelech [2004]:
  • etafct.m
    function [eta0]=etafct(k,A,dp,dc,v,T,mu,rhop,rhof,g,n)
    ap=dp/2;     %radius of the particle (m)
    NR=dp/dc;	%Aspect Ratio
    Dinf=(k*T)/(6*pi*mu*ap);	%Diffusion coefficient in an infinite medium
    NPe=(v*dc)/(Dinf);	%Peclet NUmber, characterizing ratio of convective 
    			%transport to diffusive transport
    NvdW=A/(k*T);		%Van der Waals number, charcterizing ratio of vdW 
    			%interaction energy to the particle's thermal energy
    NA=A/(12*pi*mu*(ap^2)*v);	%Attraction number, represents combined 
    	%influence of vdW  attraction forces and fluid velocity on particle 
    	%deposition rate due to interception
    NG=(2/9)*(((ap^2)*(rhop-rhof)*g)/(mu*v));	%Gravity number, ratio of 
    	%Stokes particle settling velocity to approach velocity of the fluid
    Y=(1-n)^(1/3);	%Y-part of porosity-dependent parameter of Happel's model
    AS=(2*(1-Y^5))/(2-3*Y+3*Y^5-2*Y^6);	%porosity-dependent parameter of 
    					%Happel's model
    
    eta0=(2.4*AS^(1/3)*NR^(-0.081)*NPe^(-0.715)*NvdW^(0.052))+(0.55*AS*NR^(1.675)
    	*NA^(0.125))+(0.22*NR^(-0.24)*NG^(1.11)*NvdW^(0.053));
    	%long equation, glue the second line to the one above...
    
    Call the function by using:
    eta(j)=etafct(k,A,dp,dc,v(j),T,mu,rhop,rhof,g,n);
    
    where: k=Bolzmann Constant, A=Hamaker Constant, dp=Particle diameter, dc=Collector diameter, v(j)=seepage velocity, T=Absolute Temperature, mu=Viscosity, rhop=Particle Density, rhof=Fluid Density, g=Gravitational Acceleration, n=porosity.

Run multiple scripts from one

  • Matlab script I wrote to run scripts from multiple subdirectories
  • 
    Call the function by using: