mps-tk : A C++ toolkit for mulitple-point simulation

Download Report

Transcript mps-tk : A C++ toolkit for mulitple-point simulation

mps-tk : A C++ toolkit for multiple-point
simulation
Alexandre Boucher
Advanced Resources and Risk Technology, LLC
Stanford University, ERE
Toan Tran
Stanford University, EE
Objectives of the toolkit
A SGeMS-based C++ library to ease development of mps algorithms
Present abstraction of mps components
Provide a set of coherent mps building blocks to developers
Provide implementation examples
Stepping stone for the next generation of mps algorithms
Target user is a developer not a geomodeler
NOTE: goal is to develop tools to build mps algorithms not write new algorithms.
Generic mps simulation algorithm
Imposition of a spatial texture (geology) on a grid such that it conforms to data.
Patterns
Database
The patterns database is typically built from training images
A sequential simulation algorithm builds and queries that database
The simulation is not based on the training image per se, but from the patterns
extracted from that training image
Generic sequential simulation algorithm
Pattern
Database
Generic sequential simulation algorithm
Pattern
Database
Texture is function of the patterns database
The pattern database controls
the look of the simulated geology
The data control the locations of
some texture element
Generic abstraction of mps
Patterns
database
Known values and ancillary data
(trends, regions, angles, …)
Data event extracted from the grid
and ancillary data
Sampler
Select a replicate from the list
returned from the pattern
database
Probability field adjustment
Replicates returned from the
database that match the data
event. May take different forms
(e.g. distributions)
Abstraction components
Data event
Pattern and information retrieved from the simulation grid
Pattern database Find patterns matching the data-event
Replicates
Outputs from the database
Sampler
Select a replicate from the collection of replicates
Libraries included in mps-tk
mps_dataevent
Contains all the dev related functionalities
mps_pattern_database
Database and functionalities to build new database
mps_replicate
Sampler, servo-system and collection of replicates
mps_app_utility
Base classes and utilities that link mps-tk together
mps_parallelism
Task manager for multi-threading
Unit testing
Functionality and regression testing
mps_dataevent
Data-event around a central
location (+ ancillary data)
Geovalue_dataevent
Created with either
Fixed_template_geodev_builder
?
Global_template_geodev_builder
Directional_overlap_dataevent
Created with
?
Directional_overlap_dev_builder
Dataevent_distance
Compute the similarity
between two data events
Distance
,
mps_pattern_database
Search_tree_pattern_database
Build a search tree
Searched
with
Scanning_pattern_database
Search the TI for any
data configuration.
Decompose the TI
into patterns with
fixed shape
Fixed_template_pattern_database
Cross_correlation_pattern_database
Multigrid_pattern_database
Fourier space
patDB-1
,
patDB-1
,…,
patDB-1
TI values ready for
convolution
One database per
multi-grid
mps_replicate
Results from the pattern database
Collection_replicate
Cdf_replicate
,
,
,
,
,
Conditional distribution from the
pattern database
Monte Carlo drawing from replicates
Pixel-based simulation
Cdf_servo_sampler
Draw from a distribution given the constraint of a
servo system
Updating_cdf_servo_sampler
Draw from a distribution given the constraint of a
servo system with a probability field
Patch-based simulation
Random_replicate_sampler
Draw a replicate from a collection of replicates
Mps_parallelism
Computational_task
Encapsulates data and a processing method to be executed
by a computational resource (thread or process).
Computational_task_manager
Uses threads to execute tasks
Currently uses the Boost thread library for shared memory machine. Designed to be
extended to distributed memory applications.
Platform-independent (Windows, Linux)
To run in parallel, write cpu-intensive process as a Computational_task
Type of parallelisms implemented
Parallel task manager applied within a data base (e.g. patterns scanning )
patDB
Task 1
Task 2
…
Task N
Parallel task manager applied to a full simulation (e.g. CCSIM)
Task 1
patDB-1
…
Task N
patDB-1
A note on hard data conditioning
Lack of standard approach for conditioning in mps
Copy data on grid
Built-in conditioning (snesim)
Distance-weighted function (filtersim)
Adaptive data event (ccsim)
Rejection approach
Objectives:
mps-tk does not interfere with conditioning approaches.
mps-tk offers flexibility to implement the appropriate conditioning technique.
Build a scanning pattern database
// set basic data event builder
dataevent_builder->grid_is(training_image_);
dataevent_builder->neighborhood_is(subgrid_ti_neighborhoods_);
// set trend data event builder
trend_dev_builder->dataevent_builder_is(dataevent_builder);
trend_dev_builder->trend_property_is(training_image_trend_property_);
fixed_template_pattern_db_->dataevent_builder_is(trend_dev_builder);
// set dev_distance to pattern database
fixed_template_pattern_db_->dataevent_distance_is(trend_dataevent_distance_);
// Create and set dev_selector to pattern database
dataevent_selector->k_number_is(k_number);
// set dev_selector to pattern database
fixed_template_pattern_db_->dataevent_selector_is(dataevent_selector_);
Pattern database with multiple grid
Multigrid_pattern_database
A collection of database; one for each multiple grid
Each multi-grid can use a different pattern database
multigrid_scanning_pattern_db_ = Multigrid_pattern_database< Geovalue_dataevent,
Collection_replicate<Geovalue_dataevent> >::Ptr_new();
for (int mgrid = 0; mgrid <= nb_mgrids_; mgrid++)
{
scanning_pattern_db_ = Scanning_pattern_database::Ptr_new();
//
… initialize individual pattern database …
// add database to the mgrid database
multigrid_scanning_pattern_db_->pattern_database_add(scanning_pattern_db_);
}
Multi-grid simulation with a scanning database
/* Loop for all multiple grids */
for (int mgrid = nb_mgrids_; mgrid >= 0; mgrid--){
/* initialize simulation path */
RGrid::random_path_iterator path_begin = simul_grid_->random_path_begin();
RGrid::random_path_iterator path_end = simul_grid_->random_path_end();
/* Set subgrid to multigrid_pattern_databases */
multigrid_fixed_template_pattern_db_->current_subgrid_is(subgrid);
/* Run simulation */
pixel_based_simulate( path_begin, path_end, fixed_template_dev_builder_.get(),
multigrid_fixed_template_pattern_db_.get(),sampler_.get() );
}
CCSIM algorithm
The data event builder and the FFT-based database were previously initialized
for (; _path_begin != _path_end; _path_begin++)
{
/* Create the data event */
Directional_overlap_dataevent::Ptr
simul_dev = simul_dev_builder_->dataevent(*_path_begin);
/* Get the collection of replicates from the pattern database*/
Lazy_collection_replicate<Directional_overlap_dataevent>::Ptr
replicates = ccsim_pattern_db_->replicate(simul_dev);
/* Randomly draw a replicate from the selected set of replicates*/
sampler_->sample(replicates);
}
Development and perspectives
Immediate goal is to provide tools to develop new algorithms
Write more examples to expand and test the components and the design
libraries
– GPU-powered pattern database
– Parallelism on server with MPI
– Complex gridding
Offer new perspectives
– Meta-pattern database : a database of several databases
– Pattern database not derived from a TI: e.g. process-based equations
– Cloud-based pattern database