make_darcy_forward_function: Construct a forward model for the Darcy example application

Description Usage Arguments Details See Also

Description

This is a "higher-order function". Calling it with required parameters will get the forward function object in the return.

Usage

1
make_darcy_forward_function(grid, forward_data_idx = NULL)

Arguments

grid

Model grid definition.

forward_data_idx

Model grid indices where the hydraulic head values shold be used as forward data. Default is NULL, meaning all the model grid points.

Generated

forward function object.

Details

In this example application, the forward model implements the "Darcy's Law" on the input dydraulic conductivity field. The result is the field of "hydraulic head" on the same model grid. We assume that, in the imagined field study, we measure the head values at select locations as our (forward) data. In this synthetic example application, instead of "measure", we simply "pick" the head values at the specified locations from the vector of head values that are provided by running the forward model (i.e. darcy) with the synthetic conductivity field.

The forward function that is generated takes a single parameter: the conductivity field vector on the model scale. This is expected to be a field simulation obtained from the Anchored Inversion server. In this function, the field vector is first inverse-transformed to the natural scale (using darcy_field_transform). Then function darcy is used to compute the hydraulic head values based on Darcy's Law. Then the specified head values are picked (using forward_data_idx) as the forward data. At that point the forward data are on ther natural scale. They are then transformed to the model scale using darcy_forward_transform, and returned. If anything goes wrong in this whole process, a vector of NA is returned. Otherwise, all elements of the vector should be valid, realistic values. A vector of NA in the return usually suggests that the input field is unrealistic so that Darcy's Law fails. This happens routinely in the early iterations of the model.

To recap, the generated forward function takes a field vector on the model scale (straight from simulations by the Anchored Inversion server) and returns a forward data vector on the model scale (ready to be submitted back to the server).

Note that the reverse-transformation on the natural-scale forward data This transformation should be performed on the actual measurement as well.

In real applications, this forward function typically will require calling a non-R numerical code. It may be necessary to use intermediate files for data storage and transfer. It may use distributed and parallel computing for performance. Fixed initial and boundary conditions also need to be handled.

In real applications, the field-measured forward data, which are on the natural scale, need to be reverse-transformed to model scale before submitting to the server, because the Anchored Inversion method expects the forward data to be on the model scale. This is analogous to the last step in the generated forward function.

See Also

darcy_field_transform, darcy_forward_transform


anchored-inversion/examples.R documentation built on May 12, 2019, 2:39 a.m.