Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007 #ifndef ALBANY_ODEPROBLEM_HPP
00008 #define ALBANY_ODEPROBLEM_HPP
00009
00010 #include "Teuchos_RCP.hpp"
00011 #include "Teuchos_ParameterList.hpp"
00012
00013 #include "Albany_AbstractProblem.hpp"
00014
00015 #include "Phalanx.hpp"
00016 #include "PHAL_Workset.hpp"
00017 #include "PHAL_Dimension.hpp"
00018
00019 namespace Albany {
00020
00025 class ODEProblem : public AbstractProblem {
00026 public:
00027
00029 ODEProblem(const Teuchos::RCP<Teuchos::ParameterList>& params,
00030 const Teuchos::RCP<ParamLib>& paramLib,
00031 const int numDim_);
00032
00034 ~ODEProblem();
00035
00037 virtual int spatialDimension() const { return numDim; }
00038
00040 virtual void buildProblem(
00041 Teuchos::ArrayRCP<Teuchos::RCP<Albany::MeshSpecsStruct> > meshSpecs,
00042 StateManager& stateMgr);
00043
00044
00045 virtual Teuchos::Array< Teuchos::RCP<const PHX::FieldTag> >
00046 buildEvaluators(
00047 PHX::FieldManager<PHAL::AlbanyTraits>& fm0,
00048 const Albany::MeshSpecsStruct& meshSpecs,
00049 Albany::StateManager& stateMgr,
00050 Albany::FieldManagerChoice fmchoice,
00051 const Teuchos::RCP<Teuchos::ParameterList>& responseList);
00052
00054 Teuchos::RCP<const Teuchos::ParameterList> getValidProblemParameters() const;
00055
00056 private:
00057
00059 ODEProblem(const ODEProblem&);
00060
00062 ODEProblem& operator=(const ODEProblem&);
00063
00064 public:
00065
00067 template <typename EvalT> Teuchos::RCP<const PHX::FieldTag>
00068 constructEvaluators(
00069 PHX::FieldManager<PHAL::AlbanyTraits>& fm0,
00070 const Albany::MeshSpecsStruct& meshSpecs,
00071 Albany::StateManager& stateMgr,
00072 Albany::FieldManagerChoice fmchoice,
00073 const Teuchos::RCP<Teuchos::ParameterList>& responseList);
00074
00075 void constructDirichletEvaluators(const Albany::MeshSpecsStruct& meshSpecs);
00076
00077 protected:
00078 int numDim;
00079
00080 };
00081
00082 }
00083
00084 #include "Shards_CellTopology.hpp"
00085 #include "Albany_Utils.hpp"
00086 #include "Albany_ProblemUtils.hpp"
00087 #include "Albany_EvaluatorUtils.hpp"
00088 #include "Albany_ResponseUtilities.hpp"
00089
00090 #include "PHAL_ODEResid.hpp"
00091
00092 template <typename EvalT>
00093 Teuchos::RCP<const PHX::FieldTag>
00094 Albany::ODEProblem::constructEvaluators(
00095 PHX::FieldManager<PHAL::AlbanyTraits>& fm0,
00096 const Albany::MeshSpecsStruct& meshSpecs,
00097 Albany::StateManager& stateMgr,
00098 Albany::FieldManagerChoice fieldManagerChoice,
00099 const Teuchos::RCP<Teuchos::ParameterList>& responseList)
00100 {
00101 using Teuchos::RCP;
00102 using Teuchos::rcp;
00103 using Teuchos::ParameterList;
00104 using PHX::DataLayout;
00105 using PHX::MDALayout;
00106 using std::vector;
00107 using std::string;
00108 using PHAL::AlbanyTraits;
00109
00110 const int numNodes = 1;
00111
00112 const int numVertices = 1;
00113 const int worksetSize = meshSpecs.worksetSize;
00114
00115 *out << "Field Dimensions: Workset=" << worksetSize
00116 << ", Vertices= " << numVertices
00117 << ", Nodes= " << numNodes
00118 << ", Dim= " << numDim << std::endl;
00119
00120 RCP<Albany::Layouts> dl = rcp(new Albany::Layouts(worksetSize,numVertices,numNodes,1,numDim));
00121 Albany::EvaluatorUtils<EvalT, PHAL::AlbanyTraits> evalUtils(dl);
00122 bool supportsTransient=true;
00123
00124
00125 Teuchos::RCP<PHX::Evaluator<AlbanyTraits> > ev;
00126
00127
00128
00129 Teuchos::ArrayRCP<string> dof_names(neq);
00130 dof_names[0] = "X";
00131 dof_names[1] = "Y";
00132
00133 Teuchos::ArrayRCP<string> dof_names_dot(neq);
00134 if (supportsTransient) {
00135 for (int i=0; i<neq; i++) dof_names_dot[i] = dof_names[i]+"_dot";
00136 }
00137
00138 Teuchos::ArrayRCP<string> resid_names(neq);
00139 for (int i=0; i<neq; i++) resid_names[i] = dof_names[i]+" Residual";
00140
00141 if (supportsTransient) fm0.template registerEvaluator<EvalT>
00142 (evalUtils.constructGatherSolutionEvaluator(false, dof_names, dof_names_dot));
00143 else fm0.template registerEvaluator<EvalT>
00144 (evalUtils.constructGatherSolutionEvaluator_noTransient(false, dof_names));
00145
00146 fm0.template registerEvaluator<EvalT>
00147 (evalUtils.constructScatterResidualEvaluator(false, resid_names));
00148
00149 {
00150 RCP<ParameterList> p = rcp(new ParameterList("ODE Resid"));
00151
00152
00153 p->set< RCP<DataLayout> >("Node Scalar Data Layout", dl->node_scalar);
00154 p->set<string>("Variable Name", "X");
00155 p->set<string>("Time Derivative Variable Name", "X_dot");
00156 p->set<string>("Y Variable Name", "Y");
00157 p->set<string>("Y Time Derivative Variable Name", "Y_dot");
00158
00159
00160 p->set<string>("Residual Name", "X Residual");
00161 p->set<string>("Y Residual Name", "Y Residual");
00162
00163 ev = rcp(new PHAL::ODEResid<EvalT,AlbanyTraits>(*p));
00164 fm0.template registerEvaluator<EvalT>(ev);
00165 }
00166
00167 if (fieldManagerChoice == Albany::BUILD_RESID_FM) {
00168 PHX::Tag<typename EvalT::ScalarT> res_tag("Scatter", dl->dummy);
00169 fm0.requireField<EvalT>(res_tag);
00170 return res_tag.clone();
00171 }
00172
00173 else if (fieldManagerChoice == Albany::BUILD_RESPONSE_FM) {
00174 Albany::ResponseUtilities<EvalT, PHAL::AlbanyTraits> respUtils(dl);
00175 return respUtils.constructResponses(fm0, *responseList, Teuchos::null, stateMgr);
00176 }
00177
00178 return Teuchos::null;
00179 }
00180 #endif