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

PeridigmProblem.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 PERIDIGMPROBLEM_HPP
00008 #define PERIDIGMPROBLEM_HPP
00009 
00010 #include "Teuchos_RCP.hpp"
00011 #include "Teuchos_ParameterList.hpp"
00012 
00013 #include "Albany_AbstractProblem.hpp"
00014 
00015 #include "Phalanx.hpp"
00016 #include "PHAL_Workset.hpp"
00017 #include "PHAL_Dimension.hpp"
00018 #include "PHAL_AlbanyTraits.hpp"
00019 
00020 namespace Albany {
00021 
00025   class PeridigmProblem : public Albany::AbstractProblem {
00026   public:
00027   
00029     PeridigmProblem(const Teuchos::RCP<Teuchos::ParameterList>& params,
00030                     const Teuchos::RCP<ParamLib>& paramLib,
00031                     const int numEqm,
00032                     const Teuchos::RCP<const Epetra_Comm>& comm);
00033 
00035     virtual ~PeridigmProblem();
00036 
00038     virtual int spatialDimension() const { return numDim; }
00039 
00041     virtual void buildProblem(Teuchos::ArrayRCP<Teuchos::RCP<Albany::MeshSpecsStruct> >  meshSpecs, StateManager& stateMgr);
00042 
00043     // Build evaluators
00044     virtual Teuchos::Array< Teuchos::RCP<const PHX::FieldTag> >
00045     buildEvaluators(
00046       PHX::FieldManager<PHAL::AlbanyTraits>& fm0,
00047       const Albany::MeshSpecsStruct& meshSpecs,
00048       Albany::StateManager& stateMgr,
00049       Albany::FieldManagerChoice fmchoice,
00050       const Teuchos::RCP<Teuchos::ParameterList>& responseList);
00051 
00053     Teuchos::RCP<const Teuchos::ParameterList> getValidProblemParameters() const;
00054 
00055   private:
00056 
00058     PeridigmProblem(const PeridigmProblem&);
00059     
00061     PeridigmProblem& operator=(const PeridigmProblem&);
00062 
00063   public:
00064 
00066     template <typename EvalT> 
00067     Teuchos::RCP<const PHX::FieldTag>
00068     constructEvaluators(
00069       PHX::FieldManager<PHAL::AlbanyTraits>& fm0,
00070       const Albany::MeshSpecsStruct& meshSpecs,
00071       Albany::StateManager& stateMgr,
00072       Albany::FieldManagerChoice fmchoice,
00073       const Teuchos::RCP<Teuchos::ParameterList>& responseList);
00074 
00075     void constructDirichletEvaluators(const Albany::MeshSpecsStruct& meshSpecs);
00076 
00077   protected:
00078 
00080     bool haveSource;
00081     int numDim;
00082     bool haveMatDB;
00083     std::string mtrlDbFilename;
00084     Teuchos::RCP<QCAD::MaterialDatabase> materialDB;
00085     Teuchos::RCP<Teuchos::ParameterList> peridigmParams;
00086   };
00087 
00088 }
00089 
00090 #include "Albany_Utils.hpp"
00091 #include "Albany_ProblemUtils.hpp"
00092 #include "Albany_ResponseUtilities.hpp"
00093 #include "Albany_EvaluatorUtils.hpp"
00094 
00095 #include "PHAL_Source.hpp"
00096 #include "CurrentCoords.hpp"
00097 #include "PeridigmForce.hpp"
00098 #include "PHAL_SaveStateField.hpp"
00099 
00100 template <typename EvalT>
00101 Teuchos::RCP<const PHX::FieldTag>
00102 Albany::PeridigmProblem::constructEvaluators(
00103   PHX::FieldManager<PHAL::AlbanyTraits>& fm0,
00104   const Albany::MeshSpecsStruct& meshSpecs,
00105   Albany::StateManager& stateMgr,
00106   Albany::FieldManagerChoice fieldManagerChoice,
00107   const Teuchos::RCP<Teuchos::ParameterList>& responseList)
00108 {
00109    using Teuchos::RCP;
00110    using Teuchos::rcp;
00111    using Teuchos::ParameterList;
00112    using PHX::DataLayout;
00113    using PHX::MDALayout;
00114    using std::vector;
00115    using std::string;
00116    using PHAL::AlbanyTraits;
00117 
00118   // get the name of the current element block
00119   string elementBlockName = meshSpecs.ebName;
00120 
00121   // WHAT'S IN meshSpecs Albany::MeshSpecsStruct?
00122 
00123    const int worksetSize = meshSpecs.worksetSize;
00124    const int numVertices = 1;
00125    const int numNodes = 1;
00126    const int numQPts = 1;
00127 
00128    *out << "Field Dimensions: Workset=" << worksetSize 
00129         << ", Vertices= " << numVertices
00130         << ", Nodes= " << numNodes
00131         << ", Dim= " << numDim << std::endl;
00132 
00133    // Construct evaluators
00134 
00135    RCP<Albany::Layouts> dataLayout = rcp(new Albany::Layouts(worksetSize, numVertices, numNodes, numQPts, numDim));
00136    TEUCHOS_TEST_FOR_EXCEPTION(dataLayout->vectorAndGradientLayoutsAreEquivalent==false, std::logic_error,
00137                               "Data Layout Usage in Peridigm problems assume vecDim = numDim");
00138    Albany::EvaluatorUtils<EvalT, PHAL::AlbanyTraits> evalUtils(dataLayout);
00139 
00140    Teuchos::ArrayRCP<std::string> dof_name(1), dof_name_dotdot(1), residual_name(1);
00141    dof_name[0] = "Displacement";
00142    dof_name_dotdot[0] = "Displacement_dotdot";
00143    residual_name[0] = "Residual";
00144 
00145    Teuchos::RCP<PHX::Evaluator<AlbanyTraits> > ev;
00146 
00147    bool supportsTransient = false;
00148    { // Solution
00149      if(!supportsTransient)
00150        fm0.template registerEvaluator<EvalT>(evalUtils.constructGatherSolutionEvaluator_noTransient(true, dof_name));
00151      else
00152        fm0.template registerEvaluator<EvalT>(evalUtils.constructGatherSolutionEvaluator(true, dof_name, dof_name_dotdot));
00153    }
00154 
00155    { // Volume
00156      
00157    }
00158 
00159    { // Gather Coord Vec
00160      fm0.template registerEvaluator<EvalT>(evalUtils.constructGatherCoordinateVectorEvaluator());
00161    }
00162 
00163    if (haveSource) { // Source
00164      TEUCHOS_TEST_FOR_EXCEPTION(true, Teuchos::Exceptions::InvalidParameter,
00165         "Error!  Sources not available for Peridigm!");
00166    }
00167 
00168    { // Current Coordinates
00169      RCP<ParameterList> p = rcp(new ParameterList("Current Coordinates"));
00170      p->set<std::string>("Reference Coordinates Name", "Coord Vec");
00171      p->set<std::string>("Displacement Name", "Displacement");
00172      p->set<std::string>("Current Coordinates Name", "Current Coordinates");
00173      ev = rcp(new LCM::CurrentCoords<EvalT, AlbanyTraits>(*p, dataLayout));
00174       fm0.template registerEvaluator<EvalT>(ev);
00175    }
00176 
00177    { // Peridigm Force
00178      RCP<ParameterList> p = rcp(new ParameterList("Force"));
00179 
00180      // Parameter list to be passed to Peridigm object
00181      Teuchos::ParameterList& peridigmParameterList = p->sublist("Peridigm Parameters");
00182      peridigmParameterList = *peridigmParams;
00183 
00184      // Required data layouts
00185      p->set< RCP<DataLayout> >("Node Vector Data Layout", dataLayout->node_vector);    
00186 
00187      // Input
00188      p->set<string>("Reference Coordinates Name", "Coord Vec");
00189      p->set<string>("Current Coordinates Name", "Current Coordinates");
00190 
00191      // Output
00192      p->set<string>("Force Name", "Force");
00193      p->set<string>("Residual Name", "Residual");
00194 
00195      ev = rcp(new LCM::PeridigmForce<EvalT, AlbanyTraits>(*p, dataLayout));
00196      fm0.template registerEvaluator<EvalT>(ev);
00197    }
00198 
00199    { // Scatter Residual
00200      fm0.template registerEvaluator<EvalT>(evalUtils.constructScatterResidualEvaluator(true, residual_name));
00201    }
00202 
00203    if (fieldManagerChoice == Albany::BUILD_RESID_FM)  {
00204      PHX::Tag<typename EvalT::ScalarT> res_tag("Scatter", dataLayout->dummy);
00205      fm0.requireField<EvalT>(res_tag);
00206      return res_tag.clone();
00207    }
00208    else if (fieldManagerChoice == Albany::BUILD_RESPONSE_FM) {
00209      Albany::ResponseUtilities<EvalT, PHAL::AlbanyTraits> respUtils(dataLayout);
00210      return respUtils.constructResponses(fm0, *responseList, stateMgr);
00211    }
00212 
00213    return Teuchos::null;
00214 }
00215 
00216 #endif // PERIDIGMPROBLEM_HPP

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