MATLAB API For Wave Flume Data Analysis

I'm not sure what the length of the wave is, but it's something you would find out by looking at the data).In summary, this REU student created an API which allows you to extract data from sensors in a 'wave flume' type experiment, computed uplift and moment, and calculated wave energy.
  • #1
TL;DR Summary
I'm working on developing an API for data analysis and I want to know what similar opensource code already exists and what would be the most useful route to develop it.
(As a quick note, 'wave flume' should be taken rather generally. I basically just mean the sort of experiments involved in the flow of water which may use instruments such as pressure gauges, load cells, wave gauges, and ADVs. I know that they're not always done in a flume per say -- the experiment I'm analyzing data from was technically conducted in a basin and not a flume -- but I'm not sure of the proper term).

I'm an REU student assigned to analyze data from an experiment conducted at the HWRL. Here is a link to a news article about it. I'm working on an API in MATLAB to help with analyzing data from sensors such as those in those sort of experiments. The individual functions were all created for me for this specific project, but an API would allow you to use what I wrote however you like. I have an extremely crude version already written, but it would be pretty much useless for others (it's extremely slow, it crashes, it's not at all user-friendly). (Some problems include: there's no documentation, there's only a single class, making my own GUI instead of using documentation causes it to crash due to a graphics error). It was, however, a proof of concept, and I'm now going to start to gradually build an API which will hopefully be useful. I already have some features which could be used for general purposes (not limited to 'wave flume' type experiments):

  1. I have not written code to allow you to customize the type of data you want to extract from the raw data because it has not been useful for me yet, but I think this would be essential to implement if I were to make an API. An example of extracted data is the wave height recorded for each trial for each sensor. (I'm not going to go over how I extracted all of the data on this main post because it isn't that relevant, but I would be more than happy to explain all the steps I took if someone wanted me to).
  2. Built in constants. For me, all I needed so far was water density and the acceleration due to gravity.
  3. Allows you to create your own constants. In my case, for example, one house was on stilts and the stilt height would be a good constant.
  4. Allows you to create your own parameters based on those constants. Using the previous example, I then made the parameter air gap which used the constant stilt height (the air gap is the stilt height minus water depth).
  5. Allows you to plot those created parameters against one another. (There are three parameters: independent, dependent, and legend -- the legend is automatically constructed based on unique values). For example, I could then plot uplift vs. the air gap parameter I constructed at different water depths say (just a random example). The title and labels are automatically generated based on your selection.
  6. Allows you to automatically save figures and update a PowerPoint with those figures (I haven't used Word yet, so I haven't implemented that yet, but I probably will once I start writing my research paper).
But then there's also stuff which is more 'wave flume' specific (these were all things which I created for my specific project):

  1. Computes uplift and moment from pressure gauge readings using different methods. There were multiple pressure gauges on the bottom of the house, and I think having multiple pressure gauges all in the same plane is fairly general. Originally I computed using uplift and moment using a bilinear multivariable regression. (I actually deleted that code because my mentor said he didn't want to do it like that, but I could rewrite it very easily. I could even simply build the structure of it using mvregress and the user could choose the kind of fit they want). However I also used tributary areas and a linear regression to compute uplift and moment -- both assume pressure doesn't vary along the long-shore direction of the house.
  2. Computes phase average with period and sample rate of sensor as an input. (I'm not sure if my code for Fourier Transform is correct -- I haven't really looked at it because I haven't been asked to use it yet).
  3. Computing wave height using wave gauges. It first finds the phase average, then finds the difference between the maximum and minimum value of the phase average.
  4. Computes wavelength using linear wave theory (it takes water depth and wave period as inputs and uses vpasolve (built-in function to solve equation numerically) to determine the wavelength.
  5. It computes uplift and moment from load cells (fairly self-explanatory I think).
  6. A method for computing wave energy to use for normalization (in my case, I used ##E=\rho g H y## (##H## is wave height and ##y## is the length of the house in the long-shore direction)
  7. There are other things I implemented which my mentor said weren't useful to our project, but may be useful in general:
    1. Computes wave height using Green's Law. The wave height at the wave maker is stored in the metadata so I could use Green's Law to account for shoaling during wave propagation. (The flume bottom was at a tilt so the depth decreased as the wave propagated). The waves were already broken, or close to breaking by the time it came in contact with the house, so for us it wouldn't be accurate.
    2. Computes wave length by finding the shift in wave gauge readings between successive sensors and takes the cross-shore distance between the gauges as inputs. Noisy reading, a fairly poor method for calculating it (it counted every time the reading crosses zero as half a period, making it useless for noisy reading), and the fact we can use linear wave theory made it useless for us. However, I could create a more robust algorithm (I'm thinking of minimizing the difference between the two readings by shifting one reading through time to match the other) if it turns out to be useful (maybe you don't want to approximate with linear wave theory).
That's all I have right now because that's all I was asked to do for this project so far, but I would love to started building more to it through a system of subclasses which inherit from one another. First though I want to know what exists which is similar to this and where I could find my niche. To clarify, if I were to develop this, I would imagine making it an opensource code in which anyone can view my code, make edits, and build on to it. I think I may use File Exchange to share my code. Thanks!

I'm a bit hesitant of adding this as a footnote; as I don't know if it's possible, I don't know how to do it, and I'm sure I wouldn't be able to do it; but I could imagine it may be theoretically possible to connect the API with some CFD software. It would have to use this to figure out what's going on in your server and somehow talk to the software. The software would need to know how to set everything up. It would need a lot of information: dimensions of everything, all boundary conditions, all the information about the wave conditions etc. That information would be fed to the software as directions and the software would follow those directions to run a simulation. (Something like this, but probably a lot simpler, might also work with CAD software). Again though, I have no idea if this is possible.
Last edited:
Physics news on
  • #2
The reason there is a second post is because it stops you from editing your first post after some time.

I found out that OpenFOAM has open source API. I think the final step would be to integrate my API (after I git rid of the gui, add documentation, and use subclasses) with OpenFOAM's API to create customizable protocols for OpenFOAM. I could then also include useful algorithms. For example, if there is a large difference between result I get between OpenFOAM and the data when running a method for a certain parameter, it could rerun that bit of time with a finer mesh. I could then include custom graph types which use the results of OpenFOAM and the data when running certain methods.

I'm almost sure that if this worked, it would be useful, so my question's changed a bit.

Would this be feasible? Essentially, would integrating my API with OpenFOAM's API in a useful way be feasible? At the very least, even if I couldn't, would it make sense to describe my API as something which the user COULD use with OpenFOAM (so the user would decide how to integrate it)?

(I also forgot to write something in my previous post. The user could add any type of plot they want. By this I mean they could use any extracted data (or raw data if they wanted to) and any constants to write any code which they wanted to plot something).
Last edited:
  • #3

I thought about it some more and I think it would use 4 APIs. One API would be OpenFOAM's. Another API is the one I made the "proof of concept" of. Then I think there should be a third one which interacts with those two. It would take functions from my API and converts them into instructions for the OpenFOAM's API. Meanwhile, OpenFOAM would be transferring information about the simulation to the fourth API. That API would convert it into information which my API could understand and transfer it back to my API. The API would then use functions for constructing graphs to create graphs (or actually anything at all) which would help the user analyze the relation between experimental and simulation results.

So I think I also realize why this would be hard. I would essentially have to work my way through OpenFOAM's API (I found a hierarchy view of it), and figure out two things. I would have to figure out how information should transfer to it and how it should transfer information. I would then need to combine it into a logical system of classes and subclasses (do that for each of the intermediate APIs) and make sure that functions transfer in exactly the right way. So basically an incredibly difficult undertaking which would be impossible for me to do alone(even if it did make sense).

I'm still not sure if what I'm doing makes any sense though, so I really would want someone to tell me if it doesn't.
Last edited:
  • #4
I'm continuously refining this but I will stop updating and just wait to see people's responses.

1. What is the MATLAB API for Wave Flume Data Analysis?

The MATLAB API for Wave Flume Data Analysis is a set of functions and tools that allow users to analyze and manipulate data collected from wave flumes. It provides a user-friendly interface for importing, visualizing, processing, and exporting wave flume data in MATLAB.

2. How do I install the MATLAB API for Wave Flume Data Analysis?

The MATLAB API for Wave Flume Data Analysis can be installed by downloading the appropriate package from the MathWorks website and following the installation instructions. It requires a valid MATLAB license to use.

3. What types of data can be analyzed using the MATLAB API for Wave Flume Data Analysis?

The MATLAB API for Wave Flume Data Analysis can handle various types of data collected from wave flumes, including wave height, wave period, water pressure, and wave forces. It also supports data from different types of sensors and instruments.

4. Can the MATLAB API for Wave Flume Data Analysis handle large datasets?

Yes, the MATLAB API for Wave Flume Data Analysis is optimized to handle large datasets with efficient data storage and processing capabilities. It also offers parallel computing options to speed up data analysis for even larger datasets.

5. Is the MATLAB API for Wave Flume Data Analysis suitable for beginners?

The MATLAB API for Wave Flume Data Analysis is designed to be user-friendly and accessible for both beginners and experienced users. It offers interactive tutorials and documentation to help users get started, and its functions and tools are intuitive to use.

Suggested for: MATLAB API For Wave Flume Data Analysis