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

SchwarzMultiscaleProblem.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 "SchwarzMultiscaleProblem.hpp"
00007 #include "Albany_Utils.hpp"
00008 #include "Albany_ProblemUtils.hpp"
00009 #include "PHAL_AlbanyTraits.hpp"
00010 
00011 //------------------------------------------------------------------------------
00012 Albany::SchwarzMultiscaleProblem::
00013 SchwarzMultiscaleProblem(
00014     Teuchos::RCP<Teuchos::ParameterList> const & params,
00015     Teuchos::RCP<ParamLib> const & param_lib,
00016     int const num_dims,
00017     Teuchos::RCP<const Epetra_Comm> const & comm) :
00018   Albany::AbstractProblem(params, param_lib),
00019   have_source_(false),
00020   num_dims_(num_dims),
00021   num_pts_(0),
00022   num_nodes_(0),
00023   num_vertices_(0)
00024 {
00025 
00026   std::string &
00027   method = params->get("Name", "Mechanics ");
00028 
00029   *out << "Problem Name = " << method << '\n';
00030 
00031   bool
00032   invalid_material_DB(true);
00033   if (params->isType<std::string>("MaterialDB Filename")) {
00034     invalid_material_DB = false;
00035     std::string
00036     filename = params->get<std::string>("MaterialDB Filename");
00037     material_db_ = Teuchos::rcp(new QCAD::MaterialDatabase(filename, comm));
00038   }
00039 
00040   TEUCHOS_TEST_FOR_EXCEPTION(
00041       invalid_material_DB,
00042       std::logic_error,
00043       "SchwarzMultiscale Problem Requires a Material Database"
00044   );
00045 
00046 
00047   // Compute number of equations
00048   int
00049   num_eq = num_dims_;
00050 
00051   this->setNumEquations(num_eq);
00052 
00053   //the following function returns the problem information required for
00054   //setting the rigid body modes (RBMs)
00055   int number_PDEs = neq;
00056   int number_elasticity_dimensions = spatialDimension();
00057   int number_scalar_dimensions = neq - spatialDimension();
00058   int null_space_dimensions = 0;
00059 
00060   switch (number_elasticity_dimensions) {
00061   default:
00062     TEUCHOS_TEST_FOR_EXCEPTION(
00063         true, std::logic_error,
00064         "Invalid number of dimensions"
00065     );
00066     break;
00067   case 1:
00068     null_space_dimensions = 0;
00069     break;
00070   case 2:
00071     null_space_dimensions = 3;
00072     break;
00073   case 3:
00074     null_space_dimensions = 6;
00075     break;
00076   }
00077 
00078   rigidBodyModes->setParameters(
00079       number_PDEs,
00080       number_elasticity_dimensions,
00081       number_scalar_dimensions,
00082       null_space_dimensions
00083   );
00084 
00085 }
00086 
00087 //
00088 //
00089 //
00090 Albany::SchwarzMultiscaleProblem::
00091 ~SchwarzMultiscaleProblem()
00092 {
00093 }
00094 
00095 //
00096 //
00097 //
00098 void
00099 Albany::SchwarzMultiscaleProblem::
00100 buildProblem(
00101     Teuchos::ArrayRCP<Teuchos::RCP<Albany::MeshSpecsStruct> > mesh_specs,
00102     Albany::StateManager & state_mgr)
00103 {
00104   // Construct All Phalanx Evaluators
00105   int
00106   physSets = mesh_specs.size();
00107   std::cout << "Num MeshSpecs: " << physSets << '\n';
00108   fm.resize(physSets);
00109 
00110   std::cout << "Calling SchwarzMultiscaleProblem::buildEvaluators" << '\n';
00111   for (int ps = 0; ps < physSets; ++ps) {
00112 
00113     std::string const
00114     eb_name = mesh_specs[ps]->ebName;
00115 
00116     std::string const
00117     ob_str = "Overlap Block";
00118 
00119     bool const
00120     is_ob = matDB().isElementBlockParam(eb_name, ob_str);
00121 
00122     if (is_ob == true) {
00123       bool const
00124       ebp_ob = matDB().getElementBlockParam<bool>(eb_name, ob_str);
00125       overlap_map_.insert(std::make_pair(eb_name, ebp_ob));
00126     }
00127 
00128     fm[ps]  = Teuchos::rcp(new PHX::FieldManager<PHAL::AlbanyTraits>);
00129     buildEvaluators(
00130         *fm[ps],
00131         *mesh_specs[ps],
00132         state_mgr,
00133         BUILD_RESID_FM,
00134         Teuchos::null
00135     );
00136   }
00137   constructDirichletEvaluators(*mesh_specs[0]);
00138 }
00139 
00140 //
00141 //
00142 //
00143 Teuchos::Array<Teuchos::RCP<const PHX::FieldTag> >
00144 Albany::SchwarzMultiscaleProblem::
00145 buildEvaluators(
00146     PHX::FieldManager<PHAL::AlbanyTraits> & fm0,
00147     Albany::MeshSpecsStruct const & mesh_specs,
00148     Albany::StateManager & state_mgr,
00149     Albany::FieldManagerChoice fm_choice,
00150     Teuchos::RCP<Teuchos::ParameterList> const & response_list)
00151 {
00152   // Call constructeEvaluators<EvalT>(*rfm[0], *mesh_specs[0], state_mgr);
00153   // for each EvalT in PHAL::AlbanyTraits::BEvalTypes
00154   ConstructEvaluatorsOp<SchwarzMultiscaleProblem>
00155     op(
00156         *this,
00157         fm0,
00158         mesh_specs,
00159         state_mgr,
00160         fm_choice,
00161         response_list
00162     );
00163   boost::mpl::for_each<PHAL::AlbanyTraits::BEvalTypes>(op);
00164   return *op.tags;
00165 }
00166 
00167 //
00168 //
00169 //
00170 void
00171 Albany::SchwarzMultiscaleProblem::
00172 constructDirichletEvaluators(Albany::MeshSpecsStruct const & mesh_specs)
00173 {
00174 
00175   // Construct Dirichlet evaluators for all nodesets and names
00176   std::vector<std::string>
00177   dirichletNames(neq);
00178 
00179   int
00180   index = 0;
00181 
00182   dirichletNames[index++] = "X";
00183   if (neq>1) dirichletNames[index++] = "Y";
00184   if (neq>2) dirichletNames[index++] = "Z";
00185 
00186   Albany::BCUtils<Albany::DirichletTraits> dirUtils;
00187   dfm = dirUtils.constructBCEvaluators(
00188       mesh_specs.nsNames,
00189       dirichletNames,
00190       this->params,
00191       this->paramLib
00192   );
00193 }
00194 //------------------------------------------------------------------------------
00195 Teuchos::RCP<const Teuchos::ParameterList>
00196 Albany::SchwarzMultiscaleProblem::
00197 getValidProblemParameters() const
00198 {
00199   Teuchos::RCP<Teuchos::ParameterList> valid_pl =
00200     this->getGenericProblemParams("ValidSchwarzMultiscaleProblemParams");
00201 
00202   valid_pl->set<std::string>(
00203       "MaterialDB Filename",
00204       "materials.xml",
00205       "Filename of material database xml file"
00206   );
00207 
00208   return valid_pl;
00209 }
00210 
00211 //------------------------------------------------------------------------------
00212 void
00213 Albany::SchwarzMultiscaleProblem::
00214 getAllocatedStates(
00215    Teuchos::ArrayRCP<Teuchos::ArrayRCP<Teuchos::RCP<FC> > > old_state,
00216    Teuchos::ArrayRCP<Teuchos::ArrayRCP<Teuchos::RCP<FC> > > new_state
00217                    ) const
00218 {
00219   old_state = old_state_;
00220   new_state = new_state_;
00221 }

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