EpetraExt Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Types | Private Attributes | Static Private Attributes | List of all members
GLpApp::AdvDiffReactOptModel Class Reference

PDE-constrained inverse problem based on a 2D discretization of a diffusion/reaction system. More...

#include <GLpApp_AdvDiffReactOptModel.hpp>

Inheritance diagram for GLpApp::AdvDiffReactOptModel:
Inheritance graph
[legend]

Public Member Functions

 AdvDiffReactOptModel (const Teuchos::RCP< 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, const bool supportDerivatives)
 Constructor. More...
 
void set_q (Teuchos::RCP< const Epetra_Vector > const &q)
 
Teuchos::RCP
< GLpApp::GLpYUEpetraDataPool
getDataPool ()
 
Teuchos::RCP< const
Epetra_MultiVector
get_B_bar () const
 
- Public Member Functions inherited from EpetraExt::ModelEvaluator
virtual ~ModelEvaluator ()
 
virtual Teuchos::RCP< const
Teuchos::Array< std::string > > 
get_p_names (int l) const
 Get the names of the parameters associated with parameter subvector l if available. More...
 
virtual Teuchos::ArrayView
< const std::string > 
get_g_names (int j) const
 Get the names of the response functions associated with response subvector j if available. More...
 
virtual Teuchos::RCP< const
Epetra_Vector
get_x_dot_init () const
 
virtual Teuchos::RCP< const
Epetra_Vector
get_x_dotdot_init () const
 
virtual double get_t_init () const
 
virtual double getInfBound () const
 Return the value of an infinite bound. More...
 
virtual double get_t_lower_bound () const
 
virtual double get_t_upper_bound () const
 
virtual Teuchos::RCP
< EpetraExt::ModelEvaluator::Preconditioner
create_WPrec () const
 
virtual Teuchos::RCP
< Epetra_Operator
create_DgDx_dot_op (int j) const
 
virtual Teuchos::RCP
< Epetra_Operator
create_DgDx_dotdot_op (int j) const
 
virtual Teuchos::RCP
< Epetra_Operator
create_DgDx_op (int j) const
 
virtual Teuchos::RCP
< Epetra_Operator
create_DgDp_op (int j, int l) const
 
- Public Member Functions inherited from Teuchos::Describable
DescribableStreamManipulatorState describe (const Describable &describable, const EVerbosityLevel verbLevel=Describable::verbLevel_default)
 
std::ostream & operator<< (std::ostream &os, const DescribableStreamManipulatorState &d)
 
virtual std::string description () const
 
virtual void describe (FancyOStream &out, const EVerbosityLevel verbLevel=verbLevel_default) const
 
void describe (std::ostream &out, const EVerbosityLevel verbLevel=verbLevel_default) const
 
virtual ~Describable ()
 
 LabeledObject ()
 
virtual ~LabeledObject ()
 
virtual void setObjectLabel (const std::string &objectLabel)
 
virtual std::string getObjectLabel () const
 
- Public Member Functions inherited from Teuchos::VerboseObject< AdvDiffReactOptModel >
TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT
RCP< const ParameterList
getValidVerboseObjectSublist ()
 
TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT
void 
setupVerboseObjectSublist (ParameterList *paramList)
 
TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT
void 
readVerboseObjectSublist (ParameterList *paramList, RCP< FancyOStream > *oStream, EVerbosityLevel *verbLevel)
 
void readVerboseObjectSublist (ParameterList *paramList, VerboseObject< AdvDiffReactOptModel > *verboseObject)
 
 VerboseObject (const EVerbosityLevel verbLevel=VERB_DEFAULT, const RCP< FancyOStream > &oStream=Teuchos::null)
 
virtual const VerboseObjectsetVerbLevel (const EVerbosityLevel verbLevel) const
 
virtual const VerboseObjectsetOverridingVerbLevel (const EVerbosityLevel verbLevel) const
 
virtual EVerbosityLevel getVerbLevel () const
 

Private Types

typedef Teuchos::Array
< Teuchos::RCP< const
Epetra_Map > > 
RCP_Eptra_Map_Array_t
 
typedef Teuchos::Array
< Teuchos::RCP< Epetra_Vector > > 
RCP_Eptra_Vector_Array_t
 

Private Attributes

bool supportDerivatives_
 
bool isInitialized_
 
Teuchos::RCP
< GLpApp::GLpYUEpetraDataPool
dat_
 
int np_
 
Teuchos::RCP< const Epetra_Vectorq_
 
