00001
00002
00003
00004
00005
00006
00007 #include "Albany_ComprNSProblem.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 Albany::ComprNSProblem::
00019 ComprNSProblem( 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
00026 neq = params_->get("Number of PDE Equations", numDim);
00027 }
00028
00029 Albany::ComprNSProblem::
00030 ~ComprNSProblem()
00031 {
00032 }
00033
00034 void
00035 Albany::ComprNSProblem::
00036 buildProblem(
00037 Teuchos::ArrayRCP<Teuchos::RCP<Albany::MeshSpecsStruct> > meshSpecs,
00038 Albany::StateManager& stateMgr)
00039 {
00040 using Teuchos::rcp;
00041
00042
00043 TEUCHOS_TEST_FOR_EXCEPTION(meshSpecs.size()!=1,std::logic_error,"Problem supports one Material Block");
00044 fm.resize(1);
00045 fm[0] = rcp(new PHX::FieldManager<PHAL::AlbanyTraits>);
00046 buildEvaluators(*fm[0], *meshSpecs[0], stateMgr, BUILD_RESID_FM,
00047 Teuchos::null);
00048 constructDirichletEvaluators(*meshSpecs[0]);
00049
00050 if(meshSpecs[0]->ssNames.size() > 0)
00051 constructNeumannEvaluators(meshSpecs[0]);
00052 }
00053
00054 Teuchos::Array< Teuchos::RCP<const PHX::FieldTag> >
00055 Albany::ComprNSProblem::
00056 buildEvaluators(
00057 PHX::FieldManager<PHAL::AlbanyTraits>& fm0,
00058 const Albany::MeshSpecsStruct& meshSpecs,
00059 Albany::StateManager& stateMgr,
00060 Albany::FieldManagerChoice fmchoice,
00061 const Teuchos::RCP<Teuchos::ParameterList>& responseList)
00062 {
00063
00064
00065 ConstructEvaluatorsOp<ComprNSProblem> op(
00066 *this, fm0, meshSpecs, stateMgr, fmchoice, responseList);
00067 boost::mpl::for_each<PHAL::AlbanyTraits::BEvalTypes>(op);
00068 return *op.tags;
00069 }
00070
00071 void
00072 Albany::ComprNSProblem::constructDirichletEvaluators(
00073 const Albany::MeshSpecsStruct& meshSpecs)
00074 {
00075
00076 std::vector<std::string> dirichletNames(neq);
00077 for (int i=0; i<neq; i++) {
00078 std::stringstream s; s << "qFluct" << i;
00079 dirichletNames[i] = s.str();
00080 }
00081 Albany::BCUtils<Albany::DirichletTraits> dirUtils;
00082 dfm = dirUtils.constructBCEvaluators(meshSpecs.nsNames, dirichletNames,
00083 this->params, this->paramLib);
00084 }
00085
00086
00087 void
00088 Albany::ComprNSProblem::constructNeumannEvaluators(const Teuchos::RCP<Albany::MeshSpecsStruct>& meshSpecs)
00089 {
00090
00091 std::cout << "setting Neumann evaluators" << std::endl;
00092
00093
00094
00095 Albany::BCUtils<Albany::NeumannTraits> nbcUtils;
00096
00097
00098
00099 if(!nbcUtils.haveBCSpecified(this->params)) {
00100 return;
00101 }
00102
00103
00104
00105
00106
00107 std::vector<std::string> neumannNames(neq + 1);
00108 Teuchos::Array<Teuchos::Array<int> > offsets;
00109 offsets.resize(neq + 1);
00110
00111 neumannNames[0] = "qFluct0";
00112 offsets[0].resize(1);
00113 offsets[0][0] = 0;
00114 offsets[neq].resize(neq);
00115 offsets[neq][0] = 0;
00116
00117 if (neq>1){
00118 neumannNames[1] = "qFluct1";
00119 offsets[1].resize(1);
00120 offsets[1][0] = 1;
00121 offsets[neq][1] = 1;
00122 }
00123
00124 if (neq>2){
00125 neumannNames[2] = "qFluct2";
00126 offsets[2].resize(1);
00127 offsets[2][0] = 2;
00128 offsets[neq][2] = 2;
00129 }
00130
00131 if (neq>3){
00132 neumannNames[3] = "qFluct3";
00133 offsets[3].resize(1);
00134 offsets[3][0] = 3;
00135 offsets[neq][3] = 3;
00136 }
00137
00138 if (neq>4){
00139 neumannNames[4] = "qFluct4";
00140 offsets[4].resize(1);
00141 offsets[4][0] = 4;
00142 offsets[neq][4] = 4;
00143 }
00144
00145 neumannNames[neq] = "all";
00146
00147
00148
00149 std::vector<std::string> condNames(2);
00150 Teuchos::ArrayRCP<std::string> dof_names(1);
00151 dof_names[0] = "qFluct";
00152
00153
00154 if(numDim == 2)
00155 condNames[0] = "(dFluxdx, dFluxdy)";
00156 else if(numDim == 3)
00157 condNames[0] = "(dFluxdx, dFluxdy, dFluxdz)";
00158 else
00159 TEUCHOS_TEST_FOR_EXCEPTION(true, Teuchos::Exceptions::InvalidParameter,
00160 std::endl << "Error: Sidesets only supported in 2 and 3D." << std::endl);
00161
00162 condNames[1] = "dFluxdn";
00163
00164 nfm.resize(1);
00165
00166 nfm[0] = nbcUtils.constructBCEvaluators(meshSpecs, neumannNames, dof_names, true, 0,
00167 condNames, offsets, dl,
00168 this->params, this->paramLib);
00169
00170
00171 }
00172
00173
00174 Teuchos::RCP<const Teuchos::ParameterList>
00175 Albany::ComprNSProblem::getValidProblemParameters() const
00176 {
00177 Teuchos::RCP<Teuchos::ParameterList> validPL =
00178 this->getGenericProblemParams("ValidComprNSProblemParams");
00179
00180 validPL->set("Number of PDE Equations", 1, "Number of PDE Equations in ComprNS equation set");
00181 validPL->sublist("Viscosity", false, "");
00182 validPL->sublist("Body Force", false, "");
00183 validPL->sublist("Equation Set", false, "");
00184
00185 return validPL;
00186 }
00187