29 #include "libmesh/system.h" 30 #include "libmesh/dof_map.h" 31 #include "libmesh/numeric_vector.h" 52 max_strain = RealVectorX::Zero(6);
53 max_stress = RealVectorX::Zero(6);
58 if (data.size() == 1) {
60 max_strain = data[0]->strain();
61 max_stress = data[0]->stress();
62 max_vm = data[0]->von_Mises_stress();
65 max_strain = data[0]->get_strain_sensitivity(*p);
66 max_stress = data[0]->get_stress_sensitivity(*p);
67 max_vm = data[0]->dvon_Mises_stress_dp (*p);
74 std::vector<MAST::StressStrainOutputBase::Data*>::const_iterator
81 for ( ; it != end; it++) {
86 vm = (*it)->von_Mises_stress();
89 if (vm > max_vm) max_vm = vm;
91 for (
unsigned int i=0; i<6; i++) {
92 if (fabs(strain(i)) > fabs(max_strain(i))) max_strain(i) = strain(i);
93 if (fabs(stress(i)) > fabs(max_stress(i))) max_stress(i) = stress(i);
103 const libMesh::NumericVector<Real>& X) {
119 const std::vector<unsigned int>&
122 stress_sys.solution->zero();
124 std::vector<libMesh::dof_id_type> dof_indices;
125 const libMesh::DofMap& dof_map = structural_sys.get_dof_map();
127 std::unique_ptr<libMesh::NumericVector<Real> > localized_solution;
132 libMesh::MeshBase::const_element_iterator el =
133 structural_sys.get_mesh().active_local_elements_begin();
134 const libMesh::MeshBase::const_element_iterator end_el =
135 structural_sys.get_mesh().active_local_elements_end();
141 sys_num = stress_sys.number();
144 max_strain_vals = RealVectorX::Zero(6),
145 max_stress_vals = RealVectorX::Zero(6);
150 for ( ; el != end_el; el++) {
152 const libMesh::Elem* elem = *el;
154 dof_map.dof_indices (elem, dof_indices);
156 unsigned int ndofs = (
unsigned int)dof_indices.size();
159 for (
unsigned int i=0; i<dof_indices.size(); i++)
160 sol(i) = (*localized_solution)(dof_indices[i]);
174 const std::map<
const libMesh::dof_id_type,
175 std::vector<MAST::StressStrainOutputBase::Data*> >& output_map =
180 libmesh_assert_equal_to(output_map.size(), 1);
181 libmesh_assert_equal_to(output_map.begin()->first, elem->id());
185 std::map<
const libMesh::dof_id_type,
186 std::vector<MAST::StressStrainOutputBase::Data*> >::const_iterator
187 e_it = output_map.begin(),
188 e_end = output_map.end();
190 for ( ; e_it != e_end; e_it++) {
200 dof_id = elem->dof_number(sys_num, stress_vars[12], 0);
201 stress_sys.solution->set(dof_id, max_vm_stress);
203 for (
unsigned int i=0; i<6; i++) {
205 dof_id = elem->dof_number(sys_num, stress_vars[i], 0);
206 stress_sys.solution->set(dof_id, max_strain_vals(i));
209 dof_id = elem->dof_number(sys_num, stress_vars[i+6], 0);
210 stress_sys.solution->set(dof_id, max_stress_vals(i));
215 stress_sys.solution->close();
225 const libMesh::NumericVector<Real>& X,
226 const libMesh::NumericVector<Real>& dXdp,
228 libMesh::NumericVector<Real>& dsigmadp) {
246 const std::vector<unsigned int>&
251 std::vector<libMesh::dof_id_type> dof_indices;
252 const libMesh::DofMap& dof_map = structural_sys.get_dof_map();
254 std::unique_ptr<libMesh::NumericVector<Real> >
256 localized_solution_sens;
263 libMesh::MeshBase::const_element_iterator el =
264 structural_sys.get_mesh().active_local_elements_begin();
265 const libMesh::MeshBase::const_element_iterator end_el =
266 structural_sys.get_mesh().active_local_elements_end();
272 sys_num = stress_sys.number();
275 max_strain_vals = RealVectorX::Zero(6),
276 max_stress_vals = RealVectorX::Zero(6);
281 for ( ; el != end_el; el++) {
283 const libMesh::Elem* elem = *el;
285 dof_map.dof_indices (elem, dof_indices);
287 unsigned int ndofs = (
unsigned int)dof_indices.size();
291 for (
unsigned int i=0; i<dof_indices.size(); i++) {
292 sol (i) = (*localized_solution) (dof_indices[i]);
293 dsol(i) = (*localized_solution_sens)(dof_indices[i]);
313 const std::map<
const libMesh::dof_id_type,
314 std::vector<MAST::StressStrainOutputBase::Data*> >& output_map =
319 libmesh_assert_equal_to(output_map.size(), 1);
320 libmesh_assert_equal_to(output_map.begin()->first, elem->id());
324 std::map<
const libMesh::dof_id_type,
325 std::vector<MAST::StressStrainOutputBase::Data*> >::const_iterator
326 e_it = output_map.begin(),
327 e_end = output_map.end();
329 for ( ; e_it != e_end; e_it++) {
339 dof_id = elem->dof_number(sys_num, stress_vars[12], 0);
340 dsigmadp.set(dof_id, max_vm_stress);
342 for (
unsigned int i=0; i<6; i++) {
344 dof_id = elem->dof_number(sys_num, stress_vars[i], 0);
345 dsigmadp.set(dof_id, max_strain_vals(i));
348 dof_id = elem->dof_number(sys_num, stress_vars[i+6], 0);
349 dsigmadp.set(dof_id, max_stress_vals(i));
MAST::AssemblyElemOperations * _elem_ops
provides assembly elem operations for use by this class
MAST::NonlinearSystem & system()
virtual void evaluate_sensitivity(const MAST::FunctionBase &f)
this evaluates all relevant stress sensitivity components on the element to evaluate the p-averaged q...
StressAssembly()
constructor associates this assembly object with the system
Data structure provides the mechanism to store stress and strain output from a structural analysis...
virtual ~StressAssembly()
destructor resets the association of this assembly object with the system
This class implements a system for solution of nonlinear systems.
virtual void clear_elem_operation_object()
clears the association of this object with the assembly element operation object. ...
void clear()
clears the data structure of any stored values so that it can be used for another element...
virtual void set_elem_solution_sensitivity(const RealVectorX &sol)
sets the element solution sensitivity
void set_stress_plot_mode(bool f)
tells the object that the calculation is for stress to be output for plotting.
virtual void set_elem_operation_object(MAST::AssemblyElemOperations &elem_ops)
attaches a element operation to this object, and associated this with the element operation object...
virtual void set_elem_solution(const RealVectorX &sol)
sets the element solution
void get_max_stress_strain_values(const std::vector< MAST::StressStrainOutputBase::Data * > &data, RealVectorX &max_strain, RealVectorX &max_stress, Real &max_vm, const MAST::FunctionBase *p)
MAST::SystemInitialization * _system
System for which this assembly is performed.
virtual void update_stress_strain_data(MAST::StressStrainOutputBase &ops, const libMesh::NumericVector< Real > &X)
updates the stresses and strains for the specified solution vector X.
MAST::PhysicsDisciplineBase * _discipline
PhysicsDisciplineBase object for which this class is assembling.
virtual const std::map< const libMesh::dof_id_type, std::vector< MAST::StressStrainOutputBase::Data * > > & get_stress_strain_data() const
virtual void init(const MAST::GeomElem &elem)
initialize for the element.
virtual void set_elem_data(unsigned int dim, const libMesh::Elem &ref_elem, MAST::GeomElem &elem) const
sets the structural element y-vector if 1D element is used.
Matrix< Real, Dynamic, 1 > RealVectorX
std::unique_ptr< libMesh::NumericVector< Real > > build_localized_vector(const libMesh::System &sys, const libMesh::NumericVector< Real > &global) const
localizes the parallel vector so that the local copy stores all values necessary for calculation of t...
This class acts as a wrapper around libMesh::Elem for the purpose of providing a uniform interface fo...
virtual void evaluate()
this evaluates all relevant stress components on the element to evaluate the p-averaged quantity...
virtual void clear_elem()
clears the element initialization
virtual void update_stress_strain_sensitivity_data(MAST::StressStrainOutputBase &ops, const libMesh::NumericVector< Real > &X, const libMesh::NumericVector< Real > &dXdp, const MAST::FunctionBase &p, libMesh::NumericVector< Real > &dsigmadp)
updates the sensitivity of stresses and strains for the specified solution vector X and its sensitivi...
virtual void init(const libMesh::Elem &elem, const MAST::SystemInitialization &sys_init)
initialize the object for the specified reference elem.