This tutorial explains the controls and features of the Fgen92 applet, which generates two-dimensional spatially correlated log-normal hydraulic conductivity fields using a spectral (FFT-based) simulation method.
The algorithm is based on the spectral method described in Robin et al., Water Resources Research, 29(7), 1993, implemented originally in FORTRAN (Fgen v. 9.2.1) and adapted here as a browser-based JavaScript applet.
For the mathematical background see the Solution Tutorial.
Y=0 at top; Y-axis labels on right
Log K = —
A — Nodal Dimensions & Grid Size
These parameters define the physical size of the domain and the number of grid cells:
| Parameter | Default | Description |
|---|---|---|
| NTRUNC X. (Nx) | 50 | Number of grid cells in the x-direction (columns) |
| NTRUNC Y. (Ny) | 50 | Number of grid cells in the y-direction (rows) |
| Delta X. (Dx) | 1.0 | Grid cell spacing in x [L] |
| Delta Y. (Dy) | 1.0 | Grid cell spacing in y [L]. The total domain is Nx×Dx by Ny×Dy. |
B — Statistical Parameters
These parameters control the statistical properties of the generated log K field:
| Parameter | Default | Description |
|---|---|---|
| Mean | −5.0 | Mean of the natural log of hydraulic conductivity (ln K). The geometric mean of K = eMean. |
| Variance | 1.0 | Variance σ2Y of the ln K field. Controls the degree of heterogeneity. Typical values range from 0.1 (mild) to 4+ (highly heterogeneous). |
| Nugget | 0.0 | Nugget variance — small-scale variability that appears as random noise independent of spatial correlation. Set to 0 for a purely correlated field. |
| Power Spectrum Type | Exponential | Covariance model. Exponential: C(r) ∝ exp(−r/λ). Gaussian: C(r) ∝ exp(−r²/λ²). Gaussian fields are smoother. |
| Lambda_x | 5 | Correlation length (integral scale) in the x-direction [L]. Larger values produce longer-range spatial correlation in x. |
| Lambda_y | 5 | Correlation length (integral scale) in the y-direction [L]. |
The Other Input Data section controls advanced simulation parameters. These fields are disabled by default (grayed out) and are automatically managed by the applet. Check User Input to enable manual control.
| Parameter | Default | Description |
|---|---|---|
| Random Seed | 720 | Integer seed for the pseudo-random number generator. Using the same seed with identical parameters reproduces the exact same field. Change the seed to generate a different realization. |
| nfull_x | 64 | FFT grid size in x. Must be a power of 2 and ≥ Nx. The applet automatically sets this to the next power of 2 ≥ Nx (e.g., Nx=50 → nfull_x=64; Nx=100 → nfull_x=128). |
| nfull_y | 32 | FFT grid size in y. Automatically set to the next power of 2 ≥ Ny (minimum 32). |
Clicking Compute Log K Field runs the Fgen92 spectral simulation algorithm with the current parameters:
- A spectral density function S(kx, ky) is computed from the covariance parameters (variance, nugget, correlation lengths, spectrum type).
- Complex Fourier coefficients are generated by multiplying the square root of S by random normal amplitudes and phases (using the seeded pseudo-random generator).
- A 2D inverse FFT (IFFT) transforms the spectrum back to physical space, producing a correlated Gaussian field Y(x, y) = ln K.
- The field is displayed in the center panel as a color-coded grid, and summary statistics are shown in the left panel.
E — The Field Canvas
The main canvas displays the generated log K field as a colored grid. Each cell is colored according to its ln K value:
- Blue/cool colors indicate lower log K (less permeable)
- Red/warm colors indicate higher log K (more permeable)
Axis orientation: The x-axis (horizontal) runs from 0 at the left to the total domain width (Nx × Dx) at the right, with tick labels below. The y-axis runs from 0 at the top to the total domain height at the bottom, with tick labels on the right side of the plot. This matches the convention of the original Java applet.
Hover interaction: Move the mouse over the field to read the (x, y) coordinates and ln K value at that cell in the Log K Field Data panel on the right. If a cross-section mode is active, hovering previews where the cross-section line would be placed; clicking adds it.
H — Color Scheme
Four color options control how the field values are mapped to colors:
| Option | Description |
|---|---|
| Smooth Shading | Continuous color gradient from min to max log K. Best for visualizing the full range of variability. |
| Contour by 5% Steps | The color range is divided into 20 discrete bands (5% each). Helps identify clusters of similar values. |
| Contour by 10% Steps | Ten discrete bands (10% each). Coarser classification. |
| Custom No. of Contours | Specify any number of discrete color bands. Enter the count in the adjacent input field. |
I — Cross Section Mode
Three mutually exclusive modes control cross-section extraction:
| Mode | Description |
|---|---|
| None | No cross sections. The cross-section canvas is blank. |
| Horizontal Cross Section | Click on the field to extract ln K along a horizontal row at that y-position. Multiple horizontal lines can be added by clicking at different y-positions. |
| Vertical Cross Section | Click on the field to extract ln K along a vertical column at that x-position. Multiple vertical lines can be added. |
Added cross sections appear as entries in the list below the radio buttons, each with a colored swatch and a delete (×) button. The Clear Cross Section Plots button removes all lines at once.
F — Cross-Section Plot Canvas
The lower canvas in the center panel shows the ln K profile along each selected cross-section line. Each line is drawn in a distinct color matching the entry in the cross-section list.
The x-axis of the plot represents the position along the cross section (x-coordinate for vertical, y-coordinate for horizontal) from 0 to the domain edge. The y-axis shows ln K.
J — Slider Data Display
Move the mouse cursor over the cross-section plot canvas to activate the cursor slider. A dashed vertical line follows the cursor, and the Slider Data Display panel updates in real time to show:
- The position (x or y coordinate) of the cursor
- The ln K value on each displayed cross-section line at that position
This is useful for reading off exact values and comparing multiple cross sections at the same location.
Basic Output Statistics (Left Panel)
After computing, the left panel shows summary statistics of the generated field:
| Statistic | Description |
|---|---|
| Mean | Sample mean of ln K (should be close to the input Mean) |
| Variance | Sample variance of ln K (should be close to the input Variance for large grids) |
| Stnd Dev | Sample standard deviation of ln K (= √Variance) |
Display Additional Output Stats
Opens a panel with more detailed output from the Fgen92 algorithm, including the correlation volume (HCORV) and normalization parameters used in the spectral simulation.
Plot Auto Covariance
Opens a panel showing two plots:
- Theoretical auto-covariance (solid blue line): the covariance function C(r) implied by the chosen spectrum type, variance, and correlation lengths.
- Empirical auto-covariance (hollow red circles): the sample covariance computed from the generated field by averaging pairs of cells at each lag distance.
For large grids, the empirical covariance should approach the theoretical curve. Deviations are expected for small grids due to finite-sample effects.
Display Logk Output
Opens a panel with a table of all ln K values in the grid, organized by row and column. A Download CSV button exports the full field as a comma-separated file for use in external analysis tools or numerical simulators.
| Button | Description |
|---|---|
| UI Tutorial | Opens this tutorial page in a new tab. |
| Solution Tutorial | Opens the mathematical background document describing the Fgen92 spectral algorithm, the log-normal random field model, and the covariance functions. |