interactive-track-and-trace/advection
robin 9cf2133e91 rename bilinearinterpolate 2024-05-01 12:57:34 +02:00
..
src rename bilinearinterpolate 2024-05-01 12:57:34 +02:00
.gitignore setup 2024-04-24 12:07:26 +02:00
README.md fix: us and vs, tested better 2024-05-01 12:51:20 +02:00

README.md

What is new?

There is one new added component: AdvectionKernels which is an "interface" (i.e an abstract class). There are two implementations simple Euler integration called EulerIntegrationKernel and Runge Kutta integration called RK4AdvectionKernel.

Main function gives a good example of how to use the library. Especially the following function which prints the position of the particle at every time step.

template <typename AdvectionKernelImpl>
void advectForSomeTime(const UVGrid &uvGrid, const AdvectionKernelImpl &kernel, double latstart, double lonstart) {

    // Require at compile time that kernel derives from the abstract class AdvectionKernel
    static_assert(std::is_base_of<AdvectionKernel, AdvectionKernelImpl>::value, NotAKernelError);

    double lat1 = latstart, lon1 = lonstart;
    for(int time = 100; time <= 10000; time += AdvectionKernel::DT) {
        cout << "lat = " << lat1 << " lon = " << lon1 << endl;
        auto [templat, templon] = kernel.advect(time, lat1, lon1);
        lat1 = templat;
        lon1 = templon;
    }
}

Location of data

The data path is hardcoded such that the following tree structure is assumed: The current assumption is that the name of the us and vs are flipped since this is the way the data was given to us.

data/
  grid.h5
  hydrodynamic_U.h5
  hydrodynamic_V.h5
interactive-track-and-trace/
  opening-hdf5/
     ...

Compiling

Let the current directory be the src directory. Run:

mkdir build
cd build
cmake ..
make