FEApp_HeatNonlinearSourcePDE.hpp

Go to the documentation of this file.
00001 // $Id: FEApp_HeatNonlinearSourcePDE.hpp,v 1.5 2008/08/01 22:57:12 etphipp Exp $ 
00002 // $Source: /space/CVS/Trilinos/packages/sacado/example/FEApp/FEApp_HeatNonlinearSourcePDE.hpp,v $ 
00003 // @HEADER
00004 // ***********************************************************************
00005 // 
00006 //                           Sacado Package
00007 //                 Copyright (2006) Sandia Corporation
00008 // 
00009 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00010 // the U.S. Government retains certain rights in this software.
00011 // 
00012 // This library is free software; you can redistribute it and/or modify
00013 // it under the terms of the GNU Lesser General Public License as
00014 // published by the Free Software Foundation; either version 2.1 of the
00015 // License, or (at your option) any later version.
00016 //  
00017 // This library is distributed in the hope that it will be useful, but
00018 // WITHOUT ANY WARRANTY; without even the implied warranty of
00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020 // Lesser General Public License for more details.
00021 //  
00022 // You should have received a copy of the GNU Lesser General Public
00023 // License along with this library; if not, write to the Free Software
00024 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00025 // USA
00026 // Questions? Contact David M. Gay (dmgay@sandia.gov) or Eric T. Phipps
00027 // (etphipp@sandia.gov).
00028 // 
00029 // ***********************************************************************
00030 // @HEADER
00031 
00032 #ifndef FEAPP_HEATNONLINEARSOURCEPDE_HPP
00033 #define FEAPP_HEATNONLINEARSOURCEPDE_HPP
00034 
00035 #include "Teuchos_RCP.hpp"
00036 
00037 #include "FEApp_AbstractPDE.hpp"
00038 #include "FEApp_FunctionFactory.hpp"
00039 #include "FEApp_SourceFunctionFactory.hpp"
00040 #include "Sacado_ScalarParameterLibrary.hpp"
00041 
00042 namespace FEApp {
00043 
00044   template <typename ScalarT>
00045   class HeatNonlinearSourcePDE : public FEApp::AbstractPDE<ScalarT> {
00046   public:
00047   
00049     HeatNonlinearSourcePDE(const Teuchos::RCP< const FEApp::AbstractFunction<ScalarT> >& mat_func,
00050          const Teuchos::RCP< const FEApp::AbstractSourceFunction<ScalarT> >& src_func);
00051 
00053     virtual ~HeatNonlinearSourcePDE();
00054 
00056     virtual unsigned int numEquations() const;
00057 
00059     virtual void init(unsigned int numQuadPoints, unsigned int numNodes);
00060 
00062     virtual void
00063     evaluateElementResidual(const FEApp::AbstractQuadrature& quadRule,
00064           const FEApp::AbstractElement& element,
00065           const std::vector<ScalarT>* dot,
00066           const std::vector<ScalarT>& solution,
00067           std::vector<ScalarT>& residual);
00068 
00069   private:
00070 
00072     HeatNonlinearSourcePDE(const HeatNonlinearSourcePDE&);
00073 
00075     HeatNonlinearSourcePDE& operator=(const HeatNonlinearSourcePDE&);
00076 
00077   protected:
00078 
00080     Teuchos::RCP< const FEApp::AbstractFunction<ScalarT> > mat;
00081     
00083     Teuchos::RCP< const FEApp::AbstractSourceFunction<ScalarT> > source;
00084 
00086     unsigned int num_qp;
00087     
00089     unsigned int num_nodes;
00090 
00092     std::vector< std::vector<double> > phi;
00093 
00095     std::vector< std::vector<double> > dphi;
00096 
00098     std::vector<double> jac;
00099 
00101     std::vector<ScalarT> u;
00102 
00104     std::vector<ScalarT> du;
00105 
00107     std::vector<ScalarT> udot;
00108 
00110     std::vector<ScalarT> a;
00111 
00113     std::vector<ScalarT> f;
00114 
00115   };
00116 
00117   class HeatNonlinearSourcePDE_TemplateBuilder {
00118   public:
00119     HeatNonlinearSourcePDE_TemplateBuilder(
00120     const Teuchos::RCP<Teuchos::ParameterList>& params_,
00121           const Teuchos::RCP<Sacado::ScalarParameterLibrary>& paramLib) :
00122       mat_params(Teuchos::rcp(&(params_->sublist("Material Function")),false)),
00123       src_params(Teuchos::rcp(&(params_->sublist("Source Function")),false)),
00124       pl(paramLib) {}
00125     template <typename T>
00126     Teuchos::RCP<FEApp::AbstractPDE_NTBase> build() const {
00127       FEApp::FunctionFactory<T> matFactory(mat_params, pl);
00128       Teuchos::RCP< FEApp::AbstractFunction<T> > mat =
00129   matFactory.create();
00130       FEApp::SourceFunctionFactory<T> srcFactory(src_params, pl);
00131       Teuchos::RCP< FEApp::AbstractSourceFunction<T> > source =
00132   srcFactory.create();
00133       return Teuchos::rcp( new FEApp::HeatNonlinearSourcePDE<T>(mat, source));
00134     }
00135   protected:
00136     Teuchos::RCP<Teuchos::ParameterList> mat_params;
00137     Teuchos::RCP<Teuchos::ParameterList> src_params;
00138     Teuchos::RCP<Sacado::ScalarParameterLibrary> pl;
00139   };
00140 
00141 }
00142 
00143 // Include implementation
00144 #ifndef SACADO_ETI
00145 #include "FEApp_HeatNonlinearSourcePDEImpl.hpp"
00146 #endif 
00147 
00148 #endif // FEAPP_HEATNONLINERASOURCEPDE_HPP

Generated on Wed May 12 21:59:03 2010 for Sacado Package Browser (Single Doxygen Collection) by  doxygen 1.4.7