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

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

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