35 #include "libmesh/parallel.h" 39 const libMesh::Point& qp,
40 const libMesh::Point& xyz,
50 libmesh_assert_equal_to(stress.size(), 6);
51 libmesh_assert_equal_to(strain.size(), 6);
93 libmesh_assert_equal_to(dstress_dX.rows(), 6);
94 libmesh_assert_equal_to(dstrain_dX.rows(), 6);
130 libmesh_assert_equal_to(dstress_df.size(), 6);
131 libmesh_assert_equal_to(dstrain_df.size(), 6);
143 std::map<const MAST::FunctionBase*, RealVectorX>::const_iterator
155 std::map<const MAST::FunctionBase*, RealVectorX>::const_iterator
171 std::map<const MAST::FunctionBase*, RealVectorX>::const_iterator
186 libmesh_assert_equal_to(
_stress.size(), 6);
203 libmesh_assert_equal_to(
_stress.size(), 6);
240 libmesh_assert_equal_to(
_stress.size(), 6);
266 6.0 * (dstress_dp(3) *
_stress(3)+
268 dstress_dp(5) *
_stress(5))) * 0.5 * pow(p, -0.5);
370 std::pair<const MAST::FieldFunction<RealVectorX>*,
unsigned int>
375 (
_physics_elem)->calculate_stress_boundary_velocity(f, *
this,
406 (
_physics_elem)->calculate_stress_boundary_velocity(f, *
this,
487 const libMesh::Elem& ref_elem,
521 std::map<const libMesh::dof_id_type, std::vector<MAST::StressStrainOutputBase::Data*> >::iterator
525 for ( ; map_it != map_end; map_it++) {
528 std::vector<MAST::StressStrainOutputBase::Data*>::iterator
529 it = map_it->second.begin(),
530 end = map_it->second.end();
532 for ( ; it != end; it++)
535 map_it->second.clear();
544 for ( ; map_it != map_end; map_it++) {
547 std::vector<MAST::StressStrainOutputBase::Data*>::iterator
548 it = map_it->second.begin(),
549 end = map_it->second.end();
551 for ( ; it != end; it++)
554 map_it->second.clear();
574 std::map<const libMesh::dof_id_type, std::vector<MAST::StressStrainOutputBase::Data*> >::iterator
578 for ( ; map_it != map_end; map_it++) {
581 std::vector<MAST::StressStrainOutputBase::Data*>::iterator
582 it = map_it->second.begin(),
583 end = map_it->second.end();
585 for ( ; it != end; it++)
586 (*it)->clear_sensitivity_data();
593 for ( ; map_it != map_end; map_it++) {
596 std::vector<MAST::StressStrainOutputBase::Data*>::iterator
597 it = map_it->second.begin(),
598 end = map_it->second.end();
600 for ( ; it != end; it++)
614 const unsigned int qp,
615 const libMesh::Point& quadrature_pt,
616 const libMesh::Point& physical_pt,
636 std::map<const libMesh::dof_id_type, std::vector<MAST::StressStrainOutputBase::Data*> >::iterator
642 _stress_data.insert(std::pair<
const libMesh::dof_id_type, std::vector<MAST::StressStrainOutputBase::Data*> >
644 std::vector<MAST::StressStrainOutputBase::Data*>())).first;
648 libmesh_assert_equal_to(qp, it->second.size());
650 it->second.push_back(d);
661 const unsigned int s,
662 const unsigned int qp,
663 const libMesh::Point& quadrature_pt,
664 const libMesh::Point& physical_pt,
684 std::map<const libMesh::dof_id_type, std::vector<MAST::StressStrainOutputBase::Data*> >::iterator
691 (std::pair<
const libMesh::dof_id_type, std::vector<MAST::StressStrainOutputBase::Data*> >
693 std::vector<MAST::StressStrainOutputBase::Data*>())).first;
697 libmesh_assert_equal_to(qp, it->second.size());
699 it->second.push_back(d);
707 const std::map<const libMesh::dof_id_type, std::vector<MAST::StressStrainOutputBase::Data*> >&
718 std::map<const libMesh::dof_id_type, std::vector<MAST::StressStrainOutputBase::Data*>>::const_iterator
726 for ( ; it != end; it++) {
728 std::vector<MAST::StressStrainOutputBase::Data*>::const_iterator
729 s_it = it->second.begin(),
730 s_end = it->second.end();
732 for ( ; s_it != s_end; s_it++) {
733 vm = (*s_it)->von_Mises_stress();
734 max_vm = vm>max_vm?vm:max_vm;
752 std::map<const libMesh::dof_id_type, std::vector<MAST::StressStrainOutputBase::Data*> >::const_iterator
756 n = (
unsigned int)it->second.size();
769 std::map<const libMesh::dof_id_type, std::vector<MAST::StressStrainOutputBase::Data*> >::const_iterator
773 n = (
unsigned int)it->second.size();
780 const std::vector<MAST::StressStrainOutputBase::Data*>&
785 std::map<const libMesh::dof_id_type, std::vector<MAST::StressStrainOutputBase::Data*> >::const_iterator
799 const unsigned int qp) {
803 std::map<const libMesh::dof_id_type, std::vector<MAST::StressStrainOutputBase::Data*> >::const_iterator
809 libmesh_assert_less(qp, it->second.size());
811 return *(it->second[qp]);
829 std::pair<std::multimap<libMesh::subdomain_id_type, MAST::BoundaryConditionBase*>::const_iterator,
830 std::multimap<libMesh::subdomain_id_type, MAST::BoundaryConditionBase*>::const_iterator> it;
836 for ( ; it.first != it.second; it.first++)
840 libmesh_assert(!rval);
842 rval = it.first->second;
856 libmesh_assert_greater(
_sigma0, 0.);
871 std::map<const libMesh::dof_id_type, std::vector<MAST::StressStrainOutputBase::Data*> >::const_iterator
875 for ( ; map_it != map_end; map_it++) {
877 std::vector<MAST::StressStrainOutputBase::Data*>::const_iterator
878 vec_it = map_it->second.begin(),
879 vec_end = map_it->second.end();
881 for ( ; vec_it != vec_end; vec_it++) {
884 e_val = (*vec_it)->von_Mises_stress();
885 JxW = (*vec_it)->quadrature_point_JxW();
893 exp_sp = exp(
_rho * sp);
916 Real& dsigma_vm_val_df)
const {
924 dsigma_vm_val_df = 0.;
927 std::map<const libMesh::dof_id_type, std::vector<MAST::StressStrainOutputBase::Data*> >::const_iterator
931 for ( ; map_it != map_end; map_it++) {
934 dsigma_vm_val_df += val;
949 Real& dsigma_vm_val_df)
const {
957 dsigma_vm_val_df = 0.;
960 std::map<const libMesh::dof_id_type, std::vector<MAST::StressStrainOutputBase::Data*> >::const_iterator
964 for ( ; map_it != map_end; map_it++) {
967 dsigma_vm_val_df += val;
981 const libMesh::dof_id_type e_id,
982 Real& dsigma_vm_val_df)
const {
986 libmesh_assert_greater(
_sigma0, 0.);
1000 dsigma_vm_val_df = 0.;
1003 std::map<const libMesh::dof_id_type, std::vector<MAST::StressStrainOutputBase::Data*> >::const_iterator
1007 libmesh_assert(map_it != map_end);
1009 std::vector<MAST::StressStrainOutputBase::Data*>::const_iterator
1010 vec_it = map_it->second.begin(),
1011 vec_end = map_it->second.end();
1013 for ( ; vec_it != vec_end; vec_it++) {
1016 e_val = (*vec_it)->von_Mises_stress();
1017 de_val = (*vec_it)->dvon_Mises_stress_dp(f);
1018 JxW = (*vec_it)->quadrature_point_JxW();
1032 exp_sp = exp(
_rho * sp_weight);
1034 num_sens += (de_val/
_sigma0 * JxW * exp_sp *
1052 const libMesh::dof_id_type e_id,
1053 Real& dsigma_vm_val_df)
const {
1057 libmesh_assert_greater(
_sigma0, 0.);
1067 dsigma_vm_val_df = 0.;
1070 std::map<const libMesh::dof_id_type, std::vector<MAST::StressStrainOutputBase::Data*> >::const_iterator
1074 libmesh_assert(map_it != map_end);
1076 std::vector<MAST::StressStrainOutputBase::Data*>::const_iterator
1077 vec_it = map_it->second.begin(),
1078 vec_end = map_it->second.end();
1080 for ( ; vec_it != vec_end; vec_it++) {
1083 e_val = (*vec_it)->von_Mises_stress();
1084 JxW_Vn = (*vec_it)->quadrature_point_JxW();
1092 exp_sp = exp(
_rho * sp);
1093 denom_sens += exp_sp * JxW_Vn;
1109 libmesh_assert_greater(
_sigma0, 0.);
1121 denom_sens = RealVectorX::Zero(dq_dX.size()),
1122 num_sens = RealVectorX::Zero(dq_dX.size()),
1123 de_val = RealVectorX::Zero(dq_dX.size());
1129 std::map<const libMesh::dof_id_type, std::vector<MAST::StressStrainOutputBase::Data*> >::const_iterator
1134 libmesh_assert(map_it != map_end);
1136 std::vector<MAST::StressStrainOutputBase::Data*>::const_iterator
1137 vec_it = map_it->second.begin(),
1138 vec_end = map_it->second.end();
1141 for ( ; vec_it != vec_end; vec_it++) {
1144 e_val = (*vec_it)->von_Mises_stress();
1145 de_val = (*vec_it)->dvon_Mises_stress_dX();
1146 JxW = (*vec_it)->quadrature_point_JxW();
1157 denom_sens += 0. * de_val;
1162 exp_sp = exp(
_rho * sp_weight);
1164 num_sens += (de_val/
_sigma0 * JxW * exp_sp *
RealVectorX _strain
strain data
virtual Real output_sensitivity_for_elem(const MAST::FunctionBase &p)
virtual void functional_boundary_sensitivity_for_all_elems(const MAST::FunctionBase &f, Real &dsigma_vm_val_df) const
calculates and returns the sensitivity of von Mises p-norm functional for all the elements that this ...
Data(const RealVectorX &stress, const RealVectorX &strain, const libMesh::Point &qp, const libMesh::Point &xyz, Real JxW)
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...
std::map< const MAST::FunctionBase *, RealVectorX > _stress_sensitivity
map of sensitivity of the stress with respect to a parameter
std::multimap< libMesh::subdomain_id_type, MAST::BoundaryConditionBase * > VolumeBCMapType
libMesh::Point _qp
quadrature point location in element coordinates
const MAST::ElementPropertyCardBase & get_property_card(const libMesh::Elem &elem) const
get property card for the specified element
virtual const libMesh::Elem & get_reference_elem() const
RealMatrixX _dstress_dX
derivative of stress wrt state vector
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 functional_for_all_elems()
calculates and returns the von Mises p-norm functional for all the elements that this object currentl...
const RealMatrixX & get_dstress_dX() const
Real dvon_Mises_stress_dp(const MAST::FunctionBase &f) const
void clear()
clears the data structure of any stored values so that it can be used for another element...
std::map< const libMesh::dof_id_type, std::vector< MAST::StressStrainOutputBase::Data * > > _boundary_stress_data
vector of stress with the associated location details
RealVectorX & y_vector()
returns value of the property val.
This provides the base class for definitin of element level contribution of output quantity in an ana...
void clear_sensitivity_data()
void set_local_y_vector(const RealVectorX &y_vec)
for 1D elements the transformed coordinate system attached to the element defines the local x-axis al...
Real _sigma0
reference stress value used in scaling volume.
RealVectorX _stress
stress data
virtual void zero_for_sensitivity()
zeroes the output quantity values stored inside this object so that assembly process can begin...
virtual const std::vector< MAST::StressStrainOutputBase::Data * > & get_stress_strain_data_for_elem(const MAST::GeomElem &e) const
virtual ~StressStrainOutputBase()
MAST::PhysicsDisciplineBase * _discipline
Real _rho
exponent used in scaling volume based on stress value.
virtual void functional_state_derivartive_for_elem(const libMesh::dof_id_type e_id, RealVectorX &dq_dX) const
calculates and returns the derivative of von Mises p-norm functional wrt state vector for the specifi...
bool if_elem_has_level_set_boundary() const
virtual void functional_sensitivity_for_all_elems(const MAST::FunctionBase &f, Real &dsigma_vm_val_df) const
calculates and returns the sensitivity of von Mises p-norm functional for all the elements that this ...
MAST::ElementBase * _physics_elem
virtual std::pair< const MAST::FieldFunction< RealVectorX > *, unsigned int > get_elem_boundary_velocity_data()
searches through the side load data and populates the data with the boundary id and velocity function...
bool _primal_data_initialized
primal data, needed for sensitivity and adjoints
const RealVectorX & get_strain_sensitivity(const MAST::FunctionBase &f) const
@ returns the sensitivity of the data with respect to a function
virtual bool is_topology_parameter() const
Real _p_norm_stress
norm to be used for calculation of output stress function.
virtual Real output_sensitivity_total(const MAST::FunctionBase &p)
Real get_maximum_von_mises_stress() const
const RealVectorX & get_stress_sensitivity(const MAST::FunctionBase &f) const
@ returns the sensitivity of the data with respect to a function
virtual const std::map< const libMesh::dof_id_type, std::vector< MAST::StressStrainOutputBase::Data * > > & get_stress_strain_data() const
bool _skip_comm_sum
If an output has contrinutions only from local processor then the user can request that the global co...
int get_subelem_side_on_level_set_boundary() const
std::map< const libMesh::dof_id_type, std::vector< MAST::StressStrainOutputBase::Data * > > _stress_data
vector of stress with the associated location details
RealMatrixX _dstrain_dX
derivative of strain data wrt state vector
Real quadrature_point_JxW() const
Matrix< Real, Dynamic, Dynamic > RealMatrixX
virtual void output_derivative_for_elem(RealVectorX &dq_dX)
calculates the derivative of p-norm von Mises stress for the norm identified using set_p_val()...
virtual void evaluate_topology_sensitivity(const MAST::FunctionBase &f)
this evaluates all relevant topological sensitivity components on the element.
bool has_stress_sensitivity(const MAST::FunctionBase &f) const
@ returns true if sensitivity data is available for function f .
MAST::BoundaryConditionBase * get_thermal_load_for_elem(const MAST::GeomElem &elem)
virtual void functional_boundary_sensitivity_for_elem(const MAST::FunctionBase &f, const libMesh::dof_id_type e_id, Real &dsigma_vm_val_df) const
calculates and returns the boundary sensitivity of von Mises p-norm functional for the element e...
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.
const libMesh::Point & point_location_in_element_coordinate() const
This class inherits from MAST::GeomElem and provides an interface to initialize FE objects on sub-ele...
unsigned int n_stress_strain_data_for_elem(const MAST::GeomElem &e) const
virtual void init(const MAST::GeomElem &elem)
initialize for the element.
Matrix< Real, Dynamic, 1 > RealVectorX
virtual void zero_for_analysis()
zeroes the output quantity values stored inside this object so that assembly process can begin...
unsigned int n_boundary_stress_strain_data_for_elem(const GeomElem &e) const
std::unique_ptr< MAST::StructuralElementBase > build_structural_element(MAST::SystemInitialization &sys, const MAST::GeomElem &elem, const MAST::ElementPropertyCardBase &p)
builds the structural element for the specified element type
virtual void clear_sensitivity_data()
clears the data stored for sensitivity analysis.
This class provides a mechanism to store stress/strain values, their derivatives and sensitivity valu...
This class acts as a wrapper around libMesh::Elem for the purpose of providing a uniform interface fo...
const RealVectorX & strain() const
Real von_Mises_stress() const
const MAST::VolumeBCMapType & volume_loads() const
MAST::AssemblyBase * _assembly
StressStrainOutputBase()
default constructor
const MAST::GeomElem & elem() const
virtual const libMesh::Elem & get_quadrature_elem() const
const RealMatrixX & get_dstrain_dX() const
Real _JxW
quadrature point JxW (product of transformation Jacobian and quadrature weight) for use in definition...
void set_derivatives(const RealMatrixX &dstress_dX, const RealMatrixX &dstrain_dX)
adds the derivative data
RealVectorX dvon_Mises_stress_dX() const
virtual void evaluate()
this evaluates all relevant stress components on the element to evaluate the p-averaged quantity...
std::map< const MAST::FunctionBase *, RealVectorX > _strain_sensitivity
map of sensitivity of the strain with respect to a parameter
virtual MAST::StressStrainOutputBase::Data & get_stress_strain_data_for_elem_at_qp(const MAST::GeomElem &e, const unsigned int qp)
virtual void clear_elem()
clears the element initialization
virtual void functional_sensitivity_for_elem(const MAST::FunctionBase &f, const libMesh::dof_id_type e_id, Real &dsigma_vm_val_df) const
calculates and returns the sensitivity of von Mises p-norm functional for the element e...
bool if_subelem_has_side_on_level_set_boundary() const
bool _if_stress_plot_mode
identifies the mode in which evaluation is peformed.
virtual MAST::StressStrainOutputBase::Data & add_stress_strain_at_qp_location(const MAST::GeomElem &e, const unsigned int qp, const libMesh::Point &quadrature_pt, const libMesh::Point &physical_pt, const RealVectorX &stress, const RealVectorX &strain, Real JxW)
add the stress tensor associated with the qp.
std::set< const libMesh::Elem * > _elem_subset
set of elements for which the data will be stored.
virtual Real output_total()
const RealVectorX & stress() const
void set_sensitivity(const MAST::FunctionBase &f, const RealVectorX &dstress_df, const RealVectorX &dstrain_df)
sets the sensitivity of the data with respect to a function
virtual MAST::StressStrainOutputBase::Data & add_stress_strain_at_boundary_qp_location(const MAST::GeomElem &e, const unsigned int s, const unsigned int qp, const libMesh::Point &quadrature_pt, const libMesh::Point &physical_pt, const RealVectorX &stress, const RealVectorX &strain, Real JxW_Vn)
add the stress tensor associated with the qp on side s of element e.
MAST::SystemInitialization * _system