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

Aeras_ShallowWaterProblem.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 "Aeras_ShallowWaterProblem.hpp"
00008 
00009 #include "Intrepid_FieldContainer.hpp"
00010 #include "Shards_CellTopology.hpp"
00011 #include "PHAL_FactoryTraits.hpp"
00012 #include "Albany_Utils.hpp"
00013 #include "Albany_ProblemUtils.hpp"
00014 #include <string>
00015 
00016 
00017 Aeras::ShallowWaterProblem::
00018 ShallowWaterProblem( const Teuchos::RCP<Teuchos::ParameterList>& params_,
00019              const Teuchos::RCP<ParamLib>& paramLib_,
00020              const int spatialDim_) :
00021   Albany::AbstractProblem(params_, paramLib_),
00022   spatialDim(spatialDim_)
00023 {
00024   TEUCHOS_TEST_FOR_EXCEPTION(spatialDim!=2 && spatialDim!=3,std::logic_error,"Shallow water problem is only written for 2 or 3D.");
00025   // Set number of scalar equation per node, neq,  based on spatialDim
00026   if      (spatialDim==2) { modelDim=2; neq=3; } // Planar 2D problem
00027   else if (spatialDim==3) { modelDim=2; neq=3; } // 2D shells embedded in 3D
00028 
00029   // Set the num PDEs for the null space object to pass to ML
00030   this->rigidBodyModes->setNumPDEs(neq);
00031 }
00032 
00033 Aeras::ShallowWaterProblem::
00034 ~ShallowWaterProblem()
00035 {
00036 }
00037 
00038 void
00039 Aeras::ShallowWaterProblem::
00040 buildProblem(
00041   Teuchos::ArrayRCP<Teuchos::RCP<Albany::MeshSpecsStruct> >  meshSpecs,
00042   Albany::StateManager& stateMgr)
00043 {
00044   using Teuchos::rcp;
00045 
00046  /* Construct All Phalanx Evaluators */
00047   TEUCHOS_TEST_FOR_EXCEPTION(meshSpecs.size()!=1,std::logic_error,"Problem supports one Material Block");
00048   fm.resize(1);
00049   fm[0]  = rcp(new PHX::FieldManager<PHAL::AlbanyTraits>);
00050   buildEvaluators(*fm[0], *meshSpecs[0], stateMgr, Albany::BUILD_RESID_FM, 
00051       Teuchos::null);
00052   constructDirichletEvaluators(*meshSpecs[0]);
00053   
00054   if(meshSpecs[0]->ssNames.size() > 0) // Build a sideset evaluator if sidesets are present
00055      constructNeumannEvaluators(meshSpecs[0]);
00056 }
00057 
00058 Teuchos::Array< Teuchos::RCP<const PHX::FieldTag> >
00059 Aeras::ShallowWaterProblem::
00060 buildEvaluators(
00061   PHX::FieldManager<PHAL::AlbanyTraits>& fm0,
00062   const Albany::MeshSpecsStruct& meshSpecs,
00063   Albany::StateManager& stateMgr,
00064   Albany::FieldManagerChoice fmchoice,
00065   const Teuchos::RCP<Teuchos::ParameterList>& responseList)
00066 {
00067   // Call constructeEvaluators<EvalT>(*rfm[0], *meshSpecs[0], stateMgr);
00068   // for each EvalT in PHAL::AlbanyTraits::BEvalTypes
00069   Albany::ConstructEvaluatorsOp<ShallowWaterProblem> op(
00070     *this, fm0, meshSpecs, stateMgr, fmchoice, responseList);
00071   boost::mpl::for_each<PHAL::AlbanyTraits::BEvalTypes>(op);
00072   return *op.tags;
00073 }
00074 
00075 void
00076 Aeras::ShallowWaterProblem::constructDirichletEvaluators(
00077         const Albany::MeshSpecsStruct& meshSpecs)
00078 {
00079    // Construct Dirichlet evaluators for all nodesets and names
00080    std::vector<std::string> dirichletNames(neq);
00081    dirichletNames[0] = "Depth";
00082    dirichletNames[1] = "Vx";
00083    dirichletNames[2] = "Vy";
00084    Albany::BCUtils<Albany::DirichletTraits> dirUtils;
00085    dfm = dirUtils.constructBCEvaluators(meshSpecs.nsNames, dirichletNames,
00086                                           this->params, this->paramLib);
00087 }
00088 
00089 // Neumann BCs
00090 void
00091 Aeras::ShallowWaterProblem::constructNeumannEvaluators(const Teuchos::RCP<Albany::MeshSpecsStruct>& meshSpecs)
00092 {
00093 
00094    // Note: we only enter this function if sidesets are defined in the mesh file
00095    // i.e. meshSpecs.ssNames.size() > 0
00096 
00097    Albany::BCUtils<Albany::NeumannTraits> nbcUtils;
00098 
00099    // Check to make sure that Neumann BCs are given in the input file
00100 
00101    if(!nbcUtils.haveBCSpecified(this->params)) {
00102       return;
00103    }
00104 
00105 
00106    // Construct BC evaluators for all side sets and names
00107    // Note that the string index sets up the equation offset, so ordering is important
00108 
00109    std::vector<std::string> neumannNames(neq + 1);
00110    Teuchos::Array<Teuchos::Array<int> > offsets;
00111    offsets.resize(neq + 1);
00112 
00113    neumannNames[0] = "Depth";
00114    offsets[0].resize(1);
00115    offsets[0][0] = 0;
00116    offsets[neq].resize(neq);
00117    offsets[neq][0] = 0;
00118 
00119    if (neq>1){
00120       neumannNames[1] = "Vx";
00121       offsets[1].resize(1);
00122       offsets[1][0] = 1;
00123       offsets[neq][1] = 1;
00124    }
00125 
00126    if (neq>2){
00127      neumannNames[2] = "Vy";
00128       offsets[2].resize(1);
00129       offsets[2][0] = 2;
00130       offsets[neq][2] = 2;
00131    }
00132 
00133    neumannNames[neq] = "all";
00134 
00135    // Construct BC evaluators for all possible names of conditions
00136    // Should only specify flux vector components (dUdx, dUdy, dUdz)
00137    std::vector<std::string> condNames(1); //(dUdx, dUdy, dUdz)
00138    Teuchos::ArrayRCP<std::string> dof_names(1);
00139      dof_names[0] = "Velocity";
00140 
00141 //   condNames[1] = "dFluxdn";
00142 //   condNames[2] = "basal";
00143 //   condNames[3] = "P";
00144 //   condNames[4] = "lateral";
00145 
00146    nfm.resize(1); // Aeras problem only has one element block
00147 
00148    nfm[0] = nbcUtils.constructBCEvaluators(meshSpecs, neumannNames, dof_names, true, 0,
00149                                           condNames, offsets, dl,
00150                                           this->params, this->paramLib);
00151 
00152 
00153 }
00154 
00155 Teuchos::RCP<const Teuchos::ParameterList>
00156 Aeras::ShallowWaterProblem::getValidProblemParameters() const
00157 {
00158   Teuchos::RCP<Teuchos::ParameterList> validPL =
00159     this->getGenericProblemParams("ValidShallowWaterProblemParams");
00160 
00161   validPL->sublist("Shallow Water Problem", false, "");
00162   validPL->sublist("Aeras Surface Height", false, "");
00163   return validPL;
00164 }
00165 

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