void ComputeSmearedCrackingStress::initialSetup() { ComputeMultipleInelasticStress::initialSetup(); if (!hasGuaranteedMaterialProperty(_elasticity_tensor_name, Guarantee::ISOTROPIC)) mooseError("ComputeSmearedCrackingStress requires that the elasticity tensor be " "guaranteed isotropic"); std::vector<MaterialName> soft_matls = getParam<std::vector<MaterialName>>("softening_models"); if (soft_matls.size() != 0) { for (auto soft_matl : soft_matls) { SmearedCrackSofteningBase * scsb = dynamic_cast<SmearedCrackSofteningBase *>(&getMaterialByName(soft_matl)); if (scsb) _softening_models.push_back(scsb); else mooseError("Model " + soft_matl + " is not a softening model that can be used with ComputeSmearedCrackingStress"); } if (_softening_models.size() == 1) { // Reuse the same model in all 3 directions _softening_models.push_back(_softening_models[0]); _softening_models.push_back(_softening_models[0]); } else if (_softening_models.size() != 3) mooseError("If 'softening_models' is specified in ComputeSmearedCrackingStress, either 1 or " "3 models must be provided"); } }
void ComputeReturnMappingStress::initialSetup() { std::vector<MaterialName> models = getParam<std::vector<MaterialName> >("return_mapping_models"); for (unsigned int i = 0; i < models.size(); ++i) { StressUpdateBase * rrr = dynamic_cast<StressUpdateBase *>(&getMaterialByName(models[i])); if (rrr) _models.push_back(rrr); else mooseError("Model " + models[i] + " is not compatible with ComputeReturnMappingStress"); } }
MaterialVectorPostprocessor::MaterialVectorPostprocessor(const InputParameters & parameters) : ElementVectorPostprocessor(parameters), _elem_filter(getParam<std::vector<unsigned int>>("elem_ids").begin(), getParam<std::vector<unsigned int>>("elem_ids").end()), _elem_ids(declareVector("elem_id")), _qp_ids(declareVector("qp_id")) { auto & mat = getMaterialByName(getParam<MaterialName>("material"), true); auto & prop_names = mat.getSuppliedItems(); if (mat.isBoundaryMaterial()) mooseError(name(), ": boundary materials (i.e. ", mat.name(), ") cannot be used"); for (auto & id : _elem_filter) { auto el = _mesh.getMesh().query_elem_ptr(id); // We'd better have found the requested element on *some* // processor. bool found_elem = (el != nullptr); this->comm().max(found_elem); // We might not have el on this processor in a distributed mesh, // but it should be somewhere and it ought to have a material // defined for its subdomain if (!found_elem || (el && !mat.hasBlocks(el->subdomain_id()))) mooseError(name(), ": material ", mat.name(), " is not defined on element ", id); } for (auto & prop : prop_names) { if (hasMaterialProperty<Real>(prop)) _prop_refs.push_back(&getMaterialProperty<Real>(prop)); else if (hasMaterialProperty<unsigned int>(prop)) _prop_refs.push_back(&getMaterialProperty<unsigned int>(prop)); else if (hasMaterialProperty<int>(prop)) _prop_refs.push_back(&getMaterialProperty<int>(prop)); else { mooseWarning("property " + prop + " is of unsupported type and skipped by MaterialVectorPostprocessor"); continue; } _prop_vecs.push_back(&declareVector(prop)); _prop_names.push_back(prop); } }
void ComputeMultipleInelasticStress::initialSetup() { _is_elasticity_tensor_guaranteed_isotropic = hasGuaranteedMaterialProperty(_elasticity_tensor_name, Guarantee::ISOTROPIC); std::vector<MaterialName> models = getParam<std::vector<MaterialName>>("inelastic_models"); for (unsigned int i = 0; i < _num_models; ++i) { StressUpdateBase * rrr = dynamic_cast<StressUpdateBase *>(&getMaterialByName(models[i])); if (rrr) { _models.push_back(rrr); if (rrr->requiresIsotropicTensor() && !_is_elasticity_tensor_guaranteed_isotropic) mooseError("Model " + models[i] + " requires an isotropic elasticity tensor, but the one supplied is not " "guaranteed isotropic"); } else mooseError("Model " + models[i] + " is not compatible with ComputeMultipleInelasticStress"); } }