• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

Albany_KLResponseFunction.hpp

Go to the documentation of this file.
00001 //*****************************************************************//
00002 //    Albany 2.0:  Copyright 2012 Sandia Corporation               //
00003 //    This Software is released under the BSD license detailed     //
00004 //    in the file "license.txt" in the top-level Albany directory  //
00005 //*****************************************************************//
00006 
00007 #ifndef ALBANY_KL_RESPONSE_FUNCTION_HPP
00008 #define ALBANY_KL_RESPONSE_FUNCTION_HPP
00009 
00010 #include "Albany_AbstractResponseFunction.hpp"
00011 #include "Albany_Application.hpp"
00012 
00013 #include "Teuchos_ParameterList.hpp"
00014 #include "Teuchos_FancyOStream.hpp"
00015 
00016 #include "Epetra_Map.h"
00017 #include "Epetra_Import.h"
00018 #include "Epetra_CrsGraph.h"
00019 
00020 namespace Albany {
00021 
00028   class KLResponseFunction : public AbstractResponseFunction {
00029   public:
00030   
00032     KLResponseFunction(
00033       const Teuchos::RCP<AbstractResponseFunction>& response,
00034       Teuchos::ParameterList& responseParams);
00035 
00037     virtual ~KLResponseFunction();
00038 
00040     virtual void setup() { response->setup(); }
00041 
00043     virtual Teuchos::RCP<const Epetra_Map> responseMap() const;
00044 
00049     virtual bool isScalarResponse() const;
00050 
00052     virtual Teuchos::RCP<Epetra_Operator> createGradientOp() const;
00053 
00055 
00056 
00058     virtual void evaluateResponse(
00059       const double current_time,
00060       const Epetra_Vector* xdot,
00061       const Epetra_Vector* xdotdot,
00062       const Epetra_Vector& x,
00063       const Teuchos::Array<ParamVec>& p,
00064       Epetra_Vector& g);
00065 
00067     virtual void evaluateTangent(
00068       const double alpha, 
00069       const double beta,
00070       const double omega,
00071       const double current_time,
00072       bool sum_derivs,
00073       const Epetra_Vector* xdot,
00074       const Epetra_Vector* xdotdot,
00075       const Epetra_Vector& x,
00076       const Teuchos::Array<ParamVec>& p,
00077       ParamVec* deriv_p,
00078       const Epetra_MultiVector* Vxdot,
00079       const Epetra_MultiVector* Vxdotdot,
00080       const Epetra_MultiVector* Vx,
00081       const Epetra_MultiVector* Vp,
00082       Epetra_Vector* g,
00083       Epetra_MultiVector* gx,
00084       Epetra_MultiVector* gp);
00085 
00087     virtual void evaluateDerivative(
00088       const double current_time,
00089       const Epetra_Vector* xdot,
00090       const Epetra_Vector* xdotdot,
00091       const Epetra_Vector& x,
00092       const Teuchos::Array<ParamVec>& p,
00093       ParamVec* deriv_p,
00094       Epetra_Vector* g,
00095       const EpetraExt::ModelEvaluator::Derivative& dg_dx,
00096       const EpetraExt::ModelEvaluator::Derivative& dg_dxdot,
00097       const EpetraExt::ModelEvaluator::Derivative& dg_dxdotdot,
00098       const EpetraExt::ModelEvaluator::Derivative& dg_dp);
00099 
00101 
00103 
00104 
00105 #ifdef ALBANY_SG_MP
00106 
00107     virtual void init_sg(
00108       const Teuchos::RCP<const Stokhos::OrthogPolyBasis<int,double> >& basis,
00109       const Teuchos::RCP<const Stokhos::Quadrature<int,double> >& quad,
00110       const Teuchos::RCP<Stokhos::OrthogPolyExpansion<int,double> >& expansion,
00111       const Teuchos::RCP<const EpetraExt::MultiComm>& multiComm);
00112 
00114     virtual void evaluateSGResponse(
00115       const double curr_time,
00116       const Stokhos::EpetraVectorOrthogPoly* sg_xdot,
00117       const Stokhos::EpetraVectorOrthogPoly* sg_xdotdot,
00118       const Stokhos::EpetraVectorOrthogPoly& sg_x,
00119       const Teuchos::Array<ParamVec>& p,
00120       const Teuchos::Array<int>& sg_p_index,
00121       const Teuchos::Array< Teuchos::Array<SGType> >& sg_p_vals,
00122       Stokhos::EpetraVectorOrthogPoly& sg_g);
00123 
00125     virtual void evaluateSGTangent(
00126       const double alpha, 
00127       const double beta, 
00128       const double omega, 
00129       const double current_time,
00130       bool sum_derivs,
00131       const Stokhos::EpetraVectorOrthogPoly* sg_xdot,
00132       const Stokhos::EpetraVectorOrthogPoly* sg_xdotdot,
00133       const Stokhos::EpetraVectorOrthogPoly& sg_x,
00134       const Teuchos::Array<ParamVec>& p,
00135       const Teuchos::Array<int>& sg_p_index,
00136       const Teuchos::Array< Teuchos::Array<SGType> >& sg_p_vals,
00137       ParamVec* deriv_p,
00138       const Epetra_MultiVector* Vx,
00139       const Epetra_MultiVector* Vxdot,
00140       const Epetra_MultiVector* Vxdotdot,
00141       const Epetra_MultiVector* Vp,
00142       Stokhos::EpetraVectorOrthogPoly* sg_g,
00143       Stokhos::EpetraMultiVectorOrthogPoly* sg_JV,
00144       Stokhos::EpetraMultiVectorOrthogPoly* sg_gp);
00145 
00147     virtual void evaluateSGDerivative(
00148       const double current_time,
00149       const Stokhos::EpetraVectorOrthogPoly* sg_xdot,
00150       const Stokhos::EpetraVectorOrthogPoly* sg_xdotdot,
00151       const Stokhos::EpetraVectorOrthogPoly& sg_x,
00152       const Teuchos::Array<ParamVec>& p,
00153       const Teuchos::Array<int>& sg_p_index,
00154       const Teuchos::Array< Teuchos::Array<SGType> >& sg_p_vals,
00155       ParamVec* deriv_p,
00156       Stokhos::EpetraVectorOrthogPoly* sg_g,
00157       const EpetraExt::ModelEvaluator::SGDerivative& sg_dg_dx,
00158       const EpetraExt::ModelEvaluator::SGDerivative& sg_dg_dxdot,
00159       const EpetraExt::ModelEvaluator::SGDerivative& sg_dg_dxdotdot,
00160       const EpetraExt::ModelEvaluator::SGDerivative& sg_dg_dp);
00161 #endif //ALBANY_SG_MP
00162 
00164 
00166 
00167 
00168 #ifdef ALBANY_SG_MP
00169 
00170     virtual void evaluateMPResponse(
00171       const double curr_time,
00172       const Stokhos::ProductEpetraVector* mp_xdot,
00173       const Stokhos::ProductEpetraVector* mp_xdotdot,
00174       const Stokhos::ProductEpetraVector& mp_x,
00175       const Teuchos::Array<ParamVec>& p,
00176       const Teuchos::Array<int>& mp_p_index,
00177       const Teuchos::Array< Teuchos::Array<MPType> >& mp_p_vals,
00178       Stokhos::ProductEpetraVector& mp_g);
00179 
00181     virtual void evaluateMPTangent(
00182       const double alpha, 
00183       const double beta, 
00184       const double omega, 
00185       const double current_time,
00186       bool sum_derivs,
00187       const Stokhos::ProductEpetraVector* mp_xdot,
00188       const Stokhos::ProductEpetraVector* mp_xdotdot,
00189       const Stokhos::ProductEpetraVector& mp_x,
00190       const Teuchos::Array<ParamVec>& p,
00191       const Teuchos::Array<int>& mp_p_index,
00192       const Teuchos::Array< Teuchos::Array<MPType> >& mp_p_vals,
00193       ParamVec* deriv_p,
00194       const Epetra_MultiVector* Vx,
00195       const Epetra_MultiVector* Vxdot,
00196       const Epetra_MultiVector* Vxdotdot,
00197       const Epetra_MultiVector* Vp,
00198       Stokhos::ProductEpetraVector* mp_g,
00199       Stokhos::ProductEpetraMultiVector* mp_JV,
00200       Stokhos::ProductEpetraMultiVector* mp_gp);
00201 
00203     virtual void evaluateMPDerivative(
00204       const double current_time,
00205       const Stokhos::ProductEpetraVector* mp_xdot,
00206       const Stokhos::ProductEpetraVector* mp_xdotdot,
00207       const Stokhos::ProductEpetraVector& mp_x,
00208       const Teuchos::Array<ParamVec>& p,
00209       const Teuchos::Array<int>& mp_p_index,
00210       const Teuchos::Array< Teuchos::Array<MPType> >& mp_p_vals,
00211       ParamVec* deriv_p,
00212       Stokhos::ProductEpetraVector* mp_g,
00213       const EpetraExt::ModelEvaluator::MPDerivative& mp_dg_dx,
00214       const EpetraExt::ModelEvaluator::MPDerivative& mp_dg_dxdot,
00215       const EpetraExt::ModelEvaluator::MPDerivative& mp_dg_dxdotdot,
00216       const EpetraExt::ModelEvaluator::MPDerivative& mp_dg_dp);
00217 #endif //ALBANY_SG_MP
00218 
00220 
00221   private:
00222 
00224     KLResponseFunction(const KLResponseFunction&);
00225     
00227     KLResponseFunction& operator=(const KLResponseFunction&);
00228 
00229   protected:
00230 
00231     bool computeKL(const Stokhos::EpetraVectorOrthogPoly& sg_u,
00232        const int NumKL,
00233        Teuchos::Array<double>& evals,
00234        Teuchos::RCP<Epetra_MultiVector>& evecs);
00235 
00236   protected:
00237 
00239     Teuchos::RCP<AbstractResponseFunction> response;
00240 
00242     Teuchos::ParameterList responseParams;
00243 
00245     Teuchos::RCP<Teuchos::FancyOStream> out;
00246 
00248     int num_kl;
00249 
00250   };
00251 
00252 }
00253 
00254 #endif // ALBANY_KL_RESPONSE_FUNCTION_HPP

Generated on Wed Mar 26 2014 18:36:36 for Albany: a Trilinos-based PDE code by  doxygen 1.7.1