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

PeridigmProblem.cpp

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 #include "PeridigmProblem.hpp"
00007 #include "Albany_Utils.hpp"
00008 #include "Albany_ProblemUtils.hpp"
00009 
00010 Albany::PeridigmProblem::
00011 PeridigmProblem(const Teuchos::RCP<Teuchos::ParameterList>& params_,
00012                 const Teuchos::RCP<ParamLib>& paramLib_,
00013                 const int numDim_,
00014                 const Teuchos::RCP<const Epetra_Comm>& comm) :
00015   Albany::AbstractProblem(params_, paramLib_, numDim_),
00016   haveSource(false), haveMatDB(false), numDim(numDim_)
00017 {
00018  
00019   std::string& method = params->get("Name", "Peridigm Code Coupling ");
00020   *out << "Problem Name = " << method << std::endl;
00021   peridigmParams = Teuchos::rcpFromRef(params->sublist("Peridigm Parameters", true));
00022 
00023   // Only support 3D analyses
00024   TEUCHOS_TEST_FOR_EXCEPTION(neq != 3,
00025                              Teuchos::Exceptions::InvalidParameter,
00026                              "\nOnly three-dimensional analyses are suppored when coupling with Peridigm.\n");
00027 
00028   // The following function returns the problem information required for setting the rigid body modes (RBMs) for elasticity problems
00029   // written by IK, Feb. 2012
00030   int numScalar = 0;
00031   int nullSpaceDim = 0;
00032   if (numDim == 1) {nullSpaceDim = 0; }
00033   else {
00034     if (numDim == 2) {nullSpaceDim = 3; }
00035     if (numDim == 3) {nullSpaceDim = 6; }
00036   }
00037   rigidBodyModes->setParameters(numDim, numDim, numScalar, nullSpaceDim);
00038 }
00039 
00040 Albany::PeridigmProblem::
00041 ~PeridigmProblem()
00042 {
00043 }
00044 
00045 void
00046 Albany::PeridigmProblem::
00047 buildProblem(
00048   Teuchos::ArrayRCP<Teuchos::RCP<Albany::MeshSpecsStruct> >  meshSpecs,
00049   Albany::StateManager& stateMgr)
00050 {
00051   /* Construct All Phalanx Evaluators */
00052   int physSets = meshSpecs.size();
00053   std::cout << "Peridigm Num MeshSpecs: " << physSets << std::endl;
00054   fm.resize(physSets);
00055 
00056   for (int ps=0; ps<physSets; ps++) {
00057     fm[ps]  = Teuchos::rcp(new PHX::FieldManager<PHAL::AlbanyTraits>);
00058     buildEvaluators(*fm[ps], *meshSpecs[ps], stateMgr, BUILD_RESID_FM, Teuchos::null);
00059   }
00060   constructDirichletEvaluators(*meshSpecs[0]);
00061 }
00062 
00063 Teuchos::Array< Teuchos::RCP<const PHX::FieldTag> >
00064 Albany::PeridigmProblem::
00065 buildEvaluators(
00066   PHX::FieldManager<PHAL::AlbanyTraits>& fm0,
00067   const Albany::MeshSpecsStruct& meshSpecs,
00068   Albany::StateManager& stateMgr,
00069   Albany::FieldManagerChoice fmchoice,
00070   const Teuchos::RCP<Teuchos::ParameterList>& responseList)
00071 {
00072   // Call constructeEvaluators<EvalT>(*rfm[0], meshSpecs, stateMgr);
00073   // for each EvalT in PHAL::AlbanyTraits::BEvalTypes
00074   ConstructEvaluatorsOp<PeridigmProblem> op(*this, fm0, meshSpecs, stateMgr, fmchoice, responseList);
00075   boost::mpl::for_each<PHAL::AlbanyTraits::BEvalTypes>(op);
00076   return *op.tags;
00077 }
00078 
00079 void
00080 Albany::PeridigmProblem::constructDirichletEvaluators(
00081         const Albany::MeshSpecsStruct& meshSpecs)
00082 {
00083    // Construct Dirichlet evaluators for all nodesets and names
00084    std::vector<std::string> dirichletNames(neq);
00085    dirichletNames[0] = "X";
00086    if (neq>1) dirichletNames[1] = "Y";
00087    if (neq>2) dirichletNames[2] = "Z";
00088    Albany::BCUtils<Albany::DirichletTraits> dirUtils;
00089    dfm = dirUtils.constructBCEvaluators(meshSpecs.nsNames, dirichletNames, this->params, this->paramLib);
00090 }
00091 
00092 Teuchos::RCP<const Teuchos::ParameterList>
00093 Albany::PeridigmProblem::getValidProblemParameters() const
00094 {
00095   Teuchos::RCP<Teuchos::ParameterList> validPL =
00096     this->getGenericProblemParams("ValidPeridigmProblemParams");
00097 
00098   validPL->sublist("Peridigm Parameters", false, "The full parameter list that will be passed to Peridigm.");
00099 
00100   return validPL;
00101 }

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