42#ifndef TWOD_DIFFUSION_PROBLEM_HPP
43#define TWOD_DIFFUSION_PROBLEM_HPP
45#include "Teuchos_RCP.hpp"
46#include "Teuchos_Array.hpp"
63 const Teuchos::RCP<const Epetra_Comm>& comm,
int n,
int d,
64 double s = 0.1,
double mu = 0.2,
74 Teuchos::RCP<const Epetra_Map>
get_x_map()
const;
77 Teuchos::RCP<const Epetra_Map>
get_f_map()
const;
80 Teuchos::RCP<const Epetra_Map>
get_p_map(
int l)
const;
83 Teuchos::RCP<const Epetra_Map>
get_g_map(
int j)
const;
86 Teuchos::RCP<const Teuchos::Array<std::string> >
90 Teuchos::RCP<const Epetra_Vector>
get_x_init()
const;
93 Teuchos::RCP<const Epetra_Vector>
get_p_init(
int l)
const;
96 Teuchos::RCP<Epetra_Operator>
create_W()
const;
132 Teuchos::RCP<Epetra_CrsMatrix>
get_mean()
const {
return A_k[0]; }
137 template <
typename FuncT>
152 Teuchos::Array<MeshPoint>
mesh;
155 Teuchos::RCP<const Stokhos::OrthogPolyBasis<int,double> >
basis;
178 Teuchos::RCP< Teuchos::Array<std::string> >
p_names;
181 Teuchos::RCP<Epetra_CrsGraph>
graph;
184 Teuchos::Array<Teuchos::RCP<Epetra_CrsMatrix> >
A_k;
187 Teuchos::RCP<Epetra_Vector>
b;
193 Teuchos::RCP<Epetra_CrsMatrix>
A;
196 mutable Teuchos::Array<double>
point;
A container class storing an orthogonal polynomial whose coefficients are vectors,...
A container class storing an orthogonal polynomial whose coefficients are vectors,...
Abstract base class for multivariate orthogonal polynomials.
Abstract base class for orthogonal polynomial-based expansions.
A linear 2-D diffusion problem.
Teuchos::RCP< Epetra_Vector > p_init
Initial parameters.
void fillMatrices(const FuncT &func, int sz)
Fill coefficient matrix given function to evaluate diffusion coefficient.
void computeSGJacobian(const Stokhos::EpetraVectorOrthogPoly &x_sg, const Stokhos::EpetraVectorOrthogPoly &p_sg, Stokhos::EpetraOperatorOrthogPoly &J_sg)
Compute Jacobian.
Teuchos::Array< double > basis_vals
Array to store values of basis at a point.
Teuchos::RCP< Epetra_Map > x_map
Solution vector map.
Teuchos::RCP< Epetra_Vector > x_init
Initial guess.
Teuchos::RCP< const Teuchos::Array< std::string > > get_p_names(int l) const
Return array of parameter names.
Teuchos::RCP< const Epetra_Map > get_x_map() const
Return solution vector map.
void compute_A(const Epetra_Vector &p)
Compute A matrix.
Teuchos::RCP< Epetra_CrsMatrix > A
Matrix to store deterministic operator.
Teuchos::RCP< Teuchos::Array< std::string > > p_names
Parameter names.
Teuchos::RCP< const Epetra_Map > get_p_map(int l) const
Return parameter vector map.
void computeSGResponse(const Stokhos::EpetraVectorOrthogPoly &x_sg, const Stokhos::EpetraVectorOrthogPoly &p_sg, Stokhos::EpetraVectorOrthogPoly &g_sg)
Compute SG response.
Teuchos::RCP< const Epetra_Map > get_f_map() const
Return residual vector map.
Teuchos::RCP< const Epetra_Map > get_g_map(int j) const
Return response function map.
Teuchos::RCP< const Epetra_Vector > get_p_init(int l) const
Return initial parameters.
Teuchos::RCP< Epetra_Map > p_map
Parameter vector map.
Teuchos::Array< Teuchos::RCP< Epetra_Vector > > sg_kx_vec_all
Vectors to store matrix-vector products in SG residual calculation.
Teuchos::RCP< const Stokhos::OrthogPolyBasis< int, double > > basis
void computeResidual(const Epetra_Vector &x, const Epetra_Vector &p, Epetra_Vector &f)
Compute residual.
Teuchos::Array< MeshPoint > mesh
Teuchos::Array< double > point
Array to store a point for basis evaluation.
void computeJacobian(const Epetra_Vector &x, const Epetra_Vector &p, Epetra_Operator &J)
Compute Jacobian.
Teuchos::RCP< Epetra_Import > importer
Importer to overlapped distribution.
Teuchos::Array< Teuchos::RCP< Epetra_CrsMatrix > > A_k
KL coefficients of operator
Teuchos::RCP< const Epetra_Vector > get_x_init() const
Return initial solution.
Teuchos::Array< int > bcIndices
Teuchos::RCP< Epetra_Vector > b
Deterministic RHS.
Teuchos::RCP< Epetra_CrsGraph > graph
Jacobian graph.
Teuchos::RCP< Epetra_CrsMatrix > get_mean() const
Get mean matrix.
void computeResponse(const Epetra_Vector &x, const Epetra_Vector &p, Epetra_Vector &g)
Compute response.
Teuchos::RCP< Epetra_Map > g_map
Response vector map.
Teuchos::RCP< Epetra_Operator > create_W() const
Create W = alpha*M + beta*J matrix.
void computeSGResidual(const Stokhos::EpetraVectorOrthogPoly &x_sg, const Stokhos::EpetraVectorOrthogPoly &p_sg, Stokhos::OrthogPolyExpansion< int, double > &expn, Stokhos::EpetraVectorOrthogPoly &f_sg)
Compute SG residual.
ScalarType g(const Teuchos::Array< ScalarType > &x, const ScalarType &y)
ScalarType f(const Teuchos::Array< ScalarType > &x, double a, double b)