00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef FELIX_STOKESL1L2PROBLEM_HPP
00019 #define FELIX_STOKESL1L2PROBLEM_HPP
00020
00021 #include "Teuchos_RCP.hpp"
00022 #include "Teuchos_ParameterList.hpp"
00023
00024 #include "Albany_AbstractProblem.hpp"
00025
00026 #include "Phalanx.hpp"
00027 #include "PHAL_Workset.hpp"
00028 #include "PHAL_Dimension.hpp"
00029
00030 namespace FELIX {
00031
00036 class StokesL1L2 : public Albany::AbstractProblem {
00037 public:
00038
00040 StokesL1L2(const Teuchos::RCP<Teuchos::ParameterList>& params,
00041 const Teuchos::RCP<ParamLib>& paramLib,
00042 const int numDim_);
00043
00045 ~StokesL1L2();
00046
00048 virtual int spatialDimension() const { return numDim; }
00049
00051 virtual void buildProblem(
00052 Teuchos::ArrayRCP<Teuchos::RCP<Albany::MeshSpecsStruct> > meshSpecs,
00053 Albany::StateManager& stateMgr);
00054
00055
00056 virtual Teuchos::Array< Teuchos::RCP<const PHX::FieldTag> >
00057 buildEvaluators(
00058 PHX::FieldManager<PHAL::AlbanyTraits>& fm0,
00059 const Albany::MeshSpecsStruct& meshSpecs,
00060 Albany::StateManager& stateMgr,
00061 Albany::FieldManagerChoice fmchoice,
00062 const Teuchos::RCP<Teuchos::ParameterList>& responseList);
00063
00065 Teuchos::RCP<const Teuchos::ParameterList> getValidProblemParameters() const;
00066
00067 private:
00068
00070 StokesL1L2(const StokesL1L2&);
00071
00073 StokesL1L2& operator=(const StokesL1L2&);
00074
00075 public:
00076
00078 template <typename EvalT> Teuchos::RCP<const PHX::FieldTag>
00079 constructEvaluators(
00080 PHX::FieldManager<PHAL::AlbanyTraits>& fm0,
00081 const Albany::MeshSpecsStruct& meshSpecs,
00082 Albany::StateManager& stateMgr,
00083 Albany::FieldManagerChoice fmchoice,
00084 const Teuchos::RCP<Teuchos::ParameterList>& responseList);
00085
00086 void constructDirichletEvaluators(const Albany::MeshSpecsStruct& meshSpecs);
00087
00088 protected:
00089 int numDim;
00090
00091 };
00092
00093 }
00094
00095 #include "Intrepid_FieldContainer.hpp"
00096 #include "Intrepid_DefaultCubatureFactory.hpp"
00097 #include "Shards_CellTopology.hpp"
00098
00099 #include "Albany_Utils.hpp"
00100 #include "Albany_ProblemUtils.hpp"
00101 #include "Albany_EvaluatorUtils.hpp"
00102 #include "Albany_ResponseUtilities.hpp"
00103
00104 #include "PHAL_DOFVecGradInterpolation.hpp"
00105
00106 #include "FELIX_StokesL1L2Resid.hpp"
00107 #include "FELIX_ViscosityL1L2.hpp"
00108 #include "FELIX_EpsilonL1L2.hpp"
00109 #include "FELIX_StokesL1L2BodyForce.hpp"
00110
00111 #include "PHAL_Source.hpp"
00112
00113 template <typename EvalT>
00114 Teuchos::RCP<const PHX::FieldTag>
00115 FELIX::StokesL1L2::constructEvaluators(
00116 PHX::FieldManager<PHAL::AlbanyTraits>& fm0,
00117 const Albany::MeshSpecsStruct& meshSpecs,
00118 Albany::StateManager& stateMgr,
00119 Albany::FieldManagerChoice fieldManagerChoice,
00120 const Teuchos::RCP<Teuchos::ParameterList>& responseList)
00121 {
00122 using Teuchos::RCP;
00123 using Teuchos::rcp;
00124 using Teuchos::ParameterList;
00125 using PHX::DataLayout;
00126 using PHX::MDALayout;
00127 using std::vector;
00128 using std::string;
00129 using std::map;
00130 using PHAL::AlbanyTraits;
00131
00132 RCP<Intrepid::Basis<RealType, Intrepid::FieldContainer<RealType> > >
00133 intrepidBasis = Albany::getIntrepidBasis(meshSpecs.ctd);
00134 RCP<shards::CellTopology> cellType = rcp(new shards::CellTopology (&meshSpecs.ctd));
00135
00136 const int numNodes = intrepidBasis->getCardinality();
00137 const int worksetSize = meshSpecs.worksetSize;
00138
00139 Intrepid::DefaultCubatureFactory<RealType> cubFactory;
00140 RCP <Intrepid::Cubature<RealType> > cubature = cubFactory.create(*cellType, meshSpecs.cubatureDegree);
00141
00142 const int numQPts = cubature->getNumPoints();
00143 const int numVertices = cellType->getNodeCount();
00144
00145 *out << "Field Dimensions: Workset=" << worksetSize
00146 << ", Vertices= " << numVertices
00147 << ", Nodes= " << numNodes
00148 << ", QuadPts= " << numQPts
00149 << ", Dim= " << numDim << std::endl;
00150
00151 int vecDim = neq;
00152
00153 RCP<Albany::Layouts> dl = rcp(new Albany::Layouts(worksetSize,numVertices,numNodes,numQPts,numDim, vecDim));
00154 Albany::EvaluatorUtils<EvalT, PHAL::AlbanyTraits> evalUtils(dl);
00155 bool supportsTransient=true;
00156 int offset=0;
00157
00158
00159 Teuchos::RCP<PHX::Evaluator<AlbanyTraits> > ev;
00160
00161
00162
00163 Teuchos::ArrayRCP<std::string> dof_names(1);
00164 Teuchos::ArrayRCP<std::string> dof_names_dot(1);
00165 Teuchos::ArrayRCP<std::string> resid_names(1);
00166 dof_names[0] = "Velocity";
00167 dof_names_dot[0] = dof_names[0]+"_dot";
00168 resid_names[0] = "Stokes Residual";
00169 fm0.template registerEvaluator<EvalT>
00170 (evalUtils.constructGatherSolutionEvaluator(true, dof_names, dof_names_dot, offset));
00171
00172 fm0.template registerEvaluator<EvalT>
00173 (evalUtils.constructDOFVecInterpolationEvaluator(dof_names[0]));
00174
00175 fm0.template registerEvaluator<EvalT>
00176 (evalUtils.constructDOFVecInterpolationEvaluator(dof_names_dot[0]));
00177
00178 fm0.template registerEvaluator<EvalT>
00179 (evalUtils.constructDOFVecGradInterpolationEvaluator(dof_names[0]));
00180
00181 fm0.template registerEvaluator<EvalT>
00182 (evalUtils.constructScatterResidualEvaluator(true, resid_names,offset, "Scatter Stokes"));
00183 offset += numDim;
00184
00185 fm0.template registerEvaluator<EvalT>
00186 (evalUtils.constructGatherCoordinateVectorEvaluator());
00187
00188 fm0.template registerEvaluator<EvalT>
00189 (evalUtils.constructMapToPhysicalFrameEvaluator(cellType, cubature));
00190
00191 fm0.template registerEvaluator<EvalT>
00192 (evalUtils.constructComputeBasisFunctionsEvaluator(cellType, intrepidBasis, cubature));
00193
00194 {
00195
00196 RCP<ParameterList> p = rcp(new ParameterList("DOFVecGrad Interpolation "+dof_names[0]));
00197
00198 p->set<std::string>("Variable Name", dof_names[0]);
00199
00200 p->set<std::string>("Gradient BF Name", "Grad BF");
00201
00202
00203 p->set<std::string>("Gradient Variable Name", dof_names[0]+" Gradient");
00204
00205 ev = rcp(new PHAL::DOFVecGradInterpolation<EvalT,AlbanyTraits>(*p,dl));
00206 fm0.template registerEvaluator<EvalT>(ev);
00207 }
00208
00209 {
00210 RCP<ParameterList> p = rcp(new ParameterList("Stokes Resid"));
00211
00212
00213 p->set<std::string>("Weighted BF Name", "wBF");
00214 p->set<std::string>("Weighted Gradient BF Name", "wGrad BF");
00215 p->set<std::string>("QP Variable Name", "Velocity");
00216 p->set<std::string>("QP Time Derivative Variable Name", "Velocity_dot");
00217 p->set<std::string>("Gradient QP Variable Name", "Velocity Gradient");
00218 p->set<std::string>("Velocity Gradient QP Variable Name", "Velocity Gradient");
00219 p->set<std::string>("Body Force Name", "Body Force");
00220 p->set<std::string>("FELIX Viscosity QP Variable Name", "FELIX Viscosity");
00221 p->set<std::string>("FELIX EpsilonXX QP Variable Name", "FELIX EpsilonXX");
00222 p->set<std::string>("FELIX EpsilonYY QP Variable Name", "FELIX EpsilonYY");
00223 p->set<std::string>("FELIX EpsilonXY QP Variable Name", "FELIX EpsilonXY");
00224
00225
00226 p->set<std::string>("Residual Name", "Stokes Residual");
00227
00228 ev = rcp(new FELIX::StokesL1L2Resid<EvalT,AlbanyTraits>(*p,dl));
00229 fm0.template registerEvaluator<EvalT>(ev);
00230 }
00231 {
00232 RCP<ParameterList> p = rcp(new ParameterList("FELIX Viscosity"));
00233
00234
00235 p->set<std::string>("Gradient QP Variable Name", "Velocity Gradient");
00236
00237 p->set<RCP<ParamLib> >("Parameter Library", paramLib);
00238 Teuchos::ParameterList& paramList = params->sublist("FELIX Viscosity");
00239 p->set<Teuchos::ParameterList*>("Parameter List", ¶mList);
00240 p->set<std::string>("Coordinate Vector Name", "Coord Vec");
00241 p->set<std::string>("FELIX EpsilonB QP Variable Name", "FELIX EpsilonB");
00242
00243
00244 p->set<std::string>("FELIX Viscosity QP Variable Name", "FELIX Viscosity");
00245
00246 ev = rcp(new FELIX::ViscosityL1L2<EvalT,AlbanyTraits>(*p,dl));
00247 fm0.template registerEvaluator<EvalT>(ev);
00248
00249 }
00250 {
00251 RCP<ParameterList> p = rcp(new ParameterList("FELIX Epsilon"));
00252
00253
00254 p->set<std::string>("Gradient QP Variable Name", "Velocity Gradient");
00255
00256 p->set<RCP<ParamLib> >("Parameter Library", paramLib);
00257 Teuchos::ParameterList& paramList = params->sublist("FELIX Viscosity");
00258 p->set<Teuchos::ParameterList*>("Parameter List", ¶mList);
00259
00260
00261 p->set<std::string>("FELIX EpsilonXX QP Variable Name", "FELIX EpsilonXX");
00262 p->set<std::string>("FELIX EpsilonXY QP Variable Name", "FELIX EpsilonXY");
00263 p->set<std::string>("FELIX EpsilonYY QP Variable Name", "FELIX EpsilonYY");
00264 p->set<std::string>("FELIX EpsilonB QP Variable Name", "FELIX EpsilonB");
00265
00266 ev = rcp(new FELIX::EpsilonL1L2<EvalT,AlbanyTraits>(*p,dl));
00267 fm0.template registerEvaluator<EvalT>(ev);
00268
00269 }
00270
00271 {
00272 RCP<ParameterList> p = rcp(new ParameterList("Body Force"));
00273
00274
00275 p->set<std::string>("FELIX Viscosity QP Variable Name", "FELIX Viscosity");
00276 p->set<std::string>("Coordinate Vector Name", "Coord Vec");
00277
00278 Teuchos::ParameterList& paramList = params->sublist("Body Force");
00279 p->set<Teuchos::ParameterList*>("Parameter List", ¶mList);
00280
00281
00282
00283 p->set<std::string>("Body Force Name", "Body Force");
00284
00285 ev = rcp(new FELIX::StokesL1L2BodyForce<EvalT,AlbanyTraits>(*p,dl));
00286 fm0.template registerEvaluator<EvalT>(ev);
00287 }
00288 if (fieldManagerChoice == Albany::BUILD_RESID_FM) {
00289 PHX::Tag<typename EvalT::ScalarT> res_tag("Scatter Stokes", dl->dummy);
00290 fm0.requireField<EvalT>(res_tag);
00291 }
00292 else if (fieldManagerChoice == Albany::BUILD_RESPONSE_FM) {
00293 Albany::ResponseUtilities<EvalT, PHAL::AlbanyTraits> respUtils(dl);
00294 return respUtils.constructResponses(fm0, *responseList, Teuchos::null, stateMgr);
00295 }
00296
00297 return Teuchos::null;
00298 }
00299 #endif // FELIX_STOKESL1L2PROBLEM_HPP