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

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

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