FEApp_BrusselatorProblem.cpp

Go to the documentation of this file.
00001 // $Id: FEApp_BrusselatorProblem.cpp,v 1.4 2007/07/09 17:47:47 etphipp Exp $ 
00002 // $Source: /space/CVS/Trilinos/packages/sacado/example/FEApp/FEApp_BrusselatorProblem.cpp,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 #include "FEApp_BrusselatorProblem.hpp"
00033 #include "FEApp_BrusselatorNodeBCStrategy.hpp"
00034 
00035 FEApp::BrusselatorProblem::
00036 BrusselatorProblem(
00037       const Teuchos::RCP<Teuchos::ParameterList>& params,
00038       const Teuchos::RCP<Sacado::ScalarParameterLibrary>& paramLib_) :
00039   paramLib(paramLib_)
00040 {
00041   alpha = params->get("alpha", 1.0);
00042   beta = params->get("beta", 1.0);
00043   D1 = params->get("D1", 1.0);
00044   D2 = params->get("D2", 1.0);
00045 }
00046 
00047 FEApp::BrusselatorProblem::
00048 ~BrusselatorProblem()
00049 {
00050 }
00051 
00052 unsigned int
00053 FEApp::BrusselatorProblem::
00054 numEquations() const
00055 {
00056   return 2;
00057 }
00058 
00059 void
00060 FEApp::BrusselatorProblem::
00061 buildProblem(const Epetra_Map& dofMap,
00062        const Epetra_Map& overlapped_dofMap,
00063        FEApp::AbstractPDE_TemplateManager<ValidTypes>& pdeTM,
00064        std::vector< Teuchos::RCP<FEApp::NodeBC> >& bcs,
00065        const Teuchos::RCP<Epetra_Vector>& u)
00066 {
00067   // Build PDE equations
00068   FEApp::BrusselatorPDE_TemplateBuilder pdeBuilder(alpha, beta, D1, D2, 
00069                paramLib);
00070   pdeTM.buildObjects(pdeBuilder);
00071 
00072   // Build boundary conditions
00073   FEApp::BrusselatorNodeBCStrategy_TemplateBuilder bcBuilder(alpha, beta,
00074                    paramLib);
00075   int left_node = dofMap.MinAllGID();
00076   int right_node = 
00077     (dofMap.MaxAllGID() - dofMap.MinAllGID())/2 + dofMap.MinAllGID();
00078   bcs.resize(2);
00079   bcs[0] = Teuchos::rcp(new FEApp::NodeBC(dofMap, overlapped_dofMap,
00080             left_node, 2, bcBuilder));
00081   bcs[1] = Teuchos::rcp(new FEApp::NodeBC(dofMap, overlapped_dofMap,
00082             right_node, 2, bcBuilder));
00083 
00084   // Build initial solution
00085 //   for (int i=0; i<u->MyLength()/2; i++) {
00086 //     (*u)[2*i]   = alpha;
00087 //     (*u)[2*i+1] = beta/alpha;
00088 //   }
00089   u->PutScalar(0.0);
00090 }
00091 

Generated on Tue Oct 20 12:55:02 2009 for Sacado Package Browser (Single Doxygen Collection) by doxygen 1.4.7