typVol2Vol ---------- Description ~~~~~~~~~~~ ``Vol2Vol`` interpolates the wave fields and return wave properties at given time and position. It has the multiple ``Surf2Vol`` classes and interpolation class. The ``Vol2Vol`` class structure is described in :numref:`fig:vol2volStructure`. The reconstructed HOS wave fields (snapshot of wave field) retrieved from ``Surf2Vol`` are used to construct interpolation data. HOS result file holds modes amplitudes time series for the whole HOS simulation time. If we construct HOS wave fields and interpolation data structure for the whole HOS simulation time, not only the computation time is long but also a huge memory is demanded. ``Grid2Grid`` aims for construction of demanding wave fields for relatively short period and domain, it is not necessary to construct the whole HOS wave fields and interpolation data structure. Therefore revolving algorithm is applied just to update HOS wave fields adjucent to simulation time and constuct small interpolation data structure for efficient computation time and memory. .. figure:: figures/c1.structure/Vol2VolClassStructure.png :alt: ``Vol2Vol`` class structure :name: fig:vol2volStructure ``Vol2Vol`` class structure When ``Vol2Vol`` initialised, the ``Surf2Vol`` class array is allocated and initialise multiple ``Surf2Vol`` and connect those ``Surf2Vol`` class array with the revolving algorithm. The revolving algorithm determines which ``Surf2Vol`` should be updated and the order of ``Surf2Vol`` array for the efficient generation of interpolation data. The subroutine ``correct`` with input :math:`t` first determine HOS ``Surf2Vol`` correction index and ``Surf2Vol`` order based on input :math:`t` and previous HOS time index. By using correction index and order, only necessary HOS ``Surf2Vol`` is updated and re-ordered to constructed for interpolation data. After interpolation data is constructed, it is delivered to the interpolation class. The interpolation class communicates with the ``bspline-Fortran`` module and constructs the interpolation data structure. The subroutine ``getEta``, ``getU``, ``getPd`` and ``getFlow`` return interpolated values for given space and time from the constructed interpolation data structure. Class (Type) ~~~~~~~~~~~~ **Class**: ``Vol2Vol`` - Data: - ``nInterp_``: Interpolation order (2: Linear, 3: Quadratic, 4: Cubic, ... ) - ``nSaveT_``: Number of Surf2Vol wave fields (``nSaveT_`` :math:`>` ``nInterp_``) - ``HOSs2v_(:)``: Array of ``Surf2Vol`` class - ``itp2D_``: Interpolation class for 2D waves - ``itp3D_``: Interpolation class for 3D waves - Functionality: - ``initialize``: Initialise HOS Vol2Vol class with HOS type, result file path, ... - ``correct``: Update HOS wave fields with real-time - ``getEta``: Get interpolated wave elevation - ``getU``: Get interpolated wave velocity - ``getPd``: Get interpolated dynamic pressure - ``getFlow``: Get flow information - ``destroy``: Class destroyer How to use ~~~~~~~~~~ - Initialise ``Vol2Vol`` .. code:: fortran Call hosV2V%initialize(hosType, filePath, zMin, zMax, nZmin, nZmax, zMinRatio, zMaxRatio, iflag) ! hosV2V : Vol2vol Class (Type) ! hosType : HOS Type (Ocean or NWT) ! filePath : HOS result file path (modes_HOS_SWENS.dat) ! zMin, zMax : HOS grid z-minimum and z-maximul (vertical domain) ! nZmin, nZmax : Number of z-directional Grid ! ! zMinRatio, zMaxRatio (Optional) ! : Ratio of maximum and minimum height of grid (default=3) ! ! iflag : Wriging option (iflag = 1, write Grid2Grid information) ! or Call hosV2V%initialize(dict) ! hosV2V : Vol2vol Class (Type) ! dict : HOS dictionary to initialize HOS vol2vol (Type) - Correct ``Vol2Vol`` .. code:: fortran Call hosV2V%correct(simulTime) ! hosV2V : Vol2vol Class (Type) ! simulTime : Simulation time (real time value) - Get wave elevation from ``Vol2Vol`` .. code:: fortran eta = hosV2V%getEta(x, y, simulTime, iflag) ! hosV2V : Vol2vol Class (Type) ! x, y : x and y position ! simulTime : Simulation time (real time value) ! ! eta : Wave elevation ! ! iflag (Optional) ! : if iflag = 1, nondimensional x and y can be given (default = 0). - Get wave velocity from ``Vol2Vol`` .. code:: fortran Call hosV2V%getU(x, y, z, simulTime, u, v, w, iflag) ! hosV2V : Vol2vol Class (Type) ! x, y, z : x, y and z position ! simulTime : Simulation time (real time value) ! ! u, v, z : Wave velocity ( x, y, z ) ! ! iflag (Optional) ! : if iflag = 1, nondimensional x and y can be given (default = 0). - Get dynamic pressure from ``Vol2Vol`` .. code:: fortran pd = hosV2V%getPd(x, y, z, simulTime, iflag) ! hosV2V : Vol2vol Class (Type) ! x, y, z : x, y and z position ! simulTime : Simulation time (real time value) ! ! pd : Dynamic velocity (pd = p - rho * g * z) ! ! iflag (Optional) ! : if iflag = 1, nondimensional x and y can be given (default = 0). - Get flow information from ``Vol2Vol`` .. code:: fortran Call hosV2V%getFlow(x, y, z, simulTime, eta, u, v, w, pd, iflag) ! hosV2V : Vol2vol Class (Type) ! x, y, z : x, y and z position ! simulTime : Simulation time (real time value) ! ! eta : Wave elevation ! u, v, z : Wave velocity ( x, y, z ) ! pd : Dynamic velocity (pd = p - rho * g * z) ! ! iflag (Optional) ! : if iflag = 1, nondimensional x and y can be given (default = 0). - Destroy ``Vol2Vol`` .. code:: fortran Call hosV2V%destroy()