modGrid2Grid ------------ Description ~~~~~~~~~~~ ``modGrid2Grid`` is not a class but a Fortan module which contains an array of ``Vol2Vol`` classes and subroutines to communicate with other languages. The module structure is depicted in :numref:`fig:modGrid2GridStructure`. It has two static data which are input data array and ``Vol2Vol`` array not to have and update multiple ``Vol2Vol`` classes for efficiency and to save memory. When ``Grid2Grid`` is initialized from a program written in another language, it firstly check the input variables and return ``HOSIndex``. If the same input variables are given, it returns the same ``HOSIndex`` and does not allocate nor initialise ``Vol2Vol``. Other languages can distiguish different HOS wave theory by using the ``HOSIndex``. The subroutines ``correct`` and ``get*`` can be called with ``HOSIndex``, position and time. The array size of ``modGrid2Grid`` is 100 by default (It can deal with 100 different HOS waves) but it does not consume much memory because classes of ``Grid2Grid`` are programmed with dynamic arrays and consequently only a few of static data are used. If more HOS wave theories are needed, the variable ``nMaxVol2Vol`` in ``src/modGrid2Grid.f90`` can be changed to deal with over than 100 different HOS wave theory. The functionality of ``modGrid2Grid`` is almost the same with ``Vol2Vol``. .. figure:: figures/c1.structure/ModuleGrid2GridStructure.png :alt: ``Grid2Grid`` Module structure :name: fig:modGrid2GridStructure ``Grid2Grid`` Module structure Subroutines ~~~~~~~~~~~ The interface between other languages with ``modGrid2Grid`` will be detailed in :ref:`interface:Interface`. Subroutines in ``modGrid2Grid`` follows ``ISO_C_BINDING``. Subroutines: - Initialise Grid2Grid - ``__modgrid2grid_MOD_initializegrid2grid`` - ``__modgrid2grid_MOD_initializegrid2griddict`` - Correct Grid2Grid - ``__modgrid2grid_MOD_correctgrid2grid`` - Get wave elevation - ``__modgrid2grid_MOD_gethoseta`` - Get wave velocity - ``__modgrid2grid_MOD_gethosu`` - Get dynamic pressure - ``__modgrid2grid_MOD_gethospd`` - Get flow information - ``__modgrid2grid_MOD_gethosflow`` - Get HOS simulation end time - ``__modgrid2grid_MOD_gethosendtime`` - Get HOS water depth - ``__modgrid2grid_MOD_gethoswaterdepth`` - Get logical data indicating HOS wave theory is initialized - ``__modgrid2grid_MOD_isgrid2gridinitialized``