Teuchos::RCP< const Epetra_Mapmap_p_bar_
 
Teuchos::RCP< Epetra_MultiVectorB_bar_
 
Teuchos::RCP< const Epetra_Commepetra_comm_
 
Teuchos::RCP< const Epetra_Mapmap_x_
 
RCP_Eptra_Map_Array_t map_p_
 
Teuchos::RCP< const Epetra_Mapmap_f_
 
Teuchos::RCP< const Epetra_Mapmap_g_
 
Teuchos::RCP< Epetra_Vectorx0_
 
Teuchos::RCP< Epetra_VectorxL_
 
Teuchos::RCP< Epetra_VectorxU_
 
RCP_Eptra_Vector_Array_t p0_
 
RCP_Eptra_Vector_Array_t pL_
 
RCP_Eptra_Vector_Array_t pU_
 
Teuchos::RCP< Epetra_VectorgL_
 
Teuchos::RCP< Epetra_VectorgU_
 
Teuchos::RCP< Epetra_CrsGraphW_graph_
 

Static Private Attributes

static const int Np_ = 2
 
static const int p_bndy_idx = 0
 
static const int p_rx_idx = 1
 

Overridden from EpetraExt::ModelEvaluator .

Teuchos::RCP< const Epetra_Mapget_x_map () const
 
Teuchos::RCP< const Epetra_Mapget_f_map () const
 
Teuchos::RCP< const Epetra_Mapget_p_map (int l) const
 . More...
 
Teuchos::RCP< const Epetra_Mapget_g_map (int j) const
 . More...
 
Teuchos::RCP< const Epetra_Vectorget_x_init () const
 
Teuchos::RCP< const Epetra_Vectorget_p_init (int l) const
 
Teuchos::RCP< const Epetra_Vectorget_x_lower_bounds () const
 
Teuchos::RCP< const Epetra_Vectorget_x_upper_bounds () const
 
Teuchos::RCP< const Epetra_Vectorget_p_lower_bounds (int l) const
 
Teuchos::RCP< const Epetra_Vectorget_p_upper_bounds (int l) const
 
Teuchos::RCP< Epetra_Operatorcreate_W () const
 
Teuchos::RCP< Epetra_Operatorcreate_DfDp_op (int l) const
 
InArgs createInArgs () const
 
OutArgs createOutArgs () const
 
void evalModel (const InArgs &inArgs, const OutArgs &outArgs) const
 

Additional Inherited Members

- Public Types inherited from EpetraExt::ModelEvaluator
enum  EInArgsMembers {
  IN_ARG_x_dot, IN_ARG_x, IN_ARG_x_dot_poly, IN_ARG_x_poly,
  IN_ARG_x_dot_sg, IN_ARG_x_sg, IN_ARG_x_dot_mp, IN_ARG_x_mp,
  IN_ARG_t, IN_ARG_alpha, IN_ARG_beta, IN_ARG_step_size,
  IN_ARG_stage_number, IN_ARG_x_dotdot, IN_ARG_x_dotdot_poly, IN_ARG_x_dotdot_sg,
  IN_ARG_x_dotdot_mp, IN_ARG_omega, IN_ARG_sg_basis, IN_ARG_sg_quadrature,
  IN_ARG_sg_expansion
}
 
enum  EInArgs_p_sg { IN_ARG_p_sg }
 
enum  EInArgs_p_mp { IN_ARG_p_mp }
 
enum  EEvalType { EVAL_TYPE_EXACT, EVAL_TYPE_APPROX_DERIV, EVAL_TYPE_VERY_APPROX_DERIV }
 
enum  EDerivativeMultiVectorOrientation { DERIV_MV_BY_COL, DERIV_TRANS_MV_BY_ROW }
 
enum  EDerivativeLinearOp { DERIV_LINEAR_OP }
 
enum  EDerivativeLinearity { DERIV_LINEARITY_UNKNOWN, DERIV_LINEARITY_CONST, DERIV_LINEARITY_NONCONST }
 
enum  ERankStatus { DERIV_RANK_UNKNOWN, DERIV_RANK_FULL, DERIV_RANK_DEFICIENT }
 
enum  EOutArgsMembers {
  OUT_ARG_f, OUT_ARG_W, OUT_ARG_f_poly, OUT_ARG_f_sg,
  OUT_ARG_W_sg, OUT_ARG_f_mp, OUT_ARG_W_mp, OUT_ARG_WPrec
}
 
enum  EOutArgsDfDp { OUT_ARG_DfDp }
 
