00001
00002
00003
00004
00005
00006
00007 #ifndef AERAS_SHALLOWWATERPROBLEM_HPP
00008 #define AERAS_SHALLOWWATERPROBLEM_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 Aeras {
00020
00025 class ShallowWaterProblem : public Albany::AbstractProblem {
00026 public:
00027
00029 ShallowWaterProblem(const Teuchos::RCP<Teuchos::ParameterList>& params,
00030 const Teuchos::RCP<ParamLib>& paramLib,
00031 const int spatialDim_);
00032
00034 ~ShallowWaterProblem();
00035
00037 virtual int spatialDimension() const { return spatialDim; }
00038
00040 virtual void buildProblem(
00041 Teuchos::ArrayRCP<Teuchos::RCP<Albany::MeshSpecsStruct> > meshSpecs,
00042 Albany::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 ShallowWaterProblem(const ShallowWaterProblem&);
00060
00062 ShallowWaterProblem& operator=(const ShallowWaterProblem&);
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 void constructNeumannEvaluators(const Teuchos::RCP<Albany::MeshSpecsStruct>& meshSpecs);
00077
00078 protected:
00079 int spatialDim;
00080 int modelDim;
00081 Teuchos::RCP<Albany::Layouts> dl;
00082
00083 };
00084
00085 }
00086
00087 #include "Intrepid_FieldContainer.hpp"
00088 #include "Intrepid_CubaturePolylib.hpp"
00089 #include "Intrepid_CubatureTensor.hpp"
00090
00091 #include "Shards_CellTopology.hpp"
00092
00093 #include "Albany_Utils.hpp"
00094 #include "Albany_ProblemUtils.hpp"
00095 #include "Albany_EvaluatorUtils.hpp"
00096 #include "Albany_ResponseUtilities.hpp"
00097 #include "PHAL_Neumann.hpp"
00098
00099 #include "Aeras_ShallowWaterResid.hpp"
00100 #include "Aeras_SurfaceHeight.hpp"
00101 #include "Aeras_ComputeBasisFunctions.hpp"
00102 #include "Aeras_GatherCoordinateVector.hpp"
00103
00104 template <typename EvalT>
00105 Teuchos::RCP<const PHX::FieldTag>
00106 Aeras::ShallowWaterProblem::constructEvaluators(
00107 PHX::FieldManager<PHAL::AlbanyTraits>& fm0,
00108 const Albany::MeshSpecsStruct& meshSpecs,
00109 Albany::StateManager& stateMgr,
00110 Albany::FieldManagerChoice fieldManagerChoice,
00111 const Teuchos::RCP<Teuchos::ParameterList>& responseList)
00112 {
00113 using Teuchos::RCP;
00114 using Teuchos::rcp;
00115 using Teuchos::ParameterList;
00116 using PHX::DataLayout;
00117 using PHX::MDALayout;
00118 using std::vector;
00119 using std::string;
00120 using std::map;
00121 using PHAL::AlbanyTraits;
00122
00123 RCP<Intrepid::Basis<RealType, Intrepid::FieldContainer<RealType> > >
00124 intrepidBasis = Albany::getIntrepidBasis(meshSpecs.ctd);
00125 RCP<shards::CellTopology> cellType = rcp(new shards::CellTopology(shards::getCellTopologyData< shards::Quadrilateral<4> >()));
00126
00127 const int numNodes = intrepidBasis->getCardinality();
00128 const int worksetSize = meshSpecs.worksetSize;
00129
00130 RCP <Intrepid::CubaturePolylib<RealType> > polylib = rcp(new Intrepid::CubaturePolylib<RealType>(meshSpecs.cubatureDegree, meshSpecs.cubatureRule));
00131 std::vector< Teuchos::RCP<Intrepid::Cubature<RealType> > > cubatures(2, polylib);
00132 RCP <Intrepid::Cubature<RealType> > cubature = rcp( new Intrepid::CubatureTensor<RealType>(cubatures));
00133
00134
00135
00136
00137
00138 const int numQPts = cubature->getNumPoints();
00139 const int numVertices = cellType->getNodeCount();
00140 int vecDim = neq;
00141
00142 *out << "Field Dimensions: Workset=" << worksetSize
00143 << ", Vertices= " << numVertices
00144 << ", Nodes= " << numNodes
00145 << ", QuadPts= " << numQPts
00146 << ", Spatial Dim= " << spatialDim
00147 << ", Model Dim= " << modelDim
00148 << ", vecDim= " << vecDim << std::endl;
00149
00150 dl = rcp(new Albany::Layouts(worksetSize,numVertices,numNodes,numQPts, modelDim, vecDim));
00151 Albany::EvaluatorUtils<EvalT, PHAL::AlbanyTraits> evalUtils(dl);
00152
00153
00154 Teuchos::RCP<PHX::Evaluator<AlbanyTraits> > ev;
00155
00156
00157
00158 Teuchos::ArrayRCP<std::string> dof_names(1);
00159 Teuchos::ArrayRCP<std::string> dof_names_dot(1);
00160 Teuchos::ArrayRCP<std::string> resid_names(1);
00161 dof_names[0] = "Flow State";
00162 dof_names_dot[0] = dof_names[0]+"_dot";
00163 resid_names[0] = "ShallowWater Residual";
00164
00165
00166 fm0.template registerEvaluator<EvalT>
00167 (evalUtils.constructGatherSolutionEvaluator(true, dof_names, dof_names_dot));
00168
00169 fm0.template registerEvaluator<EvalT>
00170 (evalUtils.constructDOFVecInterpolationEvaluator(dof_names[0]));
00171
00172 fm0.template registerEvaluator<EvalT>
00173 (evalUtils.constructDOFVecInterpolationEvaluator(dof_names_dot[0]));
00174
00175 fm0.template registerEvaluator<EvalT>
00176 (evalUtils.constructDOFVecGradInterpolationEvaluator(dof_names[0]));
00177
00178 fm0.template registerEvaluator<EvalT>
00179 (evalUtils.constructScatterResidualEvaluator(true, resid_names, 0, "Scatter ShallowWater"));
00180
00181
00182 if (spatialDim != modelDim) {
00183 RCP<ParameterList> p = rcp(new ParameterList("Gather Coordinate Vector"));
00184
00185
00186
00187 p->set<string>("Coordinate Vector Name", "Coord Vec");
00188
00189 ev = rcp(new Aeras::GatherCoordinateVector<EvalT,AlbanyTraits>(*p,dl));
00190 fm0.template registerEvaluator<EvalT>(ev);
00191 }
00192
00193 else {
00194 fm0.template registerEvaluator<EvalT>
00195 (evalUtils.constructGatherCoordinateVectorEvaluator());
00196 }
00197
00198
00199
00200
00201
00202 if (spatialDim != modelDim) {
00203 RCP<ParameterList> p = rcp(new ParameterList("Compute Basis Functions"));
00204
00205
00206 p->set<string>("Coordinate Vector Name","Coord Vec");
00207 p->set< RCP<Intrepid::Cubature<RealType> > >("Cubature", cubature);
00208
00209 p->set< RCP<Intrepid::Basis<RealType, Intrepid::FieldContainer<RealType> > > >
00210 ("Intrepid Basis", intrepidBasis);
00211
00212 p->set<RCP<shards::CellTopology> >("Cell Type", cellType);
00213
00214 p->set<string>("Weights Name", "Weights");
00215 p->set<string>("Spherical Coord Name", "Longitude-Latitude");
00216 p->set<string>("Jacobian Det Name", "Jacobian Det");
00217 p->set<string>("Jacobian Inv Name", "Jacobian Inv");
00218 p->set<string>("Jacobian Name", "Jacobian");
00219 p->set<string>("BF Name", "BF");
00220 p->set<string>("Coordinate Vector Name", "Coord Vec");
00221 p->set<string>("Weighted BF Name", "wBF");
00222
00223 p->set<string>("Gradient BF Name", "Grad BF");
00224 p->set<string>("Weighted Gradient BF Name", "wGrad BF");
00225
00226 p->set<string>("Jacobian Inv Trans Name", "Jacobian Inv Trans");
00227
00228 ev = rcp(new Aeras::ComputeBasisFunctions<EvalT,AlbanyTraits>(*p,dl));
00229 fm0.template registerEvaluator<EvalT>(ev);
00230 }
00231
00232 else {
00233 fm0.template registerEvaluator<EvalT>
00234 (evalUtils.constructComputeBasisFunctionsEvaluator(cellType, intrepidBasis, cubature));
00235 }
00236
00237 {
00238 RCP<ParameterList> p = rcp(new ParameterList("Shallow Water Resid"));
00239
00240
00241 p->set<std::string>("Weighted BF Name", "wBF");
00242 p->set<std::string>("Weighted Gradient BF Name", "wGrad BF");
00243 p->set<std::string>("QP Variable Name", dof_names[0]);
00244 p->set<std::string>("QP Time Derivative Variable Name", dof_names_dot[0]);
00245 p->set<std::string>("Gradient QP Variable Name", "Flow State Gradient");
00246 p->set<std::string>("Aeras Surface Height QP Variable Name", "Aeras Surface Height");
00247
00248 p->set<string>("Weights Name", "Weights");
00249 p->set<string>("Jacobian Name", "Jacobian");
00250 p->set<string>("Jacobian Inv Name", "Jacobian Inv");
00251 p->set< RCP<Intrepid::Cubature<RealType> > >("Cubature", cubature);
00252 p->set< RCP<Intrepid::Basis<RealType, Intrepid::FieldContainer<RealType> > > > ("Intrepid Basis", intrepidBasis);
00253
00254 p->set<std::size_t>("spatialDim", spatialDim);
00255
00256 p->set<RCP<ParamLib> >("Parameter Library", paramLib);
00257
00258 Teuchos::ParameterList& paramList = params->sublist("Shallow Water Problem");
00259 p->set<Teuchos::ParameterList*>("Shallow Water Problem", ¶mList);
00260
00261
00262 p->set<std::string>("Residual Name", resid_names[0]);
00263
00264 ev = rcp(new Aeras::ShallowWaterResid<EvalT,AlbanyTraits>(*p,dl));
00265 fm0.template registerEvaluator<EvalT>(ev);
00266 }
00267
00268 {
00269
00270 RCP<ParameterList> p = rcp(new ParameterList("Aeras Surface Height"));
00271
00272
00273 p->set<std::string>("Spherical Coord Name", "Longitude-Latitude");
00274
00275 p->set<RCP<ParamLib> >("Parameter Library", paramLib);
00276 Teuchos::ParameterList& paramList = params->sublist("Aeras Surface Height");
00277 p->set<Teuchos::ParameterList*>("Parameter List", ¶mList);
00278
00279
00280 p->set<std::string>("Aeras Surface Height QP Variable Name", "Aeras Surface Height");
00281
00282 ev = rcp(new Aeras::SurfaceHeight<EvalT,AlbanyTraits>(*p,dl));
00283 fm0.template registerEvaluator<EvalT>(ev);
00284
00285 }
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308 if (fieldManagerChoice == Albany::BUILD_RESID_FM) {
00309 PHX::Tag<typename EvalT::ScalarT> res_tag("Scatter ShallowWater", dl->dummy);
00310 fm0.requireField<EvalT>(res_tag);
00311 }
00312 else if (fieldManagerChoice == Albany::BUILD_RESPONSE_FM) {
00313 Albany::ResponseUtilities<EvalT, PHAL::AlbanyTraits> respUtils(dl);
00314 return respUtils.constructResponses(fm0, *responseList, Teuchos::null, stateMgr);
00315 }
00316
00317 return Teuchos::null;
00318 }
00319 #endif // AERAS_SHALLOWWATERPROBLEM_HPP