42 #ifndef TWOD_DIFFUSION_PROBLEM_TPETRA_HPP 43 #define TWOD_DIFFUSION_PROBLEM_TPETRA_HPP 45 #include "Teuchos_RCP.hpp" 46 #include "Teuchos_Array.hpp" 47 #include "Teuchos_Comm.hpp" 49 #include "Tpetra_Map.hpp" 50 #include "Tpetra_Vector.hpp" 51 #include "Tpetra_Import.hpp" 52 #include "Tpetra_CrsGraph.hpp" 53 #include "Tpetra_CrsMatrix.hpp" 69 typedef Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node>
Tpetra_Map;
70 typedef Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node>
Tpetra_Vector;
78 const Teuchos::RCP<
const Teuchos::Comm<int> >& comm,
80 BasisScalar s = 0.1, BasisScalar mu = 0.2,
88 Teuchos::RCP<const Tpetra_Map>
get_x_map()
const;
91 Teuchos::RCP<const Tpetra_Map>
get_f_map()
const;
100 Teuchos::RCP<const Teuchos::Array<std::string> >
104 Teuchos::RCP<const Tpetra_Vector>
get_x_init()
const;
110 Teuchos::RCP<Tpetra_CrsMatrix>
create_W()
const;
132 template <
typename FuncT>
146 Teuchos::Array<MeshPoint>
mesh;
152 Teuchos::RCP<const Tpetra_Map>
x_map;
161 Teuchos::RCP<const Tpetra_Map>
p_map;
164 Teuchos::RCP<const Tpetra_Map>
g_map;
170 Teuchos::RCP< Teuchos::Array<std::string> >
p_names;
173 Teuchos::RCP<Tpetra_CrsGraph>
graph;
176 Teuchos::RCP<Tpetra_Vector>
b;
179 Teuchos::RCP<Tpetra_CrsMatrix>
A;
183 mutable Teuchos::Array<MeshScalar>
point;
184 Teuchos::RCP< Stokhos::KL::ExponentialRandomField<MeshScalar> >
rf;
186 BasisScalar mean, BasisScalar std_dev,
189 const Teuchos::Array<Scalar>& rv)
const;
194 template <
typename DiffusionFunc>
199 const Teuchos::Array<Scalar>& rv)
const {
205 Teuchos::RCP<LogNormal_Diffusion_Func<KL_Diffusion_Func> >
lnFunc;
211 #endif // TWOD_DIFFUSION_ME_HPP
Scalar operator()(MeshScalar x, MeshScalar y, const Teuchos::Array< Scalar > &rv) const
Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > Tpetra_Map
KL_Diffusion_Func(MeshScalar xyLeft, MeshScalar xyRight, BasisScalar mean, BasisScalar std_dev, MeshScalar L, LocalOrdinal num_KL)
Teuchos::RCP< const Epetra_Vector > get_p_init(int l) const
Return initial parameters.
Tpetra::Operator< Scalar, LocalOrdinal, GlobalOrdinal, Node > Tpetra_Operator
Teuchos::RCP< const Tpetra_Map > p_map
Parameter vector map.
void computeResidual(const Epetra_Vector &x, const Epetra_Vector &p, Epetra_Vector &f)
Compute residual.
void computeResponse(const Epetra_Vector &x, const Epetra_Vector &p, Epetra_Vector &g)
Compute response.
Teuchos::RCP< LogNormal_Diffusion_Func< KL_Diffusion_Func > > lnFunc
void computeJacobian(const Epetra_Vector &x, const Epetra_Vector &p, Epetra_Operator &J)
Compute Jacobian.
Teuchos::RCP< Tpetra_Vector > x_init
Initial guess.
Teuchos::RCP< const Epetra_Map > get_p_map(int l) const
Return parameter vector map.
Teuchos::RCP< const Teuchos::Array< std::string > > get_p_names(int l) const
Return array of parameter names.
Teuchos::RCP< const Tpetra_Map > g_map
Response vector map.
Teuchos::RCP< const Epetra_Vector > get_x_init() const
Return initial solution.
Tpetra::Import< LocalOrdinal, GlobalOrdinal, Node > Tpetra_Import
const IndexType const IndexType const IndexType const IndexType const ValueType const ValueType * x
Teuchos::Array< MeshPoint > mesh
Teuchos::RCP< Stokhos::KL::ExponentialRandomField< MeshScalar > > rf
Teuchos::RCP< KL_Diffusion_Func > klFunc
Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > Tpetra_CrsGraph
LogNormal_Diffusion_Func(const DiffusionFunc &func_)
KokkosClassic::DefaultNode::DefaultNodeType Node
Teuchos::RCP< const Tpetra_Map > x_map
Solution vector map.
Teuchos::RCP< Epetra_Operator > create_W() const
Create W = alpha*M + beta*J matrix.
twoD_diffusion_problem(const Teuchos::RCP< const Epetra_Comm > &comm, int n, int d, double s=0.1, double mu=0.2, const Teuchos::RCP< const Stokhos::OrthogPolyBasis< int, double > > &basis=Teuchos::null, bool log_normal=false, bool eliminate_bcs=false)
Constructor.
KOKKOS_INLINE_FUNCTION PCE< Storage > exp(const PCE< Storage > &a)
Teuchos::Array< GlobalOrdinal > bcIndices
Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > Tpetra_Vector
Teuchos::RCP< const Epetra_Map > get_g_map(int j) const
Return response function map.
Teuchos::RCP< Tpetra_CrsMatrix > A
Matrix to store operator.
Scalar operator()(MeshScalar x, MeshScalar y, const Teuchos::Array< Scalar > &rv) const
Teuchos::RCP< Tpetra_Import > importer
Importer to overlapped distribution.
ScalarType f(const Teuchos::Array< ScalarType > &x, double a, double b)
Teuchos::RCP< Tpetra_Vector > b
RHS.
const DiffusionFunc & func
Tpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > Tpetra_CrsMatrix
Teuchos::RCP< const Epetra_Map > get_f_map() const
Return residual vector map.
Teuchos::RCP< Teuchos::Array< std::string > > p_names
Parameter names.
Teuchos::RCP< Tpetra_Vector > p_init
Initial parameters.
void computeA(const FuncT &func, const Tpetra_Vector &p, Tpetra_CrsMatrix &jac)
Fill coefficient matrix given function to evaluate diffusion coefficient.
Teuchos::Array< MeshScalar > point
Teuchos::RCP< Tpetra_CrsGraph > graph
Jacobian graph.
const IndexType const IndexType const IndexType const IndexType const ValueType const ValueType ValueType * y
Teuchos::RCP< const Epetra_Map > get_x_map() const
Return solution vector map.
ScalarType g(const Teuchos::Array< ScalarType > &x, const ScalarType &y)
A linear 2-D diffusion problem.