User Guide 025: Difference between revisions

From CIRPwiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 39: Line 39:




[[File:fig_e-1.png]]
 


Figure E-1. Computed grain size distribution from the Matlab script above.
Figure E-1. Computed grain size distribution from the Matlab script above.

Latest revision as of 21:25, 8 May 2015

14 Appendix D: Determining the sediment size Classes

In order to determine the appropriate grain sizes for a simulation it is useful to be able to determine ahead of time the size class fractions using a log-normal distribution for different median grain sizes and sorting. The Matlab example below determines the grain size distribution given the smallest and largest grain sizes, number of sediment sizes, median grain size and geometric standard deviation. The figure shows the computed grain size distribution.



clear all; close all %--- Start Input --- d1 = 0.234; %mm, smallest grain size dn = 2; %mm, largest grain size nsed = 5; %number of grain sizes d50 = 0.4; %mm, median grain size sg = 1.5; %mm, geometric standard deviation %--- End Input --- %Characteristic diameters d = exp(log(d1) + log(dn/d1)*((1:nsed)-1.0)/(nsed-1)); %Limits or bounds dlim = zeros(1,nsed+1); dlim(2:nsed)=sqrt(d(2:nsed).*d(1:nsed-1)); dlim(1)=d(1)*d(1)/dlim(2); dlim(nsed+1)=d(nsed)*d(nsed)/dlim(nsed); %Fractions p = diff(dlim).*lognpdf(d,log(d50),log(sg)); p = p/sum(p); %Plotting figure hold on for k=1:nsed

 fill([dlim(k) dlim(k+1) dlim(k+1) dlim(k)],...        
   [0 0 p(k) p(k)]*100,0.5*[1,1,1])

end ylabel('Fraction, %') xlabel('Grain size, mm') set(gca,'box','On','TickDir','out',...

 'XMinorTick','OFF','YMinorTick','OFF')

[d',p'] return




Figure E-1. Computed grain size distribution from the Matlab script above.