enum  EOutArgsDgDx_dot { OUT_ARG_DgDx_dot }
 
enum  EOutArgsDgDx_dotdot { OUT_ARG_DgDx_dotdot }
 
enum  EOutArgsDgDx { OUT_ARG_DgDx }
 
enum  EOutArgsDgDp { OUT_ARG_DgDp }
 
enum  EOutArgsDfDp_sg { OUT_ARG_DfDp_sg }
 
enum  EOutArgs_g_sg { OUT_ARG_g_sg }
 
enum  EOutArgsDgDx_dot_sg { OUT_ARG_DgDx_dot_sg }
 
enum  EOutArgsDgDx_dotdot_sg { OUT_ARG_DgDx_dotdot_sg }
 
enum  EOutArgsDgDx_sg { OUT_ARG_DgDx_sg }
 
enum  EOutArgsDgDp_sg { OUT_ARG_DgDp_sg }
 
enum  EOutArgsDfDp_mp { OUT_ARG_DfDp_mp }
 
enum  EOutArgs_g_mp { OUT_ARG_g_mp }
 
enum  EOutArgsDgDx_dot_mp { OUT_ARG_DgDx_dot_mp }
 
enum  EOutArgsDgDx_dotdot_mp { OUT_ARG_DgDx_dotdot_mp }
 
enum  EOutArgsDgDx_mp { OUT_ARG_DgDx_mp }
 
enum  EOutArgsDgDp_mp { OUT_ARG_DgDp_mp }
 
typedef Teuchos::RCP< const
Stokhos::ProductEpetraVector > 
mp_const_vector_t
 
typedef Teuchos::RCP< const
Stokhos::ProductEpetraMultiVector > 
mp_const_multivector_t
 
typedef Teuchos::RCP< const
Stokhos::ProductEpetraOperator > 
mp_const_operator_t
 
typedef Teuchos::RCP
< Stokhos::ProductEpetraVector > 
mp_vector_t
 
typedef Teuchos::RCP
< Stokhos::ProductEpetraMultiVector > 
mp_multivector_t
 
typedef Teuchos::RCP
< Stokhos::ProductEpetraOperator > 
mp_operator_t
 
- Static Public Member Functions inherited from Teuchos::VerboseObject< AdvDiffReactOptModel >
static void setDefaultVerbLevel (const EVerbosityLevel defaultVerbLevel)
 
static EVerbosityLevel getDefaultVerbLevel ()
 
- Static Public Attributes inherited from EpetraExt::ModelEvaluator
static const int NUM_E_IN_ARGS_MEMBERS =21
 
static const int NUM_E_OUT_ARGS_MEMBERS =9
 
- Static Public Attributes inherited from Teuchos::Describable
static const EVerbosityLevel verbLevel_default
 
- Protected Member Functions inherited from Teuchos::VerboseObject< AdvDiffReactOptModel >
void initializeVerboseObject (const EVerbosityLevel verbLevel=VERB_DEFAULT, const RCP< FancyOStream > &oStream=Teuchos::null)
 

Detailed Description

PDE-constrained inverse problem based on a 2D discretization of a diffusion/reaction system.

The model evaluator subclass is used to represent the simulation-constrained optimization problem:

 min   g(x,p)
 s.t.  f(x,p) = 0;

where:

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 162 of file GLpApp_AdvDiffReactOptModel.hpp.

Member Typedef Documentation

Definition at line 235 of file GLpApp_AdvDiffReactOptModel.hpp.

Definition at line 236 of file GLpApp_AdvDiffReactOptModel.hpp.

Constructor & Destructor Documentation

GLpApp::AdvDiffReactOptModel::AdvDiffReactOptModel ( const Teuchos::RCP< 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,
const bool  supportDerivatives 
)

Constructor.

Definition at line 95 of file GLpApp_AdvDiffReactOptModel.cpp.

Member Function Documentation

void GLpApp::AdvDiffReactOptModel::set_q ( Teuchos::RCP< const Epetra_Vector > const &  q)

Definition at line 246 of file GLpApp_AdvDiffReactOptModel.cpp.

Teuchos::RCP< GLpApp::GLpYUEpetraDataPool > GLpApp::AdvDiffReactOptModel::getDataPool ( )

Definition at line 259 of file GLpApp_AdvDiffReactOptModel.cpp.

Teuchos::RCP< const Epetra_MultiVector > GLpApp::AdvDiffReactOptModel::get_B_bar ( ) const

Definition at line 265 of file GLpApp_AdvDiffReactOptModel.cpp.

