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

FELIX_StokesFO.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 "FELIX_StokesFO.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 #include "Albany_ProblemUtils.hpp"
00015 #include <string>
00016 
00017 
00018 FELIX::StokesFO::
00019 StokesFO( const Teuchos::RCP<Teuchos::ParameterList>& params_,
00020              const Teuchos::RCP<ParamLib>& paramLib_,
00021              const int numDim_) :
00022   Albany::AbstractProblem(params_, paramLib_),
00023   numDim(numDim_)
00024 {
00025   neq = 2; //FELIX FO Stokes system is a system of 2 PDEs
00026 
00027   // Set the num PDEs for the null space object to pass to ML
00028   this->rigidBodyModes->setNumPDEs(neq);
00029 
00030   // Need to allocate a fields in mesh database
00031   this->requirements.push_back("Surface Height");
00032   this->requirements.push_back("Temperature");
00033   this->requirements.push_back("Basal Friction");
00034   this->requirements.push_back("Thickness");
00035   this->requirements.push_back("Flow Factor");
00036   this->requirements.push_back("Surface Velocity");
00037   this->requirements.push_back("Velocity RMS");
00038 }
00039 
00040 FELIX::StokesFO::
00041 ~StokesFO()
00042 {
00043 }
00044 
00045 void
00046 FELIX::StokesFO::
00047 buildProblem(
00048   Teuchos::ArrayRCP<Teuchos::RCP<Albany::MeshSpecsStruct> >  meshSpecs,
00049   Albany::StateManager& stateMgr)
00050 {
00051   using Teuchos::rcp;
00052 
00053  /* Construct All Phalanx Evaluators */
00054   TEUCHOS_TEST_FOR_EXCEPTION(meshSpecs.size()!=1,std::logic_error,"Problem supports one Material Block");
00055   fm.resize(1);
00056   fm[0]  = rcp(new PHX::FieldManager<PHAL::AlbanyTraits>);
00057   buildEvaluators(*fm[0], *meshSpecs[0], stateMgr, Albany::BUILD_RESID_FM, 
00058       Teuchos::null);
00059   constructDirichletEvaluators(*meshSpecs[0]);
00060   
00061   if(meshSpecs[0]->ssNames.size() > 0) // Build a sideset evaluator if sidesets are present
00062      constructNeumannEvaluators(meshSpecs[0]);
00063 }
00064 
00065 Teuchos::Array< Teuchos::RCP<const PHX::FieldTag> >
00066 FELIX::StokesFO::
00067 buildEvaluators(
00068   PHX::FieldManager<PHAL::AlbanyTraits>& fm0,
00069   const Albany::MeshSpecsStruct& meshSpecs,
00070   Albany::StateManager& stateMgr,
00071   Albany::FieldManagerChoice fmchoice,
00072   const Teuchos::RCP<Teuchos::ParameterList>& responseList)
00073 {
00074   // Call constructeEvaluators<EvalT>(*rfm[0], *meshSpecs[0], stateMgr);
00075   // for each EvalT in PHAL::AlbanyTraits::BEvalTypes
00076   Albany::ConstructEvaluatorsOp<StokesFO> op(
00077     *this, fm0, meshSpecs, stateMgr, fmchoice, responseList);
00078   boost::mpl::for_each<PHAL::AlbanyTraits::BEvalTypes>(op);
00079   return *op.tags;
00080 }
00081 
00082 void
00083 FELIX::StokesFO::constructDirichletEvaluators(
00084         const Albany::MeshSpecsStruct& meshSpecs)
00085 {
00086    // Construct Dirichlet evaluators for all nodesets and names
00087    std::vector<std::string> dirichletNames(neq);
00088    for (int i=0; i<neq; i++) {
00089      std::stringstream s; s << "U" << i;
00090      dirichletNames[i] = s.str();
00091    }
00092    Albany::BCUtils<Albany::DirichletTraits> dirUtils;
00093    dfm = dirUtils.constructBCEvaluators(meshSpecs.nsNames, dirichletNames,
00094                                           this->params, this->paramLib);
00095 }
00096 
00097 // Neumann BCs
00098 void
00099 FELIX::StokesFO::constructNeumannEvaluators(const Teuchos::RCP<Albany::MeshSpecsStruct>& meshSpecs)
00100 {
00101 
00102    // Note: we only enter this function if sidesets are defined in the mesh file
00103    // i.e. meshSpecs.ssNames.size() > 0
00104 
00105    Albany::BCUtils<Albany::NeumannTraits> nbcUtils;
00106 
00107    // Check to make sure that Neumann BCs are given in the input file
00108 
00109    if(!nbcUtils.haveBCSpecified(this->params)) {
00110       return;
00111    }
00112 
00113 
00114    // Construct BC evaluators for all side sets and names
00115    // Note that the string index sets up the equation offset, so ordering is important
00116 
00117    std::vector<std::string> neumannNames(neq + 1);
00118    Teuchos::Array<Teuchos::Array<int> > offsets;
00119    offsets.resize(neq + 1);
00120 
00121    neumannNames[0] = "U0";
00122    offsets[0].resize(1);
00123    offsets[0][0] = 0;
00124    offsets[neq].resize(neq);
00125    offsets[neq][0] = 0;
00126 
00127    if (neq>1){
00128       neumannNames[1] = "U1";
00129       offsets[1].resize(1);
00130       offsets[1][0] = 1;
00131       offsets[neq][1] = 1;
00132    }
00133 
00134    if (neq>2){
00135      neumannNames[2] = "U2";
00136       offsets[2].resize(1);
00137       offsets[2][0] = 2;
00138       offsets[neq][2] = 2;
00139    }
00140 
00141    neumannNames[neq] = "all";
00142 
00143    // Construct BC evaluators for all possible names of conditions
00144    // Should only specify flux vector components (dCdx, dCdy, dCdz), or dCdn, not both
00145    std::vector<std::string> condNames(5); //(dCdx, dCdy, dCdz), dCdn, basal, P
00146    Teuchos::ArrayRCP<std::string> dof_names(1);
00147      dof_names[0] = "Velocity";
00148 
00149    // Note that sidesets are only supported for two and 3D currently
00150    if(numDim == 2)
00151     condNames[0] = "(dFluxdx, dFluxdy)";
00152    else if(numDim == 3)
00153     condNames[0] = "(dFluxdx, dFluxdy, dFluxdz)";
00154    else
00155     TEUCHOS_TEST_FOR_EXCEPTION(true, Teuchos::Exceptions::InvalidParameter,
00156        std::endl << "Error: Sidesets only supported in 2 and 3D." << std::endl);
00157 
00158    condNames[1] = "dFluxdn";
00159    condNames[2] = "basal";
00160    condNames[3] = "P";
00161    condNames[4] = "lateral";
00162 
00163    nfm.resize(1); // FELIX problem only has one element block
00164 
00165    nfm[0] = nbcUtils.constructBCEvaluators(meshSpecs, neumannNames, dof_names, true, 0,
00166                                           condNames, offsets, dl,
00167                                           this->params, this->paramLib);
00168 
00169 
00170 }
00171 
00172 Teuchos::RCP<const Teuchos::ParameterList>
00173 FELIX::StokesFO::getValidProblemParameters() const
00174 {
00175   Teuchos::RCP<Teuchos::ParameterList> validPL =
00176     this->getGenericProblemParams("ValidStokesFOProblemParams");
00177 
00178   validPL->sublist("FELIX Viscosity", false, "");
00179   validPL->sublist("Equation Set", false, "");
00180   validPL->sublist("Body Force", false, "");
00181   return validPL;
00182 }
00183 

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