00001
00002
00003
00004
00005
00006
00007 #include "Albany_HeatProblem.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
00015
00016 Albany::HeatProblem::
00017 HeatProblem( const Teuchos::RCP<Teuchos::ParameterList>& params_,
00018 const Teuchos::RCP<ParamLib>& paramLib_,
00019 const int numDim_,
00020 const Teuchos::RCP<const Epetra_Comm>& comm_) :
00021 Albany::AbstractProblem(params_, paramLib_),
00022 haveSource(false),
00023 haveAbsorption(false),
00024 numDim(numDim_),
00025 comm(comm_)
00026 {
00027 this->setNumEquations(1);
00028
00029 if (numDim==1) periodic = params->get("Periodic BC", false);
00030 else periodic = false;
00031 if (periodic) *out <<" Periodic Boundary Conditions being used." <<std::endl;
00032
00033 haveAbsorption = params->isSublist("Absorption");
00034
00035 if(params->isType<std::string>("MaterialDB Filename")){
00036
00037 std::string mtrlDbFilename = params->get<std::string>("MaterialDB Filename");
00038
00039 materialDB = Teuchos::rcp(new QCAD::MaterialDatabase(mtrlDbFilename, comm));
00040
00041 }
00042
00043
00044 }
00045
00046 Albany::HeatProblem::
00047 ~HeatProblem()
00048 {
00049 }
00050
00051 void
00052 Albany::HeatProblem::
00053 buildProblem(
00054 Teuchos::ArrayRCP<Teuchos::RCP<Albany::MeshSpecsStruct> > meshSpecs,
00055 Albany::StateManager& stateMgr)
00056 {
00057
00058 int physSets = meshSpecs.size();
00059 std::cout << "Heat Problem Num MeshSpecs: " << physSets << std::endl;
00060 fm.resize(physSets);
00061
00062 for (int ps=0; ps<physSets; ps++) {
00063 fm[ps] = Teuchos::rcp(new PHX::FieldManager<PHAL::AlbanyTraits>);
00064 buildEvaluators(*fm[ps], *meshSpecs[ps], stateMgr, BUILD_RESID_FM,
00065 Teuchos::null);
00066 }
00067
00068 if(meshSpecs[0]->nsNames.size() > 0)
00069
00070 constructDirichletEvaluators(meshSpecs[0]->nsNames);
00071
00072 if(meshSpecs[0]->ssNames.size() > 0)
00073
00074 constructNeumannEvaluators(meshSpecs[0]);
00075
00076 }
00077
00078 Teuchos::Array<Teuchos::RCP<const PHX::FieldTag> >
00079 Albany::HeatProblem::
00080 buildEvaluators(
00081 PHX::FieldManager<PHAL::AlbanyTraits>& fm0,
00082 const Albany::MeshSpecsStruct& meshSpecs,
00083 Albany::StateManager& stateMgr,
00084 Albany::FieldManagerChoice fmchoice,
00085 const Teuchos::RCP<Teuchos::ParameterList>& responseList)
00086 {
00087
00088
00089 ConstructEvaluatorsOp<HeatProblem> op(
00090 *this, fm0, meshSpecs, stateMgr, fmchoice, responseList);
00091 boost::mpl::for_each<PHAL::AlbanyTraits::BEvalTypes>(op);
00092 return *op.tags;
00093 }
00094
00095
00096 void
00097 Albany::HeatProblem::constructDirichletEvaluators(const std::vector<std::string>& nodeSetIDs)
00098 {
00099
00100 std::vector<std::string> bcNames(neq);
00101 bcNames[0] = "T";
00102 Albany::BCUtils<Albany::DirichletTraits> bcUtils;
00103 dfm = bcUtils.constructBCEvaluators(nodeSetIDs, bcNames,
00104 this->params, this->paramLib);
00105 }
00106
00107
00108 void
00109 Albany::HeatProblem::constructNeumannEvaluators(const Teuchos::RCP<Albany::MeshSpecsStruct>& meshSpecs)
00110 {
00111
00112
00113
00114 Albany::BCUtils<Albany::NeumannTraits> bcUtils;
00115
00116
00117
00118 if(!bcUtils.haveBCSpecified(this->params))
00119
00120 return;
00121
00122
00123
00124 std::vector<std::string> bcNames(neq);
00125 Teuchos::ArrayRCP<std::string> dof_names(neq);
00126 Teuchos::Array<Teuchos::Array<int> > offsets;
00127 offsets.resize(neq);
00128
00129 bcNames[0] = "T";
00130 dof_names[0] = "Temperature";
00131 offsets[0].resize(1);
00132 offsets[0][0] = 0;
00133
00134
00135
00136
00137 std::vector<std::string> condNames(4);
00138
00139
00140
00141 if(numDim == 2)
00142 condNames[0] = "(dudx, dudy)";
00143 else if(numDim == 3)
00144 condNames[0] = "(dudx, dudy, dudz)";
00145 else
00146 TEUCHOS_TEST_FOR_EXCEPTION(true, Teuchos::Exceptions::InvalidParameter,
00147 std::endl << "Error: Sidesets only supported in 2 and 3D." << std::endl);
00148
00149 condNames[1] = "dudn";
00150
00151 condNames[2] = "scaled jump";
00152
00153 condNames[3] = "robin";
00154
00155 nfm.resize(1);
00156 nfm[0] = bcUtils.constructBCEvaluators(meshSpecs, bcNames, dof_names, false, 0,
00157 condNames, offsets, dl, this->params, this->paramLib, materialDB);
00158
00159 }
00160
00161 Teuchos::RCP<const Teuchos::ParameterList>
00162 Albany::HeatProblem::getValidProblemParameters() const
00163 {
00164 Teuchos::RCP<Teuchos::ParameterList> validPL =
00165 this->getGenericProblemParams("ValidHeatProblemParams");
00166
00167 if (numDim==1)
00168 validPL->set<bool>("Periodic BC", false, "Flag to indicate periodic BC for 1D problems");
00169 validPL->sublist("Thermal Conductivity", false, "");
00170 validPL->set("Convection Velocity", "{0,0,0}", "");
00171 validPL->set<bool>("Have Rho Cp", false, "Flag to indicate if rhoCp is used");
00172 validPL->set<std::string>("MaterialDB Filename","materials.xml","Filename of material database xml file");
00173
00174 return validPL;
00175 }
00176