.grd File Format ================ Introduction ------------ This format is used for storing field values in a rectangular grid. Files of this type are generated by objects of the classes Spherical Grid, Planar Grid, Surface Grid, and Cylindrical Grid. The file extension is `.grd`. The field points are in all cases parameterized by two variables which are generally denoted **X** and **Y** and which run from **XMIN** to **XMAX** and from **YMIN** to **YMAX**, respectively. The file is organized so that X varies faster than Y. The variables **X** and **Y** should be considered as general names for the actual variables which may e.g. be :math:`\phi` and :math:`\theta` for points on a sphere or any of the other options as specified by IGRID below. **All angles are in degrees.** Currently supported formats --------------------------- The following table shows the formats that `grasp2alm` can read. +-------+-------+-------+-------+-----------------------------------------------------------+ | KTYPE | ICOMP | NCOMP | IGRID | Description | +=======+=======+=======+=======+===========================================================+ | 1 | 3 | 2 | 7 | :math:`\theta\phi\mathrm{-grid}` far field beam, | | | | | | linear :math:`E_{co}` and :math:`E_{cx}` | +-------+-------+-------+-------+-----------------------------------------------------------+ File Structure -------------- A `.grd` file consists of four primary types of records: 1. **Record Type 1: TEXT** Record with identification text. This record is repeated until a record containing ++++ as the first 4 characters is reached. 2. **Record Type 2: File format** An integer that specifies the file format: - **KTYPE = 1**: standard format for 2D grid. For files used in TICRA Tools, this variable is always 1. 3. **Record Type 3: Parameters** This record defines the parameters for the grid (they are all integers): - **NSET**: Number of field sets or beams. - **ICOMP**: Control parameter of field components. - **NCOMP**: Number of components. - **IGRID**: Control parameter of field grid type. 4. **Record Type 4: Center definition** This record contains a list of two coordinates. The number of entries (rows) is equal to **NSET**. - **IX**, **IY**: two integers representing the center of each set or beam All the following records are repeated **NSET** times. 5. **Record Type 5: Grid limits** Four parameters represent the limits of the 2D grid. - **XS**, **YS**, **XE**, **YE**: four real numbers, the unit of **X** and **Y** follows the settings in the generating project, angles are in degrees. The grid points (X,Y) run through the values: .. math:: \mathrm{X} = \mathrm{XCEN} + \mathrm{XS} + \mathrm{DX}*(\mathrm{I}-1) \mathrm{Y} = \mathrm{YCEN} + \mathrm{YS} + \mathrm{DY}*(\mathrm{J}-1) where .. math:: \mathrm{DX} = (\mathrm{XE}-\mathrm{XS})/(\mathrm{NX}-1) \mathrm{DY} = (\mathrm{YE}-\mathrm{YS})/(\mathrm{NY}-1) with .. math:: \mathrm{XCEN} = \mathrm{DX}*\mathrm{IX} \mathrm{YCEN} = \mathrm{DY}*\mathrm{IY} 6. **Record Type 6: Number of columns and rows** This record specifies the number of columns and rows for the current beam: - **NX**: number of columns (integer) - **NY**: number of rows (integer) - **KLIMIT**: specification of limits in 2D grid (integer) =0 Each row contains data for all **NX** columns =1 The number of data points for each row is defined in the record n\°7 The following records 7 and 8 are repeated **NY** times for each beam 7. **Record Type 7: Number of columns and rows** This record is read if and only if **KLIMIT** = 1. It specifies how a single row **J** is structured. - **IS**: Column number of first data point in row J - **IN**: Number of data points in row J If **IN** is 0 (there are no values in the row) skip record n\°8, otherwise continue to the next record reading the field components. 8. **Record Type 8: Field components** If **KLIMIT** is 0 then **IS** and **IN** are always assumed to be 1 and NX, respectively. With :math:`\mathrm{IE}=\mathrm{IS}+\mathrm{IN}-1`. The record contains a list of :math:`(\mathrm{IE}-\mathrm{IS})` entries representing the complex field components. - **F1**, **F2**, **F3**: Complex field with two or three components depending on **NCOMP**. **Example of a typical .grd file:** :: VERSION: TICRA-EM-FIELD-V0.1 Field data in grid SOURCE_FIELD_NAME: field_name.po FREQUENCY_NAME: freq FREQUENCIES [GHz]: 0.1190000000E+03 ++++ KTYPE NSET ICOMP NCOMP IGRID IX IY XS YS XE YE NX NY KLIMIT F1.real F1.img F2.real F2.img F3.real F3.img ... Parameter Definitions for Spherical Cuts ---------------------------------------- The field components **F1**, **F2** are controlled by the parameter ICOMP. For near fields, the third component **F3** always contains the radial :math:`E_r` component. - **ICOMP**: - **1**: Linear :math:`E_\theta` and :math:`E_\phi` - **2**: Right hand and left hand circular (:math:`E_{rhc}` and :math:`E_{lhc}`) - **3**: Linear :math:`E_{co}` and :math:`E_{cx}` (Ludwig's third definition) - **4**: Linear along major and minor axes of the polarization ellipse, :math:`E_{maj}` and :math:`E_{min}` - **5-8**: Various XPD (Cross-Polar Discrimination) fields - **9**: Total power :math:`|\vec{E}|` and :math:`\sqrt{E_{rhc}/E_{lhc}}` - **NCOMP**, number of field components: - **2**: the file contains twinner producto field components for each point as specified above. - **3**: if the field is a near field the file also contains the third radial component. - **IGRID**, type of field grid: - **1**: uv-grid, where u and v are the two first coordinates of the unit vector to the field point - **4**: elevation over azimuth - **5**: elevation and azimuth - **6**: azimuth over elevation - **7**: :math:`\theta\phi\mathrm{-grid}` - **9**: azimuth over elevation, EDX definition - **10**: elevation over azimuth, EDX definition