RE: Read/plot curvilinear sediment transport field with MatLab  Coast/Estuary  Delft3D
intro story Coast / Estuary
Coast / EstuaryCoastal systems are among the most dynamic physical systems on earth and are subject to a large variety of forces. The morphodynamic changes occurring to coastlines worldwide are of great interest and importance. These changes occur as a result of the erosion of sediments, its subsequent transport as bed load or suspended load, and eventual deposition. Estuaries are partly enclosed water bodies that have an open connection to the coast. Estuaries generally have one or more branching channels, intertidal mudflats and/or salt marshes. Intertidal areas are of high ecological importance and trap sediments (sands, silts, clays and organic matter). Within the Delft3D modelling package a large variation of coastal and estuarine physical and chemical processes can be simulated. These include waves, tidal propagation, wind or waveinduced water level setup, flow induced by salinity or temperature gradients, sand and mud transport, water quality and changing bathymetry (morphology). Delft3D can also be used operationally e.g. storm, surge and algal bloom forecasting. On this discussion page you can post questions, research discussions or just share your experience about modelling coastal and/or estuarine systems with Delft3D FM. ** PLEASE TAG YOUR POST! **  Sub groups

Message Boards
RE: Read/plot curvilinear sediment transport field with MatLab
SP
Stefan Pluis, modified 3 Years ago.
Read/plot curvilinear sediment transport field with MatLab
Youngling Posts: 1 Join Date: 6/15/15 Recent Posts 00
Dear all,
My model calculates the hydrodynamics and sediment transport of a tidal inlet system on a curvilinear grid (M,N coordinates). For the processing of my model data I use MatLab. For loading the trimNEFIS file and extracting the desired data from the trimNEFIS file, I respectively use the functions 'vs_use' and 'vs_let'.
I want to plot my data in the X,Ydirection. I started with the velocity data, so first I extracted the U and Vvelocity data from trimfile with the functions 'vs_use' and 'vs_let' in MatLab. When I plotted this 'raw velocity data' with the function 'quiver', the flow pattern seems to be wrong compared to same data I plotted with QUICKPLOT. Then I directly read the velocity data from the trimfile using the function 'xyveloc'. This function seems to 'rotate' the U and Vflowvectors from the M,Ncoordinate system to the X,Ycoordinate system, and the 'quiverplot' I made with MatLab was equal to the plot of the same data in QUICKPLOT.
Then I moved on to sediment data. There I encountered similar problems as with 'raw' velocity data: the quiver plot of 'raw' sediment transport data (e.g. SSUU and SSVV as extracted from the trimfile) in MatLab was not equal to the plot of the same data in QUICKPLOT. Since the function 'xyveloc' is intended for velocity data, I searched for an alternative function but it seems this is not present. I also tried to adapt the function 'xyveloc', but me nor others could find where the transformation of the vector in the M,Ncoordinate system to the X,Ycoordinate system happens. Does anybody have an idea how this problem can be resolved? Is vector data like SSUU, SSVV, SBUU and SBVV transformed to the X,Ycoordinate system if you automatically use the function 'qpread'?
Extra info:
*The point (M,N) = 1,1 is defined in the Northwestern corner of my grid and N increases towards the East and M increases towards the South. In the grid I load in MatLab with the function 'drawgrid', X increases to the East and Y increases to the South.
*I use MatLab version R2013a for the processing of my data.
Thanks in advance.
Kind regards,
Stefan
My model calculates the hydrodynamics and sediment transport of a tidal inlet system on a curvilinear grid (M,N coordinates). For the processing of my model data I use MatLab. For loading the trimNEFIS file and extracting the desired data from the trimNEFIS file, I respectively use the functions 'vs_use' and 'vs_let'.
I want to plot my data in the X,Ydirection. I started with the velocity data, so first I extracted the U and Vvelocity data from trimfile with the functions 'vs_use' and 'vs_let' in MatLab. When I plotted this 'raw velocity data' with the function 'quiver', the flow pattern seems to be wrong compared to same data I plotted with QUICKPLOT. Then I directly read the velocity data from the trimfile using the function 'xyveloc'. This function seems to 'rotate' the U and Vflowvectors from the M,Ncoordinate system to the X,Ycoordinate system, and the 'quiverplot' I made with MatLab was equal to the plot of the same data in QUICKPLOT.
Then I moved on to sediment data. There I encountered similar problems as with 'raw' velocity data: the quiver plot of 'raw' sediment transport data (e.g. SSUU and SSVV as extracted from the trimfile) in MatLab was not equal to the plot of the same data in QUICKPLOT. Since the function 'xyveloc' is intended for velocity data, I searched for an alternative function but it seems this is not present. I also tried to adapt the function 'xyveloc', but me nor others could find where the transformation of the vector in the M,Ncoordinate system to the X,Ycoordinate system happens. Does anybody have an idea how this problem can be resolved? Is vector data like SSUU, SSVV, SBUU and SBVV transformed to the X,Ycoordinate system if you automatically use the function 'qpread'?
Extra info:
*The point (M,N) = 1,1 is defined in the Northwestern corner of my grid and N increases towards the East and M increases towards the South. In the grid I load in MatLab with the function 'drawgrid', X increases to the East and Y increases to the South.
*I use MatLab version R2013a for the processing of my data.
Thanks in advance.
Kind regards,
Stefan
Ben Williams, modified 2 Years ago.
RE: Read/plot curvilinear sediment transport field with MatLab
Jedi Knight Posts: 114 Join Date: 3/23/11 Recent Posts 00
Hi Stephan,
I have the same problem: I want to read in sediment transport fields for simulations considering multiple sediment fractions.
Normally one can read in fields using qpread function, but it this function seems stubbornly unable to read subfields from trim files.
Assuming qpread can handle it, the code would go something like...
% Get info on subfields to read in for depthaverage sediment transport
dpath = '..\Runs\Test003\';
F = qpfopen([dpath,'trimFLOW.dat']);
FLDS = qpread(F,0);
SBFLDS = qpread(F,0,'d.a. suspended transport','subfields');
% read in data for first subfield (first sediment fraction), all timesteps, all grid cells:
S1 = qpread(F,0,'d.a. suspended transport','griddata',SBFLDS{1},0,0,0);
However, no matter what I try, I keep getting get a 'Index exceeds matrix dimensions' error.
The offending function is 'd3d_trimfil' at line 118, with the dimensions of variable 'idx' not matching that of varargin(2:end). Although at first site it seems a relatively simple bug fix, it's not that obvious how to do it such that the dimensions are handled correctly for all cases rather than just the one file.
FYI: A workaround I found (very unsatisfactory) is to hack DETRAN to give what I want.
https://svn.oss.deltares.nl/repos/openearthtools/trunk/matlab/applications/detran/detran_engines/detran_d3dTrans_single.m
You only need lines 141 to 192. Substitute 'names' for your trim file name (and path).
It would be much better if qpread could read subfields directly from trim files  has anybody solved this?
Cheers,
Ben
I have the same problem: I want to read in sediment transport fields for simulations considering multiple sediment fractions.
Normally one can read in fields using qpread function, but it this function seems stubbornly unable to read subfields from trim files.
Assuming qpread can handle it, the code would go something like...
% Get info on subfields to read in for depthaverage sediment transport
dpath = '..\Runs\Test003\';
F = qpfopen([dpath,'trimFLOW.dat']);
FLDS = qpread(F,0);
SBFLDS = qpread(F,0,'d.a. suspended transport','subfields');
% read in data for first subfield (first sediment fraction), all timesteps, all grid cells:
S1 = qpread(F,0,'d.a. suspended transport','griddata',SBFLDS{1},0,0,0);
However, no matter what I try, I keep getting get a 'Index exceeds matrix dimensions' error.
The offending function is 'd3d_trimfil' at line 118, with the dimensions of variable 'idx' not matching that of varargin(2:end). Although at first site it seems a relatively simple bug fix, it's not that obvious how to do it such that the dimensions are handled correctly for all cases rather than just the one file.
FYI: A workaround I found (very unsatisfactory) is to hack DETRAN to give what I want.
https://svn.oss.deltares.nl/repos/openearthtools/trunk/matlab/applications/detran/detran_engines/detran_d3dTrans_single.m
You only need lines 141 to 192. Substitute 'names' for your trim file name (and path).
It would be much better if qpread could read subfields directly from trim files  has anybody solved this?
Cheers,
Ben
You do not have permission to access the requested resource.