Contents: Input Parameters Other Input Data Compute Log K Field Plot Cross Sections Output & Statistics Tutorials

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.

Fgen92 — Generation of Log Normal Spatially Correlated Random Fields
Domain & Grid ← A
Nx50
Ny50
Dx1.0
Dy1.0
Statistical Parameters ← B
Mean (ln K)−5.0
Variance1.0
Nugget0.0
SpectrumExponential
Lambda x5
Lambda y5
Other Input Data ← C
☐ User Input (disabled)
Seed720
nfull_x64
nfull_y32
Compute Log K Field ← D
Log K Field (colored grid) ← E
Y=0 at top; Y-axis labels on right
Cross-Section Plot ← F
Log K Field Data ← G
(x,y) = —
Log K = —
Color Scheme ← H
● Smooth Shading
○ Contour 5%
○ Contour 10%
○ Custom
Cross Sections ← I
● None
○ Horizontal
○ Vertical
Slider Data ← J
Hover over CS plot
Additional Output Display ← K
Tutorials ← L
UI Tutorial
Solution Tutorial
Figure 1 — Annotated layout of the Fgen92 applet (letters correspond to sections below)

1 Left Panel — Input Parameters

A — Nodal Dimensions & Grid Size

These parameters define the physical size of the domain and the number of grid cells:

ParameterDefaultDescription
NTRUNC X. (Nx)50Number of grid cells in the x-direction (columns)
NTRUNC Y. (Ny)50Number of grid cells in the y-direction (rows)
Delta X. (Dx)1.0Grid cell spacing in x [L]
Delta Y. (Dy)1.0Grid cell spacing in y [L]. The total domain is Nx×Dx by Ny×Dy.
Tip: The total domain size is Nx × Dx in x and Ny × Dy in y. For example, Nx=50, Dx=1.0 gives a domain 50 m wide.

B — Statistical Parameters

These parameters control the statistical properties of the generated log K field:

ParameterDefaultDescription
Mean−5.0Mean of the natural log of hydraulic conductivity (ln K). The geometric mean of K = eMean.
Variance1.0Variance σ2Y of the ln K field. Controls the degree of heterogeneity. Typical values range from 0.1 (mild) to 4+ (highly heterogeneous).
Nugget0.0Nugget variance — small-scale variability that appears as random noise independent of spatial correlation. Set to 0 for a purely correlated field.
Power Spectrum TypeExponentialCovariance model. Exponential: C(r) ∝ exp(−r/λ). Gaussian: C(r) ∝ exp(−r²/λ²). Gaussian fields are smoother.
Lambda_x5Correlation length (integral scale) in the x-direction [L]. Larger values produce longer-range spatial correlation in x.
Lambda_y5Correlation length (integral scale) in the y-direction [L].
Anisotropy: Setting Lambda x ≠ Lambda y creates an anisotropic field. For example, Lambda x = 10, Lambda y = 2 produces a field with elongated correlation structures aligned with the x-axis.

2 C — Other Input Data

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.

ParameterDefaultDescription
Random Seed720Integer 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_x64FFT 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_y32FFT grid size in y. Automatically set to the next power of 2 ≥ Ny (minimum 32).
Auto-snap: When User Input is enabled and you type directly into the nfull fields, the value automatically snaps to the nearest power of 2 as you type. This ensures the FFT always operates on a valid grid size.
When to use User Input: The default auto-computed nfull values are always correct. You might increase nfull beyond the minimum (e.g., 128 when Nx=50) to improve the spectral resolution of the simulation, at the cost of longer computation time.

3 D — Compute Log K Field

Clicking Compute Log K Field runs the Fgen92 spectral simulation algorithm with the current parameters:

  1. A spectral density function S(kx, ky) is computed from the covariance parameters (variance, nugget, correlation lengths, spectrum type).
  2. Complex Fourier coefficients are generated by multiplying the square root of S by random normal amplitudes and phases (using the seeded pseudo-random generator).
  3. A 2D inverse FFT (IFFT) transforms the spectrum back to physical space, producing a correlated Gaussian field Y(x, y) = ln K.
  4. The field is displayed in the center panel as a color-coded grid, and summary statistics are shown in the left panel.
Reproducibility: The same seed always gives the same field for the same parameters. To explore the variability between realizations, change the seed (with User Input enabled) and click Compute again.

4 Center Panel — Log K Field Plot

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:

OptionDescription
Smooth ShadingContinuous color gradient from min to max log K. Best for visualizing the full range of variability.
Contour by 5% StepsThe color range is divided into 20 discrete bands (5% each). Helps identify clusters of similar values.
Contour by 10% StepsTen discrete bands (10% each). Coarser classification.
Custom No. of ContoursSpecify any number of discrete color bands. Enter the count in the adjacent input field.

5 Cross Sections

I — Cross Section Mode

Three mutually exclusive modes control cross-section extraction:

ModeDescription
NoneNo cross sections. The cross-section canvas is blank.
Horizontal Cross SectionClick 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 SectionClick on the field to extract ln K along a vertical column at that x-position. Multiple vertical lines can be added.
Switching mode clears lines: Switching from Horizontal to Vertical (or vice versa) automatically clears all existing cross-section lines. You cannot display horizontal and vertical cross sections simultaneously.

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.


6 K — Output & Statistics

Basic Output Statistics (Left Panel)

After computing, the left panel shows summary statistics of the generated field:

StatisticDescription
MeanSample mean of ln K (should be close to the input Mean)
VarianceSample variance of ln K (should be close to the input Variance for large grids)
Stnd DevSample 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.


7 L — Tutorials
ButtonDescription
UI TutorialOpens this tutorial page in a new tab.
Solution TutorialOpens the mathematical background document describing the Fgen92 spectral algorithm, the log-normal random field model, and the covariance functions.

→ Solution Tutorial (Fgen92 model)
► Launch the Model → Solution Tutorial