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;
162 dof_map.dof_indices (elem, dof_indices);
164 unsigned int ndofs = (
unsigned int)dof_indices.size();
167 for (
unsigned int i=0; i<dof_indices.size(); i++)
168 sol(i) = (*localized_solution)(dof_indices[i]);
176 const std::map<
const libMesh::dof_id_type,
177 std::vector<MAST::StressStrainOutputBase::Data*> >& output_map =
182 libmesh_assert_equal_to(output_map.size(), 1);
183 libmesh_assert_equal_to(output_map.begin()->first, elem->id());
187 std::map<
const libMesh::dof_id_type,
188 std::vector<MAST::StressStrainOutputBase::Data*> >::const_iterator
189 e_it = output_map.begin(),
190 e_end = output_map.end();
192 for ( ; e_it != e_end; e_it++) {
202 dof_id = elem->dof_number(sys_num, stress_vars[12], 0);
203 stress_sys.solution->set(dof_id, max_vm_stress);
205 for (
unsigned int i=0; i<6; i++) {
207 dof_id = elem->dof_number(sys_num, stress_vars[i], 0);
208 stress_sys.solution->set(dof_id, max_strain_vals(i));
211 dof_id = elem->dof_number(sys_num, stress_vars[i+6], 0);
212 stress_sys.solution->set(dof_id, max_stress_vals(i));
217 stress_sys.solution->close();
227 const libMesh::NumericVector<Real>& X,
228 const libMesh::NumericVector<Real>& dXdp,
230 libMesh::NumericVector<Real>& dsigmadp) {
248 const std::vector<unsigned int>&
253 std::vector<libMesh::dof_id_type> dof_indices;
254 const libMesh::DofMap& dof_map = structural_sys.get_dof_map();
256 std::unique_ptr<libMesh::NumericVector<Real> >
258 localized_solution_sens;
265 libMesh::MeshBase::const_element_iterator el =
266 structural_sys.get_mesh().active_local_elements_begin();
267 const libMesh::MeshBase::const_element_iterator end_el =
268 structural_sys.get_mesh().active_local_elements_end();
274 sys_num = stress_sys.number();
277 max_strain_vals = RealVectorX::Zero(6),
278 max_stress_vals = RealVectorX::Zero(6);
283 for ( ; el != end_el; el++) {
285 const libMesh::Elem* elem = *el;
297 dof_map.dof_indices (elem, dof_indices);
299 unsigned int ndofs = (
unsigned int)dof_indices.size();
303 for (
unsigned int i=0; i<dof_indices.size(); i++) {
304 sol (i) = (*localized_solution) (dof_indices[i]);
305 dsol(i) = (*localized_solution_sens)(dof_indices[i]);
317 const std::map<
const libMesh::dof_id_type,
318 std::vector<MAST::StressStrainOutputBase::Data*> >& output_map =
323 libmesh_assert_equal_to(output_map.size(), 1);
324 libmesh_assert_equal_to(output_map.begin()->first, elem->id());
328 std::map<
const libMesh::dof_id_type,
329 std::vector<MAST::StressStrainOutputBase::Data*> >::const_iterator
330 e_it = output_map.begin(),
331 e_end = output_map.end();
333 for ( ; e_it != e_end; e_it++) {
343 dof_id = elem->dof_number(sys_num, stress_vars[12], 0);
344 dsigmadp.set(dof_id, max_vm_stress);
346 for (
unsigned int i=0; i<6; i++) {
348 dof_id = elem->dof_number(sys_num, stress_vars[i], 0);
349 dsigmadp.set(dof_id, max_strain_vals(i));
352 dof_id = elem->dof_number(sys_num, stress_vars[i+6], 0);
353 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 bool if_evaluate_for_element(const MAST::GeomElem &elem) const
checks to see if the object has been told about the subset of elements and if the specified element i...
virtual void clear_elem_operation_object()
clears the association of this object with the assembly element operation object. ...
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)
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
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
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...
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.
virtual void init(const MAST::GeomElem &elem)
initialize for the element.
Matrix< Real, Dynamic, 1 > RealVectorX
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.