|
adamantine
|
#include <DataAssimilator.hh>
Public Member Functions | |
| DataAssimilator (MPI_Comm const &global_communicator, MPI_Comm const &local_communicator, int my_color, boost::property_tree::ptree const &database) | |
| void | update_ensemble (std::vector< dealii::LA::distributed::BlockVector< double >> &augmented_state_ensemble, std::vector< double > const &expt_data, dealii::SparseMatrix< double > const &R) |
| template<int dim> | |
| void | update_dof_mapping (std::pair< std::vector< int >, std::vector< int >> const &expt_to_dof_mapping) |
| template<int dim> | |
| void | update_covariance_sparsity_pattern (dealii::DoFHandler< dim > const &dof_handler, const unsigned int parameter_size) |
Private Types | |
| using | block_size_type = dealii::LA::distributed::BlockVector< double >::size_type |
Private Member Functions | |
| void | gather_ensemble_members (std::vector< dealii::LA::distributed::BlockVector< double >> &augmented_state_ensemble, std::vector< dealii::LA::distributed::BlockVector< double >> &global_augmented_state_ensemble, std::vector< unsigned int > &local_n_ensemble_members, std::vector< block_size_type > &block_sizes) |
| void | scatter_ensemble_members (std::vector< dealii::LA::distributed::BlockVector< double >> &augmented_state_ensemble, std::vector< dealii::LA::distributed::BlockVector< double >> const &global_augmented_state_ensemble, std::vector< unsigned int > const &local_n_ensemble_members, std::vector< block_size_type > const &block_sizes) |
| std::vector< dealii::LA::distributed::BlockVector< double > > | apply_kalman_gain (std::vector< dealii::LA::distributed::BlockVector< double >> &augmented_state_ensemble, dealii::SparseMatrix< double > const &R, std::vector< dealii::Vector< double >> const &perturbed_innovation) |
| dealii::SparseMatrix< double > | calc_H (dealii::SparsityPattern &pattern) const |
| dealii::Vector< double > | calc_Hx (dealii::LA::distributed::Vector< double > const &sim_ensemble_member) const |
| void | fill_noise_vector (dealii::Vector< double > &vec, dealii::SparseMatrix< double > const &R, bool const R_is_diagonal) |
| double | gaspari_cohn_function (double const r) const |
| dealii::TrilinosWrappers::SparseMatrix | calc_sample_covariance_sparse (std::vector< dealii::LA::distributed::BlockVector< double >> const &vec_ensemble) const |
Private Attributes | |
| MPI_Comm | _global_communicator |
| MPI_Comm | _local_communicator |
| int | _global_rank = -1 |
| int | _global_comm_size = -1 |
| int | _color = -1 |
| unsigned int | _num_ensemble_members = 0 |
| unsigned int | _sim_size = 0 |
| unsigned int | _parameter_size = 0 |
| unsigned int | _expt_size = 0 |
| dealii::TrilinosWrappers::SparsityPattern | _covariance_sparsity_pattern |
| std::map< const std::pair< unsigned int, unsigned int >, double > | _covariance_distance_map |
| double | _localization_cutoff_distance |
| LocalizationCutoff | _localization_cutoff_function |
| std::mt19937 | _prng |
| std::normal_distribution | _normal_dist_generator |
| std::pair< std::vector< int >, std::vector< int > > | _expt_to_dof_mapping |
| dealii::SolverControl | _solver_control |
| dealii::SolverGMRES< dealii::Vector< double > >::AdditionalData | _additional_data |
Friends | |
| class | DataAssimilatorTester |
This class implements an ensemble Kalman filter (EnKF) for data assimilation. It updates an ensemble of solution vectors to be consistent with experimental observations.
The EnKF implementation here is largely based on Chapter 6 of Data Assimilation: Method and Applications by Asch, Bocquet, and Nodet.
Definition at line 57 of file DataAssimilator.hh.
|
private |
Definition at line 110 of file DataAssimilator.hh.
| adamantine::DataAssimilator::DataAssimilator | ( | MPI_Comm const & | global_communicator, |
| MPI_Comm const & | local_communicator, | ||
| int | my_color, | ||
| boost::property_tree::ptree const & | database | ||
| ) |
Constructor.
Definition at line 31 of file DataAssimilator.cc.
|
private |
This calculates the Kalman gain and applies it to the perturbed innovation.
Definition at line 399 of file DataAssimilator.cc.
|
private |
This calculates the observation matrix.
Definition at line 474 of file DataAssimilator.cc.
|
private |
This calculates the application of the observation matrix on an unaugmented ensemble member from the simulation, avoiding explicit construction of a sparse matrix for H.
Definition at line 607 of file DataAssimilator.cc.
|
private |
This calculates the sample covariance for an input ensemble of vectors (vec_ensemble). Currently this is tied to the simulation ensemble, through the use of member variables inside. If needed, the interface could be redone to make it more generally applicable.
Definition at line 684 of file DataAssimilator.cc.
|
private |
This fills a vector (vec) with noise from a multivariate normal distribution defined by a covariance matrix (R). Note: For non-diagonal R this method currently uses full matrices, which substantially limits the allowable problem size.
Definition at line 623 of file DataAssimilator.cc.
|
private |
A standard localization function, resembles a Gaussian, but with finite support. From Gaspari and Cohn, Quarterly Journal of the Royal Meteorological Society, 125, 1999.
Definition at line 665 of file DataAssimilator.cc.
|
private |
Gather the augmented ensemble members on the global root node in order to apply the Kalman gain.
Definition at line 186 of file DataAssimilator.cc.
|
private |
Scatter the global_augmented_state_ensemble back into augmented_state_ensemble.
Definition at line 300 of file DataAssimilator.cc.
| template void adamantine::DataAssimilator::update_covariance_sparsity_pattern< 3 > | ( | dealii::DoFHandler< dim > const & | dof_handler, |
| const unsigned int | parameter_size | ||
| ) |
This updates the sparsity pattern for the sample covariance matrix for the simulation ensemble. This must be called before updateEnsemble whenever there are changes to the simulation mesh.
Definition at line 508 of file DataAssimilator.cc.
| template void adamantine::DataAssimilator::update_dof_mapping< 3 > | ( | std::pair< std::vector< int >, std::vector< int >> const & | expt_to_dof_mapping | ) |
This updates the internal mapping between the indices of the entries in expt_data and the indices of the entries in the sim_data ensemble members in updateEnsemble. This must be called before updateEnsemble whenever there are changes to the simulation mesh or the observation locations.
Definition at line 500 of file DataAssimilator.cc.
| void adamantine::DataAssimilator::update_ensemble | ( | std::vector< dealii::LA::distributed::BlockVector< double >> & | augmented_state_ensemble, |
| std::vector< double > const & | expt_data, | ||
| dealii::SparseMatrix< double > const & | R | ||
| ) |
This is the main public interface for the class and is called to perform one assimilation process. It takes in an ensemble of simulation data (sim_data), experimental observation data (expt_data), and the covariance matrix for the experimental observations (R). This function updates sim_data using the EnKF method.
Overall it performs x = x + K (y + u - H x) for each ensemble member, where: x is the simulation solution K is the Kalman gain y is the observed solution u is a perturbation to the observed solution H is the observation matrix
Definition at line 90 of file DataAssimilator.cc.
|
friend |
Definition at line 59 of file DataAssimilator.hh.
|
private |
Additional settings for the GMRES solver needed for the matrix inversion in the Kalman gain calculation.
Definition at line 286 of file DataAssimilator.hh.
|
private |
Color associated with the local
Definition at line 209 of file DataAssimilator.hh.
|
private |
Map between the indices in the covariance matrix and the distance between the support points for the associated dofs on the mesh. This is necessary for localization.
Definition at line 242 of file DataAssimilator.hh.
|
private |
The sparsity pattern for the localized covariance matrix.
Definition at line 234 of file DataAssimilator.hh.
|
private |
The length of the data vector the experimental observations.
Definition at line 229 of file DataAssimilator.hh.
|
private |
The mapping between the index in the experimental observation data vector to the DoF in the simulation data vectors. This is simpler to use than the indices and offsets that are passed into updateEnsemble, and means that the simulation DoFHandler only needs to be used by updateDofMapping where this variable is set.
Definition at line 274 of file DataAssimilator.hh.
|
private |
Number of processes in the gglbal MPI communicator.
Definition at line 204 of file DataAssimilator.hh.
|
private |
Global MPI communicator.
Definition at line 189 of file DataAssimilator.hh.
|
private |
Rank of the process when using the global MPI communicator.
Definition at line 199 of file DataAssimilator.hh.
|
private |
Local MPI communicator split off the global MPI communicator.
Definition at line 194 of file DataAssimilator.hh.
|
private |
The distance at which the sample covariance is truncated.
Definition at line 247 of file DataAssimilator.hh.
|
private |
The function used to reduce the sample covariance entries based on the distance between the relevant points.
Definition at line 253 of file DataAssimilator.hh.
|
private |
Random variate generator for a normal distribution, used for the perturbations to the innovation vectors.
Definition at line 265 of file DataAssimilator.hh.
|
private |
The number of ensemble members in the simulation.
Definition at line 214 of file DataAssimilator.hh.
|
private |
The length of the parameter vector for each simulation ensemble member.
Definition at line 224 of file DataAssimilator.hh.
|
private |
The pseudo-random number generator, used for the perturbations to the innovation vectors.
Definition at line 259 of file DataAssimilator.hh.
|
private |
The length of the data vector for each simulation ensemble member.
Definition at line 219 of file DataAssimilator.hh.
|
private |
Standardized settings for the GMRES solver needed for the matrix inversion in the Kalman gain calculation.
Definition at line 280 of file DataAssimilator.hh.