Program Structure ================= The file structure of ``Grid2Grid`` is shown in the following tree structure. The ``cmake`` directory contains CMake definitions. The ``doc`` directory contains ``Grid2Grid`` documentation files. The ``example`` directory contains examples for interfacing Grid2grid with other languages. The ``src/libGrid2Grid`` is the source code directory of ``Grid2Grid`` and is composed of several modules. .. topic:: Grid2Grid * ``cmake``: CMake modules directory * ``doc``: The documentation you're currently reading * ``example`` * ``fortGrid2Grid``, *Example for the interface between Fortran* * ``ofGrid2Grid``, *Example 1 for the interface between OpenFOAM* * ``ofGrid2GridDict``, *Example 2 for the interface between OpenFOAM* * ``src`` * ``libGrid2Grid`` * ``src`` * ``Grid2Grid``, *the main Grid2Grid module* * ``auxiliary``, *Auxiliary functions* * ``fftw3``, *FFTW3 library interface module* * ``HDF5``, *HDF5 library interface module* * ``surf2Vol``, *HOS wave field reconstruction module* * ``vol2Vol``, *HOS wave field interpolation module* * ``postGrid2Grid``, *post Grid2Grid Module* * ``mpiGrid2Grid``, *MPI Grid2Grid Module* The program structure of ``Grid2Grid`` is depicted in :numref:`fig:grid2GridStructure`. The program is composed of several modules (``.f90``) with a suffix ``mod``. HOS wave fields are generated by ``modSurf2Vol`` from the HOS result file (``modes_HOS_SWENSE.dat`` or ``modes_HOS_SWENSE.hdf5``). Since the results files only contains modes information, the volumic wave fields is reconstructed on the HOS grid by inverse FFTs (denoted as :math:`H_2` Operator). The volumic wave field in ``Grid2Grid`` at the certain time step is called as a snapshot of wave field. ``modVol2Vol`` constructs an interpolation data structure from several snapshots of wave field by using multidimensional spline module (:cite:t:`BsplineWilliams`). ``modVol2Vol`` can directly compiled with other fortran program if the same Fortran compiler is used (gfortran>4.9.2). ``modGrid2Grid`` generates shared library named as ``libGrid2Grid.so`` to communicate with other languages. Standard program language rule ``ISO_C_BINDING`` is required to communicate with the library ``Grid2Grid``. The examples are given in directory ``example``. ``modPostGrid2Grid`` is a post processing module of ``Grid2Grid`` generating the HOS wave fields for the 3D visualization(VTK format) and the wave elevation time series. .. figure:: figures/c1.structure/g2g_programStructure_R2.png :alt: Program Structure of ``Grid2Grid`` :name: fig:grid2GridStructure Program Structure of ``Grid2Grid`` The main feature of each module is following. - ``modSurf2Vol``: HOS-Ocean and NWT classes and reconstructed HOS wave fields - ``modVol2Vol``: Interpolate reconstructed HOS wave fields - ``modGrid2Grid``: Communication with other language with ``ISO_C_BINDING`` - ``modPostGrid2Grid``: Post processing of HOS (wave fields and elevation) - ``modFourier_r2c_FFTW``: Interface module of ``FFTW`` open library - ``modHDF5Interface``: Interface module of ``HDF5`` open library - ``modGrid2GridGeneral``: Grid2Grid global variables and auxiliary functions