Go to the documentation of this file.00001
00002
00003
00004
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
00026 if (spatialDim==2) { modelDim=2; neq=3; }
00027 else if (spatialDim==3) { modelDim=2; neq=3; }
00028
00029
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
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)
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
00068
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
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
00090 void
00091 Aeras::ShallowWaterProblem::constructNeumannEvaluators(const Teuchos::RCP<Albany::MeshSpecsStruct>& meshSpecs)
00092 {
00093
00094
00095
00096
00097 Albany::BCUtils<Albany::NeumannTraits> nbcUtils;
00098
00099
00100
00101 if(!nbcUtils.haveBCSpecified(this->params)) {
00102 return;
00103 }
00104
00105
00106
00107
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
00136
00137 std::vector<std::string> condNames(1);
00138 Teuchos::ArrayRCP<std::string> dof_names(1);
00139 dof_names[0] = "Velocity";
00140
00141
00142
00143
00144
00145
00146 nfm.resize(1);
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