#include <GLpApp_AdvDiffReactOptModel.hpp>
Inheritance diagram for GLpApp::AdvDiffReactOptModel:
Overridden from EpetraExt::ModelEvaluator . | |
| Teuchos::RefCountPtr< const Epetra_Map > | get_x_map () const |
| | |
| Teuchos::RefCountPtr< const Epetra_Map > | get_f_map () const |
| | |
| Teuchos::RefCountPtr< const Epetra_Map > | get_p_map (int l) const |
| . | |
| Teuchos::RefCountPtr< const Epetra_Map > | get_g_map (int j) const |
| . | |
| Teuchos::RefCountPtr< const Epetra_Vector > | get_x_init () const |
| | |
| Teuchos::RefCountPtr< const Epetra_Vector > | get_p_init (int l) const |
| | |
| Teuchos::RefCountPtr< const Epetra_Vector > | get_x_lower_bounds () const |
| | |
| Teuchos::RefCountPtr< const Epetra_Vector > | get_x_upper_bounds () const |
| | |
| Teuchos::RefCountPtr< const Epetra_Vector > | get_p_lower_bounds (int l) const |
| | |
| Teuchos::RefCountPtr< const Epetra_Vector > | get_p_upper_bounds (int l) const |
| | |
| Teuchos::RefCountPtr< Epetra_Operator > | create_W () const |
| | |
| Teuchos::RefCountPtr< Epetra_Operator > | create_DfDp_op (int l) const |
| | |
| InArgs | createInArgs () const |
| | |
| OutArgs | createOutArgs () const |
| | |
| void | evalModel (const InArgs &inArgs, const OutArgs &outArgs) const |
| | |
Public Member Functions | |
| AdvDiffReactOptModel (const Teuchos::RefCountPtr< const Epetra_Comm > &comm, const double beta, const double len_x, const double len_y, const int local_nx, const int local_ny, const char meshFile[], const int np, const double x0, const double p0, const double reactionRate, const bool normalizeBasis) | |
| Constructor. | |
| void | set_q (Teuchos::RefCountPtr< const Epetra_Vector > const &q) |
| | |
Private Types | |
| typedef Teuchos::Array< Teuchos::RefCountPtr< const Epetra_Map > > | RCP_Eptra_Map_Array_t |
| typedef Teuchos::Array< Teuchos::RefCountPtr< Epetra_Vector > > | RCP_Eptra_Vector_Array_t |
Private Attributes | |
| bool | isInitialized_ |
| Teuchos::RefCountPtr< GLpApp::GLpYUEpetraDataPool > | dat_ |
| int | np_ |
| Teuchos::RefCountPtr< const Epetra_Vector > | q_ |
| Teuchos::RefCountPtr< const Epetra_Map > | map_p_bar_ |
| Teuchos::RefCountPtr< Epetra_MultiVector > | B_bar_ |
| Teuchos::RefCountPtr< const Epetra_Comm > | epetra_comm_ |
| Teuchos::RefCountPtr< const Epetra_Map > | map_x_ |
| RCP_Eptra_Map_Array_t | map_p_ |
| Teuchos::RefCountPtr< const Epetra_Map > | map_f_ |
| Teuchos::RefCountPtr< const Epetra_Map > | map_g_ |
| Teuchos::RefCountPtr< Epetra_Vector > | x0_ |
| Teuchos::RefCountPtr< Epetra_Vector > | xL_ |
| Teuchos::RefCountPtr< Epetra_Vector > | xU_ |
| RCP_Eptra_Vector_Array_t | p0_ |
| RCP_Eptra_Vector_Array_t | pL_ |
| RCP_Eptra_Vector_Array_t | pU_ |
| Teuchos::RefCountPtr< Epetra_Vector > | gL_ |
| Teuchos::RefCountPtr< Epetra_Vector > | gU_ |
| Teuchos::RefCountPtr< Epetra_CrsGraph > | W_graph_ |
Static Private Attributes | |
| const int | Np_ = 2 |
| const int | p_bndy_idx = 0 |
| const int | p_rx_idx = 1 |
The model evaluator subclass is used to represent the simulation-constrained optimization problem:
min g(x,p) s.t. f(x,p) = 0;
where:
x is the vector of discretized concentations of the species in the 2D domain.
p is the global vector of coefficients of a sine series basis (see B_bar below).
f(x,p) = A*x + reationRate*Ny(x) + B*(B_bar*p) is the discretized 2D diffusion/reaction PDE.
g(x,p) = 0.5 * (x-q)'*H*(x-q) + 0.5*regBeta*(B_bar*p)'*R*(B_bar*p) is the least squares objective function.
A is the discretized Laplacian operator for the diffusion part of the PDE state equation. This matrix is constant, square and singular.
B is the sensitivity of the flux boundary conditions. This is a constant rectangular matrix.
B_bar are the sine series coefficients with a column dimension of np.
Ny(x) is the nonlinear terms for the discretized reaction over the 2D domain.
reactionRate is the relative reaction rate which must take on a non-zero value to form a solvable problem.
H is the symmetric positive definite mass matrix for the problem (i.e. the discretization of the inner product operator over the 2D domain).
q is a matching or target vector for the state x over the 2D domain of the problem.
R is the symmetric positive definite discretization of the inner product of the flux function over the boundary of the 2D domain.
regBeta is a regularization parameter that must be greater than zero.
The nuts and bolts of the implementation for this problem are contained in the C++ class GLpApp::GLpYUEpetraDataPool that was originally implemented by Denis Ridzal while a student at Rice University. The class GLpApp::GLpYUEpetraDataPool implements the basic operators and nonlinear functions but this class puts them together to form a valid the model in terms of a model evaluator interface.
This example problem demonstrates a few different aspects of the EpetraExt::ModelEvaluator interface:
How to manage parallel vector data. The state variables in x are managed as fully distributed parallel data while the flux sine-series parameter coefficients p are managed as locally replicated data.
Demonstrates shared compuation between the objective function g(x,p) and the simulation equality constraints f(x,p) and their derivatives. The intermediate vector B_bar*p is computed only once and is shared with the computation of g and f. The intermediate vector R*(B_bar*p) is computed once and shared between the computation of g and DgDp.
The functions AdvDiffReactOptModel() createInArgs(), createOutArgs() and evalModel() are fairly cleanly written and are appropriate to be studied in order to show how to implement other parallel simulation-constrained problems based on Epetra objects.
The mesh for the 2D domain can either be read in as a mesh data file give the files name or can be generated automatically on a square 2D domain.
The program triangle can be used to generate meshes for arbitary 2D geometries and then metis can be used to partition the mesh to multiple domains. Instructions for how to use triangle and metis to generate meshes is described ???here???.
Instead of reading in a mesh file, a square 2D mesh can be automatically generated given just the length in the x and y directions and the number of local elements in each direction. Currently, the square mesh is only partitioned in the x direction and therefore will not demonstrate great parallel scalability for large numbers of processors due to excessive amounts of shared boundary between processes.
ToDo: Finish Documentation!
Definition at line 119 of file GLpApp_AdvDiffReactOptModel.hpp.
|
|
Definition at line 185 of file GLpApp_AdvDiffReactOptModel.hpp. |
|
|
Definition at line 186 of file GLpApp_AdvDiffReactOptModel.hpp. |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Constructor.
Definition at line 45 of file GLpApp_AdvDiffReactOptModel.cpp. |
|
|
Definition at line 193 of file GLpApp_AdvDiffReactOptModel.cpp. |
|
|
Implements EpetraExt::ModelEvaluator. Definition at line 208 of file GLpApp_AdvDiffReactOptModel.cpp. |
|
|
Implements EpetraExt::ModelEvaluator. Definition at line 214 of file GLpApp_AdvDiffReactOptModel.cpp. |
|
|
.
Reimplemented from EpetraExt::ModelEvaluator. Definition at line 220 of file GLpApp_AdvDiffReactOptModel.cpp. |
|
|
.
Reimplemented from EpetraExt::ModelEvaluator. Definition at line 227 of file GLpApp_AdvDiffReactOptModel.cpp. |
|
|
Reimplemented from EpetraExt::ModelEvaluator. Definition at line 234 of file GLpApp_AdvDiffReactOptModel.cpp. |
|
|
Reimplemented from EpetraExt::ModelEvaluator. Definition at line 240 of file GLpApp_AdvDiffReactOptModel.cpp. |
|
|
Reimplemented from EpetraExt::ModelEvaluator. Definition at line 247 of file GLpApp_AdvDiffReactOptModel.cpp. |
|
|
Reimplemented from EpetraExt::ModelEvaluator. Definition at line 253 of file GLpApp_AdvDiffReactOptModel.cpp. |
|
|
Reimplemented from EpetraExt::ModelEvaluator. Definition at line 259 of file GLpApp_AdvDiffReactOptModel.cpp. |
|
|
Reimplemented from EpetraExt::ModelEvaluator. Definition at line 266 of file GLpApp_AdvDiffReactOptModel.cpp. |
|
|
Reimplemented from EpetraExt::ModelEvaluator. Definition at line 273 of file GLpApp_AdvDiffReactOptModel.cpp. |
|
|
Reimplemented from EpetraExt::ModelEvaluator. Definition at line 279 of file GLpApp_AdvDiffReactOptModel.cpp. |
|
|
Implements EpetraExt::ModelEvaluator. Definition at line 287 of file GLpApp_AdvDiffReactOptModel.cpp. |
|
|
Implements EpetraExt::ModelEvaluator. Definition at line 297 of file GLpApp_AdvDiffReactOptModel.cpp. |
|
||||||||||||
|
Implements EpetraExt::ModelEvaluator. Definition at line 344 of file GLpApp_AdvDiffReactOptModel.cpp. |
|
|
Definition at line 191 of file GLpApp_AdvDiffReactOptModel.hpp. |
|
|
Definition at line 192 of file GLpApp_AdvDiffReactOptModel.hpp. |
|
|
Definition at line 193 of file GLpApp_AdvDiffReactOptModel.hpp. |
|
|
Definition at line 195 of file GLpApp_AdvDiffReactOptModel.hpp. |
|
|
Definition at line 197 of file GLpApp_AdvDiffReactOptModel.hpp. |
|
|
Definition at line 198 of file GLpApp_AdvDiffReactOptModel.hpp. |
|
|
Definition at line 199 of file GLpApp_AdvDiffReactOptModel.hpp. |
|
|
Definition at line 201 of file GLpApp_AdvDiffReactOptModel.hpp. |
|
|
Definition at line 202 of file GLpApp_AdvDiffReactOptModel.hpp. |
|
|
Definition at line 204 of file GLpApp_AdvDiffReactOptModel.hpp. |
|
|
Definition at line 205 of file GLpApp_AdvDiffReactOptModel.hpp. |
|
|
Definition at line 206 of file GLpApp_AdvDiffReactOptModel.hpp. |
|
|
Definition at line 207 of file GLpApp_AdvDiffReactOptModel.hpp. |
|
|
Definition at line 208 of file GLpApp_AdvDiffReactOptModel.hpp. |
|
|
Definition at line 210 of file GLpApp_AdvDiffReactOptModel.hpp. |
|
|
Definition at line 211 of file GLpApp_AdvDiffReactOptModel.hpp. |
|
|
Definition at line 212 of file GLpApp_AdvDiffReactOptModel.hpp. |
|
|
Definition at line 213 of file GLpApp_AdvDiffReactOptModel.hpp. |
|
|
Definition at line 214 of file GLpApp_AdvDiffReactOptModel.hpp. |
|
|
Definition at line 215 of file GLpApp_AdvDiffReactOptModel.hpp. |
|
|
Definition at line 216 of file GLpApp_AdvDiffReactOptModel.hpp. |
|
|
Definition at line 217 of file GLpApp_AdvDiffReactOptModel.hpp. |
|
|
Definition at line 219 of file GLpApp_AdvDiffReactOptModel.hpp. |
1.3.9.1