Teuchos::RCP< const Epetra_Map > GLpApp::AdvDiffReactOptModel::get_x_map ( ) const
virtual

Implements EpetraExt::ModelEvaluator.

Definition at line 273 of file GLpApp_AdvDiffReactOptModel.cpp.

Teuchos::RCP< const Epetra_Map > GLpApp::AdvDiffReactOptModel::get_f_map ( ) const
virtual

Implements EpetraExt::ModelEvaluator.

Definition at line 279 of file GLpApp_AdvDiffReactOptModel.cpp.

Teuchos::RCP< const Epetra_Map > GLpApp::AdvDiffReactOptModel::get_p_map ( int  l) const
virtual

.

Reimplemented from EpetraExt::ModelEvaluator.

Definition at line 285 of file GLpApp_AdvDiffReactOptModel.cpp.

Teuchos::RCP< const Epetra_Map > GLpApp::AdvDiffReactOptModel::get_g_map ( int  j) const
virtual

.

Reimplemented from EpetraExt::ModelEvaluator.

Definition at line 292 of file GLpApp_AdvDiffReactOptModel.cpp.

Teuchos::RCP< const Epetra_Vector > GLpApp::AdvDiffReactOptModel::get_x_init ( ) const
virtual

Reimplemented from EpetraExt::ModelEvaluator.

Definition at line 299 of file GLpApp_AdvDiffReactOptModel.cpp.

Teuchos::RCP< const Epetra_Vector > GLpApp::AdvDiffReactOptModel::get_p_init ( int  l) const
virtual

Reimplemented from EpetraExt::ModelEvaluator.

Definition at line 305 of file GLpApp_AdvDiffReactOptModel.cpp.

Teuchos::RCP< const Epetra_Vector > GLpApp::AdvDiffReactOptModel::get_x_lower_bounds ( ) const
virtual

Reimplemented from EpetraExt::ModelEvaluator.

Definition at line 312 of file GLpApp_AdvDiffReactOptModel.cpp.

Teuchos::RCP< const Epetra_Vector > GLpApp::AdvDiffReactOptModel::get_x_upper_bounds ( ) const
virtual

Reimplemented from EpetraExt::ModelEvaluator.

Definition at line 318 of file GLpApp_AdvDiffReactOptModel.cpp.

Teuchos::RCP< const Epetra_Vector > GLpApp::AdvDiffReactOptModel::get_p_lower_bounds ( int  l) const
virtual

Reimplemented from EpetraExt::ModelEvaluator.

Definition at line 324 of file GLpApp_AdvDiffReactOptModel.cpp.

Teuchos::RCP< const Epetra_Vector > GLpApp::AdvDiffReactOptModel::get_p_upper_bounds ( int  l) const
virtual

Reimplemented from EpetraExt::ModelEvaluator.

Definition at line 331 of file GLpApp_AdvDiffReactOptModel.cpp.

Teuchos::RCP< Epetra_Operator > GLpApp::AdvDiffReactOptModel::create_W ( ) const
virtual

Reimplemented from EpetraExt::ModelEvaluator.

Definition at line 338 of file GLpApp_AdvDiffReactOptModel.cpp.

Teuchos::RCP< Epetra_Operator > GLpApp::AdvDiffReactOptModel::create_DfDp_op ( int  l) const
virtual

Reimplemented from EpetraExt::ModelEvaluator.

Definition at line 344 of file GLpApp_AdvDiffReactOptModel.cpp.

EpetraExt::ModelEvaluator::InArgs GLpApp::AdvDiffReactOptModel::createInArgs ( ) const
virtual

Implements EpetraExt::ModelEvaluator.

Definition at line 352 of file GLpApp_AdvDiffReactOptModel.cpp.

EpetraExt::ModelEvaluator::OutArgs GLpApp::AdvDiffReactOptModel::createOutArgs ( ) const
virtual

Implements EpetraExt::ModelEvaluator.

Definition at line 362 of file GLpApp_AdvDiffReactOptModel.cpp.

void GLpApp::AdvDiffReactOptModel::evalModel ( const InArgs inArgs,
const OutArgs outArgs 
) const
virtual

Implements EpetraExt::ModelEvaluator.

Definition at line 411 of file GLpApp_AdvDiffReactOptModel.cpp.

Member Data Documentation

const int GLpApp::AdvDiffReactOptModel::Np_ = 2
staticprivate

Definition at line 241 of file GLpApp_AdvDiffReactOptModel.hpp.

