From Gerris

Jump to: navigation, search

GfsRefineTerrain both refines the mesh and builds a least-squares bilinear approximation of a terrain surface using a terrain database. This database needs to be built in a pre-processing step using the xyz2kdt utility.

The algorithm used is adapted from Bertram et al, 2003. The quadtree mesh is refined recursively by locally fitting a bilinear function to the cloud of elevation points contained within each cell. Each of these (discontinuous) surface patches are then matched at the boundaries between adjacent cells to obtain a globally continuous surface reconstruction. The reconstruction error (residual of the least-squares fit) and other user-defined criteria (e.g. slope, elevation etc...) can then be used to further locally refine the mesh if necessary.

Several independent but possibly overlapping terrain datasets can be used simultaneously and do not need to match locally. The resulting reconstructed surface will then be an "optimal" reconstruction in the least-squares sense. The weight given to each dataset can also be controlled.

The syntax in parameter files is

[ GfsRefine ] H {
  path = PATH
  basename = BASE1:W1,BASE2:W2,BASE3:W3
} [ GfsFunction ]


the basename of the variables which will define the terrain. Eight variables are defined called: H0, H1, H2, H3, He, Hn, Hdmin, Hdmax. The first four define the bilinear surface patch in each cell as
z(x,y) = H0 + 2*H1*(x - cx)/h + 2*H2*(y - cy)/h + 4*H3*(x - cx)*(y - cy)/(h*h)

with h the cell size. He is the standard z-coordinate deviation of the local point cloud coordinates from the bilinear patch z-coordinate. Hn, Hdmin and Hdmax are the number of, minimum and maximum heights of the samples which were used to construct the bilinear patch respectively. Two additional "derived variables" are also defined: Hmin and Hmax, the minimum and maximum values of elevation within a cell respectively.

the search path used to locate the terrain databases i.e. a colon-delimited list of directories. Defaults to "." (the local directory) when not specified. This default value can be changed by setting the GFS_TERRAIN_PATH environment variable.
the list of names of the databases to use. Optionally the names can also include the full path to the database (in this case the name must start with "/"). The :W... parameters are optional weights (floating-point numbers) associated to each of the databases (the weight is set to one by default).

The last GfsFunction defines the function used to check whether to further refine the mesh. A return value of zero will stop refinement.


Refine the mesh and define the corresponding solid surface using the etopo2 database. This database is defined using a longitude, latitude and elevation coordinate system, so we use the map module to define the geographic projection within Gerris.

GModule map
GModule terrain
PhysicalParams { L = 20e3 }
MapProjection { lon = 174.73 lat = -41.32 angle = 10 }
RefineTerrain 7 H {
  path = /data/terrain:/somebody_elses_data/gerris:.
  basename = etopo2
} (He > 1.)
Terrain H

The mesh will be refined up to 7 levels whenever the standard deviation of the reconstruction (He) is larger than one metre.

Personal tools