%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Make plot from the results of the SANDBAR test case % % Further Information: % http://www.crocoagrif.org/ % % This file is part of CROCOTOOLS % % CROCOTOOLS is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published % by the Free Software Foundation; either version 2 of the License, % or (at your option) any later version. % % CROCOTOOLS is distributed in the hope that it will be useful, but % WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; if not, write to the Free Software % Foundation, Inc., 59 Temple Place, Suite 330, Boston, % MA 02111-1307 USA % % Ref: Penven, P., L. Debreu, P. Marchesiello and J.C. McWilliams, % Application of the ROMS embedding procedure for the Central % California Upwelling System, Ocean Modelling, 2006. % % Patrick Marchesiello, IRD 2017,2020 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% clear all close all %================== User defined parameters =========================== % % --- LIP experiment --- % %prompt = 'Erosion (1B) or Accretion (1C) LIP experiment? [1B]: '; %mycase = input(prompt,'s'); %if isempty(mycase) mycase = '1B'; %end % % --- model params --- % fname = 'sandbar_his.nc'; % croco file name if mycase == '1B', morph_fac = 18; % morphological factor (from sediment.in) else morph_fac = 13; end morph_cpl = 1; % feedback to currents makepdf = 0; % make pdf file % %====================================================================== % % --------------------------------------------------------------------- % --- get grid from numerical model --- % --------------------------------------------------------------------- % yindex = 2; % Mm=1 with NS no-slip conditions nc=netcdf(fname,'r'); tindex =length(nc{'scrum_time'}(:)); % reads last record time=morph_fac*nc{'scrum_time'}(:)/3600; % time in hours if mycase == '1B', [d,tindex0]=min(abs(time-4)); % 0-8h (1B) else [d,tindex0]=min(abs(time-3)); % 0-7h (1C) end % horizontal grid hr=squeeze(nc{'h'}(yindex,:)); xr=squeeze(nc{'x_rho'}(yindex,:)); hu=0.5*(hr(1:end-1)+hr(2:end)); xu=0.5*(xr(1:end-1)+xr(2:end)); L=length(hr); % new bathy from last record if morph_cpl, hnew=squeeze(nc{'hmorph'}(tindex,yindex,:)); h=hnew; h0=squeeze(nc{'hmorph'}(tindex0,yindex,:)); if isempty(hnew), h=hr; hnew=hr; h0=hr; end else h=hr; hnew=hr; h0=hr; end % vertical grid N=length(nc('s_rho')); theta_s=nc.theta_s(:); theta_b=nc.theta_b(:); hc=nc.hc(:); zeta=squeeze(nc{'zeta'}(tindex,yindex,:)); Dcrit=1.1*nc{'Dcrit'}(:); zeta(h xu,zu u=squeeze(nc{'u'}(tindex,:,yindex,:)); % ... vertical velocity ... ---> xr,zw w=squeeze(nc{'w'}(tindex,:,yindex,:)); % ... sediment concentration ... ---> xr,zr C=2*squeeze(nc{'sand_01'}(tindex,:,yindex,:)); % ... total viscosity Akv=squeeze(nc{'AKv'}(tindex,:,yindex,:)); % ... viscosity due to wave breaking ... Akb=squeeze(nc{'Akb'}(tindex,:,yindex,:)); % ... wave setup ... sup=squeeze(nc{'zeta'}(tindex0,yindex,:)); % mid exp time sup(hr<0)=sup(hr<0)+hr(hr<0)-Dcrit; % --------------------------------------------------------------------- % --- read/compute bottom model fields (tindx0) --- % -------------------------------------------------------------------- % ... u undertow ... zref=0.1; u0=squeeze(nc{'u'}(tindex0,:,yindex,:)); hu=0.5*(h0(1:end-1)+h0(2:end)); L=length(hu); hu2d=repmat(hu,[N 1]); z0=squeeze(nc{'zeta'}(tindex0,yindex,:)); z0(h0zref)); if isempty(nn), nn=N; end ubot(ix)=squeeze(u0(nn,ix)); end % ... sediment concentration ... ---> xr,zr C0=2*squeeze(nc{'sand_01'}(tindex0,:,yindex,:)); zref=0.05; L=length(h0); h2d=repmat(h0,[N 1]); zz=h2d+zr0; for ix=1:L nn=min(find(zz(:,ix)>zref)); if isempty(nn), nn=N; end Cbot(ix)=squeeze(C0(nn,ix)); end % ... hrms ... hrms =squeeze(nc{'hrm'}(tindex0,yindex,:)); % init time close(nc) zeta(D