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

HydMorphProblem.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 
00007 #include "HydMorphProblem.hpp"
00008 
00009 #include "Intrepid_FieldContainer.hpp"
00010 #include "Intrepid_DefaultCubatureFactory.hpp"
00011 #include "Shards_CellTopology.hpp"
00012 #include "PHAL_FactoryTraits.hpp"
00013 #include "Albany_Utils.hpp"
00014 
00015 
00016 Albany::HydMorphProblem::
00017 HydMorphProblem( const Teuchos::RCP<Teuchos::ParameterList>& params_,
00018              const Teuchos::RCP<ParamLib>& paramLib_,
00019              const int numDim_,
00020              const Teuchos::RCP<const Epetra_Comm>& comm_) :
00021   Albany::AbstractProblem(params_, paramLib_),
00022   numDim(numDim_),
00023   comm(comm_)
00024 {
00025 
00026   this->setNumEquations(2);
00027 
00028   if(params->isType<std::string>("MaterialDB Filename")){
00029 
00030     std::string mtrlDbFilename = params->get<std::string>("MaterialDB Filename");
00031  // Create Material Database
00032     materialDB = Teuchos::rcp(new QCAD::MaterialDatabase(mtrlDbFilename, comm));
00033 
00034   }
00035 
00036 
00037 }
00038 
00039 Albany::HydMorphProblem::
00040 ~HydMorphProblem()
00041 {
00042 }
00043 
00044 void
00045 Albany::HydMorphProblem::
00046 buildProblem(
00047   Teuchos::ArrayRCP<Teuchos::RCP<Albany::MeshSpecsStruct> >  meshSpecs,
00048   Albany::StateManager& stateMgr)
00049 {
00050 
00051   /* Construct All Phalanx Evaluators */
00052   int physSets = meshSpecs.size();
00053   std::cout << "HydMorphology Problem 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,
00059                     Teuchos::null);
00060   }
00061 
00062 
00063 
00064   if(meshSpecs[0]->nsNames.size() > 0) // Build a nodeset evaluator if nodesets are present
00065 
00066     constructDirichletEvaluators(meshSpecs[0]->nsNames);
00067 
00068   if(meshSpecs[0]->ssNames.size() > 0) // Build a sideset evaluator if sidesets are present
00069 
00070     constructNeumannEvaluators(meshSpecs[0]);
00071 
00072 
00073 }
00074 
00075 Teuchos::Array<Teuchos::RCP<const PHX::FieldTag> >
00076 Albany::HydMorphProblem::
00077 buildEvaluators(
00078   PHX::FieldManager<PHAL::AlbanyTraits>& fm0,
00079   const Albany::MeshSpecsStruct& meshSpecs,
00080   Albany::StateManager& stateMgr,
00081   Albany::FieldManagerChoice fmchoice,
00082   const Teuchos::RCP<Teuchos::ParameterList>& responseList)
00083 {
00084   // Call constructEvaluators<EvalT>(*rfm[0], *meshSpecs[0], stateMgr);
00085   // for each EvalT in PHAL::AlbanyTraits::BEvalTypes
00086   ConstructEvaluatorsOp<HydMorphProblem> op(
00087     *this, fm0, meshSpecs, stateMgr, fmchoice, responseList);
00088   boost::mpl::for_each<PHAL::AlbanyTraits::BEvalTypes>(op);
00089   return *op.tags;
00090 }
00091 
00092 // Dirichlet BCs
00093 void
00094 Albany::HydMorphProblem::constructDirichletEvaluators(const std::vector<std::string>& nodeSetIDs)
00095 {
00096    // Construct BC evaluators for all node sets and names
00097    std::vector<std::string> bcNames(neq);
00098    bcNames[0] = "T";
00099    bcNames[1] = "Ch";
00100 
00101    Albany::BCUtils<Albany::DirichletTraits> bcUtils;
00102    dfm = bcUtils.constructBCEvaluators(nodeSetIDs, bcNames,
00103                                           this->params, this->paramLib);
00104 }
00105 
00106 // Neumann BCs
00107 void
00108 Albany::HydMorphProblem::constructNeumannEvaluators(
00109         const Teuchos::RCP<Albany::MeshSpecsStruct>& meshSpecs)
00110 {
00111    // Note: we only enter this function if sidesets are defined in the mesh file
00112    // i.e. meshSpecs.ssNames.size() > 0
00113 
00114    Albany::BCUtils<Albany::NeumannTraits> neuUtils;
00115 
00116    // Check to make sure that Neumann BCs are given in the input file
00117 
00118    if(!neuUtils.haveBCSpecified(this->params))
00119 
00120       return;
00121 
00122    // Construct BC evaluators for all side sets and names
00123    // Note that the string index sets up the equation offset, so ordering is important
00124    std::vector<std::string> neumannNames(neq);
00125    Teuchos::Array<Teuchos::Array<int> > offsets;
00126    offsets.resize(neq+1);
00127 
00128    neumannNames[0] = "T";
00129    neumannNames[1] = "Ch";
00130    offsets[0].resize(1);
00131    offsets[0][0] = 0;
00132    offsets[1].resize(2);
00133    offsets[1][0] = 0;
00134    offsets[1][1] = 1;
00135 
00136    if (numDim>1){
00137       neumannNames[1] = "Ty";
00138       offsets[1].resize(1);
00139       offsets[1][0] = 1;
00140       offsets[neq][1] = 1;
00141    }
00142 
00143    if (numDim>2){
00144      neumannNames[2] = "Tz";
00145       offsets[2].resize(1);
00146       offsets[2][0] = 2;
00147       offsets[neq][2] = 2;
00148    }
00149 
00150    neumannNames[numDim] = "cFlux";
00151    offsets[numDim].resize(1);
00152    offsets[numDim][0] = numDim;
00153    offsets[neq][numDim] = numDim;
00154 
00155    neumannNames[numDim + 1] = "wFlux";
00156    offsets[numDim+1].resize(1);
00157    offsets[numDim+1][0] = numDim+1;
00158    offsets[neq][numDim+1] = numDim+1;
00159 
00160    neumannNames[neq] = "all";
00161 
00162    // Construct BC evaluators for all possible names of conditions
00163    // Should only specify flux vector components (dudx, dudy, dudz), or dudn, not both
00164    std::vector<std::string> condNames(3); //dudx, dudy, dudz, dudn,
00165    Teuchos::ArrayRCP<std::string> dof_names(1);
00166      dof_names[0] = "Displacement";
00167 
00168    // Note that sidesets are only supported for two and 3D currently
00169    if(numDim == 2)
00170     condNames[0] = "(dudx, dudy)";
00171    else if(numDim == 3)
00172     condNames[0] = "(dudx, dudy, dudz)";
00173    else
00174     TEUCHOS_TEST_FOR_EXCEPTION(true, Teuchos::Exceptions::InvalidParameter,
00175        std::endl << "Error: Sidesets only supported in 2 and 3D." << std::endl);
00176 
00177    condNames[1] = "dudn";
00178    condNames[2] = "P";
00179 
00180    nfm.resize(1); // Elasticity problem only has one element block
00181 
00182    nfm[0] = neuUtils.constructBCEvaluators(meshSpecs, neumannNames, dof_names, true, 0,
00183                                           condNames, offsets, dl,
00184                                           this->params, this->paramLib);
00185 
00186 }
00187 
00188 Teuchos::RCP<const Teuchos::ParameterList>
00189 Albany::HydMorphProblem::getValidProblemParameters() const
00190 {
00191   Teuchos::RCP<Teuchos::ParameterList> validPL =
00192     this->getGenericProblemParams("ValidHydMorphProblemParams");
00193 
00194   Teuchos::Array<int> defaultPeriod;
00195   validPL->sublist("Thermal Conductivity", false, "");
00196   validPL->sublist("Hydrogen Conductivity", false, "");
00197   validPL->set<bool>("Have Rho Cp", false, "Flag to indicate if rhoCp is used");
00198   validPL->set<std::string>("MaterialDB Filename","materials.xml","Filename of material database xml file");
00199 
00200 
00201   return validPL;
00202 }
00203 

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