00001
00002
00003
00004
00005
00006 #include "Albany_ProblemUtils.hpp"
00007 #include "Albany_Utils.hpp"
00008 #include "Intrepid_DefaultCubatureFactory.hpp"
00009 #include "Intrepid_FieldContainer.hpp"
00010 #include "ProjectionProblem.hpp"
00011 #include "Shards_CellTopology.hpp"
00012
00013 Albany::ProjectionProblem::ProjectionProblem(
00014 RCP<ParameterList> const & parameter_list,
00015 RCP<ParamLib> const & parameter_library,
00016 int const number_dimensions) :
00017 Albany::AbstractProblem(
00018 parameter_list,
00019 parameter_library,
00020 number_dimensions + 9),
00021 have_boundary_source_(false),
00022 number_dimensions_(number_dimensions),
00023 projection_(
00024 params->sublist("Projection").get("Projection Variable", ""),
00025 params->sublist("Projection").get("Projection Rank", 0),
00026 params->sublist("Projection").get("Projection Comp", 0),
00027 number_dimensions_)
00028 {
00029 std::string &
00030 method = params->get("Name", "Total Lagrangian Plasticity with Projection ");
00031
00032 have_boundary_source_ = params->isSublist("Source Functions");
00033
00034 material_model_name_ =
00035 params->sublist("Material Model").get("Model Name", "Neohookean");
00036
00037 projected_field_name_ =
00038 params->sublist("Projection").get("Projection Variable", "");
00039
00040 projection_rank_ = params->sublist("Projection").get("Projection Rank", 0);
00041
00042 *out << "Problem Name = " << method << std::endl;
00043 *out << "Projection Variable: " << projected_field_name_ << std::endl;
00044 *out << "Projection Variable Rank: " << projection_rank_ << std::endl;
00045
00046 insertion_criterion_ =
00047 params->sublist("Insertion Criteria").get("Insertion Criteria", "");
00048
00049
00050 if (projection_.isProjected()) {
00051
00052
00053 *out << "Will variable be projected? " << projection_.isProjected();
00054 *out << std::endl;
00055 *out << "Number of components: " << projection_.getProjectedComponents();
00056 *out << std::endl;
00057 *out << "Rank of variable: " << projection_.getProjectedRank();
00058 *out << std::endl;
00059
00060
00061
00062
00063
00064
00065
00066
00067 switch (projection_.getProjectedRank()) {
00068
00069 case 1:
00070 is_field_vector_ = true;
00071 is_field_tensor_ = false;
00072 break;
00073
00074 case 2:
00075 is_field_vector_ = true;
00076 is_field_tensor_ = false;
00077 break;
00078
00079 default:
00080 is_field_vector_ = false;
00081 is_field_tensor_ = false;
00082 break;
00083 }
00084 }
00085
00086
00087
00088 #ifdef NUMBER_T_FIRST
00089 target_offset_= 0;
00090 source_offset_= projection_.getProjectedComponents();
00091 #else
00092 source_offset_ = 0;
00093 target_offset_ = number_dimensions_;
00094 #endif
00095
00096
00097
00098
00099
00100 int number_PDEs = number_dimensions_ + projection_.getProjectedComponents();
00101 int number_elasticity_dimensions = number_dimensions_;
00102 int number_scalar_dimensions = projection_.getProjectedComponents();
00103 int null_space_dimensions = 0;
00104
00105 switch (number_dimensions_) {
00106 default:
00107 TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error,
00108 "Invalid number of dimensions");
00109 break;
00110 case 1:
00111 null_space_dimensions = 0;
00112 break;
00113 case 2:
00114 null_space_dimensions = 3;
00115 break;
00116 case 3:
00117 null_space_dimensions = 6;
00118 break;
00119 }
00120
00121 rigidBodyModes->setParameters(number_PDEs, number_elasticity_dimensions,
00122 number_scalar_dimensions, null_space_dimensions);
00123
00124 }
00125
00126
00127
00128
00129 Albany::ProjectionProblem::~ProjectionProblem()
00130 {
00131 }
00132
00133 void
00134 Albany::ProjectionProblem::buildProblem(
00135 ArrayRCP<RCP<Albany::MeshSpecsStruct> > mesh_specs,
00136 Albany::StateManager & state_manager)
00137 {
00138
00139 TEUCHOS_TEST_FOR_EXCEPTION(
00140 mesh_specs.size() != 1,
00141 std::logic_error,
00142 "Problem supports one Material Block");
00143
00144 fm.resize(1);
00145 fm[0] = rcp(new PHX::FieldManager<AlbanyTraits>);
00146
00147 buildEvaluators(
00148 *fm[0],
00149 *mesh_specs[0],
00150 state_manager,
00151 BUILD_RESID_FM,
00152 Teuchos::null);
00153
00154 constructDirichletEvaluators(*mesh_specs[0]);
00155 }
00156
00157 Teuchos::Array<RCP<const PHX::FieldTag> >
00158 Albany::ProjectionProblem::buildEvaluators(
00159 PHX::FieldManager<AlbanyTraits> & field_manager,
00160 Albany::MeshSpecsStruct const & mesh_specs,
00161 Albany::StateManager & state_manager,
00162 Albany::FieldManagerChoice field_manager_choice,
00163 RCP<ParameterList> const & response_list)
00164 {
00165
00166
00167
00168 ConstructEvaluatorsOp<ProjectionProblem>
00169 construct_evaluator(
00170 *this,
00171 field_manager,
00172 mesh_specs,
00173 state_manager,
00174 field_manager_choice,
00175 response_list);
00176
00177 boost::mpl::for_each<AlbanyTraits::BEvalTypes>(construct_evaluator);
00178
00179 return *construct_evaluator.tags;
00180 }
00181
00182 void
00183 Albany::ProjectionProblem::constructDirichletEvaluators(
00184 Albany::MeshSpecsStruct const & mesh_specs)
00185 {
00186
00187 std::vector<std::string>
00188 dirichlet_names(neq);
00189
00190 dirichlet_names[source_offset_] = "X";
00191 if (number_dimensions_ > 1) dirichlet_names[source_offset_ + 1] = "Y";
00192 if (number_dimensions_ > 2) dirichlet_names[source_offset_ + 2] = "Z";
00193
00194 dirichlet_names[target_offset_] = "T";
00195
00196 Albany::BCUtils<Albany::DirichletTraits>
00197 dirichlet_utils;
00198
00199 dfm = dirichlet_utils.constructBCEvaluators(
00200 mesh_specs.nsNames,
00201 dirichlet_names,
00202 this->params,
00203 this->paramLib);
00204 }
00205
00206 RCP<const ParameterList>
00207 Albany::ProjectionProblem::getValidProblemParameters() const
00208 {
00209 RCP<ParameterList>
00210 parameters = this->getGenericProblemParams("ValidProjectionProblemParams");
00211
00212 parameters->sublist("Material Model", false, "");
00213
00214 parameters->set<bool>("avgJ", false,
00215 "Flag to indicate the J should be averaged");
00216
00217 parameters->set<bool>("volavgJ", false,
00218 "Flag to indicate the J should be volume averaged");
00219
00220 parameters->set<bool>("weighted_Volume_Averaged_J", false,
00221 "Flag to indicate the J should be volume averaged with stabilization");
00222
00223 parameters->sublist("Elastic Modulus", false, "");
00224 parameters->sublist("Shear Modulus", false, "");
00225 parameters->sublist("Poissons Ratio", false, "");
00226 parameters->sublist("Projection", false, "");
00227 parameters->sublist("Insertion Criteria", false, "");
00228
00229 if (material_model_name_ == "J2" || material_model_name_ == "J2Fiber") {
00230
00231 parameters->set<bool>("Compute Dislocation Density Tensor", false,
00232 "Flag to compute the dislocaiton density tensor (only for 3D)");
00233
00234 parameters->sublist("Hardening Modulus", false, "");
00235 parameters->sublist("Saturation Modulus", false, "");
00236 parameters->sublist("Saturation Exponent", false, "");
00237 parameters->sublist("Yield Strength", false, "");
00238
00239 if (material_model_name_ == "J2Fiber") {
00240 parameters->set<RealType>("xiinf_J2", false, "");
00241 parameters->set<RealType>("tau_J2", false, "");
00242 parameters->set<RealType>("k_f1", false, "");
00243 parameters->set<RealType>("q_f1", false, "");
00244 parameters->set<RealType>("vol_f1", false, "");
00245 parameters->set<RealType>("xiinf_f1", false, "");
00246 parameters->set<RealType>("tau_f1", false, "");
00247 parameters->set<RealType>("Mx_f1", false, "");
00248 parameters->set<RealType>("My_f1", false, "");
00249 parameters->set<RealType>("Mz_f1", false, "");
00250 parameters->set<RealType>("k_f2", false, "");
00251 parameters->set<RealType>("q_f2", false, "");
00252 parameters->set<RealType>("vol_f2", false, "");
00253 parameters->set<RealType>("xiinf_f2", false, "");
00254 parameters->set<RealType>("tau_f2", false, "");
00255 parameters->set<RealType>("Mx_f2", false, "");
00256 parameters->set<RealType>("My_f2", false, "");
00257 parameters->set<RealType>("Mz_f2", false, "");
00258 }
00259 }
00260
00261 return parameters;
00262 }
00263
00264 void
00265 Albany::ProjectionProblem::getAllocatedStates(
00266 ArrayRCP<ArrayRCP<RCP<FieldContainer<RealType> > > > old_state,
00267 ArrayRCP<ArrayRCP<RCP<FieldContainer<RealType> > > > new_state) const
00268 {
00269 old_state = old_state_;
00270 new_state = new_state_;
00271 }