const int GLpApp::AdvDiffReactOptModel::p_bndy_idx = 0
staticprivate

Definition at line 242 of file GLpApp_AdvDiffReactOptModel.hpp.

const int GLpApp::AdvDiffReactOptModel::p_rx_idx = 1
staticprivate

Definition at line 243 of file GLpApp_AdvDiffReactOptModel.hpp.

bool GLpApp::AdvDiffReactOptModel::supportDerivatives_
private

Definition at line 245 of file GLpApp_AdvDiffReactOptModel.hpp.

bool GLpApp::AdvDiffReactOptModel::isInitialized_
private

Definition at line 247 of file GLpApp_AdvDiffReactOptModel.hpp.

Teuchos::RCP<GLpApp::GLpYUEpetraDataPool> GLpApp::AdvDiffReactOptModel::dat_
private

Definition at line 249 of file GLpApp_AdvDiffReactOptModel.hpp.

int GLpApp::AdvDiffReactOptModel::np_
private

Definition at line 250 of file GLpApp_AdvDiffReactOptModel.hpp.

Teuchos::RCP<const Epetra_Vector> GLpApp::AdvDiffReactOptModel::q_
private

Definition at line 251 of file GLpApp_AdvDiffReactOptModel.hpp.

Teuchos::RCP<const Epetra_Map> GLpApp::AdvDiffReactOptModel::map_p_bar_
private

Definition at line 253 of file GLpApp_AdvDiffReactOptModel.hpp.

Teuchos::RCP<Epetra_MultiVector> GLpApp::AdvDiffReactOptModel::B_bar_
private

Definition at line 254 of file GLpApp_AdvDiffReactOptModel.hpp.

Teuchos::RCP<const Epetra_Comm> GLpApp::AdvDiffReactOptModel::epetra_comm_
private

Definition at line 256 of file GLpApp_AdvDiffReactOptModel.hpp.

Teuchos::RCP<const Epetra_Map> GLpApp::AdvDiffReactOptModel::map_x_
private

Definition at line 257 of file GLpApp_AdvDiffReactOptModel.hpp.

RCP_Eptra_Map_Array_t GLpApp::AdvDiffReactOptModel::map_p_
private

Definition at line 258 of file GLpApp_AdvDiffReactOptModel.hpp.

Teuchos::RCP<const Epetra_Map> GLpApp::AdvDiffReactOptModel::map_f_
private

Definition at line 259 of file GLpApp_AdvDiffReactOptModel.hpp.

Teuchos::RCP<const Epetra_Map> GLpApp::AdvDiffReactOptModel::map_g_
private

Definition at line 260 of file GLpApp_AdvDiffReactOptModel.hpp.

Teuchos::RCP<Epetra_Vector> GLpApp::AdvDiffReactOptModel::x0_
private

Definition at line 262 of file GLpApp_AdvDiffReactOptModel.hpp.

Teuchos::RCP<Epetra_Vector> GLpApp::AdvDiffReactOptModel::xL_
private

Definition at line 263 of file GLpApp_AdvDiffReactOptModel.hpp.

Teuchos::RCP<Epetra_Vector> GLpApp::AdvDiffReactOptModel::xU_
private

Definition at line 264 of file GLpApp_AdvDiffReactOptModel.hpp.

RCP_Eptra_Vector_Array_t GLpApp::AdvDiffReactOptModel::p0_
private

Definition at line 265 of file GLpApp_AdvDiffReactOptModel.hpp.

RCP_Eptra_Vector_Array_t GLpApp::AdvDiffReactOptModel::pL_
private

Definition at line 266 of file GLpApp_AdvDiffReactOptModel.hpp.

RCP_Eptra_Vector_Array_t GLpApp::AdvDiffReactOptModel::pU_
private

Definition at line 267 of file GLpApp_AdvDiffReactOptModel.hpp.

Teuchos::RCP<Epetra_Vector> GLpApp::AdvDiffReactOptModel::gL_
private

Definition at line 268 of file GLpApp_AdvDiffReactOptModel.hpp.

Teuchos::RCP<Epetra_Vector> GLpApp::AdvDiffReactOptModel::gU_
private

Definition at line 269 of file GLpApp_AdvDiffReactOptModel.hpp.

Teuchos::RCP<Epetra_CrsGraph> GLpApp::AdvDiffReactOptModel::W_graph_
private

Definition at line 271 of file GLpApp_AdvDiffReactOptModel.hpp.


The documentation for this class was generated from the following files: